<?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 settings backup in SDK 15.1.0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/38061/bootloader-settings-backup-in-sdk-15-1-0</link><description>Hi 
 I&amp;#39;ve migrated some of our code to the SDK 15.1.0. One of the new features in the bootloader seems to cause some problems right now. 
 I was able t build a project and a new bootloader based on the SDK 15.1.0, but now after a few updates it seems</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 03 Sep 2018 22:05:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/38061/bootloader-settings-backup-in-sdk-15-1-0" /><item><title>RE: Bootloader settings backup in SDK 15.1.0</title><link>https://devzone.nordicsemi.com/thread/147056?ContentTypeID=1</link><pubDate>Mon, 03 Sep 2018 22:05:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:951f2431-641e-4896-9224-5896892b580a</guid><dc:creator>Adrian Eggenberger</dc:creator><description>&lt;p&gt;Hi Aaron&lt;/p&gt;
&lt;p&gt;Thanks for the detailed analyzation. I totally agree with your findings and your conclution that the backup needs to be invalidated or written with the download. I adapted your recommendation in my solution and it works perfectly.&lt;/p&gt;
&lt;p&gt;Maybe a short addition concerning the halt of the CPU. I don&amp;#39;t use this normally, but in this test i used it to stop the cpu to prevent that it starts after programming before i could setup the RTT viewer. It seems to work, but wouldn&amp;#39;t use it normally.&lt;/p&gt;
&lt;p&gt;Regards Adrian&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader settings backup in SDK 15.1.0</title><link>https://devzone.nordicsemi.com/thread/147051?ContentTypeID=1</link><pubDate>Mon, 03 Sep 2018 18:49:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8bb83dc0-09c9-4572-ab11-62ddddb5c154</guid><dc:creator>Aaron Nabil</dc:creator><description>&lt;p&gt;The problem seems to be here:&lt;/p&gt;
&lt;pre&gt;    
    
    bool settings_valid        = settings_crc_ok();
    bool settings_backup_valid = settings_backup_crc_ok();

    if (settings_valid &amp;amp;&amp;amp;
        settings_backup_valid &amp;amp;&amp;amp;
        !settings_forbidden_parts_equal_to_backup(m_dfu_settings_buffer))
    {
        NRF_LOG_WARNING(&amp;quot;Restoring settings from backup since the app has tampered with the &amp;quot;
                        &amp;quot;off-limit parts of the settings page.&amp;quot;);
        memcpy(&amp;amp;s_dfu_settings,
               mp_dfu_settings_backup_buffer,
               sizeof(nrf_dfu_settings_t));
    }
&lt;/pre&gt;
&lt;p&gt;IE, you have a valid backup that doesn&amp;#39;t match the current settings file. You either need to invalidate it by erasing it or program it at the same time. This seems to work for me, please try it:&lt;/p&gt;
&lt;pre&gt;    REM program new application and the coresponsing bootloader settings
    .\nrfutil settings generate --application nrf52832_xxaa.hex --family NRF52 --application-version 0 --bootloader-version 0 --bl-settings-version 1 &amp;quot;settings.hex&amp;quot;
    &lt;strong&gt;.\nrfutil settings generate  --start-address 0x7E000 --application nrf52832_xxaa.hex --family NRF52 --application-version 0 --bootloader-version 0 --bl-settings-version 1 &amp;quot;settings_backup.hex&amp;quot;&lt;/strong&gt;
    nrfjprog --sectorerase --program nrf52832_xxaa.hex
    nrfjprog --sectorerase --program settings.hex
    &lt;strong&gt;nrfjprog --sectorerase --program settings_backup.hex&lt;/strong&gt;


&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader settings backup in SDK 15.1.0</title><link>https://devzone.nordicsemi.com/thread/147048?ContentTypeID=1</link><pubDate>Mon, 03 Sep 2018 18:24:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3336d0a-b20e-4d76-84b2-64768116c892</guid><dc:creator>Aaron Nabil</dc:creator><description>&lt;p&gt;Note the undocumented change in&amp;nbsp;&lt;span&gt;NRF_DFU_DEBUG in 15.1, it used to just mean &amp;quot;honor debug flag in init packet&amp;quot;, now it also means ignore CRC.&amp;nbsp; I reverted it back to the original&amp;nbsp;behavior in my code base.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader settings backup in SDK 15.1.0</title><link>https://devzone.nordicsemi.com/thread/147046?ContentTypeID=1</link><pubDate>Mon, 03 Sep 2018 18:12:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82769faf-bed1-4669-9900-e4f6b162016c</guid><dc:creator>Aaron Nabil</dc:creator><description>&lt;p&gt;Hi Adrian,&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve just started looking at this, but my first question would be to wonder if it is valid to halt the cpu, reflash the application and then&amp;nbsp;simply resume it again as you do at the end of your batch file.&amp;nbsp; At this point in my flashing routine I restart, not run, the device.&lt;/p&gt;
&lt;p&gt;Note that you can avoid the initial backup by flashing a copy of the bootloader settings into the MBR parameter storage area (which is the bootloader settings backup area) at the same time you load the initial image.&amp;nbsp; Apparently the MBR has some kind of magic that distinguishes between bootloader settings backups and MBR commands.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader settings backup in SDK 15.1.0</title><link>https://devzone.nordicsemi.com/thread/146979?ContentTypeID=1</link><pubDate>Mon, 03 Sep 2018 12:49:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30c4f7b1-be6d-458c-aae3-6fd214fcd5d2</guid><dc:creator>Adrian Eggenberger</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve prepared a little test that can reproduce the issue. You can find the required test files an the attached test.zip file. The difference between this reproduced case and my problem case is the&amp;nbsp;NRF_DFU_DEBUG setting. Here in this example it is activated and in my case it&amp;#39;s not as I&amp;#39;m not a fan of developing with different settings than the end user will have. Setting&amp;nbsp;NRF_DFU_DEBUG would fix my problem, but if possible I&amp;#39;m looking for a good way to solve it without that.&lt;/p&gt;
&lt;p&gt;The test executes the following sequence:&lt;br /&gt;1) Program a bootloader, softdevice and application to a recovered nRF52 DK that has to be connected to the PC&lt;br /&gt;2) At this point a RTT viewer is attached. The attached log_1.txt file shows the output of the RTT viewer. In the log we can see that the bootloader settings are backed up to 0x7E000.&lt;br /&gt;3) Afterwards the nRF52 DK is halted and a new application with the generated correct bootloader settings is programmed.&lt;br /&gt;4) The next restart of the device shows in the log the output of the file log_2.txt. We can see that at the beginning the written new bootloader settings are overwritten by the restore of the backup. A few lines later we come to the place where the application is checked for validity. The output &amp;quot;CRC check of app failed. Return 1&amp;quot; shows that the restored bootloader settings are now surely not matching the written application. The &amp;quot;Return 1&amp;quot; is a result of the activated NRF_DFU_DEBUG that cases in this case that the application is started even if it is invalid. If&amp;nbsp;NRF_DFU_DEBUG is not set it will return 0 and the application is not started (as it is in my case).&lt;/p&gt;
&lt;p&gt;I see different options to solve this, but which one is the best. As others may struggle over the same behavior I think the problem should be fixed somehow as it is a new unwanted behavior that may confuse a lot of users.&lt;/p&gt;
&lt;p&gt;Regards Adrian&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/log_5F00_2.txt"&gt;devzone.nordicsemi.com/.../log_5F00_2.txt&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/2604.test.zip"&gt;devzone.nordicsemi.com/.../2604.test.zip&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/log_5F00_1.txt"&gt;devzone.nordicsemi.com/.../log_5F00_1.txt&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Bootloader settings backup in SDK 15.1.0</title><link>https://devzone.nordicsemi.com/thread/146855?ContentTypeID=1</link><pubDate>Sun, 02 Sep 2018 03:15:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b582366-f843-493e-933f-acb5dd5eee51</guid><dc:creator>Aaron Nabil</dc:creator><description>&lt;p&gt;Can you cut and paste what you are seeing in the log output to this thread and highlight the area of concern?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>