<?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>LPC MicrocontrollersのトピックRe: RAM sections</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/RAM-sections/m-p/513839#M385</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Fri Aug 14 10:14:35 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: IanB&lt;/STRONG&gt;&lt;BR /&gt;Could someone please tell me the correct assembler directive for allocating RAM into sections? I'm using the automatically generated linker file. _debug.ld&lt;BR /&gt;&lt;BR /&gt;The linker file appears to call the sections .bss, .bss_RAM2 and .bss_RAM3&lt;BR /&gt;&lt;BR /&gt;but if I use the assembler directives:&lt;BR /&gt;&lt;BR /&gt;.section .bss&lt;BR /&gt;(memory definitions)&lt;BR /&gt;.section .bss_RAM2&lt;BR /&gt;(more memory definitions)&lt;BR /&gt;&lt;BR /&gt;etc. &lt;BR /&gt;&lt;BR /&gt;The assembler appears to want to put them all in RAM0_4 and then tells me there isn't enough room.&lt;BR /&gt;&lt;BR /&gt;It wants to put the stack at the top of RAM0_4 (understandable, as thats the section that can't be switched off) so I need to leave plenty of room in RAM0_4 and then start on RAM1_4, which I would have expected the directive .section .bss_RAM2 to do.&lt;BR /&gt;&lt;BR /&gt;If I call the section .section .RAM2 the it doesn't know where the address is.&lt;BR /&gt;&lt;BR /&gt;I'm using .bss not .data because all the memory needs to be zeroed and not pre-loaded with any values.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Don't confuse the section name with where you want to locate the section. The answer is found in your main linker script. You may need to create a custom script. This is now much easier using the Freemarker linker script templates. See&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://https://www.lpcware.com/content/faq/lpcxpresso/freemarker-linker-script-templates"&gt;Freemarker Linker Script Templates&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks and regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPCXpresso-Support&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 17:11:54 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T17:11:54Z</dc:date>
    <item>
      <title>RAM sections</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/RAM-sections/m-p/513838#M384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by IanB on Fri Aug 14 09:00:19 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Could someone please tell me the correct assembler directive for allocating RAM into sections? I'm using the automatically generated linker file. _debug.ld&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The linker file appears to call the sections .bss, .bss_RAM2 and .bss_RAM3&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but if I use the assembler directives:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;.section .bss&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(memory definitions)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.section .bss_RAM2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(more memory definitions)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;etc. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The assembler appears to want to put them all in RAM0_4 and then tells me there isn't enough room.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It wants to put the stack at the top of RAM0_4 (understandable, as thats the section that can't be switched off) so I need to leave plenty of room in RAM0_4 and then start on RAM1_4, which I would have expected the directive .section .bss_RAM2 to do.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I call the section .section .RAM2 the it doesn't know where the address is.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using .bss not .data because all the memory needs to be zeroed and not pre-loaded with any values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:11:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/RAM-sections/m-p/513838#M384</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: RAM sections</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/RAM-sections/m-p/513839#M385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Fri Aug 14 10:14:35 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: IanB&lt;/STRONG&gt;&lt;BR /&gt;Could someone please tell me the correct assembler directive for allocating RAM into sections? I'm using the automatically generated linker file. _debug.ld&lt;BR /&gt;&lt;BR /&gt;The linker file appears to call the sections .bss, .bss_RAM2 and .bss_RAM3&lt;BR /&gt;&lt;BR /&gt;but if I use the assembler directives:&lt;BR /&gt;&lt;BR /&gt;.section .bss&lt;BR /&gt;(memory definitions)&lt;BR /&gt;.section .bss_RAM2&lt;BR /&gt;(more memory definitions)&lt;BR /&gt;&lt;BR /&gt;etc. &lt;BR /&gt;&lt;BR /&gt;The assembler appears to want to put them all in RAM0_4 and then tells me there isn't enough room.&lt;BR /&gt;&lt;BR /&gt;It wants to put the stack at the top of RAM0_4 (understandable, as thats the section that can't be switched off) so I need to leave plenty of room in RAM0_4 and then start on RAM1_4, which I would have expected the directive .section .bss_RAM2 to do.&lt;BR /&gt;&lt;BR /&gt;If I call the section .section .RAM2 the it doesn't know where the address is.&lt;BR /&gt;&lt;BR /&gt;I'm using .bss not .data because all the memory needs to be zeroed and not pre-loaded with any values.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Don't confuse the section name with where you want to locate the section. The answer is found in your main linker script. You may need to create a custom script. This is now much easier using the Freemarker linker script templates. See&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://https://www.lpcware.com/content/faq/lpcxpresso/freemarker-linker-script-templates"&gt;Freemarker Linker Script Templates&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks and regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPCXpresso-Support&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:11:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/RAM-sections/m-p/513839#M385</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: RAM sections</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/RAM-sections/m-p/513840#M386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by IanB on Fri Aug 14 10:55:12 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm no expert on Linker scripts, but doesn't this one define sections called .bss, .bss_RAM2 and .bss_RAM3 and state that they are in RAM0_4, RAM1_4 and RAM2_4 respectively?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:11:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/RAM-sections/m-p/513840#M386</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: RAM sections</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/RAM-sections/m-p/513841#M387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Fri Aug 14 12:09:05 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Let's back up a minute. Exactly what are you trying to do, and which release of LPCXpresso are you using?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The linker has a concept of both input and output sections. Using the section directive in your assembler code, you are actually creating a named input section. The linker script combines input sections into named output sections. And, the names may be similar enough to confuse. So, for example, note the section name .bss_RAM2 is actually an output section in the managed linker script. If you had placed your data in an input section named .bss.$RAM2 (see crt_section_macros.h), it would have located in .bss_RAM2. If you care not to follow the naming conventions established by the managed linker scripts, you can always create your own scripts.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks and regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPCXpresso-Support&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:11:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/RAM-sections/m-p/513841#M387</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: RAM sections</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/RAM-sections/m-p/513842#M388</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by IanB on Sat Aug 15 08:42:09 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;it's version 7.8.0&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was confused between input and output sections, now that I've put .bss.$RAM2 instead of .bss_RAM2, that fault has gone away. As I said, I don't like linker script and prefer to write my code to fit the automatically generated files.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Having said that, is this correct?&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;MEMORY
{
&amp;nbsp; /* Define each memory region */
&amp;nbsp; MFlash64 (rx) : ORIGIN = 0x0, LENGTH = 0x10000 /* 64K bytes */
&amp;nbsp; Ram0_4 (rwx) : ORIGIN = 0x2000000, LENGTH = 0x1000 /* 4K bytes */
&amp;nbsp; Ram1_4 (rwx) : ORIGIN = 0x2001000, LENGTH = 0x1000 /* 4K bytes */
&amp;nbsp; Ram2_4 (rwx) : ORIGIN = 0x2004000, LENGTH = 0x1000 /* 4K bytes */


}
&amp;nbsp; /* Define a symbol for the top of each memory region */
&amp;nbsp; __top_MFlash64 = 0x0 + 0x10000;
&amp;nbsp; __top_Ram0_4 = 0x2000000 + 0x1000;
&amp;nbsp; __top_Ram1_4 = 0x2001000 + 0x1000;
&amp;nbsp; __top_Ram2_4 = 0x2004000 + 0x1000;&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Doesn't Ram2_4 start at 0x02002000 on an LPC1517?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That, and not my misunderstanding of sections, would explain why the stack gets overwritten.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The stack starts at 0x02001000 (first entry is 0x02000FFC), but when RAM2_4 is misallocated, a write to 0x02004FFC overwrites the stack at 0x02000FFC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:11:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/RAM-sections/m-p/513842#M388</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: RAM sections</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/RAM-sections/m-p/513843#M389</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by lpcxpresso-support on Mon Aug 17 00:12:08 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: IanB&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Doesn't Ram2_4 start at 0x02002000 on an LPC1517?&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes it does. We'll fix for the next LPCXpresso IDE release. In the meantime, you can correct this for your project using the Memory Configuration Editor (see chapter 6 of the LPCXpresso 7.9.0 User Guide for more information).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPCXpresso Support&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:11:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/RAM-sections/m-p/513843#M389</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:11:56Z</dc:date>
    </item>
    <item>
      <title>Re: RAM sections</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/RAM-sections/m-p/513844#M390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by IanB on Mon Aug 17 01:19:47 MST 2015&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;OK Thanks. I'll look up the memory configuration editor. In the mean time I implemented a temporary fix by editing the&amp;nbsp; _debug_mem.ld file, and telling it that the linker files were no longer automatically generated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Having decoded Z80 and 6502 address lines with 74LS138 ICs, I know why it overwrote the stack, but I would have expected a "HardFault" to be generated when writing to memory that wasn't there.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:11:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/RAM-sections/m-p/513844#M390</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T17:11:57Z</dc:date>
    </item>
  </channel>
</rss>

