<?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>NRF52833 UART Secure DFU - Not booting after app start</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/92196/nrf52833-uart-secure-dfu---not-booting-after-app-start</link><description>I&amp;#39;m working on developing a UART Secure DFU platform on the NRF52833 with SDK 17.1 and soft-device s140 v7.2.0. 
 As there are no direct examples for this application, I followed the steps outlined in this blog post as a starting point. I then updated</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 26 Sep 2022 08:14:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/92196/nrf52833-uart-secure-dfu---not-booting-after-app-start" /><item><title>RE: NRF52833 UART Secure DFU - Not booting after app start</title><link>https://devzone.nordicsemi.com/thread/387827?ContentTypeID=1</link><pubDate>Mon, 26 Sep 2022 08:14:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:580eebaa-a426-4fdc-94d7-140ea71385db</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Dan,&amp;nbsp;&lt;br /&gt;It&amp;#39;s recommended to use the exact SES version that we mentioned in the release note of SDK v17.1&amp;nbsp;, which is v5.42a.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;br /&gt;Please see &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/index.html?cp=8_1_0"&gt;here.&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52833 UART Secure DFU - Not booting after app start</title><link>https://devzone.nordicsemi.com/thread/387740?ContentTypeID=1</link><pubDate>Fri, 23 Sep 2022 16:44:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de74e602-a8b9-4eb9-b635-0ac65b2ed5e2</guid><dc:creator>dsweet</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/hungbui"&gt;Hung Bui&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My IDE / gcc info is below, let me know if you need any other details:&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/pastedimage1663950811331v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Incidentally, this current effort started as&amp;nbsp;a migration from a prior project on a nRF52840 that was originally on SDK 15.3 and s140 6.1.1 SD. I first updated this 52840 project to the same SDK17.1 / SD 7.2.0, which worked great with minimal/expected changes. AKA I wasn&amp;#39;t able to reproduce these same issues on the nRF52840 with the same SDK/SD.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It wasn&amp;#39;t until I worked&amp;nbsp;on migrating to the nRF52833 where I started running into problems, it is unfortunate there was no working dfu example to start from for this platform.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I will note that I think I updated from SES version 4.22 (IDE used when I did the original 52840 project) to SES 6.32b right around the time when I started trying to port to the 52833 because debugging kept crashing on 4.22 on the 52833. It seemed like updating to 6.32b fixed this issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52833 UART Secure DFU - Not booting after app start</title><link>https://devzone.nordicsemi.com/thread/387629?ContentTypeID=1</link><pubDate>Fri, 23 Sep 2022 08:15:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:710d831a-e93a-4262-acef-620386930b07</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Dan,&amp;nbsp;&lt;br /&gt;Please let me know the toolchain setup you have.&amp;nbsp;&lt;br /&gt;We do see an issue with newer toolchain (IDE/compiler) when compiling with our nRF5 SDK. Note that the SDK is now considered legacy and&amp;nbsp;we stopped any new development for it since last year.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;An update to the compiler may break the compatibility with the SDK.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Could you reproduce the same issue on a nRF52832 or nRF52840 so that there is no modification needed to the bootloader project ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52833 UART Secure DFU - Not booting after app start</title><link>https://devzone.nordicsemi.com/thread/387581?ContentTypeID=1</link><pubDate>Fri, 23 Sep 2022 00:23:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c03ff2c6-c3f5-4eba-9403-6ff50ad0d576</guid><dc:creator>dsweet</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/hungbui"&gt;Hung Bui&lt;/a&gt;&amp;nbsp;It seems I have been able to simplify what works and does not work to a very simple code change, but I&amp;#39;m not sure I understand why.&lt;/p&gt;
&lt;p&gt;By adding `volatile` to the&amp;nbsp;sd_mbr_command_t command variable in `nrf_dfu_mbr_irq_forward_address_set()`, my bootloader appears to work with any optimization setting.&lt;/p&gt;
&lt;p&gt;Applying this change back to my original (non-debug) projects is also working. Seems to bootload and run my full application (with BLE / SD dependencies) just fine.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m unsure what&amp;nbsp;sd_mbr_command is doing under the surface but wondering if the address variable was somehow being optimized incorrectly causing an invalid jump/forwarding address.&lt;/p&gt;
&lt;p&gt;Does this make any sense to you and any chance this is related to any known bug/issue? Seems surprising I&amp;#39;m the only one to run into this during new bootloader development on the v17.1 SDK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52833 UART Secure DFU - Not booting after app start</title><link>https://devzone.nordicsemi.com/thread/387564?ContentTypeID=1</link><pubDate>Thu, 22 Sep 2022 17:54:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d2a10be-65c0-4075-922d-90e7edb28ade</guid><dc:creator>dsweet</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/hungbui"&gt;Hung Bui&lt;/a&gt;&amp;nbsp;Another set of interesting updates:&lt;/p&gt;
&lt;p&gt;My comment above about ending up at 0xA60 seemed wrong/suspicious and I recalled running across&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/58618/dfu-upgraded-app-wont-boot"&gt; this issue&lt;/a&gt; related to a bug in the jump_to_address optimization. This issue was supposed to be fixed in v17.0+ SDK, so I originally moved on, but decided to revisit messing with optimizations:&lt;/p&gt;
&lt;p&gt;My current debug project has an optimization level of &amp;#39;None&amp;#39; as my baseline. I then tried the following tests:&lt;/p&gt;
&lt;p&gt;1. Change full bootloader project to &amp;#39;Level 2 for Size&amp;#39;. -&amp;gt; Now I get a new error: &amp;#39;Failed running nrf_dfu_mbr_irq_forward_address_set()&amp;#39; right before starting the application. App does not boot.&lt;/p&gt;
&lt;p&gt;2. Return full&amp;nbsp;bootloader&amp;nbsp; project to &amp;#39;Level 0&amp;#39;, but change only&amp;nbsp;nrf_bootloader_start_final.c to &amp;#39;Level 2 for Size&amp;#39; -&amp;gt; Bootloading now works, app boots and runs as expected.&lt;/p&gt;
&lt;p&gt;3. Change full bootloader&amp;nbsp;project to &amp;#39;Level 3&amp;#39; -&amp;gt; Bootloading works,&amp;nbsp;app boots and runs as expected.&lt;/p&gt;
&lt;p&gt;Note these changes are only applied to my bootloader project, my SD and APP packages remained the same for all tests.&lt;/p&gt;
&lt;p&gt;I find these results a bit surprising and confusing. Particularly it confuses me that test 1 does not work the same as test 2. Seems like it is possible my issue is not the same as the&amp;nbsp;original&amp;nbsp;jump_to_address&amp;nbsp;bug, but perhaps similar. Another idea is that there is some sort of word alignment issue somewhere and changing various optimizations just moves things around in a way to just happen to work.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thoughts? I plan to try applying the above modifications back to my original non-debug version of my project to see if I end up with similar results.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52833 UART Secure DFU - Not booting after app start</title><link>https://devzone.nordicsemi.com/thread/387557?ContentTypeID=1</link><pubDate>Thu, 22 Sep 2022 16:44:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b3c2615-a558-4581-ae13-43ae1cb24329</guid><dc:creator>dsweet</dc:creator><description>&lt;p&gt;Thanks for the response. I will give a simpler application a try (starting with no SD) to see if I see the same issues.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I did some more debugging with my existing debug application and don&amp;#39;t believe I&amp;#39;m making it to my application. It appears I am hitting a hard fault in the soft device.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Specifically, from the `jump_to_addr()` call in the bootloader, I can see the following sequence (in Disassembly):&lt;/p&gt;
&lt;p&gt;1. Starts with ~4 instructions at 0xA60, which is odd because this is in the MBR and I thought `jump_to_addr` was targeting address 0x1000 (start of SD).&lt;/p&gt;
&lt;p&gt;2. Jumps from 0xA68 to a region at 0x25F46, which is towards the end of the soft device region.&lt;/p&gt;
&lt;p&gt;3.&amp;nbsp; Runs about a dozen instructions before jumping to 0x273A2, which is the HardFault handler in my application space. As far as I can tell this is the only/first time I make it to my application space (I tried running the debugger in my application as you suggest and it breaks here).&lt;/p&gt;
&lt;p&gt;Let me know if the above gives you any clues as to what might be happening and I will try a blinky application in the meantime.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF52833 UART Secure DFU - Not booting after app start</title><link>https://devzone.nordicsemi.com/thread/387468?ContentTypeID=1</link><pubDate>Thu, 22 Sep 2022 11:12:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cbb80f24-c4de-4998-9a63-cd29596fcb3e</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Dan,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;From what you described&amp;nbsp;I couldn&amp;#39;t find anything wrong. Note that you can debug the application after it&amp;#39;s flashed by DFU the same as when it&amp;#39;s flashed by&amp;nbsp;an IDE. You can simply run it in debug and the debugger will wait until the PC counter jumps to the address of the reset vector in the application.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I would suggest the following process to detect the issue:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1.Start with debug version of the bootloader.&lt;/p&gt;
&lt;p&gt;2. Try to update a very simple application with no softdevice, blinky for example. The application should not use any interrupt handler, just a normal NOP delay to blink LED. Please make sure you use the version that&amp;#39;s compiled for MBR, which mean it starts at 0x1000 and memory starts at 0x20000008&lt;/p&gt;
&lt;p&gt;3. Try to test with an application that actually use interrupt handler,&amp;nbsp;e.g RTC example. Same requirement on the memory as above&lt;/p&gt;
&lt;p&gt;4. Test with an example that uses softdevice, ble_app_hrs for example.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Let us know if it fails at any step.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Another way to debug is to do a hex dump and then compare it with what you have when flashing the application + SD with the programmer to see if there is any different.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>