<?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: Linker Command File in ColdFire/68K Microcontrollers and Processors</title>
    <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linker-Command-File/m-p/204289#M9586</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please use separate posts when you have different questions,&lt;/P&gt;&lt;P&gt;Some people may only have answer to one question and will not answer a post where you encapsulate multiple questions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On .lcf file syntax, you can find some documentation on linker file syntax in&amp;nbsp;{Install\MCU\Help|PDF\MCU_ColdFire_Compiler.pdf in chapter ELF Linker and Command Language.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically you define a new flash area by adding a new line in the MEMORY block.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;PRE&gt;MEMORY {   ...    my_flah (RX) : ORIGIN = 0x20000000, LENGTH = 0x00020000 } &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;This defines a block of memory starting at address 0x20000000 and which has a length of 0x20000 bytes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you can place some sections in that segment in the SECTIONS block.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;SECTIONS {  ...  .myCode : {} &amp;gt; my_flash }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 09 May 2011 16:12:47 GMT</pubDate>
    <dc:creator>CrasyCat</dc:creator>
    <dc:date>2011-05-09T16:12:47Z</dc:date>
    <item>
      <title>Linker Command File</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linker-Command-File/m-p/204287#M9584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm used to work with .prm file to define segments. But now I'm working with MCF51QE, since it's a ColdFire MCU, it has no longer a .prm files instead it's got a .lcf file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't understand it....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If some could explain me it would be great because I'd like to learn about it. If you don't want to waste time explaining I just need to know how to define a new FLASH segment.&lt;/P&gt;&lt;P&gt;&amp;nbsp;What I want to do is save data into this new FLASH segment. I'm using routines from &amp;nbsp;AN3942SW. I want this segment to be 1024bytes long.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And one more question... I just want to be sure about this: When erasing flash, it is erased by blocks of 512bytes, right?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!!!! Best Regards!&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 May 2011 04:52:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linker-Command-File/m-p/204287#M9584</guid>
      <dc:creator>sebasira</dc:creator>
      <dc:date>2011-05-07T04:52:18Z</dc:date>
    </item>
    <item>
      <title>Re: Linker Command File</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linker-Command-File/m-p/204288#M9585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I forgot to say that I've allready read &lt;A href="http://www.freescale.com/webapp/sps/utils/SingleFaq.jsp?FAQ-27860.xml" rel="nofollow" target="_self"&gt;FAQ-27860&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I still can't work it out &amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 May 2011 04:55:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linker-Command-File/m-p/204288#M9585</guid>
      <dc:creator>sebasira</dc:creator>
      <dc:date>2011-05-07T04:55:48Z</dc:date>
    </item>
    <item>
      <title>Re: Linker Command File</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linker-Command-File/m-p/204289#M9586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please use separate posts when you have different questions,&lt;/P&gt;&lt;P&gt;Some people may only have answer to one question and will not answer a post where you encapsulate multiple questions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On .lcf file syntax, you can find some documentation on linker file syntax in&amp;nbsp;{Install\MCU\Help|PDF\MCU_ColdFire_Compiler.pdf in chapter ELF Linker and Command Language.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically you define a new flash area by adding a new line in the MEMORY block.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;PRE&gt;MEMORY {   ...    my_flah (RX) : ORIGIN = 0x20000000, LENGTH = 0x00020000 } &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;This defines a block of memory starting at address 0x20000000 and which has a length of 0x20000 bytes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you can place some sections in that segment in the SECTIONS block.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;SECTIONS {  ...  .myCode : {} &amp;gt; my_flash }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 16:12:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linker-Command-File/m-p/204289#M9586</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2011-05-09T16:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: Linker Command File</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linker-Command-File/m-p/204290#M9587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your replay CrasyCat.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry about the other question, I was thinking about that and didn't realize that it's got nothing to do with the post.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought it would be "harder" to define a new section, because in the .lcf file, inside each section there are many things I don't understand. I'll try what you say and if I find another question, I'll let you know.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 19:00:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linker-Command-File/m-p/204290#M9587</guid>
      <dc:creator>sebasira</dc:creator>
      <dc:date>2011-05-09T19:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: Linker Command File</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linker-Command-File/m-p/204291#M9588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here am I again!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Well, I still couldn't accomplish what I want to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All I want is to define a segment in FLASH where I can store constant data.&lt;/P&gt;&lt;P&gt;This is what I've done:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;MEMORY {   myflash     (RX)  : ORIGIN = 0x00000410, LENGTH = 0x00000400   code        (RX)  : ORIGIN = 0x00000810, LENGTH = 0x00007AF0   userram     (RWX) : ORIGIN = 0x00800000, LENGTH = 0x00002000}SECTIONS {  .userram        : {} &amp;gt; userram  .code     : {} &amp;gt; code  .myDATA : {} &amp;gt; myflash
&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Then I want a constant named const1 inside .myDATA and I do this:&lt;/P&gt;&lt;PRE&gt;#pragma CONST_SEG myDATA  const word const1;#pragma CONST_SEG DEFAULT &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But const1 appears at and address in RAM. Why's that???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only way I managed to put it in flash is by setting its address as:&lt;/P&gt;&lt;PRE&gt;#pragma CONST_SEG myDATA  const word const1 @0x00000410;#pragma CONST_SEG DEFAULT &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance!!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Sep 2011 07:04:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linker-Command-File/m-p/204291#M9588</guid>
      <dc:creator>sebasira</dc:creator>
      <dc:date>2011-09-24T07:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: Linker Command File</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linker-Command-File/m-p/204292#M9589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; First if you are defining a constant you better define it with an initialization value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Otherwise the compiler does not consider it is a constant.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Then using following notation you can place the variable in&amp;nbsp; user defined section named myData:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;#pragma define_section myDataSec "myData" far_absolute R__declspec(myDataSec) const word const1 =6;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you should get the constant const1 allocated in section myData.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Sep 2011 13:10:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linker-Command-File/m-p/204292#M9589</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2011-09-26T13:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: Linker Command File</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linker-Command-File/m-p/204293#M9590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is some info in this thread:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.freescale.com/message/23661#23661" title="https://community.freescale.com/message/23661#23661"&gt;https://community.freescale.com/message/23661#23661&lt;/A&gt;﻿&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And also my experience here:&lt;/P&gt;&lt;P&gt;&lt;A __default_attr="90614" class="jive_macro jive_macro_thread default_title" href="https://community.freescale.com/thread/90614" jivemacro="thread" title="https://community.freescale.com/thread/90614"&gt;https://community.freescale.com/thread/90614&lt;/A&gt;﻿&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Sep 2011 00:08:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linker-Command-File/m-p/204293#M9590</guid>
      <dc:creator>FridgeFreezer</dc:creator>
      <dc:date>2011-09-30T00:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Linker Command File</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linker-Command-File/m-p/204294#M9591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply CrasyCat!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Well, I couldn't still make it work.... I guess I may be missing something.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll explain a little more what I want to do. Please, excuse my english. I've got an application that needs to store some data in FLASH, I'm working with MCF51QE96. As code is also in flash, I want to define an area where I will later store data, so I can erase it and not erase the code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I went to the LCF file and found this:&lt;/P&gt;&lt;PRE&gt;MEMORY {   code        (RX)  : ORIGIN = 0x00000410, LENGTH = 0x00007AF0   userram     (RWX) : ORIGIN = 0x00800000, LENGTH = 0x00002000}
.... other stuff .....
  .userram        : {} &amp;gt; userram  .code     : {} &amp;gt; code&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;This was my first time dealing with LCF. And I changed it to be like this:&lt;/P&gt;&lt;PRE&gt;MEMORY {   myflash     (RX)  : ORIGIN = 0x00000410, LENGTH = 0x00000400   code        (RX)  : ORIGIN = 0x00000810, LENGTH = 0x00007AF0   userram     (RWX) : ORIGIN = 0x00800000, LENGTH = 0x00002000}
.... other stuff ....  .userram        : {} &amp;gt; userram  .code     : {} &amp;gt; code  .myDATA : {} &amp;gt; myflash&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I've not idea if this is right... What I ment to do is define a new memory section called "myDATA" wich starts at address 0x410 and it contains 0x400 bytes (two FLASH blocks of 512bytes)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then inside one of my files I did as you said:&lt;/P&gt;&lt;PRE&gt;#pragma define_section myDataSec "myflash" far_absolute R__declspec(myDataSec) const dword FLASH_CODE = 0xFFFFFFFF;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I found 2 things:&lt;/P&gt;&lt;P&gt;1- on .xMAP files FLASH_CODE does not appear (it is used in several parts of my code)&lt;/P&gt;&lt;P&gt;2- when debugging FLASH_CODE appears at address 0x00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Further infromation, all I want to do is erase/write flash area so I can store data using burst_prog and page_erase routines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As I said before, the strange thing is that if I define as:&lt;/P&gt;&lt;PRE&gt;const dword FLASH_CODE @0x410;&lt;/PRE&gt;&lt;P&gt;I can perfectly used burst_prog and page_erase. Then go to address 0x410 (in debugger) and data is written. But if I enter "FLASH_CODE" in the Data component, it appears as UNDEFINED. Also not appearing in .xMAP&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;But I don't want to used it this way because I've got to keep track of address and size, in order to not overlap with other constatns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please, help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Oct 2011 22:16:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linker-Command-File/m-p/204294#M9591</guid>
      <dc:creator>sebasira</dc:creator>
      <dc:date>2011-10-08T22:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Linker Command File</title>
      <link>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linker-Command-File/m-p/204295#M9592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well after a loooooot of reading and breaking my head against the wall with trial and error, I've manage to accomplish my task.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A __default_attr="17176" class="jive_macro jive_macro_thread default_title" href="https://community.freescale.com/thread/17176" jivemacro="thread" title="this"&gt;this&lt;/A&gt; post was very very useful!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 09 Oct 2011 00:12:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/ColdFire-68K-Microcontrollers/Linker-Command-File/m-p/204295#M9592</guid>
      <dc:creator>sebasira</dc:creator>
      <dc:date>2011-10-09T00:12:09Z</dc:date>
    </item>
  </channel>
</rss>

