<?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>Files for OTA firmware update stored in flash</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/57157/files-for-ota-firmware-update-stored-in-flash</link><description>Hello, 
 We are using nRF52840 with SDK 15.2.0, a bootloader, the bootloader settings and the SoftDevice. Our product has a cellular modem to be able to perform OTA firmware updates without BLE. We are currently able to receive and store the new firmware</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 04 Feb 2020 16:18:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/57157/files-for-ota-firmware-update-stored-in-flash" /><item><title>RE: Files for OTA firmware update stored in flash</title><link>https://devzone.nordicsemi.com/thread/232653?ContentTypeID=1</link><pubDate>Tue, 04 Feb 2020 16:18:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2046fdb4-0702-412b-b9ce-17eac504ee22</guid><dc:creator>Pierre cgwi22</dc:creator><description>&lt;p&gt;Thanks a lot! It works now and we have succesfully swapped on the new firmware.&lt;/p&gt;
&lt;p&gt;But it takes about 2 minutes between the reboot in DFU mode and the start of the new firmware. Is this delay normal? (For information the firmware has a size of 213140 bytes)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Files for OTA firmware update stored in flash</title><link>https://devzone.nordicsemi.com/thread/232617?ContentTypeID=1</link><pubDate>Tue, 04 Feb 2020 14:42:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7dbbc4df-b7e7-407b-b2e5-8a1e3b79ca56</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Good point.&amp;nbsp;The background is that backup of bootloader settings was introduced as a security feature, as part of the support for secure boot. You can disable parts of this check by setting&amp;nbsp;NRF_DFU_SETTINGS_ALLOW_UPDATE_FROM_APP to 1 in the bootloaders sdk_config.h. Alternatively, you can remove it altogether by modifying&amp;nbsp;settings_forbidden_parts_equal_to_backup&amp;nbsp;in &amp;lt;SDK&amp;gt;\components\libraries\bootloader\dfu\nrf_dfu_settings.c to always return true.&lt;/p&gt;
&lt;p&gt;I am sorry I did not mention this before. (In my faulty memory settings backup was introduced in SDK 15.3 rather than 15.2).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Files for OTA firmware update stored in flash</title><link>https://devzone.nordicsemi.com/thread/232519?ContentTypeID=1</link><pubDate>Tue, 04 Feb 2020 11:03:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15f0e7bc-aa98-4c7b-947c-76bcc9139149</guid><dc:creator>Pierre cgwi22</dc:creator><description>&lt;p&gt;Perhaps our problem comes from the settings backup in 0xFE000 which is not the same as our settings in 0xFF000, so the settings are overwritten like in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/38061/bootloader-settings-backup-in-sdk-15-1-0"&gt;this thread&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So we need to write the same data in 0xFE000 and 0xFF000 but the 0xFE000 page is protected by the bootloader like explained in &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/47147/erasing-of-master-boot-record-parameters-page-hangs"&gt;this other thread&lt;/a&gt;. Is there a solution for removing this protection directly from the application, without modifying the bootloader?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Files for OTA firmware update stored in flash</title><link>https://devzone.nordicsemi.com/thread/232421?ContentTypeID=1</link><pubDate>Mon, 03 Feb 2020 18:27:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a46527ea-1ae4-47c7-affd-8e2fb27c49e4</guid><dc:creator>Pierre cgwi22</dc:creator><description>&lt;p&gt;Concerning our last question in the previous post, we have found a difference between the online documentation and the bootloader code about the CRC.&lt;/p&gt;
&lt;p&gt;In the description of the settings structure, we can read &amp;quot;&lt;strong&gt;uint32_t nrf_dfu_settings_t::crc CRC for the stored DFU settings, not including the CRC itself.&lt;/strong&gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;But in the comments of the bootloader code, for the &lt;em&gt;settings_crc_get()&lt;/em&gt; function, it is written &amp;quot;&lt;strong&gt;The crc is calculated from the s_dfu_settings struct, except the crc itself and the init command&lt;/strong&gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;So we have removed the init command from the CRC calculation but the behavior stays the same.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Files for OTA firmware update stored in flash</title><link>https://devzone.nordicsemi.com/thread/232403?ContentTypeID=1</link><pubDate>Mon, 03 Feb 2020 16:20:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:42dbcb73-066a-4491-8929-09b4cf828b0e</guid><dc:creator>Pierre cgwi22</dc:creator><description>&lt;p&gt;OK, thanks!&lt;/p&gt;
&lt;p&gt;We have checked what the bootloader do in &lt;em&gt;nrf_bootloader_init()&lt;/em&gt; and &lt;em&gt;nrf_bootloader_fw_activate()&lt;/em&gt;. It seems ok compared to our settings, but perhaps the problem appears above, in &lt;em&gt;nrf_dfu_settings_init()&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Here is our full &lt;em&gt;nrf_dfu_settings_t&lt;/em&gt; structure values after adding the init command:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;crc = computed value of the settings, like the documentation explains&lt;/li&gt;
&lt;li&gt;settings_version, app_version and bootloader_version = no modification&lt;/li&gt;
&lt;li&gt;bank_layout and bank_current = no modification&lt;/li&gt;
&lt;li&gt;bank_0:
&lt;ul&gt;
&lt;li&gt;image_size and image_crc = no modification&lt;/li&gt;
&lt;li&gt;bank_code = NRF_DFU_BANK_INVALID&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;bank_1:
&lt;ul&gt;
&lt;li&gt;image_size = size of the new firmware&lt;/li&gt;
&lt;li&gt;image_crc = computed value of the new firmware&lt;/li&gt;
&lt;li&gt;bank_code = NRF_DFU_BANK_VALID_APP&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;write_offset and sd_size = no modification&lt;/li&gt;
&lt;li&gt;progress:
&lt;ul&gt;
&lt;li&gt;command_size = size of the init command&lt;/li&gt;
&lt;li&gt;command_offset = no modification&lt;/li&gt;
&lt;li&gt;command_crc = computed value of the init command&lt;/li&gt;
&lt;li&gt;data_object_size = no modification&lt;/li&gt;
&lt;li&gt;update_start_address = bank 1 address&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;enter_buttonless_dfu = 1&lt;/li&gt;
&lt;li&gt;init_command = init command data&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Is it correct? About the CRC of the settings, we must include all the size of the init_command table (256 bytes with several 0xFF at the end) or only the size of the written data?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Files for OTA firmware update stored in flash</title><link>https://devzone.nordicsemi.com/thread/232332?ContentTypeID=1</link><pubDate>Mon, 03 Feb 2020 13:13:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:faa2cff1-d927-49b5-98f3-ab2a01d7b697</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Pierre,&lt;/p&gt;
&lt;p&gt;I am sorry, I did not mention that you need to populate &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/structnrf__dfu__settings__t.html"&gt;bank_1&lt;/a&gt;&amp;nbsp;in the bootloader settings. The bank_code field must be&amp;nbsp;NRF_DFU_BANK_VALID_APP. The bootloader checks this during startup (nrf_bootloader_init() calls&amp;nbsp;nrf_bootloader_fw_activate()), and will continue with activation if the code is&amp;nbsp;NRF_DFU_BANK_VALID_APP.&lt;/p&gt;
&lt;p&gt;Br,&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Files for OTA firmware update stored in flash</title><link>https://devzone.nordicsemi.com/thread/232176?ContentTypeID=1</link><pubDate>Sat, 01 Feb 2020 16:09:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b34b7e3-c5fe-4bce-bd43-3a91c2edec66</guid><dc:creator>Pierre cgwi22</dc:creator><description>&lt;p&gt;Currently the application code starts in memory at address 0x26000 and finishes at 0x58DD1. So the new firmware data (.bin) is stored in the following page at 0x59000.&lt;/p&gt;
&lt;p&gt;The bootloader settings are stored on the last page, at 0xFF000. We have written the init command (.dat) in the &lt;em&gt;nrf_dfu_settings_t&lt;/em&gt; structure and calculated the CRCs. Then the modified settings are rewritten in flash.&lt;/p&gt;
&lt;p&gt;Finally, we have tried to reboot on DFU mode with the following code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;err_code = sd_power_gpregret_clr(0, 0xFFFFFFFF);
APP_ERROR_CHECK(err_code);
err_code = sd_power_gpregret_set(0, BOOTLOADER_DFU_START);
APP_ERROR_CHECK(err_code);
nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Is it the good way to do what we want? This is not working, the bootloader seems doing nothing during 2 minutes then it reboots on the original application and the settings are reinitialized in flash.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Files for OTA firmware update stored in flash</title><link>https://devzone.nordicsemi.com/thread/231893?ContentTypeID=1</link><pubDate>Thu, 30 Jan 2020 13:02:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c25ab21-ae5f-46e0-b8ce-a524d88bbe1f</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The image (.dat) should be located in bank 1, which is calculated by&amp;nbsp;nrf_dfu_bank1_start_addr(). The init command should be stored in the bootloader settings page (&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/structnrf__dfu__settings__t.html"&gt;nrf_dfu_settings_t&lt;/a&gt;::init_command). Note that this approach described by Vidar describes how you can use the &amp;quot;normal&amp;quot; SDK bootloader to do DFU from the application. This makes a lot of sense in many cases, for instance, if you also want BLE transport in the bootloader, or you need a well-tested solution.&lt;/p&gt;
&lt;p&gt;(If you &lt;em&gt;only&lt;/em&gt; intend to do DFU via your modem, then another approach could be to use a thin bootloader such as the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v16.0.0/lib_background_dfu.html?cp=7_1_3_24_1_0"&gt;IoT backround DFU library&lt;/a&gt; (this uses many of the same concepts). However, there is no complete example for the IoT DFU solution, and it is experimental.)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Files for OTA firmware update stored in flash</title><link>https://devzone.nordicsemi.com/thread/231844?ContentTypeID=1</link><pubDate>Thu, 30 Jan 2020 10:55:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d5eb362-aa07-4430-ba18-638b6e54ac4a</guid><dc:creator>Pierre cgwi22</dc:creator><description>&lt;p&gt;Thanks for your help.&lt;/p&gt;
&lt;p&gt;In fact we can&amp;#39;t use the DFU transport because the new firmware come from an external FTP server, downloaded in several parts and with some extra data we need to filter. We can&amp;#39;t modify this behavior. It&amp;#39;s the reason why we have created our own storage method in flash memory.&lt;/p&gt;
&lt;p&gt;So we must just know how we can inform the bootloader about the addresses of the .bin and .dat data in the flash to be able to perform the swap.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Files for OTA firmware update stored in flash</title><link>https://devzone.nordicsemi.com/thread/231835?ContentTypeID=1</link><pubDate>Thu, 30 Jan 2020 10:20:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76fd2825-d806-4571-9920-14fb9798b380</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]We have tried to store firstly all the .zip DFU file in flash, but according to &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/47410/firmware-update-dfu-from-server-or-cloud/189244#189244"&gt;this answer on an other thread&lt;/a&gt; we can&amp;#39;t do that.[/quote]
&lt;p&gt;You should not store the . zip on the nRF (then you would have to have flash to unzip it etc).&lt;/p&gt;
[quote user=""]Can you explain which files must be used and where in the flash memory ?[/quote]
&lt;p&gt;You should transfer and store the raw binary image (.bin) file as well as the init packet (.dat file). You do not actually have to think about how this is stored. Instead, you can make a transport for your cellular modem similar to the UART transport as &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/47410/firmware-update-dfu-from-server-or-cloud/190243#190243"&gt;described here&lt;/a&gt;. Then the DFU library will temporarily store the data for you (somewhere between the application end address and the reserved application data pages).&lt;/p&gt;
&lt;p&gt;I recomend you refer to the project Vidar posted in&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/47410/firmware-update-dfu-from-server-or-cloud/"&gt; the thread you linked to&lt;/a&gt;&amp;nbsp;as an example of how this can be done. Note that it uses some support that was introduced in SDK 15.3, which is the first SDK with proper&amp;nbsp;support for DFU in the application. If you start playing with that, which is a working example, then you can adapt that to your cellular transport starting off with a known good base. Once that works, you can port it to your application.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>