<?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>Reserving internal flash for user data</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/119785/reserving-internal-flash-for-user-data</link><description>nRF52832 &amp;amp; nRF Connect SDK 2.6.1 
 We would like to reserve some internal flash for user configuration data that would be written in production like 
 
 and read by FW but never modified by FW. 
 So we shrank the &amp;quot;storage&amp;quot; partition and added a custom</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 17 Mar 2025 16:13:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/119785/reserving-internal-flash-for-user-data" /><item><title>RE: Reserving internal flash for user data</title><link>https://devzone.nordicsemi.com/thread/527712?ContentTypeID=1</link><pubDate>Mon, 17 Mar 2025 16:13:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5aaf2cca-707a-47ff-b6dc-466f2c433f29</guid><dc:creator>MartinZ</dc:creator><description>&lt;p&gt;Thank you. In the meantime, I found a 2nd solution:&lt;/p&gt;
&lt;p&gt;- Put a custom.ld file in project folder with the following lines:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;.version_section 0x3DFC0 :
{
PROVIDE(__version_section_start = .);
KEEP(*(.version_section))
PROVIDE(__version_section_end = .);
} &amp;gt; FLASH
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;- Add the following line to CMakeLists.txt:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;zephyr_linker_sources(SECTIONS custom.ld)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;- Define your variable that will be put to the address specified in custom.ld:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static const uint32_t FW_VERSION __attribute__((section(&amp;quot;.version_section&amp;quot;))) __attribute__((used)) = 0x12345678;&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reserving internal flash for user data</title><link>https://devzone.nordicsemi.com/thread/527702?ContentTypeID=1</link><pubDate>Mon, 17 Mar 2025 15:24:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba6a544d-7b40-471e-bc00-85283a8150f7</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can refer to &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/0071c3aa661df0be98a9639784f6c01424f0ebb6/subsys/fw_info"&gt;the implementation of fw_info&lt;/a&gt; to see how it is done there (you have the cod ein fw_info.c and the linker script in fw_info.ld. Also, there the Kconfig defines the address as an offset by&amp;nbsp;FW_INFO_OFFSET.&lt;/p&gt;
&lt;p&gt;(This module does much of what you describe that you want from before, so you could also consider using it directly).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reserving internal flash for user data</title><link>https://devzone.nordicsemi.com/thread/527601?ContentTypeID=1</link><pubDate>Mon, 17 Mar 2025 12:04:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88126756-77db-474b-bf11-8e889acab311</guid><dc:creator>MartinZ</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;so how to create a new section to put its name into __attribute__?&lt;/p&gt;
&lt;p&gt;And where to specify the absolute address at which the variable should be put?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;FYI: If I use&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;__attribute__((at(0x7f000))) static const uint32_t FW_VERSION = 0x12345768;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I get this at build:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;warning: &amp;#39;at&amp;#39; attribute directive ignored [-Wattributes]&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reserving internal flash for user data</title><link>https://devzone.nordicsemi.com/thread/527598?ContentTypeID=1</link><pubDate>Mon, 17 Mar 2025 11:59:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56de3065-c087-4ca5-aa6c-c3b4a696592e</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;1. That should be good, but you can also see the generated config files. If using sysbuild, you can add&amp;nbsp;SB_CONFIG_PARTITION_MANAGER=n to sysbuild.conf to make sure it is disabled.&lt;/p&gt;
&lt;p&gt;2. Yes, if you use that approach to specify an address within the firmware that makes sense. This can be done with&amp;nbsp;__attribute__ as you would any other C project built with GCC.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reserving internal flash for user data</title><link>https://devzone.nordicsemi.com/thread/527183?ContentTypeID=1</link><pubDate>Thu, 13 Mar 2025 13:38:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7631ea44-b107-4a4c-adff-f82bd5365215</guid><dc:creator>MartinZ</dc:creator><description>&lt;p&gt;Thank you for your prompt response. I have two sub-questions:&lt;/p&gt;
&lt;p&gt;1. To be sure that we are not using the partition manager, is it enough to check that no partitions.yml file gets generated in the build folder?&lt;/p&gt;
&lt;p&gt;2. We would also like to have a few bytes of FW version data at a fixed address somewhere in flash (but outside the config_partition, not to get erased) to be readable by&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfjprog -f NRF52 --memrd &amp;lt;address&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Unlike the config data mentioned above, this data should be part of the FW image that gets flashed when the FW is written. As far as I understand, this should be done by placing a variable in a dedicated section:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static const uint32_t FW_VERSION __attribute__((section(&amp;lt;section_name&amp;gt;))) = 0x12345678;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;If this is the right way to achieve this, how to create this new section and specify its address? And how to prevent the compiler eliminating it as an unused variable?&lt;/p&gt;
&lt;p&gt;Or perhaps there is a better way to guarantee that the FW binary will contain some known bytes at a known address?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reserving internal flash for user data</title><link>https://devzone.nordicsemi.com/thread/527164?ContentTypeID=1</link><pubDate>Thu, 13 Mar 2025 12:52:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca1f20df-71a0-4a55-bdbd-c126315ca840</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;em&gt;If&lt;/em&gt; you don&amp;#39;t use the partition manager, then it looks good. However, the default for multi image builds is to use the &lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.9.1/page/nrf/scripts/partition_manager/partition_manager.html"&gt;partition manager&lt;/a&gt;, and then you need to make changes in pm_static.yml.&amp;nbsp; See &lt;a href="https://docs.nordicsemi.com/bundle/ncs-2.9.1/page/nrf/scripts/partition_manager/partition_manager.html#configuring_static_partitions"&gt;Configuring static partitions&lt;/a&gt;&amp;nbsp;for details.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>