<?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>Write Value in Flash during Compiling/Linking</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/57458/write-value-in-flash-during-compiling-linking</link><description>Hello, 
 I have exercised the flash driver and that is working fine. I want to save a certain value into a specific address in NVM and I want that part of the .hex file. I am assuming this would be done using __attribute or some other GCC symbol, but</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 06 Feb 2020 16:01:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/57458/write-value-in-flash-during-compiling-linking" /><item><title>RE: Write Value in Flash during Compiling/Linking</title><link>https://devzone.nordicsemi.com/thread/233117?ContentTypeID=1</link><pubDate>Thu, 06 Feb 2020 16:01:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b44b19d3-bdb2-458b-97b8-b948e71bbbdb</guid><dc:creator>tesc</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;We do something like that in the Secure DFU bootloader, where in nrf_dfu_settings.c you will find:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    uint8_t m_dfu_settings_buffer[BOOTLOADER_SETTINGS_PAGE_SIZE]
        __attribute__((section(&amp;quot;.bootloader_settings_page&amp;quot;)))
        __attribute__((used));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;What &amp;quot;.bootloader_settings_page&amp;quot; refers to in this piece of code, is the following memory segment from the flash_placement.xml file for the project:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="xml"&gt;  &amp;lt;MemorySegment name=&amp;quot;bootloader_settings_page&amp;quot; start=&amp;quot;0x000FF000&amp;quot; size=&amp;quot;0x1000&amp;quot;&amp;gt;
    &amp;lt;ProgramSection alignment=&amp;quot;4&amp;quot; keep=&amp;quot;Yes&amp;quot; load=&amp;quot;No&amp;quot; name=&amp;quot;.bootloader_settings_page&amp;quot; address_symbol=&amp;quot;__start_bootloader_settings_page&amp;quot; end_symbol=&amp;quot;__stop_bootloader_settings_page&amp;quot; start = &amp;quot;0x000FF000&amp;quot; size=&amp;quot;0x1000&amp;quot; /&amp;gt;
  &amp;lt;/MemorySegment&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I hope that helps!&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Terje&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>