<?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>Losing NOINIT RAM contents on a soft reset, nRF52832, SDK 14.0.0, gcc</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/35488/losing-noinit-ram-contents-on-a-soft-reset-nrf52832-sdk-14-0-0-gcc</link><description>I have an in memory log, built using a custom log backend, which I write to using the NRF_LOG_*() macros. 
 My implementation of app_error_fault_handler() will do some NRF_LOG_ERROR() logging, then call NVIC_SystemReset(). 
 It&amp;#39;s my hope that I&amp;#39;ll be</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 07 Jul 2018 05:03:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/35488/losing-noinit-ram-contents-on-a-soft-reset-nrf52832-sdk-14-0-0-gcc" /><item><title>RE: Losing NOINIT RAM contents on a soft reset, nRF52832, SDK 14.0.0, gcc</title><link>https://devzone.nordicsemi.com/thread/139327?ContentTypeID=1</link><pubDate>Sat, 07 Jul 2018 05:03:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf001848-69ef-4c5a-9b9d-adb5f04cdde3</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;In the end this was just down to me having made some changes in the application linker script without carrying them across to the bootloader linker script.&amp;nbsp;&lt;span&gt;But thanks everyone for the help.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing NOINIT RAM contents on a soft reset, nRF52832, SDK 14.0.0, gcc</title><link>https://devzone.nordicsemi.com/thread/136629?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 23:06:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ee04ac5-a633-49d1-9530-ab8e5f156c50</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;of course you can set a breakpoint in the reset handler, set it by name or set it by address. Or use a better debugger than remote gdb, Segger Ozone is great at this stuff. Either way gdb, if pointed at a proper executable with debugging info can set a breakpoint on any line of any file.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Do you even have NOINIT defined in your memory map file? Are you getting link warnings?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And NOLOAD only deals with how a loader puts stuff into flash, it&amp;#39;s really got nothing much to do with how the early runtime then copies stuff around into RAM or zeroes it out every time you reset. This is why you need to look at the early init code and see what it does with the various sections.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing NOINIT RAM contents on a soft reset, nRF52832, SDK 14.0.0, gcc</title><link>https://devzone.nordicsemi.com/thread/136625?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 21:58:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8583fef8-ed4b-44e4-a9e3-e5d2d066b954</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;Thanks, I made a bunch of edits above.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing NOINIT RAM contents on a soft reset, nRF52832, SDK 14.0.0, gcc</title><link>https://devzone.nordicsemi.com/thread/136561?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 13:04:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1b49570-f543-44ef-be6f-f90975476c76</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;good point. So should work if NOLOAD is used.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing NOINIT RAM contents on a soft reset, nRF52832, SDK 14.0.0, gcc</title><link>https://devzone.nordicsemi.com/thread/136560?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 13:02:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26b35e9f-ab4d-4d6a-aa03-4c973ae67cf2</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;if .noinit &amp;nbsp;isn&amp;#39;t &amp;nbsp;declared in sections, how &amp;nbsp;does the code link without error?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing NOINIT RAM contents on a soft reset, nRF52832, SDK 14.0.0, gcc</title><link>https://devzone.nordicsemi.com/thread/136546?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 12:17:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f7aa50a-7014-47fb-890f-fde257b5acdf</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;As Austin mentioned, .noinit needs to be declared in SECTIONS as well (remember NOLOAD directive). But you&amp;nbsp;could&amp;nbsp;use&amp;nbsp;NRF_LOG_FLUSH() if the goal is to empty the log buffer before reset.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing NOINIT RAM contents on a soft reset, nRF52832, SDK 14.0.0, gcc</title><link>https://devzone.nordicsemi.com/thread/136458?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 00:57:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fa06a57b-1b4e-4e05-af13-62961d9b99ca</guid><dc:creator>Austin</dc:creator><description>&lt;p&gt;In addition to adding the extra segment to MEMORY, I believe you also need to add a SECTION directive and instruct the linker to direct your .noinit variables into NOINIT MEMORY area.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;eg. Within the SECTION area of your linker script, add the following.&amp;nbsp; As described in the comment for you existing linker script, ensure that your bootloader and any other program loader which runs before your app has a similar defined area which is not touched.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;.noinit (NOLOAD) :
{
. = ALIGN(4);
__noinit_start__ = .;
*(.noinit*)
__noinit_end__ = .;
} &amp;gt; NOINIT&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;You can verify that your m_ram_log is in the correct memory location after linking by examining the map file or using nm on the linked binary to show symbol locations.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing NOINIT RAM contents on a soft reset, nRF52832, SDK 14.0.0, gcc</title><link>https://devzone.nordicsemi.com/thread/136452?ContentTypeID=1</link><pubDate>Sun, 17 Jun 2018 17:50:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:097d2533-8953-4ed7-a3ba-a8313193e863</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;I tested this on my setup, and can confirm that &lt;em&gt;NVIC_SystemReset()&lt;/em&gt; does not cause power to be removed from SRAM on the nRF52832; pity, maybe it is indeed the linker issue RK mentions. The sections and actual locations will be in the link map, of course. I do not see any RAM corruption with or without the above &lt;em&gt;POWERSET&lt;/em&gt; setting.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing NOINIT RAM contents on a soft reset, nRF52832, SDK 14.0.0, gcc</title><link>https://devzone.nordicsemi.com/thread/136439?ContentTypeID=1</link><pubDate>Sun, 17 Jun 2018 02:00:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fde431b1-3424-4535-8889-22f28ecbbc0a</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;what&amp;#39;s it being reset to, 0? Where do you initialise the index pointer (or is the default for that 0 too)? You need to step through the early init code, the stuff called long before main, to see what it&amp;#39;s doing with your noinit area and why. Just because you put it in section .noinit doesn&amp;#39;t mean much unless your linker file puts that somewhere useful and your crt file doesn&amp;#39;t overwrite it.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Put a breakpoint on the very first instruction after reset, the reset handler, and look at the contents of memory then. If it&amp;#39;s correct, then your init code is overwriting it.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing NOINIT RAM contents on a soft reset, nRF52832, SDK 14.0.0, gcc</title><link>https://devzone.nordicsemi.com/thread/136438?ContentTypeID=1</link><pubDate>Sat, 16 Jun 2018 21:08:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96eac6a4-1b92-4b5a-bdd5-a1bee0740b3f</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;Thanks. I&amp;#39;ve got the power on to the RAM, but I haven&amp;#39;t aligned my buffer to the RAM areas. Will try that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Losing NOINIT RAM contents on a soft reset, nRF52832, SDK 14.0.0, gcc</title><link>https://devzone.nordicsemi.com/thread/136437?ContentTypeID=1</link><pubDate>Sat, 16 Jun 2018 20:54:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:638a860d-ad15-45c1-b112-66e57fafafb7</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Not sure if this will help, but try keeping power applied to the particular RAM area you are using, which may be lost on a NVIC_SystemReset(). Also you might want to move the buffer so it aligns with a specific RAM location rather than overlapping two areas. Here&amp;#39;s some code I use for this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;   // Set RAM power modes in system off
   NRF_POWER-&amp;gt;RAM[7].POWERSET = (POWER_RAM_POWER_S0POWER_On     &amp;lt;&amp;lt; POWER_RAM_POWER_S0POWER_Pos)      |
                                (POWER_RAM_POWER_S1POWER_On     &amp;lt;&amp;lt; POWER_RAM_POWER_S1POWER_Pos)      |
                                (POWER_RAM_POWER_S0RETENTION_On &amp;lt;&amp;lt; POWER_RAM_POWER_S0RETENTION_Pos)  |
                                (POWER_RAM_POWER_S1RETENTION_On &amp;lt;&amp;lt; POWER_RAM_POWER_S1RETENTION_Pos);
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>