<?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 Moving a Function to, then Executing from RAM (Kinetis) in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Moving-a-Function-to-then-Executing-from-RAM-Kinetis/m-p/313932#M10936</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After reading AN4329, I attempted to implement the relocation of a function to internal RAM, but cannot get the compiler to do it.[1]&amp;nbsp; The only difference between my program and the example is that the "funcInRAM" is located in a different '.c' file, and I believe this is causing the problem.&amp;nbsp; I have read through some other discussions on this forum which discuss other problems, but not this one.[2][3][4][5]&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is visible in the xMAP, which shows that "my_ram" (where the function should have been relocated to) is empty.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# .my_ram&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#&amp;gt;2000C000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ___myRAMStart (linker command file)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#&amp;gt;2000C000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ___myRAMEnd (linker command file)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#&amp;gt;00000000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ___CodeSize (linker command file)&lt;/EM&gt;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The main loop calls the 'funcInRAM()' repeatedly in an infinite loop, and the 'funcInRAM' is defined as follows in a separate file:&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#pragma define_section mySectionInRAM ".myCodeInRAM" far_absolute RX&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#pragma section mySectionInRAM begin&lt;/EM&gt;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5em; font-size: 10pt;"&gt;&lt;EM&gt;void funcInRAM(void){&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5em; font-size: 10pt;"&gt;&lt;EM&gt;...&lt;BR /&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5em; font-size: 10pt;"&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#pragma section mySectionInRAM end&lt;/EM&gt;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached my LCF to this post.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate any help, as I am quite stuck on this.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;[1] &lt;/SPAN&gt;&lt;A _jive_internal="true" class="" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fcache.freescale.com%2Ffiles%2Fsoft_dev_tools%2Fdoc%2Fapp_note%2FAN4329.pdf"&gt;http://cache.freescale.com/files/soft_dev_tools/doc/app_note/AN4329.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;[2] &lt;A _jive_internal="true" data-containerid="2028" data-containertype="14" data-objectid="308222" data-objecttype="1" href="https://community.nxp.com/thread/308222"&gt;relocating code&lt;/A&gt;&lt;/P&gt;&lt;P&gt;[3]&lt;A _jive_internal="true" data-containerid="2028" data-containertype="14" data-objectid="308275" data-objecttype="1" href="https://community.nxp.com/thread/308275"&gt;relocating code from FLASH to RAM&lt;/A&gt;&lt;/P&gt;&lt;P&gt;[4]&lt;A _jive_internal="true" href="https://community.nxp.com/thread/317741#comment-372304"&gt;Re: How to relocate memory library function using #pragma?&lt;/A&gt;&lt;/P&gt;&lt;P&gt;[5] &lt;A _jive_internal="true" data-containerid="2029" data-containertype="14" data-objectid="100196" data-objecttype="1" href="https://community.nxp.com/thread/100196"&gt;How to Copy Function from Flash to RAM &amp;amp; execute it&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-339128"&gt;MK20FX512_flash.lcf.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Jun 2014 22:35:50 GMT</pubDate>
    <dc:creator>nicholasf</dc:creator>
    <dc:date>2014-06-03T22:35:50Z</dc:date>
    <item>
      <title>Moving a Function to, then Executing from RAM (Kinetis)</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Moving-a-Function-to-then-Executing-from-RAM-Kinetis/m-p/313932#M10936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After reading AN4329, I attempted to implement the relocation of a function to internal RAM, but cannot get the compiler to do it.[1]&amp;nbsp; The only difference between my program and the example is that the "funcInRAM" is located in a different '.c' file, and I believe this is causing the problem.&amp;nbsp; I have read through some other discussions on this forum which discuss other problems, but not this one.[2][3][4][5]&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is visible in the xMAP, which shows that "my_ram" (where the function should have been relocated to) is empty.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# .my_ram&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#&amp;gt;2000C000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ___myRAMStart (linker command file)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#&amp;gt;2000C000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ___myRAMEnd (linker command file)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#&amp;gt;00000000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ___CodeSize (linker command file)&lt;/EM&gt;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The main loop calls the 'funcInRAM()' repeatedly in an infinite loop, and the 'funcInRAM' is defined as follows in a separate file:&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#pragma define_section mySectionInRAM ".myCodeInRAM" far_absolute RX&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#pragma section mySectionInRAM begin&lt;/EM&gt;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5em; font-size: 10pt;"&gt;&lt;EM&gt;void funcInRAM(void){&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5em; font-size: 10pt;"&gt;&lt;EM&gt;...&lt;BR /&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 1.5em; font-size: 10pt;"&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#pragma section mySectionInRAM end&lt;/EM&gt;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have attached my LCF to this post.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate any help, as I am quite stuck on this.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;[1] &lt;/SPAN&gt;&lt;A _jive_internal="true" class="" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fcache.freescale.com%2Ffiles%2Fsoft_dev_tools%2Fdoc%2Fapp_note%2FAN4329.pdf"&gt;http://cache.freescale.com/files/soft_dev_tools/doc/app_note/AN4329.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;[2] &lt;A _jive_internal="true" data-containerid="2028" data-containertype="14" data-objectid="308222" data-objecttype="1" href="https://community.nxp.com/thread/308222"&gt;relocating code&lt;/A&gt;&lt;/P&gt;&lt;P&gt;[3]&lt;A _jive_internal="true" data-containerid="2028" data-containertype="14" data-objectid="308275" data-objecttype="1" href="https://community.nxp.com/thread/308275"&gt;relocating code from FLASH to RAM&lt;/A&gt;&lt;/P&gt;&lt;P&gt;[4]&lt;A _jive_internal="true" href="https://community.nxp.com/thread/317741#comment-372304"&gt;Re: How to relocate memory library function using #pragma?&lt;/A&gt;&lt;/P&gt;&lt;P&gt;[5] &lt;A _jive_internal="true" data-containerid="2029" data-containertype="14" data-objectid="100196" data-objecttype="1" href="https://community.nxp.com/thread/100196"&gt;How to Copy Function from Flash to RAM &amp;amp; execute it&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-339128"&gt;MK20FX512_flash.lcf.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2014 22:35:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Moving-a-Function-to-then-Executing-from-RAM-Kinetis/m-p/313932#M10936</guid>
      <dc:creator>nicholasf</dc:creator>
      <dc:date>2014-06-03T22:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: Moving a Function to, then Executing from RAM (Kinetis)</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Moving-a-Function-to-then-Executing-from-RAM-Kinetis/m-p/313933#M10937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Nicholas:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems you are doing the procedure correctly, but there must be some missing reference. Are you declaring the prototype of your function in a header file? Also are you calling such function from your code? If the function is never referenced maybe the linker is being smart and not allocating it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If possible please share with me your whole project so I can take a look on it.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Regards!,&lt;BR /&gt;Jorge Gonzalez&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jun 2014 16:34:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Moving-a-Function-to-then-Executing-from-RAM-Kinetis/m-p/313933#M10937</guid>
      <dc:creator>Jorge_Gonzalez</dc:creator>
      <dc:date>2014-06-09T16:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: Moving a Function to, then Executing from RAM (Kinetis)</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Moving-a-Function-to-then-Executing-from-RAM-Kinetis/m-p/313934#M10938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Jorge,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I resolved the problem a couple of hours ago (and hadn't gotten around to posting the solution yet).&amp;nbsp; I am not sure what the exact cause was, but it was fixed by manually typing in all the '#pragma' statements, rather than copying and pasting.&amp;nbsp; If you read some of the other threads on this issue, they mention that copying and pasting from PDF causes an issue with the quotation marks, but this is apparently not the only issue with copying and pasting (I know this because I had manually fixed the quotation marks, and it still did not work).&amp;nbsp; There must be some issue with the formatting &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;of the text in AN4329, and related application notes, which goes deeper than just the quotation marks.&lt;BR /&gt; &lt;/SPAN&gt;&lt;BR /&gt;I would suggest that Freescale create a simple example project with the contents of AN4329, to avoid this kind of thing happening to other developers, as it was quite confusing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your time,&lt;BR /&gt;Nicholas F&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Jun 2014 17:09:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Moving-a-Function-to-then-Executing-from-RAM-Kinetis/m-p/313934#M10938</guid>
      <dc:creator>nicholasf</dc:creator>
      <dc:date>2014-06-09T17:09:02Z</dc:date>
    </item>
  </channel>
</rss>

