<?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>Reserve some spaces in a partition</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/106272/reserve-some-spaces-in-a-partition</link><description>Hello, 
 I&amp;#39;m using the nrf connect SDK v2.5.0. 
 For historical reasons (devices working with the nrf5 stack at my clients), I would like to reserve part of the bytes located in my &amp;quot;app&amp;quot; partition: 
 app: address: 0x27000 end_address: 0xE4000 region:</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 15 Dec 2023 12:33:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/106272/reserve-some-spaces-in-a-partition" /><item><title>RE: Reserve some spaces in a partition</title><link>https://devzone.nordicsemi.com/thread/460539?ContentTypeID=1</link><pubDate>Fri, 15 Dec 2023 12:33:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:532bd4e5-75bd-4941-869f-c622d7a74676</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;I have tried to make this work, without success.&lt;/p&gt;
&lt;p&gt;Here are some links to what I have tried, so maybe you can figure something out as well:&lt;/p&gt;
&lt;p&gt;Firstly, it is possible to add a custom linker script, as you can see in &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/main/samples/application_development/code_relocation_nocopy/linker_arm_nocopy.ld"&gt;this sample&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;As far as I can tell, it is not possible to split the &amp;quot;app&amp;quot; with the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/scripts/partition_manager/partition_manager.html#partition-manager"&gt;partition manager&lt;/a&gt;, so I figure we need to use the linker directly.&lt;/p&gt;
&lt;p&gt;I found some stack overflow articles on how I can modify the linker, but I have not been able to add it on top of the linker script:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/19781375/how-to-place-constant-at-specific-address-with-ld-linker-command-file"&gt;https://stackoverflow.com/questions/19781375/how-to-place-constant-at-specific-address-with-ld-linker-command-file&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/44443619/how-to-write-read-to-flash-on-stm32f4-cortex-m4/44855815#44855815"&gt;https://stackoverflow.com/questions/44443619/how-to-write-read-to-flash-on-stm32f4-cortex-m4/44855815#44855815&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The next step would be to copy the full linker script from NCS and edit just the sections we need.&lt;br /&gt;I suggest that you give this a try yourself first, and let me know if you figure something out.&lt;/p&gt;
&lt;p&gt;I can continue to assist here next week (but I will set the case to waiting, so I will not see it if you do not answer again).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reserve some spaces in a partition</title><link>https://devzone.nordicsemi.com/thread/460494?ContentTypeID=1</link><pubDate>Fri, 15 Dec 2023 09:04:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e592810b-37d4-49db-87aa-5fe0d84f969e</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;That makes sense then.&lt;br /&gt;I will try to figure out how to protect some addresses in the middle of the application&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reserve some spaces in a partition</title><link>https://devzone.nordicsemi.com/thread/460492?ContentTypeID=1</link><pubDate>Fri, 15 Dec 2023 09:00:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d993a16-3fbe-4b71-bd33-bd6d0d1b86fe</guid><dc:creator>QuentinD</dc:creator><description>&lt;p&gt;Yes the nrf5 bootloader writes values to these addresses and then the application (application based on the nrf5 SDK or on the NCS SDK) uses this data.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reserve some spaces in a partition</title><link>https://devzone.nordicsemi.com/thread/460490?ContentTypeID=1</link><pubDate>Fri, 15 Dec 2023 08:55:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9cb723d3-aec5-40de-a51e-7dd9d27bae84</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>[quote user="QuentinD"]The problem I have is that my predecessor&amp;nbsp;(bootloader) wrote important values between address 0xD0000 and address 0xD1000&amp;nbsp;so to avoid the bootloader overwriting part of the application[/quote]
&lt;p&gt;Do I understand it correctly that those values are used by the nRF5 bootloader?&lt;br /&gt;Or are they used by the application? Or both?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reserve some spaces in a partition</title><link>https://devzone.nordicsemi.com/thread/460489?ContentTypeID=1</link><pubDate>Fri, 15 Dec 2023 08:38:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d1e6d64-fc91-4343-897c-a61f9f085660</guid><dc:creator>QuentinD</dc:creator><description>&lt;p&gt;In my devices (NRF52840) that are in the field (bootloader and application based on the nrf5 SDK), here is their memory layout:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;mbr: 0x0 -&amp;gt; 0x1000&lt;/li&gt;
&lt;li&gt;softdevice: 0x1000 -&amp;gt; 0x27000&lt;/li&gt;
&lt;li&gt;app: 0x27000 -&amp;gt; 0xE4000&lt;/li&gt;
&lt;li&gt;bootloader: 0xE4000 -&amp;gt; 0xF0000&lt;/li&gt;
&lt;li&gt;/ : 0xF0000 -&amp;gt; 0xFE000&lt;/li&gt;
&lt;li&gt;MBR params page: 0xFE000 -&amp;gt; 0xFF000&lt;/li&gt;
&lt;li&gt;bootloader settings page: 0xFF000 -&amp;gt; 0x1000000&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;And, in the flash_placement.xml file, I added this memory segment (at the end of &amp;quot;app&amp;quot;):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;  &amp;lt;MemorySegment name=&amp;quot;ot_flash_data&amp;quot; start=&amp;quot;0xe0000&amp;quot; size=&amp;quot;0x4000&amp;quot;&amp;gt;
    &amp;lt;ProgramSection alignment=&amp;quot;4&amp;quot; keep=&amp;quot;Yes&amp;quot; load=&amp;quot;Yes&amp;quot; name=&amp;quot;.ot_flash_data&amp;quot; address_symbol=&amp;quot;__start_ot_flash_data&amp;quot; end_symbol=&amp;quot;__stop_ot_flash_data&amp;quot; start = &amp;quot;0xe0000&amp;quot; size=&amp;quot;0x4000&amp;quot; /&amp;gt;
  &amp;lt;/MemorySegment&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The problem I have is that my predecessor&amp;nbsp;(bootloader) wrote important values between address 0xD0000 and address 0xD1000&amp;nbsp;so to avoid the bootloader overwriting part of the application, I would need my new applications based on the nrf SDK not to write code to these addresses.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;I know it would be possible for me to redevelop a bootloader that will write to other more suitable addresses but that will then force my clients to have to update their bootloader and application for it to work (very expensive).&amp;nbsp;So if it&amp;#39;s possible to only update the app, I would prefer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reserve some spaces in a partition</title><link>https://devzone.nordicsemi.com/thread/460481?ContentTypeID=1</link><pubDate>Fri, 15 Dec 2023 07:53:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e74240ca-ba8a-49ab-a85e-9eccbe23a368</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Doing that is theoretically possible, but with the partition manager, it may be hard to achieve.&lt;/p&gt;
&lt;p&gt;Therefore I first want to check if this is an &lt;a href="https://en.wikipedia.org/wiki/XY_problem"&gt;XY Problem&lt;/a&gt;. For me to see if there is a better solution to your challenge, can you describe the memory layout of your nRF5 application?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reserve some spaces in a partition</title><link>https://devzone.nordicsemi.com/thread/460394?ContentTypeID=1</link><pubDate>Thu, 14 Dec 2023 14:37:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:387e8095-2efa-4eab-be3e-25760207571c</guid><dc:creator>QuentinD</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;No what I want is to prevent the linker from putting code in an area of the &amp;quot;app&amp;quot; partition.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using the nrf connect SDK and I created my partitions with the pm_static.yml file. My &amp;quot;app&amp;quot; partition starts at address 0x27000 and goes to address 0xE0000 but I would like the linker not to put any code between address 0xD0000 and address 0xD1000.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reserve some spaces in a partition</title><link>https://devzone.nordicsemi.com/thread/460390?ContentTypeID=1</link><pubDate>Thu, 14 Dec 2023 14:28:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f477ebed-f4e9-42f7-a755-46112b478818</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I will continue helping in this case. You are not forgotten.&lt;/p&gt;
&lt;p&gt;From &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/lib_bootloader.html?cp=9_1_3_5_0_7#lib_bootloader_memory"&gt;nRF5 memory layout&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1702564095605v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Here, the Bootloader settings are located at the start of the memory address. Is this the data you are reffering to?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reserve some spaces in a partition</title><link>https://devzone.nordicsemi.com/thread/460178?ContentTypeID=1</link><pubDate>Wed, 13 Dec 2023 14:53:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:460be9dc-0528-47a7-9163-96cf8a91782b</guid><dc:creator>QuentinD</dc:creator><description>&lt;p&gt;Have you forgotten me &lt;a href="https://devzone.nordicsemi.com/members/ahaug"&gt;AHaug&lt;/a&gt;&amp;nbsp;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reserve some spaces in a partition</title><link>https://devzone.nordicsemi.com/thread/459500?ContentTypeID=1</link><pubDate>Fri, 08 Dec 2023 10:36:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cca4e188-0d1e-46e2-8031-b1163b5058b7</guid><dc:creator>QuentinD</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Yes it&amp;#39;s for the NCS based application (afterwards I will update a device that has an nrf5 SDK bootloader with this application based on the NRF SDK).&lt;br /&gt;&lt;br /&gt;In devices that are in the field (with the nrf5 sdk), the application goes from address 0x27000 to 0xE0000.&lt;br /&gt;So I would like to be able to do the same thing so as not to waste space for my new applications. I just want the addresses 0xd0000 to 0xd1000 not to be used by the linker to put application code there.&lt;br /&gt;&lt;br /&gt;If I change my pm_static.yml to the app covers the other partition like this:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;app&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span&gt;address&lt;/span&gt;&lt;span&gt;: &lt;/span&gt;&lt;span&gt;0x27000&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span&gt;region&lt;/span&gt;&lt;span&gt;: &lt;/span&gt;&lt;span&gt;flash_primary&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span&gt;size&lt;/span&gt;&lt;span&gt;: &lt;/span&gt;&lt;span&gt;0xB9000&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;storage_data&lt;/span&gt;&lt;span&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span&gt;address&lt;/span&gt;&lt;span&gt;: &lt;/span&gt;&lt;span&gt;0xD0000&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span&gt;region&lt;/span&gt;&lt;span&gt;: &lt;/span&gt;&lt;span&gt;flash_primary&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;span&gt;size&lt;/span&gt;&lt;span&gt;: &lt;/span&gt;&lt;span&gt;0x1000&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;I have this error at the compilation time:&lt;br /&gt;Partition manager failed: Incorrect amount of gaps found in static configuration. There must be exactly one gap in the static configuration to support placing the dynamic partitions (such as &amp;#39;app&amp;#39;). Gaps found (2):0x27000-0xd0000 0xd1000-0xe0000 The most common solution to this problem is to fill the smallest of these gaps with statically defined partition(s) until there is only one gap left. Alternatively re-order the already defined static partitions so that only one gap remains.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Isn&amp;#39;t there a way to ask the linker not to write at these addresses?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Reserve some spaces in a partition</title><link>https://devzone.nordicsemi.com/thread/458994?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2023 14:08:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e6cff15-3c54-4d54-96ad-c983d4217354</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I see that you want the empty/not to be used region to be located roughly in the middle of your application space. Is this for the NCS based application or nRF5 based application? Will this empty partition be filled with something when you do DFU from nRF5 to NCS?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Will the application fit within 0x27000 -&amp;gt; 0xd0000 or do you intend to split it into multiple regions?&lt;/p&gt;
&lt;p&gt;Initial thoughts is that you can define the partition with a custom name, or to my understanding you could even define it as an empty partition in the static pm. This will in turn not be used by NCS unless you specify that this area is to be used in the app itself.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>