<?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: s32k1xx_linker script in S32 SDK</title>
    <link>https://community.nxp.com/t5/S32-SDK/s32k1xx-linker-script/m-p/719026#M232</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the Stack is filled backward - from StackTop down to StackLimit. So - the location is okay.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway - you can change stack location/size as you needed. Only not so "safe" thing on stack location at the end of RAM is that by stack overflow you may (but also may not)&amp;nbsp; re-write data in RAM. With stacktop location on the beginning of RAM + StackSize you got exception on stack overflow because you are trying write out of memory range.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jiri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Apr 2018 06:45:05 GMT</pubDate>
    <dc:creator>jiri_kral</dc:creator>
    <dc:date>2018-04-10T06:45:05Z</dc:date>
    <item>
      <title>s32k1xx_linker script</title>
      <link>https://community.nxp.com/t5/S32-SDK/s32k1xx-linker-script/m-p/719025#M231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using s32studio ARM v.2.0 and s32k144 EVB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there is one thing that I don't understand in s32k1xx_flash.ld from SDK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as you can see below, .stack segment is located next to .heap not in the&amp;nbsp;end of m_data_2.&lt;/P&gt;&lt;P&gt;[&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; m_data_2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;]&lt;/P&gt;&lt;P&gt;[bss][heap][stack]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;however, __StackTop is set to the end address of m_data_2 as depicted in the below.&lt;/P&gt;&lt;P&gt;[&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; m_data_2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;]&lt;/P&gt;&lt;P&gt;[bss][heap][stack]&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ^&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |---- __StackTop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe it should be like the below.&lt;/P&gt;&lt;P&gt;[&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; m_data_2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;]&lt;/P&gt;&lt;P&gt;[bss][heap][stack]&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|---- __StackTop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plus, stack limit&amp;nbsp;indicates the wrong position according to the linker script from SDK.&lt;/P&gt;&lt;P&gt;&amp;nbsp; [&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; m_data_2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;]&lt;/P&gt;&lt;P&gt;&amp;nbsp; [bss][heap][stack]&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [--1K--]&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;^&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;|----&amp;nbsp;&amp;nbsp;stack limit position.&lt;/P&gt;&lt;P&gt;&amp;nbsp; should be here --|&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did I understand incorrectly?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;s32k1xx_flash.ld&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6;" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;/* Specify the memory areas */&lt;BR /&gt;MEMORY&lt;BR /&gt;{&lt;BR /&gt; /* Flash */&lt;BR /&gt; m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400&lt;BR /&gt; m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010&lt;BR /&gt; m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x0007FBF0&lt;/P&gt;&lt;P&gt;/* SRAM_L */&lt;BR /&gt; m_data (RW) : ORIGIN = 0x1FFF8000, LENGTH = 0x00008000&lt;/P&gt;&lt;P&gt;/* SRAM_U */&lt;BR /&gt; &lt;STRONG&gt;m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00007000&lt;/STRONG&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6;" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;.customSectionBlock ORIGIN(m_data_2) :&lt;BR /&gt; {&lt;BR /&gt; KEEP(*(.customSection)) /* Keep section even if not referenced. */&lt;BR /&gt; } &amp;gt; m_data_2&lt;/P&gt;&lt;P&gt;/* Uninitialized data section. */&lt;BR /&gt; .bss :&lt;BR /&gt; {&lt;BR /&gt; /* This is used by the startup in order to initialize the .bss section. */&lt;BR /&gt; . = ALIGN(4);&lt;BR /&gt; __BSS_START = .;&lt;BR /&gt; __bss_start__ = .;&lt;BR /&gt; *(.bss)&lt;BR /&gt; *(.bss*)&lt;BR /&gt; *(COMMON)&lt;BR /&gt; . = ALIGN(4);&lt;BR /&gt; __bss_end__ = .;&lt;BR /&gt; __BSS_END = .;&lt;BR /&gt; } &amp;gt; m_data_2&lt;/P&gt;&lt;P&gt;.heap :&lt;BR /&gt; {&lt;BR /&gt; . = ALIGN(8);&lt;BR /&gt; __end__ = .;&lt;BR /&gt; PROVIDE(end = .);&lt;BR /&gt; PROVIDE(_end = .);&lt;BR /&gt; PROVIDE(__end = .);&lt;BR /&gt; __HeapBase = .;&lt;BR /&gt; . += HEAP_SIZE;&lt;BR /&gt; __HeapLimit = .;&lt;BR /&gt; __heap_limit = .;&lt;BR /&gt; } &amp;gt; m_data_2&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;.stack :&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; {&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; . = ALIGN(8);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; . += STACK_SIZE;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; } &amp;gt; m_data_2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/* Initializes stack on the end of block */&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt; __StackTop = ORIGIN(m_data_2) + LENGTH(m_data_2);&lt;/STRONG&gt;&lt;BR /&gt; &lt;STRONG&gt;__StackLimit = __StackTop - STACK_SIZE;&lt;/STRONG&gt;&lt;BR /&gt; PROVIDE(__stack = __StackTop);&lt;/P&gt;&lt;P&gt;.ARM.attributes 0 : { *(.ARM.attributes) }&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Startup_S32k144.S&lt;/P&gt;&lt;TABLE class="j-table jiveBorder" style="border: 1px solid #c6c6c6;" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;/* Initialize the stack pointer */&lt;BR /&gt; ldr r0,=__StackTop&lt;BR /&gt; mov r13,r0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2018 04:51:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-SDK/s32k1xx-linker-script/m-p/719025#M231</guid>
      <dc:creator>jongtaepark</dc:creator>
      <dc:date>2018-04-10T04:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: s32k1xx_linker script</title>
      <link>https://community.nxp.com/t5/S32-SDK/s32k1xx-linker-script/m-p/719026#M232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the Stack is filled backward - from StackTop down to StackLimit. So - the location is okay.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway - you can change stack location/size as you needed. Only not so "safe" thing on stack location at the end of RAM is that by stack overflow you may (but also may not)&amp;nbsp; re-write data in RAM. With stacktop location on the beginning of RAM + StackSize you got exception on stack overflow because you are trying write out of memory range.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jiri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2018 06:45:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32-SDK/s32k1xx-linker-script/m-p/719026#M232</guid>
      <dc:creator>jiri_kral</dc:creator>
      <dc:date>2018-04-10T06:45:05Z</dc:date>
    </item>
  </channel>
</rss>

