<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SRAM0B shutdown error in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/SRAM0B-shutdown-error/m-p/684145#M27533</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your really detailed response. Your hint "&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Check where your stack is located." lead me to the right location :-)&lt;BR /&gt;&lt;BR /&gt;Here the complete solution for others with the same problem:&lt;BR /&gt;&lt;BR /&gt;Following table shows the RAM setup (old and new desired version, the SRAM block 1 and 2 are not used)&lt;BR /&gt;Table not in scale!&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; width: 87.7028%;"&gt;&lt;THEAD&gt;&lt;TR style="background-color: #efefef; height: 25px;"&gt;&lt;TH style="width: 36%; height: 25px;"&gt;SRAM0 Address&lt;/TH&gt;&lt;TH style="width: 54.6238%; height: 25px;"&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 36%; height: 25px;"&gt;Top (End, 64kB) 0x0200'FFFF&lt;/TD&gt;&lt;TD style="width: 54.6238%; height: 25px;"&gt;Top of Stack (OLD place, wrong for my application) = &amp;nbsp;&lt;SPAN&gt;__top_RAM0_64&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 36%; height: 25px;"&gt;&lt;/TD&gt;&lt;TD style="width: 54.6238%; height: 25px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 36%; height: 25px;"&gt;&lt;/TD&gt;&lt;TD style="width: 54.6238%; height: 25px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 36%; height: 25px;"&gt;(End of first 8kB, SRM0A) 0x0200'2000&amp;nbsp;&lt;/TD&gt;&lt;TD style="width: 54.6238%; height: 25px;"&gt;Top of Stack (NEW place for my application)&lt;BR /&gt;initial position of Stack pointer, growing downwards (in direction Bottom)&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 36%; height: 25px;"&gt;&lt;/TD&gt;&lt;TD style="width: 54.6238%; height: 25px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 36%; height: 25px;"&gt;&lt;/TD&gt;&lt;TD style="width: 54.6238%; height: 25px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 36%; height: 25px;"&gt;&lt;/TD&gt;&lt;TD style="width: 54.6238%; height: 25px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 36%; height: 25px;"&gt;Bottom (Start) 0x0200'000&lt;/TD&gt;&lt;TD style="width: 54.6238%; height: 25px;"&gt;&lt;P&gt;Variables in RAM (from Bottom up)&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Memory locations are defined in LPCxpresso in following path:&lt;BR /&gt;MyProject/Debug/myproject_Debug_memory.ld&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Stack and Heap location is set in following file:&lt;BR /&gt;&lt;SPAN&gt;MyProject/Debug/myproject_Debug.ld - on Line 179 and 180 witt the define __user_heap_base and __user_stack_top&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;The heap pointer is on reset by default on location ??? (I'dont know, I don't need the heap until now because I didn't use dynamic memory allocation with malloc)&lt;/P&gt;&lt;P&gt;The stack pointer is on reset by default on location __top_RAM0_64 = 0x0200'FFFF (This is outside of the first 8kB of RAM, therefore after the wakeup, the CPU was lost with corrupted memory, the stack was killed by memory shutdown :-) )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To change the stackpointer to 0x0200'2000 (top of first 8kB = SRAM0A) I set the following Linker Flag:&lt;BR /&gt;Project / Properties / C/C++ Build / Settings / Tool Settings / MCU Linker / &amp;nbsp;Add Flag:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;--defsym=__user_stack_top=0x2002000&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This solution is from the following thread:&lt;BR /&gt;&lt;A href="https://community.nxp.com/thread/437059"&gt;How to modify the stack location?&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a list with topics concerning this question.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stack location&lt;BR /&gt;&lt;A href="https://community.nxp.com/thread/389026"&gt;Heap allocation/checking in Redlib&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/429069"&gt;How can check stack level using IDE?&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/428355"&gt;Monitoring Stack Size&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/389027"&gt;How to use Watchpoints&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Move (data) location into different RAM blocks:&lt;BR /&gt;&lt;A href="https://community.nxp.com/thread/389100"&gt;Placing data into different RAM blocks&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/447558"&gt;Move stack to RamAHB32&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;A href="https://community.nxp.com/thread/454591"&gt;Stack placed in RAM2&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;A href="https://community.nxp.com/thread/437059"&gt;How to modify the stack location?&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Jul 2017 11:35:01 GMT</pubDate>
    <dc:creator>simonwyss</dc:creator>
    <dc:date>2017-07-28T11:35:01Z</dc:date>
    <item>
      <title>SRAM0B shutdown error</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SRAM0B-shutdown-error/m-p/684143#M27531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Going in power-down mode works if I&amp;nbsp;use the default setting (from the LPCopen example rtc.c):&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;/* Go to sleep leaving SRAM and the 32K oscillator powered during sleep. Use lower
voltage during sleep. */&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Chip_POWER_EnterPowerMode&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;curr_pwr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;SYSCON_PDRUNCFG_PD_SRAM0A &lt;SPAN class="operator token"&gt;|&lt;/SPAN&gt; SYSCON_PDRUNCFG_PD_SRAM0B &lt;SPAN class="operator token"&gt;|&lt;/SPAN&gt; SYSCON_PDRUNCFG_PD_32K_OSC&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; ‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;But wakeup doesn't work if I also shutdown the SRAM0B. Therefore only the first 8kB of the RAM stay active.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;/* Go to sleep leaving SRAM and the 32K oscillator powered during sleep. Use lower
voltage during sleep. */&lt;/SPAN&gt;
&lt;SPAN class="token function"&gt;Chip_POWER_EnterPowerMode&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;curr_pwr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;SYSCON_PDRUNCFG_PD_SRAM0A &lt;SPAN class="operator token"&gt;|&lt;/SPAN&gt; SYSCON_PDRUNCFG_PD_32K_OSC&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;My code uses the following space:&lt;BR /&gt; &lt;STRONG&gt;text data bss dec hex filename&lt;/STRONG&gt;&lt;BR /&gt; 40288 4 &lt;STRONG&gt;1004&lt;/STRONG&gt; 41296 a150 MyCode.axf&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In my opinion the bss is the required RAM size in bytes. This is much less than the size of the first 8kB of the SRAM0.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How can I solve this problem?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for your advice.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Jul 2017 20:57:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SRAM0B-shutdown-error/m-p/684143#M27531</guid>
      <dc:creator>simonwyss</dc:creator>
      <dc:date>2017-07-26T20:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: SRAM0B shutdown error</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SRAM0B-shutdown-error/m-p/684144#M27532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check where your stack is located.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Jul 2017 23:15:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SRAM0B-shutdown-error/m-p/684144#M27532</guid>
      <dc:creator>Dezheng_Tang</dc:creator>
      <dc:date>2017-07-27T23:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: SRAM0B shutdown error</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/SRAM0B-shutdown-error/m-p/684145#M27533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your really detailed response. Your hint "&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Check where your stack is located." lead me to the right location :-)&lt;BR /&gt;&lt;BR /&gt;Here the complete solution for others with the same problem:&lt;BR /&gt;&lt;BR /&gt;Following table shows the RAM setup (old and new desired version, the SRAM block 1 and 2 are not used)&lt;BR /&gt;Table not in scale!&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6; width: 87.7028%;"&gt;&lt;THEAD&gt;&lt;TR style="background-color: #efefef; height: 25px;"&gt;&lt;TH style="width: 36%; height: 25px;"&gt;SRAM0 Address&lt;/TH&gt;&lt;TH style="width: 54.6238%; height: 25px;"&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;/THEAD&gt;&lt;TBODY&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 36%; height: 25px;"&gt;Top (End, 64kB) 0x0200'FFFF&lt;/TD&gt;&lt;TD style="width: 54.6238%; height: 25px;"&gt;Top of Stack (OLD place, wrong for my application) = &amp;nbsp;&lt;SPAN&gt;__top_RAM0_64&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 36%; height: 25px;"&gt;&lt;/TD&gt;&lt;TD style="width: 54.6238%; height: 25px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 36%; height: 25px;"&gt;&lt;/TD&gt;&lt;TD style="width: 54.6238%; height: 25px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 36%; height: 25px;"&gt;(End of first 8kB, SRM0A) 0x0200'2000&amp;nbsp;&lt;/TD&gt;&lt;TD style="width: 54.6238%; height: 25px;"&gt;Top of Stack (NEW place for my application)&lt;BR /&gt;initial position of Stack pointer, growing downwards (in direction Bottom)&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 36%; height: 25px;"&gt;&lt;/TD&gt;&lt;TD style="width: 54.6238%; height: 25px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 36%; height: 25px;"&gt;&lt;/TD&gt;&lt;TD style="width: 54.6238%; height: 25px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 36%; height: 25px;"&gt;&lt;/TD&gt;&lt;TD style="width: 54.6238%; height: 25px;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 25px;"&gt;&lt;TD style="width: 36%; height: 25px;"&gt;Bottom (Start) 0x0200'000&lt;/TD&gt;&lt;TD style="width: 54.6238%; height: 25px;"&gt;&lt;P&gt;Variables in RAM (from Bottom up)&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Memory locations are defined in LPCxpresso in following path:&lt;BR /&gt;MyProject/Debug/myproject_Debug_memory.ld&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Stack and Heap location is set in following file:&lt;BR /&gt;&lt;SPAN&gt;MyProject/Debug/myproject_Debug.ld - on Line 179 and 180 witt the define __user_heap_base and __user_stack_top&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;The heap pointer is on reset by default on location ??? (I'dont know, I don't need the heap until now because I didn't use dynamic memory allocation with malloc)&lt;/P&gt;&lt;P&gt;The stack pointer is on reset by default on location __top_RAM0_64 = 0x0200'FFFF (This is outside of the first 8kB of RAM, therefore after the wakeup, the CPU was lost with corrupted memory, the stack was killed by memory shutdown :-) )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To change the stackpointer to 0x0200'2000 (top of first 8kB = SRAM0A) I set the following Linker Flag:&lt;BR /&gt;Project / Properties / C/C++ Build / Settings / Tool Settings / MCU Linker / &amp;nbsp;Add Flag:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;--defsym=__user_stack_top=0x2002000&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This solution is from the following thread:&lt;BR /&gt;&lt;A href="https://community.nxp.com/thread/437059"&gt;How to modify the stack location?&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is a list with topics concerning this question.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stack location&lt;BR /&gt;&lt;A href="https://community.nxp.com/thread/389026"&gt;Heap allocation/checking in Redlib&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/429069"&gt;How can check stack level using IDE?&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/428355"&gt;Monitoring Stack Size&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/389027"&gt;How to use Watchpoints&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Move (data) location into different RAM blocks:&lt;BR /&gt;&lt;A href="https://community.nxp.com/thread/389100"&gt;Placing data into different RAM blocks&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/447558"&gt;Move stack to RamAHB32&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;A href="https://community.nxp.com/thread/454591"&gt;Stack placed in RAM2&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;A href="https://community.nxp.com/thread/437059"&gt;How to modify the stack location?&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Jul 2017 11:35:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/SRAM0B-shutdown-error/m-p/684145#M27533</guid>
      <dc:creator>simonwyss</dc:creator>
      <dc:date>2017-07-28T11:35:01Z</dc:date>
    </item>
  </channel>
</rss>

