<?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>How to make sure DFU erases all app data</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/41475/how-to-make-sure-dfu-erases-all-app-data</link><description>Hi, I want to make sure that all application data are erased when we do a DFU, so that the newer application get a clean start without having to worry about data from older versions. The application uses FDS. 
 Is it sufficient to set DFU_APP_DATA_RESERVED</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 13 Dec 2018 12:22:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/41475/how-to-make-sure-dfu-erases-all-app-data" /><item><title>RE: How to make sure DFU erases all app data</title><link>https://devzone.nordicsemi.com/thread/161654?ContentTypeID=1</link><pubDate>Thu, 13 Dec 2018 12:22:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d9ca3ac-9dbd-44b5-a242-0e582c11b358</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The bootloader will not erase the app data section unless&amp;nbsp;it&amp;#39;s required&amp;nbsp;to fit the new image(s) you are uploading. If you want to guarantee that the app data reserved is erased&amp;nbsp;you need to either modify the bootloader or add a mechanism in your app that erases the app data after an application update.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Maybe something like this:&lt;/p&gt;
&lt;p&gt;1. Create a new data record that holds the current version number of the application.&lt;/p&gt;
&lt;p&gt;2. Harcode the version number in the app or create a pointer that points to&amp;nbsp; &amp;nbsp;nrf_dfu_settings_t::app_version in the bootloader settings.&lt;/p&gt;
&lt;p&gt;3. On startup, compare the version number from step 2 with the one in step 1. If there&amp;#39;s a mismatch (ie app has been updated), erase user data then update the fds record with the new version number.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>