<?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>pstorage data did not erase by bootloader？</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/19930/pstorage-data-did-not-erase-by-bootloader</link><description>HI，I want to store some data in 51822. These data was store by my program. I know the pstorage.c could store data. When I do DUF the data could be erased by the bootloader？</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 24 Feb 2017 08:44:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/19930/pstorage-data-did-not-erase-by-bootloader" /><item><title>RE: pstorage data did not erase by bootloader？</title><link>https://devzone.nordicsemi.com/thread/77560?ContentTypeID=1</link><pubDate>Fri, 24 Feb 2017 08:44:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9d0b8b4-7091-445e-b701-84d5aa574f84</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Hi Mark,&lt;/p&gt;
&lt;p&gt;you are correct in that data stored using pstorage will be erased during a DFU if the bootloader is not configured to preserve application data during a DFU. This is done by setting the&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define DFU_APP_DATA_RESERVED           0x0000
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;in dfu_types.h to the number of bytes, note it must be a multiple of the flash page size, you want to preserve. This is described in detail &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk51.v9.0.0/bledfu_memory_appdata.html?resultof=%22%70%72%65%73%65%72%76%65%22%20%22%70%72%65%73%65%72%76%22%20%22%61%70%70%6c%69%63%61%74%69%6f%6e%22%20%22%61%70%70%6c%69%63%22%20%22%64%61%74%61%22%20"&gt;here&lt;/a&gt;. The value of DFU_APP_DATA_RESERVED corresponds to the number of bytes below the bootloader start address, which is where pstorage stores data,  that will be preserved during a DFU, you can see the memory layout on &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk51.v9.0.0/bledfu_memory.html"&gt;this&lt;/a&gt; Infocenter page.&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>