<?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>Can firmware be overwritten by fds?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/86569/can-firmware-be-overwritten-by-fds</link><description>Hi guys 
 
 I&amp;#39;m just want to know, is this situation can occur if my application size will grow so high that it could be overwritten by the flash data storage module? 
 
 The start and end addresses are calculated in fds.c: 
 
 
 
 
 SDK 17.1.0. Softdevice</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 04 Apr 2022 13:21:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/86569/can-firmware-be-overwritten-by-fds" /><item><title>RE: Can firmware be overwritten by fds?</title><link>https://devzone.nordicsemi.com/thread/361537?ContentTypeID=1</link><pubDate>Mon, 04 Apr 2022 13:21:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07384ebe-4040-405d-9313-e2265f10663c</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes, when you use a bootloader, FDS will use the pages immediately below the bootloader. If you don&amp;#39;t use a bootloader, the FDS pages are located at the end of the flash. Note that when you use FDS and a bootloader you also need to ensure that you configure&amp;nbsp;NRF_DFU_APP_DATA_AREA_SIZE in the bootloader&amp;#39;s sdk_config.h correctly, so that the FDS pages are not overwritten during a DFU procedure.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can firmware be overwritten by fds?</title><link>https://devzone.nordicsemi.com/thread/361523?ContentTypeID=1</link><pubDate>Mon, 04 Apr 2022 12:53:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03c963b7-5fd3-4be7-a326-a4e2b186a7e5</guid><dc:creator>Mike Tuev R9FT</dc:creator><description>&lt;p&gt;Thank you for explanation.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I added the following LOG message to know exact addresses where FDS&amp;nbsp;memory allocated:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;quot;nrf_log.h&amp;quot;
static void flash_bounds_set(void)
{
    uint32_t flash_size  = (FDS_PHY_PAGES * FDS_PHY_PAGE_SIZE * sizeof(uint32_t));
    m_fs.end_addr   = flash_end_addr();
    m_fs.start_addr = m_fs.end_addr - flash_size;
    NRF_LOG_INFO(&amp;quot;FDS  start: %x  end: %x&amp;quot;,m_fs.start_addr,m_fs.end_addr);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;By default in Keil examples these addresses overlaps with IROM1 memory area in Keil&amp;#39;s project options.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Besides, FDS addresses are differerent when I run my application with secure_bootloader_ble (I use&amp;nbsp;mergehex, nrfutil and nrfjprog for manually program firmware with bootloader, softdevice, application, bootloader settings).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can firmware be overwritten by fds?</title><link>https://devzone.nordicsemi.com/thread/361498?ContentTypeID=1</link><pubDate>Mon, 04 Apr 2022 12:04:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e2ef17f-9dff-43a9-88f2-27dc151303a8</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;FDS automatically ensures that the FDS pages occupy the flash immediately below the bootloader (if used). That is essentially what happens in&amp;nbsp;flash_bounds_set() and&amp;nbsp;flash_end_addr(). FDS does not check where your application ends. It is your responsibility to have control over the memory layout and ensure that the various regions does not overlap. I suggest you refer to the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_bootloader.html?lib_bootloader_memory"&gt;Memory layout&lt;/a&gt; figure in the bootloader documentation if to help visualize how this looks.&lt;/p&gt;
&lt;p&gt;If you want an error when building a too large application, you should adjust the flash size in your linker configuration to only include the size you have reserved for the application. Then you would get a build error if the application grows into the FDS pages.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>