<?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>bootloader with 2 or 3 applications</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/66938/bootloader-with-2-or-3-applications</link><description>Hi, I am trying to get bootloader to jump to either application 1 or 2 base on button states when booting. I am not sure how do it properly. One of the applications is using softdevice while the other is not (zigbee). I know that for ble application I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 12 Oct 2020 14:30:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/66938/bootloader-with-2-or-3-applications" /><item><title>RE: bootloader with 2 or 3 applications</title><link>https://devzone.nordicsemi.com/thread/274379?ContentTypeID=1</link><pubDate>Mon, 12 Oct 2020 14:30:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07f4c075-0c7f-4597-a6a6-71944e7862d9</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi Michał,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;In principle there is nothing preventing you from having an arbitrary numbers of applications at different addresses, but you need your own bootloader&amp;nbsp;or to modify the SDK bootloader. I understand that you have this basically working, as you write it works on the first boot. There is one pitfall though which I want to mention, and that is important when booting an application that is not residing immediately after the SoftDevice.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;There was a change in SDK 15.0.0, where the bootloader no longer had dependencies on the SoftDevice (except for when BLE is needed). In SDK &amp;gt;= 15.0.0, the boot process consists of forwarding interrupts to the SoftDevice using SD_MBR_COMMAND_IRQ_FORWARD_ADDRESS_SET (nrf_dfu_mbr_irq_forward_address_set()), and then always jumping to address 0x1000 (SoftDevice start) instead of the application start address. An interesting point here is that SoftDevice reset function is not run by SD_MBR_COMMAND_IRQ_FORWARD_ADDRESS_SET, so a magic word indicating that the SoftDevice is enabled would not be reset, and the SoftDevice would still be enabled if it was enabled at some point before, even before a reset.&lt;br /&gt;&amp;nbsp;&lt;br /&gt;Another approach, which was used up to and including SDK 14.2 was to use the SD_MBR_COMMAND_INIT_SD and SD_MBR_COMMAND_VECTOR_TABLE_BASE_SET command, and start the application at a specific address. This is what you should use for a dual boot scenario when the application is not always immediately after the bootloader. Interestingly in this case is that SD_MBR_COMMAND_INIT_SD runs the SD reset function, which clears the magic word that indicates that the SD has been enabled. You can compare components\libraries\bootloader\nrf_bootloader_app_start.c in SDK 14.2 and a newer SDK to see both approaches.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;If the above is not &lt;/span&gt;&lt;span style="font-family:inherit;"&gt;the problem we need to go deeper into your bootloader. Can you &lt;/span&gt;&lt;span style="font-family:inherit;"&gt;share you bootloader code (being your own or a modified SDK bootloader)? What is the difference in flash between the first and second boot if you dump the entire flash using e.g. nrfjprog --memrd and diff it? Has it changed, and can that explain the difference? If not, there must be something else (change in a retention register, GPIO or similar that causes the bootloader to act differently the second time.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family:inherit;"&gt;Einar&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>