<?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: Linking an array to a fixed address in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Linking-an-array-to-a-fixed-address/m-p/162702#M799</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is exactly what I did before and I tried it again; myrom_section is created but the constant is still linked to .rodata section, regardless of what I do&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 02 Nov 2012 09:30:56 GMT</pubDate>
    <dc:creator>mattj</dc:creator>
    <dc:date>2012-11-02T09:30:56Z</dc:date>
    <item>
      <title>Linking an array to a fixed address</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Linking-an-array-to-a-fixed-address/m-p/162698#M795</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;within Codewarrior / processor expert / CPU build options I have created a new MemoryArea at a fixed address called myromheader. Now I want the linker to put an array in this section. I've tried all ways I could find, via attribute, via declspec etc:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;const unsigned char myheader[10] __attribute__((section(".myromheader"))) = {"1752"};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the generated map file I can see that my section is created but the array is always linked to the normal code section. Any ideas what else to do?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 16:33:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Linking-an-array-to-a-fixed-address/m-p/162698#M795</guid>
      <dc:creator>mattj</dc:creator>
      <dc:date>2012-11-01T16:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Linking an array to a fixed address</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Linking-an-array-to-a-fixed-address/m-p/162699#M796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Matthias,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You require a set of pragma plus declspec.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've created a section on my linker as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.myrom_section:&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; *(.myrom)&lt;/P&gt;&lt;P&gt;&amp;nbsp; . = ALIGN (0x4);&lt;/P&gt;&lt;P&gt;} &amp;gt; myrom&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, on the code, use the pragma "define_Section" and the declspec "section" to do the job:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#pragma define_section myrom_section ".myrom" far_abs RX&lt;/P&gt;&lt;P&gt;__declspec(section "myrom_section")&lt;/P&gt;&lt;P&gt;const unsigned long gu32Test = 0x1234;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Compiled and got the expected placement on my MAP file:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# .myrom_section&lt;/P&gt;&lt;P&gt;&amp;nbsp; 00000800 00000004 .myrom&amp;nbsp; gu32Test (main.obj)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can refer to the app note 4498, which is on your CW installation path (10.2 or 10.3):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{CW path}\MCU\Help\PDF&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 18:52:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Linking-an-array-to-a-fixed-address/m-p/162699#M796</guid>
      <dc:creator>carlos_neri</dc:creator>
      <dc:date>2012-11-01T18:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: Linking an array to a fixed address</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Linking-an-array-to-a-fixed-address/m-p/162700#M797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;if this is for gcc and Kinetis, then this link could be helpful: &lt;A href="http://mcuoneclipse.com/2012/11/01/defining-variables-at-absolute-addresses-with-gcc/" title="http://mcuoneclipse.com/2012/11/01/defining-variables-at-absolute-addresses-with-gcc/"&gt;Defining Variables at Absolute Addresses with gcc | MCU on Eclipse.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Keep in mind, if you change the linker file for a Processor Expert Project, you need to disable linker file generation, otherwise your changes will be overwritten. How to disable this, see the last screenshot in &lt;A href="http://mcuoneclipse.com/2012/03/23/disable-my-code-generation/" title="http://mcuoneclipse.com/2012/03/23/disable-my-code-generation/"&gt;Disable my Code Generation | MCU on Eclipse.&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 21:17:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Linking-an-array-to-a-fixed-address/m-p/162700#M797</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2012-11-01T21:17:00Z</dc:date>
    </item>
    <item>
      <title>Re: Linking an array to a fixed address</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Linking-an-array-to-a-fixed-address/m-p/162701#M798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The Kinetis linker has some different syntax, so I couldn't get this to run&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2012 09:27:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Linking-an-array-to-a-fixed-address/m-p/162701#M798</guid>
      <dc:creator>mattj</dc:creator>
      <dc:date>2012-11-02T09:27:27Z</dc:date>
    </item>
    <item>
      <title>Re: Linking an array to a fixed address</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Linking-an-array-to-a-fixed-address/m-p/162702#M799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is exactly what I did before and I tried it again; myrom_section is created but the constant is still linked to .rodata section, regardless of what I do&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2012 09:30:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Linking-an-array-to-a-fixed-address/m-p/162702#M799</guid>
      <dc:creator>mattj</dc:creator>
      <dc:date>2012-11-02T09:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Linking an array to a fixed address</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Linking-an-array-to-a-fixed-address/m-p/162703#M800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Matt,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please find attached the sample code I wrote to test this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is on CW10.2 with all the patches installed. You can take a look at the xMAP file to confirm the variable is placed on the new section. Note that&amp;nbsp; that I used a pragma called "force_active" to avoid the linker to optimize the variable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Nov 2012 00:06:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Linking-an-array-to-a-fixed-address/m-p/162703#M800</guid>
      <dc:creator>carlos_neri</dc:creator>
      <dc:date>2012-11-22T00:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Linking an array to a fixed address</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Linking-an-array-to-a-fixed-address/m-p/162704#M801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the force on pragma made the difference now it is working when I manually edit the processor expert generated linker script. I still have to figure out how to get this running together with the processor expert memory map settings or disable the linker script generation&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Nov 2012 09:59:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Linking-an-array-to-a-fixed-address/m-p/162704#M801</guid>
      <dc:creator>mattj</dc:creator>
      <dc:date>2012-11-22T09:59:11Z</dc:date>
    </item>
  </channel>
</rss>

