<?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>how to reserve memory segment using SES</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/84018/how-to-reserve-memory-segment-using-ses</link><description>Hello, 
 I have modified flash_placement.xml to define a 64 byte RAM region to be used to preserve data across soft resets. It compiles and links but the memory seems to be set to zeros on reset initialization. 
 This is part of flash_placement.xml. </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 28 Jan 2022 00:15:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/84018/how-to-reserve-memory-segment-using-ses" /><item><title>RE: how to reserve memory segment using SES</title><link>https://devzone.nordicsemi.com/thread/350092?ContentTypeID=1</link><pubDate>Fri, 28 Jan 2022 00:15:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12d3f928-2428-41d9-aae4-febe99aafe3f</guid><dc:creator>Allen</dc:creator><description>&lt;p&gt;You are correct, the bootloader stack was overwriting the reserved RAM region. Had to make the same change to the bootloader flash_placement.xml file&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to reserve memory segment using SES</title><link>https://devzone.nordicsemi.com/thread/349688?ContentTypeID=1</link><pubDate>Wed, 26 Jan 2022 08:34:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d01710f4-fa4d-4e51-9e0b-3a268de01fa8</guid><dc:creator>Vidar Berg</dc:creator><description>[quote user="ajcurtis"]Should be fine.[/quote]
&lt;p&gt;Why? Have you gone over the map files and made sure nothing is overlapping with your &amp;quot;.ewave&amp;quot; section?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to reserve memory segment using SES</title><link>https://devzone.nordicsemi.com/thread/349649?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 22:02:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6581965a-72f5-4b0c-813c-efe3e25cac61</guid><dc:creator>Allen</dc:creator><description>&lt;p&gt;We are using custom hardware. Will try this again using a DK board. It is the standard bootloader. Should be fine.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to reserve memory segment using SES</title><link>https://devzone.nordicsemi.com/thread/349645?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 20:37:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7fe47d98-db89-4f5f-806b-7905bb28a6b1</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I think the only explanation then is that your bootloader must have a section that overlaps with your &amp;quot;.ewave&amp;quot; section in your app. Did you try without the bootloader?&lt;/p&gt;
&lt;p&gt;Peripheral registers are generally reset to 0x0 on reset. Exception is those that are marked as retained. Still, I can&amp;#39;t think of any registers that could be used for this purpose.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Edit: &lt;/strong&gt;a solution may be to define the &amp;quot;.ewave&amp;quot; section&amp;nbsp; in your bootloader and application, and then make sure they both start at the same RAM address.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to reserve memory segment using SES</title><link>https://devzone.nordicsemi.com/thread/349637?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 18:01:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bbcd97c3-6965-4845-8494-bac1d8400ed8</guid><dc:creator>Allen</dc:creator><description>&lt;p&gt;Hello Vidar,&lt;/p&gt;
&lt;p&gt;I tried your exact solution below and it does not work for me. The RAM is messed up with each reset. This is my configuration.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;nRF52832&lt;/li&gt;
&lt;li&gt;SDK 17.0.1&lt;/li&gt;
&lt;li&gt;Soft device 17.2.0&lt;/li&gt;
&lt;li&gt;standard bootloader&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It is possible to use the control registers for an unused peripheral? What about all the &amp;quot;reserved&amp;quot; areas?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to reserve memory segment using SES</title><link>https://devzone.nordicsemi.com/thread/349553?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 13:35:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:faffa482-e639-491f-ae54-4fa8dbb42cd4</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not seeing any problems with the way you have defined your linker section.&amp;nbsp; Did you by any chance have a bootloader present when testing this? In that case, maybe the bootloader is overwriting your section after reset?&lt;/p&gt;
[quote user=""]It appears it is defined to be *filled* and I don&amp;#39;t know how to disable that.[/quote]
&lt;p&gt;*Fill* is the unused part of your section, but it does not actually fill any data unless you also modify the startup file (thumb_crt0.s) to do so. And it will go away if you don&amp;#39;t specify a fixed&amp;nbsp; &amp;quot;size&amp;quot; for the section in your flash_placement.xml.&lt;/p&gt;
&lt;p&gt;This is the code I used to test here:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define MAGIC_WORD    0x51B1E5DB

typedef struct 
{
    uint32_t magic_word;
    uint32_t value;
} boot_count_t;


__attribute__((section(&amp;quot;.ewave&amp;quot;))) static boot_count_t boot_count;


/**@brief Application main function.
 */
 
int main(void)
{
    bool erase_bonds;

    log_init();

    if (boot_count.magic_word != MAGIC_WORD)
    {
      boot_count.magic_word = MAGIC_WORD;
      boot_count.value = 0x0;
    }
    else
    {
        boot_count.value++;
        NRF_LOG_INFO(&amp;quot;Boot count: %d&amp;quot;, boot_count.value);
        NRF_LOG_PROCESS();
    }
    
    nrf_delay_ms(100);
    /* Reboot */
    NVIC_SystemReset();
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and flash_placement:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1643115643797v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/pastedimage1643115698661v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to reserve memory segment using SES</title><link>https://devzone.nordicsemi.com/thread/349395?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 01:13:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9cad8fb6-1485-474f-8986-62fb1d788561</guid><dc:creator>Allen</dc:creator><description>&lt;p&gt;I also tried making this a separate memory segment. &lt;/p&gt;
&lt;pre&gt;&amp;nbsp; &amp;lt;MemorySegment name=&amp;quot;RAM2&amp;quot; start=&amp;quot;$(RAM_PH_START)+$(RAM_PH_SIZE)-$(EWAVE_DATA_SIZE)&amp;quot; size=&amp;quot;$(EWAVE_DATA_SIZE)&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ProgramSection load=&amp;quot;no&amp;quot; size=&amp;quot;$(EWAVE_DATA_SIZE)&amp;quot; name=&amp;quot;.ewave&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;/MemorySegment&amp;gt;&lt;br /&gt;&lt;br /&gt;The memory gets trashed with a J-Link reset or calling NVIC_SystemReset(). &lt;/pre&gt;
&lt;p&gt;The objective is to store a 32-bit value across resets. The general retention registers are only 8-bits. Is there any other registers that could be used?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>