<?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 MCUboot</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/117801/debugging-mcuboot</link><description>Hi, 
 
 I want to debug [i.e. attach to and single step] mcuboot [running as second stage bootloader] using Ozone and JLink. 
 
 I can connect to the board via the debugger and can debug for a while, but I never get to main(). 
 
 I am probably doing</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 08 Jan 2025 10:21:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/117801/debugging-mcuboot" /><item><title>RE: Debugging MCUboot</title><link>https://devzone.nordicsemi.com/thread/517430?ContentTypeID=1</link><pubDate>Wed, 08 Jan 2025 10:21:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25b3c10a-1be4-4f36-9b63-fb7d9bff8ef1</guid><dc:creator>Elfving</dc:creator><description>&lt;p&gt;Hi Odd Rune,&lt;/p&gt;
&lt;p&gt;Glad to see you found a solution this quickly yourself. I&amp;#39;ve also explained this &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/81738/mcuboot-on-nrf9160-custom-board/339681"&gt;here &lt;/a&gt;in an older case of mine.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Elfving&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Debugging MCUboot</title><link>https://devzone.nordicsemi.com/thread/517415?ContentTypeID=1</link><pubDate>Wed, 08 Jan 2025 09:51:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa8dfc10-8012-455c-8107-63b4728a7364</guid><dc:creator>vitalgobo</dc:creator><description>&lt;p&gt;Well, to tie things up, I have solved it.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;The basic gist of it is:&lt;br /&gt;* Flash the merged.hex from the west build.&lt;br /&gt;* Make sure to run b0 (wichever you use) before attempting to debug mcuboot. Essentially, the steps are:&lt;/p&gt;
&lt;p&gt;In the Ozone jdebug script:&lt;br /&gt;1. We do this by inspecting the b0 elf, finding the entry point and adding a step to _SetupTaget(), in our case &lt;br /&gt;&amp;nbsp; &amp;nbsp;Target.SetReg(&amp;quot;PC&amp;quot;, 0x10E0&amp;quot;)&lt;br /&gt;&amp;nbsp; &amp;nbsp;Target.SetReg(&amp;quot;SP&amp;quot;, 0x20003208).&lt;br /&gt;2. Load the mcuboot ELF in Ozone using: File.open() in OnProjectLoad() to get access to the debug symbols.&lt;br /&gt;3. In TargetDownload():&amp;nbsp; Target.LoadMemory(&amp;quot;/home/user/blah/build/merged.hex&amp;quot;)&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;In effect, this&amp;nbsp; flashes and runs b0 (entry point at 0x10E0), and hands things over to mcuboot; so that the external APIs are registered by b0 and accessible by mcuboot [used as the second stage bl].&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So that works.&lt;br /&gt;&lt;br /&gt;A second case I had was getting Segger RTT to work in mcuboot, but I&amp;#39;ve abandoned this for now as I can actually get step-debugging to work.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>