<?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>Relocating bootloader by DFU</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/76147/relocating-bootloader-by-dfu</link><description>Description: 
 We&amp;#39;d like to extend our existing bootloader. It currently supports UART transport and we want to retrofit a bootloader that also supports OTA via BLE. On merging the code bases for pca10056_uart and pca10056_ble it became clear that we</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 09 Jun 2021 15:00:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/76147/relocating-bootloader-by-dfu" /><item><title>RE: Relocating bootloader by DFU</title><link>https://devzone.nordicsemi.com/thread/314534?ContentTypeID=1</link><pubDate>Wed, 09 Jun 2021 15:00:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a392d4df-164e-4e34-8b0a-a8ea45c9add0</guid><dc:creator>xmoex</dc:creator><description>&lt;p&gt;Thanks again! We will have a discussion about it and see if this will be an option for us in the future.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Relocating bootloader by DFU</title><link>https://devzone.nordicsemi.com/thread/314501?ContentTypeID=1</link><pubDate>Wed, 09 Jun 2021 13:34:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3f4ef17-f5cf-424c-922c-223c635108bc</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes, it should be doable in this case.&lt;/p&gt;
&lt;p&gt;Regarding point 2 you will not be able to write the bootloader to&amp;nbsp;0xF0000 via DFU directly, but you could use something form &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/18199/dfu---updating-from-legacy-sdk-v11-0-0-bootloader-to-secure-sdk-v12-x-0-bootloader/70272#70272"&gt;this old post&lt;/a&gt;. This describes essentially what you want to do, but with a method that only worked on older SDK&amp;#39;s and only on nRF52832, as there the bootloader address was in the UICR and the UICR could be erased and reprogrammed.&lt;/p&gt;
&lt;p&gt;Alternatively and perhaps easier for step 2 it should be possible to make an application image that contains the new temporary bootloader at the new start&amp;nbsp;address,&amp;nbsp;but also with something else (application or just junk / empty space) from the beginning of the application start address.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Relocating bootloader by DFU</title><link>https://devzone.nordicsemi.com/thread/314481?ContentTypeID=1</link><pubDate>Wed, 09 Jun 2021 13:00:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0c2639de-ff37-4947-a0c6-b461f1dad589</guid><dc:creator>xmoex</dc:creator><description>&lt;p&gt;&lt;span&gt;Hi Einar Thorsrud,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;thank you very much for your insight!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;That might still be interesting for us. Currently, the bootloader sits at 0xF8000 with a size of 0x6000. When it could be possible to just flip bit 15 of the start address we&amp;#39;d end up with the new start address being 0xF0000 and a size of 0xE000 which would give us more than enough space to work with.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;However do I understand you correctly that we still would need to&amp;nbsp;&lt;/span&gt;&lt;strong&gt;&lt;span&gt;flash a bootloader onto the device&lt;/span&gt;&lt;/strong&gt;&lt;span&gt;&amp;nbsp;which does not do this first:&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&lt;span&gt;// Protect MBR and bootloader code from being overwritten.&lt;br /&gt;&lt;/span&gt;ret_val = nrf_bootloader_flash_protect(&lt;span&gt;0&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;MBR_SIZE&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;false&lt;/span&gt;)&lt;span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;APP_ERROR_CHECK&lt;/span&gt;(ret_val)&lt;span&gt;;&lt;br /&gt;&lt;/span&gt;ret_val = nrf_bootloader_flash_protect(&lt;span&gt;BOOTLOADER_START_ADDR&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;BOOTLOADER_SIZE&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;false&lt;/span&gt;)&lt;span&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;APP_ERROR_CHECK&lt;/span&gt;(ret_val)&lt;span&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span&gt;Reading about&amp;nbsp;&lt;/span&gt;&lt;a class="editor-rtfLink" href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf5340%2Facl.html" rel="noopener noreferrer" target="_blank"&gt;&lt;span&gt;ACL&lt;/span&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;it seems to be impossible to reset permissions during runtime once they have been set.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;As a vague Idea I have the following scenario (all DFU) in mind:&lt;/span&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span&gt;Transfer a temporary bootloader to the device via DFU to address 0xF8000. This bootloader would not utilize ACL.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;Transfer an intermediate bootloader to the device via DFU to address 0xF0000. This bootloader utilizes ACL.&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Have the temporary bootloader modify the MBR section to just flip bit 15 at&amp;nbsp;&lt;/span&gt;&lt;a class="editor-rtfLink" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s212.api.v6.1.1/group___n_r_f___m_b_r___d_e_f_i_n_e_s.html#ga21a55e684b30e9dabbf86859cd788b1a" rel="noopener noreferrer" target="_blank"&gt;&lt;span&gt;MBR_BOOTLOADER_ADDR&lt;/span&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;triggered by a custom DFU command or some other means.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Reset the device to activate the intermediate bootloader.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Now we have ACL back on and a bootloader slot staring at 0xF0000 of size 0xE000, ready to accept our desired UART+BLE bootloader.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;It&amp;#39;s not an easy task but it should be possible all by DFU shouldn&amp;#39;t it?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Relocating bootloader by DFU</title><link>https://devzone.nordicsemi.com/thread/314440?ContentTypeID=1</link><pubDate>Wed, 09 Jun 2021 11:34:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b23a8f23-4e40-4c9f-93e8-1bf7de16b864</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;In recent SDK versions (including 15.3) the bootloader start address is stored in the end of the MBR page (page 0). That gives you a few problems which in sum makes this not possible.&lt;/p&gt;
&lt;p&gt;You cannot do a page erase of the MBR and then write it again as that resides in address 0 and has the interrupt vector table etc. So that cannot be done.&lt;/p&gt;
&lt;p&gt;In theory you could change the bootloader start address if you only require bits in the address to be flipped from 1 to 0 as that way you only need to write to the MBR page and not erase it. You would need to flash a temporary bootloader though, as the bootloader now write protects the bootloader pages and the MBR page using ACL. But this limits the number of possible addresses so much that it is probably not useful in practice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Relocating bootloader by DFU</title><link>https://devzone.nordicsemi.com/thread/314367?ContentTypeID=1</link><pubDate>Wed, 09 Jun 2021 07:50:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:63986bdd-495b-479c-8874-940b6702cca4</guid><dc:creator>xmoex</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/alex-tishchenko"&gt;Alex Tishchenko&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;thanks for taking the time to answer. As I said: &lt;strong&gt;manual flashing is not an option&lt;/strong&gt; here.&lt;/p&gt;
&lt;p&gt;Looking at&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v15.3.0%2Flib_bootloader.html&amp;amp;anchor=lib_bootloader_memory"&gt;infocenter.nordicsemi.com&lt;/a&gt;&amp;nbsp;it states:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;span&gt;The size of the bootloader is fixed for the lifetime of the device. This is because the location (&lt;/span&gt;&lt;a class="elRef" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.s212.api.v6.1.1/group___n_r_f___m_b_r___d_e_f_i_n_e_s.html#ga21a55e684b30e9dabbf86859cd788b1a"&gt;MBR_BOOTLOADER_ADDR&lt;/a&gt;&lt;span&gt;) that stores the start address of the bootloader is not (safely) updateable.&lt;/span&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;span&gt;So I am interested in what way (possibly&amp;nbsp;unsafe) it could still be done.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Relocating bootloader by DFU</title><link>https://devzone.nordicsemi.com/thread/314261?ContentTypeID=1</link><pubDate>Tue, 08 Jun 2021 15:06:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8fcdc7b4-4dd1-40a4-a876-67999de71207</guid><dc:creator>Alex Tishchenko</dc:creator><description>&lt;p&gt;Hello&lt;/p&gt;
&lt;p&gt;Have a look at the DEBUG version of the BLE bootloader in the SDK - its start&amp;nbsp; address is set to 71000 as opposed to 78000 for the non DEBUG version. So yes, just edit the project file, recompile and you are there. (Just update the flash size for your application too). Beware, once you flashed the bootloader with whatever starting address, you won&amp;#39;t be able to upgrade it over the air with the bootloader with &lt;strong&gt;different&lt;/strong&gt; starting address, manual flashing will be required.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>