<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Debugging in VSCode gets stuck booting Zephyr OS</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93994/debugging-in-vscode-gets-stuck-booting-zephyr-os</link><description>I&amp;#39;ve been trying to get breakpoints working on a new nRF Connect project but have been running into an issue: when I hit &amp;quot;Debug&amp;quot; in the nRF Connect plugin in VSCode, the app compiles, loads, and logs everything from my application, but seems to ignore</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 21 Nov 2022 11:15:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93994/debugging-in-vscode-gets-stuck-booting-zephyr-os" /><item><title>RE: Debugging in VSCode gets stuck booting Zephyr OS</title><link>https://devzone.nordicsemi.com/thread/396615?ContentTypeID=1</link><pubDate>Mon, 21 Nov 2022 11:15:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c684f07f-a200-443a-baa1-62181d97e66b</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;I&amp;#39;m glad to hear that it works now, but I&amp;#39;m afraid I don&amp;#39;t have an explanation as to why this issue occured in the first place. I tried to reproduce the problem here by debugging a project which included MCUBoot, but no luck.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you happen to encounter this again,&amp;nbsp;please try to&amp;nbsp;use Segger Ozone to see if it gives you the same problem. I&amp;#39;m trying to understand if the issue may&amp;nbsp;be related to the debugger configuration or not.&lt;/p&gt;
&lt;p&gt;The &amp;quot;Debug with Ozone&amp;quot; button should appear here if you have &lt;a href="https://www.segger.com/products/development-tools/ozone-j-link-debugger/"&gt;Ozone&lt;/a&gt; installed:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1669029164149v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Debugging in VSCode gets stuck booting Zephyr OS</title><link>https://devzone.nordicsemi.com/thread/396491?ContentTypeID=1</link><pubDate>Sat, 19 Nov 2022 00:24:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b2bd289-a76b-4227-a4e4-08a0c4114531</guid><dc:creator>deveryn</dc:creator><description>&lt;p&gt;Thank you for getting back to me. Setting CONFIG_BOOTLOADER_MCUBOOT to &amp;quot;n&amp;quot; did seem to fix the issue - the breakpoints are hit and I can walk through the app.&lt;/p&gt;
&lt;p&gt;While debugging this, I accidentally stopped a flash halfway through, which made the J-Link debugger not respond when programming with VSCode. I used the nRF Connect desktop app to program the merged.hex file. Then, all of a sudden, the debugging started working with and without the CONFIG_BOOTLOADER_MCUBOOT=n value!&lt;/p&gt;
&lt;p&gt;Do you know why this would happen so I can avoid running into the issue in the future?&lt;/p&gt;
&lt;p&gt;Either way, thank you for your help!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Debugging in VSCode gets stuck booting Zephyr OS</title><link>https://devzone.nordicsemi.com/thread/396446?ContentTypeID=1</link><pubDate>Fri, 18 Nov 2022 14:32:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7bed008-1846-4a65-9d66-12796c5e393d</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;It&amp;#39;s interesting that it works fine with the &amp;quot;hello world&amp;quot; sample. This indicates that the debugger and everything is configured correctly, at least.&lt;/p&gt;
&lt;p&gt;Maybe you can try to build your application without the bootloader (CONFIG_BOOTLOADER_MCUBOOT=n) to see if it works better when you only have one FW image. This may help narrow down the problem.&lt;/p&gt;
&lt;p&gt;The CPU registers can be viewed in the top left corner here:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1668781717232v1.png" alt=" " /&gt;&lt;/p&gt;
[quote user="deveryn"]One thing I tried was disabling the &amp;quot;Enable debug options&amp;quot;, creating a pristine build, and running the debugger. This seems to break inside &amp;quot;cpu_idle&amp;quot; when run and then a FIH_PANIC spot (see screenshot) when I hit pause, but continuing doesn&amp;#39;t continue past when I hit continue (F5). I assume this is going down the wrong path but maybe it&amp;#39;s helpful for debugging the problem?[/quote]
&lt;p&gt;This shows that the program hangs inside MCUBoot because it did not find a bootable app. This can happen if only the mcuboot image is programmed to the device instead (i.e. if the zephyr.hex in build/mcuboot/zephyr/ was programmed instead of the merged.hex in build/zephyr)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Debugging in VSCode gets stuck booting Zephyr OS</title><link>https://devzone.nordicsemi.com/thread/396299?ContentTypeID=1</link><pubDate>Thu, 17 Nov 2022 17:49:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9602f7f3-75d3-49e4-8c1f-69e0a6cf8b6b</guid><dc:creator>deveryn</dc:creator><description>&lt;p&gt;One thing that&amp;#39;s a clear difference between the hello_world example and my application is there&amp;#39;s no &amp;quot;&lt;span&gt;[Switching to Thread abcd]&amp;quot; after the [New Thread] lines in the debug console output of my application. It&amp;#39;s like it gets stuck somewhere.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Here is the full debug console output for my app:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;JLinkGDBServerCLexe: SEGGER J-Link GDB Server V7.82b Command Line Version
JLinkGDBServerCLexe: 
JLinkGDBServerCLexe: JLinkARM.dll V7.82b (DLL compiled Nov  9 2022 17:01:29)
JLinkGDBServerCLexe: 
JLinkGDBServerCLexe: -----GDB Server start settings-----
JLinkGDBServerCLexe: GDBInit file:                  none
JLinkGDBServerCLexe: GDB Server Listening port:     65228
JLinkGDBServerCLexe: SWO raw output listening port: 2332
JLinkGDBServerCLexe: Terminal I/O port:             2333
JLinkGDBServerCLexe: Accept remote connection:      yes
JLinkGDBServerCLexe: Generate logfile:              off
JLinkGDBServerCLexe: Verify download:               off
JLinkGDBServerCLexe: Init regs on start:            off
JLinkGDBServerCLexe: Silent mode:                   on
JLinkGDBServerCLexe: Single run mode:               on
JLinkGDBServerCLexe: Target connection timeout:     0 ms
JLinkGDBServerCLexe: ------J-Link related settings------
JLinkGDBServerCLexe: J-Link Host interface:         USB
JLinkGDBServerCLexe: J-Link script:                 none
JLinkGDBServerCLexe: J-Link settings file:          none
JLinkGDBServerCLexe: ------Target related settings------
JLinkGDBServerCLexe: Target device:                 nRF52832_xxAA
JLinkGDBServerCLexe: Target device parameters:      none
JLinkGDBServerCLexe: Target interface:              SWD
JLinkGDBServerCLexe: Target interface speed:        12000kHz
JLinkGDBServerCLexe: Target endian:                 little
JLinkGDBServerCLexe: 
=thread-group-added,id=&amp;quot;i1&amp;quot;
=cmd-param-changed,param=&amp;quot;pagination&amp;quot;,value=&amp;quot;off&amp;quot;
arch_cpu_idle () at /opt/nordic/ncs/v2.1.2/zephyr/arch/arm/core/aarch32/cpu_idle.S:105
105		cpsie	i
[New Thread 536879720]
[New Thread 536878096]
[New Thread 536878280]
[New Thread 536879504]
[New Thread 536880088]
[New Thread 536878712]
[New Thread 536878496]
[New Thread 536879320]&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;And here is the full debug console output for hello_world:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;JLinkGDBServerCLexe: SEGGER J-Link GDB Server V7.82b Command Line Version
JLinkGDBServerCLexe: 
JLinkGDBServerCLexe: JLinkARM.dll V7.82b (DLL compiled Nov  9 2022 17:01:29)
JLinkGDBServerCLexe: 
JLinkGDBServerCLexe: -----GDB Server start settings-----
JLinkGDBServerCLexe: GDBInit file:                  none
JLinkGDBServerCLexe: GDB Server Listening port:     65299
JLinkGDBServerCLexe: SWO raw output listening port: 2332
JLinkGDBServerCLexe: Terminal I/O port:             2333
JLinkGDBServerCLexe: Accept remote connection:      yes
JLinkGDBServerCLexe: Generate logfile:              off
JLinkGDBServerCLexe: Verify download:               off
JLinkGDBServerCLexe: Init regs on start:            off
JLinkGDBServerCLexe: Silent mode:                   on
JLinkGDBServerCLexe: Single run mode:               on
JLinkGDBServerCLexe: Target connection timeout:     0 ms
JLinkGDBServerCLexe: ------J-Link related settings------
JLinkGDBServerCLexe: J-Link Host interface:         USB
JLinkGDBServerCLexe: J-Link script:                 none
JLinkGDBServerCLexe: J-Link settings file:          none
JLinkGDBServerCLexe: ------Target related settings------
JLinkGDBServerCLexe: Target device:                 nRF52832_xxAA
JLinkGDBServerCLexe: Target device parameters:      none
JLinkGDBServerCLexe: Target interface:              SWD
JLinkGDBServerCLexe: Target interface speed:        12000kHz
JLinkGDBServerCLexe: Target endian:                 little
JLinkGDBServerCLexe: 
=thread-group-added,id=&amp;quot;i1&amp;quot;
=cmd-param-changed,param=&amp;quot;pagination&amp;quot;,value=&amp;quot;off&amp;quot;
arch_cpu_idle () at /opt/nordic/ncs/v2.1.2/zephyr/arch/arm/core/aarch32/cpu_idle.S:105
105		cpsie	i
[New Thread 536871104]
[New Thread 536871280]
[Switching to Thread 536871280]

Thread 3 hit Breakpoint 1, main () at ../src/main.c:11
11		printk(&amp;quot;Hello World! %s\n&amp;quot;, CONFIG_BOARD);
Execute debugger commands using &amp;quot;-exec &amp;lt;command&amp;gt;&amp;quot;, for example &amp;quot;-exec info registers&amp;quot; will list registers in use (when GDB is the debugger)&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Debugging in VSCode gets stuck booting Zephyr OS</title><link>https://devzone.nordicsemi.com/thread/396298?ContentTypeID=1</link><pubDate>Thu, 17 Nov 2022 17:41:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:91a325ce-86ab-4b7e-8e83-574d4e69ac94</guid><dc:creator>deveryn</dc:creator><description>&lt;p&gt;Thank you for the quick response. Pressing the Pause button doesn&amp;#39;t seem to do anything. The Debug Console window doesn&amp;#39;t seem to show any errors (see attached image).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Sorry for the basic question: what peripheral would I need to look at on the left to see the program counter?&lt;/p&gt;
&lt;p&gt;One thing I tried was disabling the &amp;quot;Enable debug options&amp;quot;, creating a pristine build, and running the debugger. This seems to break inside &amp;quot;cpu_idle&amp;quot; when run and then a FIH_PANIC spot (see screenshot) when I hit pause, but continuing doesn&amp;#39;t continue past when I hit continue (F5). I assume this is going down the wrong path but maybe it&amp;#39;s helpful for debugging the problem?&lt;/p&gt;
&lt;p&gt;When I switch to the sample hello_world application on the same board the breakpoints work just fine.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/CleanShot-2022_2D00_11_2D00_17-at-12.27.16_4000_2x.png" alt=" " /&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/CleanShot-2022_2D00_11_2D00_17-at-12.29.07_4000_2x.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/CleanShot-2022_2D00_11_2D00_17-at-12.33.57_4000_2x.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/CleanShot-2022_2D00_11_2D00_17-at-12.40.35_4000_2x.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Debugging in VSCode gets stuck booting Zephyr OS</title><link>https://devzone.nordicsemi.com/thread/396289?ContentTypeID=1</link><pubDate>Thu, 17 Nov 2022 16:42:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dcb1ff06-d97a-42ee-9c9c-b96fa395cf0c</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure if I have encountered this issue before. Are you able to see where it hangs if you press the &amp;quot;pause&amp;quot; button? If not, maybe you can check the CPU registers to see where the program counter is at.&lt;/p&gt;
&lt;p&gt;Also, please check if there are any errors reported in the Debug console.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1668703364447v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Debugging in VSCode gets stuck booting Zephyr OS</title><link>https://devzone.nordicsemi.com/thread/396262?ContentTypeID=1</link><pubDate>Thu, 17 Nov 2022 15:15:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:31bc484a-33aa-474b-a0dc-0580ae04a2c5</guid><dc:creator>deveryn</dc:creator><description>&lt;p&gt;Here is my project configuration if that&amp;#39;s helpful:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;# Bluetooth
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME=&amp;quot;Stylus&amp;quot;
CONFIG_BT_DEVICE_APPEARANCE=0
CONFIG_BT_MAX_CONN=1
CONFIG_BT_LL_SOFTDEVICE=y

CONFIG_GPIO=y
CONFIG_DK_LIBRARY=y

# Logging
CONFIG_LOG=y
CONFIG_LOG_BACKEND_RTT=n
CONFIG_LOG_BACKEND_UART=y
CONFIG_LOG_DEFAULT_LEVEL=4

CONFIG_ASSERT=y

# DFU
CONFIG_MCUMGR=y
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_BT_L2CAP_TX_MTU=252
CONFIG_BT_BUF_ACL_RX_SIZE=256
CONFIG_MCUMGR_SMP_BT=y
CONFIG_MCUMGR_SMP_BT_AUTHEN=n
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096

# DEBUGGING
CONFIG_DEBUG_OPTIMIZATIONS=y
CONFIG_DEBUG_THREAD_INFO=y&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>