<?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>CodeWarrior for QorIQのトピックRe: Coldfire: Locating variables at fixed addresses</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126262#M168</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;You got it right Crystcat. After adding "_" &amp;nbsp;to symbol name I can see this in MAP file.&lt;/DIV&gt;&lt;DIV&gt;Thanks a lot!!!&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;While doing this stuff I came across one&amp;nbsp;more things very much similar to this:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;My aim is to add a hex file with code warrior output on fixed location. For this I converted hex file to bin file and tried to place&amp;nbsp;it at the fixed&amp;nbsp;address as follows:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;.MacAddr :&lt;BR /&gt;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _CAN_LIOStart = .;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INCLUDE CAN_LIO.mid&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _CAN_LIOEnd = .;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;gt; MAC_Mem&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;I made all the required changes in project settings to mark a bin file as resource file.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;In this case linker complains that it did not find the file CAN_LIO.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If I add "-" to file name (INCLUDE _CAN_LIO.mid) then&amp;nbsp;CW crashes.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I would really appriciate&amp;nbsp;if you can give me some workaround to add a bin file into project at a predefined location.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Trilok&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Jan 2008 23:04:39 GMT</pubDate>
    <dc:creator>TT</dc:creator>
    <dc:date>2008-01-11T23:04:39Z</dc:date>
    <item>
      <title>Coldfire: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126241#M147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I'm using CodeWarrior 6.2 for a ColdFire processor.&amp;nbsp; I'm trying to locate variables at specific locations in FLASH.&amp;nbsp; According to several different methods I can use:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;1.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MATRIX stMatrixInNVM:0x0001e000;&lt;/DIV&gt;&lt;DIV&gt;or&lt;/DIV&gt;&lt;DIV&gt;2.&lt;/DIV&gt;&lt;DIV&gt;#pragma define_section matrixdb ".matrixdb" RW&lt;BR /&gt;__declspec(matrixdb) MATRIX stMatrixInNVM;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;// where&amp;nbsp; above in .lcf&lt;/DIV&gt;&lt;DIV&gt;MEMORY&lt;BR /&gt;{&lt;BR /&gt;//&amp;nbsp; flash&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (RX)&amp;nbsp; : ORIGIN = 0x00000000, LENGTH = 0x0001df80&lt;BR /&gt;&amp;nbsp; flash&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (RX)&amp;nbsp; : ORIGIN = 0x00000000, LENGTH = 0x00040000&lt;BR /&gt;&amp;nbsp; versioninfo (RW)&amp;nbsp; : ORIGIN = 0x0001df80, LENGTH = 0x00000080&lt;BR /&gt;&amp;nbsp; matrixdb&amp;nbsp;&amp;nbsp; (RW)&amp;nbsp;&amp;nbsp; : ORIGIN = 0x0001e000, LENGTH = 0x00002000&lt;BR /&gt;&amp;nbsp;vectorsram (RWX)&amp;nbsp;: ORIGIN = 0x20000000, LENGTH = 0x00000400&lt;BR /&gt;&amp;nbsp;sram&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (RWX)&amp;nbsp;: ORIGIN = 0x20000400, LENGTH = 0x00007c00&lt;BR /&gt;&amp;nbsp;ipsbar&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (RWX)&amp;nbsp;: ORIGIN = 0x40000000, LENGTH = 0x0&lt;BR /&gt;}&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;SECTIONS&lt;/DIV&gt;&lt;DIV&gt;{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .matrixdb&amp;nbsp;&amp;nbsp; : {} &amp;gt; matrixdb&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;or&lt;/DIV&gt;&lt;DIV&gt;3.&lt;/DIV&gt;&lt;DIV&gt;#pragma section .matrixdb begin&lt;/DIV&gt;&lt;DIV&gt;MATRIX stMatrixInNVM;&lt;/DIV&gt;&lt;DIV&gt;#pragma section .matrixdb end&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Number 3. above is rejected by the compiler/linker/locator failing at the '.'&amp;nbsp; Absent the '.' it fails at the "end" identifier.&lt;/DIV&gt;&lt;DIV&gt;Numbers 1 and 2 are accepted but stMatrixInNVM doesn't appear in the memory map .xMAP file at the expected address as defined.&amp;nbsp; I thought perhaps it's there but just doesn't appear properly in the .xMap file.&amp;nbsp; I examined the code in Mixed mode and the address used for stMatrixInNVM is 0x00000000 so it looks as though the linker never reconciled it to the defined address.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Can anyone help me out here and tell me how to make variables appear at specific addresses in FLASH with initial values.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This is fairly straightforward on the HCS08 by using the @ qualifier,&lt;/DIV&gt;&lt;DIV&gt;eg&lt;/DIV&gt;&lt;DIV&gt;MATRIX stMatrixInNVM @ 0xfd00; or&lt;/DIV&gt;&lt;DIV&gt;const char sApp_VersionNum[] @0xf3b0= "00.02";&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;Thanks.&lt;/DIV&gt;&lt;P&gt;Message Edited by CrasyCat on &lt;SPAN class="date_text"&gt;2007-04-13&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;11:14 AM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Aug 2006 02:00:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126241#M147</guid>
      <dc:creator>jes</dc:creator>
      <dc:date>2006-08-10T02:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126242#M148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Notation 3 is not working today. I have already reported that as a defect with our engineering team.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Notation 1 &amp;amp; 2 should be working.&lt;/DIV&gt;&lt;DIV&gt;When you use MATRIX stMatrixInNVM:0x0001e000 there is no formal object allocated at address 0x0001e000. The compiler is dealing with that as if it was a macro.&lt;/DIV&gt;&lt;DIV&gt;When you are accessing the object, the compiler will directly use the absolute address of the object.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Notation 2 should bring the object in the .map file.&lt;/DIV&gt;&lt;DIV&gt;There is just a small change requested in the .lcf file. Within SECTION block I would rather write:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .matrixdb: {*(.matrixdb)} &amp;gt; matrixdb&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Is the object referenced within the application? If not you have to tell the linker you want to link that object even though it is not&amp;nbsp;used.&lt;/DIV&gt;&lt;DIV&gt;This can be done using the linker command FORCE_ACTIVE in the lcf file.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I hope this helps.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Aug 2006 21:03:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126242#M148</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2006-08-15T21:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126243#M149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Thanks for reply.&amp;nbsp; I'm having difficulty with the syntax in general with the linker and as its presented in the documentation.&lt;/P&gt;&lt;P&gt;Note that I've also been in contact with a Freescale engineer for another defect in the linker/locator(which I believe has been reported).&amp;nbsp; That is, if you include a 'const' specifier in the definition of a variable enclosed with a #pragma ...begin and #pragma ...end&amp;nbsp; statements then the linker incorrectly locates the variable to RAM space rather than that specified in the section specifier of the pragma.&amp;nbsp; The .xMAP file clearly shows this error.&amp;nbsp; Most annoying since you'd most likely want to include a const specifier say for any variable located within FLASH space.&amp;nbsp; Like a database for example that was written there and needs to be referenced on POR.&amp;nbsp; Any such variables are never written to (other than through flash write routines which the compiler and linker/locator are not cognizant of) and thus the const specifier is appropriate.&lt;/P&gt;&lt;P&gt;The syntax of the #pragma define_section is also somewhat confusing.&amp;nbsp; The doc defines as follows:&lt;/P&gt;&lt;PRE&gt;#pragma define_section sname ".istr" [.ustr] [addrmode] [accmode]&lt;/PRE&gt;&lt;A target="_blank"&gt;&lt;/A&gt;&lt;A target="_blank"&gt;&lt;/A&gt;Parameters&lt;A target="_blank"&gt;&lt;/A&gt; &lt;P&gt;sname&lt;/P&gt;&lt;A target="_blank"&gt;&lt;/A&gt; &lt;P&gt;Identifier for source references to this user-defined section.&lt;/P&gt;&lt;A target="_blank"&gt;&lt;/A&gt; &lt;P&gt;istr&lt;/P&gt;&lt;A target="_blank"&gt;&lt;/A&gt; &lt;P&gt;Section-name string for &lt;EM&gt;initialized&lt;/EM&gt; data assigned to this section. Double quotes must surround this parameter value, which must begin with a period. (Also applies to &lt;EM&gt;uninitialized&lt;/EM&gt; data if there is no ustr value.)&lt;/P&gt;&lt;P&gt;----------------------&lt;/P&gt;&lt;P&gt;The Section-name for istr above leads one to believe that it could be a section name as defined by the linker syntax:&lt;/P&gt;&lt;PRE&gt;SECTIONS { section_spec[, section_spec] }&lt;/PRE&gt;&lt;A target="_blank"&gt;&lt;/A&gt;&lt;A target="_blank"&gt;&lt;/A&gt;Parameters&lt;A target="_blank"&gt;&lt;/A&gt; &lt;P&gt;section_spec&lt;/P&gt;&lt;A target="_blank"&gt;&lt;/A&gt; &lt;P&gt;sectionName : [AT (loadAddress)] {contents}&lt;BR /&gt;&amp;gt;segmentName&lt;/P&gt;&lt;A target="_blank"&gt;&lt;/A&gt; &lt;P&gt;sectionName&lt;/P&gt;&lt;A target="_blank"&gt;&lt;/A&gt; &lt;P&gt;Name for the output section, such as mysection. Must start with a period.&lt;/P&gt;&lt;P&gt;---------&lt;/P&gt;&lt;P&gt;However, I've only gotten the #pragma define_section to work correctly if the istr name is another name other than the sectionName above AND appearing within the {contents}.&amp;nbsp; That is confusing and misleading.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Aug 2006 23:02:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126243#M149</guid>
      <dc:creator>jes</dc:creator>
      <dc:date>2006-08-15T23:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126244#M150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;Only thing I can do here is report that back to doc team and ask for a better documentation.&lt;/P&gt;&lt;P&gt;On the constant stuff, did you specify R as AccessType in the corresponding define_section pragma?&lt;BR /&gt;R is the accessType for constant data.&lt;/P&gt;&lt;P&gt;I am not sure I get the point when you say "the istr name is another name other than the sectionName above AND appearing within the {contents}.&amp;nbsp;"&lt;/P&gt;&lt;P&gt;Can you eventually give me a syntax which was not working and should have been correct according to your understanding.&lt;BR /&gt;I am afraid it is a little bit fuzzy for me &lt;IMG alt=":smileyindifferent:" class="emoticon emoticon-smileyindifferent" id="smileyindifferent" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-indifferent.gif" title="Smiley Indifferent" /&gt;&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Aug 2006 20:43:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126244#M150</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2006-08-16T20:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126245#M151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;You wrote:&lt;/P&gt;&lt;P&gt;On the constant stuff, did you specify R as AccessType in the corresponding define_section pragma?&lt;BR /&gt;R is the accessType for constant data.&lt;/P&gt;&lt;P&gt;Yes, I did try the R specifier in the #pragma according to the allowed syntax and it was still improperly located to RAM.&amp;nbsp; The R was also specified in the MEMORY segment defining the area of flash to which I wanted that 'variable' located.&amp;nbsp; But if you think about it, providing an R explicitly in the pragma as a solution when using&amp;nbsp; the const specifier&amp;nbsp;doesn't make much sense when the absence of the const (implying that it is indeed r/w to the compiler anyway) correctly locates the 'variable' within the segment specified to flash.&amp;nbsp; That is, if it properly locates to 'static' flash when you don't explicitly state R for a variable which is defined as something other than const then why would it not work when you're even more specific as to the variable's type?&amp;nbsp; A 'developer' for Freescale (another SR which I'm currently discussing) also stated the following with respect to above:&lt;/P&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT size="2"&gt;Developer looked at this issue and he considers that this is not a bug.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;He states that all "const" type must go to BSS segment (RAM) no matter&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;if they are declared in a pragma section.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;To the above I'd just&amp;nbsp;have to emphatically say HUH!!???&amp;nbsp; That's one of the points&amp;nbsp;of declaring something const.&amp;nbsp; Compiler will thwart any direct attempts to modify the variable declared as 'const' and linker will locate variable in flash space so as not to consume precious RAM space.&amp;nbsp; Static strings, look-up tables declared as const, etc. all end up in flash and are fixed-up by linker to refer in code to their flash addresses.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;You wrote:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;I am not sure I get the point when you say "the istr name is another name other than the sectionName above AND appearing within the {contents}.&amp;nbsp;"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;Can you eventually give me a syntax which was not working and should have been correct according to your understanding.&lt;BR /&gt;I am afraid it is a little bit fuzzy for me&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;I'll try to make more clear what's also fuzzy to me.&amp;nbsp; The "istr" description in the pragma define_section definition states that istr is a "section-name".&amp;nbsp; sectionName is referred to in the LCF syntax as a name according to the SECTIONS{section-spec[,section-spec]} where sectionName is part of the sectionName : [AT (loadAddress)] {contents}&lt;BR /&gt;&amp;gt;segmentName&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;syntax.&amp;nbsp; So, as an example, I ought to be able to do the following:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;SECTIONS&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;{&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;.my_sectionName : {} &amp;gt;my_MEMORY_SEGMENT&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;#pragma define_section this_matrixdb ".my_sectionName" (R)&lt;BR /&gt;#pragma section this_matrixdb begin&lt;BR /&gt;MATRIX stMatrixInNVM;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;#pragma section this_matrixdb end&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;However, the above doesn't work and linker reports an error as follows:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;_stMatrixInNVM(.my_sectionName) in file matrix.c is referenced but has not been written.&lt;BR /&gt;Check your linker command file.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;In order to get the pragma syntax accepted by linker and located to correct MEMORY segment then I must add an additional identifier within {} brackets of .my_sectionName above as follows and refer to this as "istr" in pragma statement:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;.my_sectionName :&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;{ *(.my_additionalsectionName)&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;. &amp;nbsp;=ALIGN(0x10);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;} &amp;gt;&amp;nbsp;my_MEMORY_SEGMENT&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;So, what does the linker error mean?&amp;nbsp; In the original definition of .my_sectionName it refers to the MEMORY segment my_MEMORY_SEGMENT.&amp;nbsp; So why isn't this sufficient and why do I need to define the additional .my_additionalsectionName?&amp;nbsp; If above is required then why does syntax of #pragma define_section refer to istr as sectionName when it means rather something defined within the {contents} LCF syntax?&lt;/FONT&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Aug 2006 23:06:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126245#M151</guid>
      <dc:creator>jes</dc:creator>
      <dc:date>2006-08-16T23:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126246#M152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;I needed some time to go through that on.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I made some tests on both CW Coldfire V6.2 &amp;amp; V6.3.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;First I would recommend you to use __declspec only to place an object is a specific section.&lt;/DIV&gt;&lt;DIV&gt;This is the only way you are going to get that working reliably.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;On both version, if I define&amp;nbsp; a constant (with const keyword),&amp;nbsp;the constant is always allocated in .rodata section.&amp;nbsp;Any __declspec modifier is in fact ignored.&lt;/DIV&gt;&lt;DIV&gt;This is s limitation in the compiler. All constants are allocated in section .rodata.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I could not get any constant into a .bss or .data section....&lt;/DIV&gt;&lt;DIV&gt;I defined my constants as&lt;/DIV&gt;&lt;DIV&gt;const int myConstData = 0x56;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Around the linker file behavior. Here is what I know about the linker file syntax.&lt;/DIV&gt;&lt;DIV&gt;A standard line in the .lcf file looks like:&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;.my_sectionName : {*(.my_sectionname)} &amp;gt;my_MEMORY_SEGMENT&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;The section name on the left is the name of the section as it should be generated in the executable file. The section name in the curly brackets is the section name as it appears in the object files generated by the compiler or assembler.&lt;/DIV&gt;&lt;DIV&gt;This has the big advantage of being completely open. You can use different section name in the object and executable file, you can merge several sections from the object files into one sections in the executable file, and so on.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I am not sure whether the notation&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; .my_sectionName : {} &amp;gt;my_MEMORY_SEGMENT&lt;/DIV&gt;&lt;DIV&gt;is working.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If you feed that is needed, go forward and submit a feature request through our web interface.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Aug 2006 17:28:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126246#M152</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2006-08-18T17:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126247#M153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;You wrote:&lt;/P&gt;&lt;DIV&gt;First I would recommend you to use __declspec only to place an object is a specific section.&lt;/DIV&gt;&lt;DIV&gt;This is the only way you are going to get that working reliably.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;On both version, if I define&amp;nbsp; a constant (with const keyword),&amp;nbsp;the constant is always allocated in .rodata section.&amp;nbsp;Any __declspec modifier is in fact ignored.&lt;/DIV&gt;&lt;DIV&gt;This is s limitation in the compiler. All constants are allocated in section .rodata.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I could not get any constant into a .bss or .data section....&lt;/DIV&gt;&lt;DIV&gt;I defined my constants as&lt;/DIV&gt;&lt;DIV&gt;const int myConstData = 0x56;&lt;/DIV&gt;&lt;DIV&gt;------------------------&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The "working reliably" statement above is disconcerting and I've found there are numerous things that this compiler/linker (6.2) does unreliably or incorrectly.&amp;nbsp; That said--&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I've also tried using the __declspec modifier and it has same limitation as the #pragma.&amp;nbsp; That is, if the intended target MEMORY segment is in flash (and declared properly as R) and a const modifier is used then the 'variable' ends up in RAM.&amp;nbsp; How's this you say since this contradicts with what you've found above in your myConstData example?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Don't specify the = 0x56 assignment and it will end up in RAM.&amp;nbsp; Why, you ask, would you define a const and then not assign to it in the definition? &amp;nbsp;Here's an example:&amp;nbsp; Suppose you have a database an image of which you have in RAM.&amp;nbsp; During normal execution the RAM image of the database is configured by user action.&amp;nbsp; This database is expected to persist on loss of power so it's written to flash occasionally so that on a power-cycle it may be restored from previous settings.&amp;nbsp; This is the reason for the const DATABASE myDatabaseInFlash definition.&amp;nbsp; It is allocated an address&amp;nbsp;at a specific location in flash so that on POR it can be read from and into the RAM database copy.&amp;nbsp; Specifying const also informs the compiler to bark at any references made to it as writable.&amp;nbsp; When written to flash (indirectly) the compiler isn't and shouldn't be cognizant of the fact that it's address in flash is being written to using appropriate flash write routines other than the fact that it's address in flash is referenced in preparation for the flash write.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If you're saying that the compiler syntax doesn't allow for definition of a&amp;nbsp;'variable' as const without specifically defining with an "= ..." at compiler time then the compiler ought to say so.&amp;nbsp; Instead, the compiler happily accepts&amp;nbsp;the&amp;nbsp;lack of "=..." specification and allocates to RAM instead.&amp;nbsp; That's not good and in my opinion is a bug/defect.&amp;nbsp; Have the compiler spit out a warning or an error (I'm using 6.2).&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;(Where is the C BNF grammar listed in 6.2 Help by the way?&amp;nbsp; I haven't been able to locate it and if I could have found const&amp;nbsp;grammar then this would have been helpful and made for a quicker resolution.&amp;nbsp;)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;In regards to the .lcf syntax and section&amp;nbsp;names, I think&amp;nbsp; you've missed my point.&amp;nbsp; Referring to every instance of use in the .lcf syntax and in the #pragmas (or elsewhere) as a section name does not promote a complete understanding of what is/is not acceptable syntax and only makes it more confusing.&amp;nbsp; If references in #pragma is something other than sectionName as defined in .lcf syntax then call it something different.&amp;nbsp; Doing otherwise is about as helpful&amp;nbsp;as writing the same letter on every key of your keyboard but each actually representing something different and expecting the user to eventually figure out the transformation.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks for&amp;nbsp;looking into this.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Aug 2006 20:27:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126247#M153</guid>
      <dc:creator>jes</dc:creator>
      <dc:date>2006-08-18T20:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126248#M154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;Well you are right, when the constant is not initialized, the variable gets allocated in .bss rather than .rodata section. The point here is that normally a constant data is not changing over execution time, so it should be initialized. It is normally good practice to initialize constant data.&lt;/P&gt;&lt;P&gt;On the other hand, ELF defines that all un-initialized variables should come into .bss section. So the compiler is not completely wrong either.&lt;/P&gt;&lt;P&gt;I would recommend to open a service request through the web for that&amp;nbsp;one. We may get compiler engineers to modify this one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;If you have constant data that you know are initialized by some other means in the target board, you may want to define a pointer to that constant data and access the data through that pointer.&lt;/P&gt;&lt;P&gt;In ANSI C a pointer to an int is equivalent to a table of int. i.e.&amp;nbsp;if you define&amp;nbsp;a pointer to char variable, you can access it&amp;nbsp;as an array.&lt;/P&gt;&lt;P&gt;So something like:&lt;BR /&gt;&amp;nbsp; const int *myConstData = (int *)0x45000;&lt;BR /&gt;&amp;nbsp;and access it as&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;tmp = &amp;nbsp;myConstData[0];&lt;/P&gt;&lt;P&gt;This is fully legal in C.&amp;nbsp;&lt;/P&gt;&lt;P&gt;We do not have ANSI C BNF notation in our manual as ANSI C is defined through ANSI C standard from ISO committee. So you found the BNF notation in the ISO manual or in any good ANSI C reference manual.&lt;/P&gt;&lt;P&gt;BNF notation from liker command file is available in the ColdFire_Build_Tools_Reference.pdf manual.&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Aug 2006 18:55:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126248#M154</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2006-08-21T18:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126249#M155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I have a similar problem.&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I am porting a code from Diab compiler to CodeWarrior 8.1 for MPC555.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;because of some available external memory some data is being placed on that address space.&lt;/DIV&gt;&lt;DIV&gt;there are some differences the way #pragma section statement works between two compilers.&lt;/DIV&gt;&lt;DIV&gt;I was able to port the code that works as follows&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#ifdef __MWERKS__&amp;nbsp; // Changes for Metrowerks port - EA - 07/01/03&lt;/DIV&gt;&lt;DIV&gt;#pragma push&lt;BR /&gt;#pragma section RW ".abs.00980040"&lt;BR /&gt;#pragma section ".abs.00980040" ".abs.00980040"&amp;nbsp; data_mode=far_abs&lt;/DIV&gt;&lt;DIV&gt;__declspec(section ".abs.00980040")&amp;nbsp; extern T_dhp_nv_data_struct dhp_nv_data_struct;&lt;/DIV&gt;&lt;DIV&gt;#pragma pop&lt;BR /&gt;#else //Orginal Diab is below&lt;/DIV&gt;&lt;DIV&gt;#pragma section DHP_NV_DATA_Sect far-absolute RW address=0x00980040&lt;/DIV&gt;&lt;DIV&gt;#pragma use_section DHP_NV_DATA_Sect dhp_nv_data_struct;&lt;/DIV&gt;&lt;DIV&gt;extern T_dhp_nv_data_struct dhp_nv_data_struct;&lt;/DIV&gt;&lt;DIV&gt;#endif&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;above metrowerks code works, it creates the variable at correct location.&amp;nbsp; I had to fiddle around with different options to get this working.&amp;nbsp; Since this code is in the .h file where it is declared, but the action memory is allocated in the .c file.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;however Metrowerks way does not allow me to crated a named section with a given address like Diab statement.&amp;nbsp; Is there a way to do it?&amp;nbsp; I do not want to do it in the LCF file, since I would like this to also work in the debug version where .lcf is not used.&amp;nbsp; I was able to get MW to create a named section, or create it at an absolute address, but not both together like Diab Does.&lt;/DIV&gt;&lt;DIV&gt;This is the first question.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;second question is:&lt;/DIV&gt;&lt;DIV&gt;I am having trouble making interrupt vectors defined at an address&lt;/DIV&gt;&lt;DIV&gt;Diab code is as follows&lt;BR /&gt;---------------&lt;BR /&gt;#pragma interrupt InterruptHandler&lt;BR /&gt;#pragma interrupt InterruptHandler&lt;/DIV&gt;&lt;DIV&gt;#pragma section ProgSect address=0x940000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;#pragma use_section ProgSect InterruptMachine&lt;BR /&gt;#pragma section ProgSectII address=0x940100&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;#pragma use_section ProgSectII InterruptHandler&lt;BR /&gt;----------&lt;/DIV&gt;&lt;DIV&gt;I checked the Metrowerks targeting manual but could not find a corresponding way to place Interrupt routines at certain address.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;following statement defines interrupt routine but not at an address&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;__declspec(interrupt) void InterruptHandler()&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;or&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#pragma interrupt on&lt;BR /&gt;void InterruptHandler(void)&lt;BR /&gt;{&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;myRoutine()&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;#pragma interrupt off&lt;BR /&gt;&lt;BR /&gt;also Diab way first defines where the function will be placed and then function is declared later on, can you do that with CodeWarrior?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Cheers&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Jan 2007 01:29:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126249#M155</guid>
      <dc:creator>RoughNeck</dc:creator>
      <dc:date>2007-01-06T01:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126250#M156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;&lt;HR /&gt;jes wrote:&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT size="2"&gt;Compiler will thwart any direct attempts to modify the variable declared as 'const' and linker will locate variable in flash space so as not to consume precious RAM space.&lt;/FONT&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;I've also been struggling to place constants in specific areas of flash. I eventually plan to use this for a copyright notice and CRC, but started with the CFM constants, which are normally declared in an assembler file.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This is what I did to get it working. In&amp;nbsp;the .c file:&lt;/DIV&gt;&lt;BLOCKQUOTE dir="ltr"&gt;&lt;DIV&gt;#pragma define_section _Flash_CFM ".Flash_CFM_Data" far_absolute R&lt;BR /&gt;#pragma section _Flash_CFM begin&lt;/DIV&gt;&lt;DIV&gt;/* CFM Flash Configuration Field */&lt;BR /&gt;/* 0x0400 Backdoor Comparison Key - High */&lt;BR /&gt;u32 u32KEY_UPPER = 0x00000000;&lt;BR /&gt;/* 0x0404 Backdoor Comparison Key - Low */&lt;BR /&gt;u32 u32KEY_LOWER = 0x00000000;&lt;BR /&gt;/* 0x0408 Flash Protection Bytes */&lt;BR /&gt;u32 u32CFMPROT&amp;nbsp;&amp;nbsp; = 0x00000000;&lt;BR /&gt;/* 0x040C Flash SUPV Access Bytes */&lt;BR /&gt;u32 u32CFMSACC&amp;nbsp;&amp;nbsp; = 0x00000000;&lt;BR /&gt;/* 0x0410 Flash DATA Access Bytes */&lt;BR /&gt;u32 u32CFMDACC&amp;nbsp;&amp;nbsp; = 0x00000000;&lt;BR /&gt;/* 0x0414 Flash Security Word */&lt;BR /&gt;u32 u32CFMSEC&amp;nbsp;&amp;nbsp;&amp;nbsp; = 0x00000000;&lt;/DIV&gt;&lt;DIV&gt;#pragma section _Flash_CFM end&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;As Jes found, declaring these as "const" doesn't work.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;In the linker file:&lt;/DIV&gt;&lt;BLOCKQUOTE dir="ltr"&gt;&lt;DIV&gt;FORCE_ACTIVE{_u32KEY_UPPER, _u32KEY_LOWER, _u32CFMPROT, _u32CFMSACC, _u32CFMDACC, _u32CFMSEC}&lt;BR /&gt;...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;SECTIONS&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;.Flash_CFM:&lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;*(.Flash_CFM_Data)&lt;BR /&gt;&amp;nbsp;} &amp;gt; Flash_CFM&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;Note that the FORCE_ACTIVE line only seems to work if you put it &lt;EM&gt;before&lt;/EM&gt; the SECTIONS block!!! The documentation does not make this clear!&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;As has been mentioned, putting constants in specified areas of flash is an important thing to be able to do, and the tools make it very difficult.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;What is additionally frustrating is that, in the previous project I worked on, which&amp;nbsp;used CodeWarrior for HCS12, doing this was much easier - and it worked without the workarounds required for the ColdFire edition.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Steve.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Apr 2007 16:21:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126250#M156</guid>
      <dc:creator>sjmelnikoff</dc:creator>
      <dc:date>2007-04-23T16:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126251#M157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;In my previous post, I forgot to include this in the linker file excerpt:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;MEMORY&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&lt;BR /&gt;&amp;nbsp;&amp;nbsp;Flash_CFM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (R)&amp;nbsp;&amp;nbsp; : ORIGIN = 0x00000400, LENGTH = 0x00020&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&lt;BR /&gt;}&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;Steve.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Apr 2007 16:55:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126251#M157</guid>
      <dc:creator>sjmelnikoff</dc:creator>
      <dc:date>2007-04-23T16:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: Coldfire: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126252#M158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I take it all back. The linker does correctly allocate the space - but doesn't initialise the data &lt;IMG alt=":smileysad:" class="emoticon emoticon-smileysad" id="smileysad" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif" title="Smiley Sad" /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Any suggestions?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Steve.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Apr 2007 17:07:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126252#M158</guid>
      <dc:creator>sjmelnikoff</dc:creator>
      <dc:date>2007-04-23T17:07:02Z</dc:date>
    </item>
    <item>
      <title>Re: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126253#M159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I did perform some tests.&lt;/DIV&gt;&lt;DIV&gt;Defining the constants as follows seems to do the trick:&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;PRE&gt;#pragma push /* Save the compiler’s state. */
#pragma section data_type const_type ".Flash_CFM_Data" ".Flash_CFM_Data" data_mode=far_abs/* CFM Flash Configuration Field */
/* 0x0400 Backdoor Comparison Key - High */
unsigned long u32KEY_UPPER = 0x00000000;
/* 0x0404 Backdoor Comparison Key - Low */
unsigned long u32KEY_LOWER = 0x00000000;
/* 0x0408 Flash Protection Bytes */
unsigned long u32CFMPROT   = 0x00000000;
/* 0x040C Flash SUPV Access Bytes */
unsigned long u32CFMSACC   = 0x00000000;
/* 0x0410 Flash DATA Access Bytes */
unsigned long u32CFMDACC   = 0x00000000;
/* 0x0414 Flash Security Word */
unsigned long u32CFMSEC    = 0x00000000;
#pragma pop /* Save the compiler’s state. */
&lt;/PRE&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;Attached sample ANSI C and .lcf file I have been using.&lt;/DIV&gt;&lt;DIV&gt;I did the test with CW MCP5xx V8.7.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;If you want to define a section allocated at an absolute address you&amp;nbsp;may want to&amp;nbsp;try the following:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;P class="SourceCode" style="margin: 0in 0in 0pt 42.55pt"&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;&lt;FONT face="Courier New"&gt;#pragma push&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SourceCode" style="margin: 0in 0in 0pt 42.55pt"&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;&lt;FONT face="Courier New"&gt;#pragma section code_type ".abs.00010000" code_mode=pc_rel&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SourceCode" style="margin: 0in 0in 0pt 42.55pt"&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;&lt;FONT face="Courier New"&gt;void&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; func(void)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SourceCode" style="margin: 0in 0in 0pt 42.55pt"&gt;&lt;SPAN&gt;&lt;FONT size="2"&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;&lt;FONT face="Courier New"&gt;{&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="SourceCode" style="margin: 0in 0in 0pt 42.55pt"&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P class="SourceCode" style="margin: 0in 0in 0pt 42.55pt"&gt;&lt;STRONG&gt;&lt;FONT color="#000000" face="Courier New" size="2"&gt;#pragma pop&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;I get it working on an earlier version of CodeWarrior EPPC. I did not try it with&amp;nbsp;the latest release I should admit.&lt;/DIV&gt;&lt;DIV&gt;otherwise you can use pragma section and also use a .lcf file in debug mode.&lt;/DIV&gt;&lt;DIV&gt;I would recommend this approach anyway as lcf files are much more flexible than the EPPC Linker Panel.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;A href="http://www.freescale.com/files/community_files/CWCFCOMM/msg1144_testcst.zip" rel="nofollow noopener noreferrer" target="_self"&gt;testcst.zip&lt;/A&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by t.dowe on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-09-04&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;11:32 AM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Apr 2007 17:29:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126253#M159</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2007-04-23T17:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126254#M160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="3"&gt;Hi CrasyCat. Thanks for responding so quickly.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="3"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="3"&gt;This syntax for #pragma section is not supported for ColdFire. The &lt;EM&gt;CodeWarrior Build Tools Reference ColdFire™ Architectures Edition&lt;/EM&gt; manual states:&lt;/FONT&gt;&lt;/DIV&gt;&lt;BLOCKQUOTE dir="ltr"&gt;&lt;DIV&gt;&lt;FONT size="3"&gt;Activates or deactivates a user-defined or predefined section.&lt;/FONT&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;#pragma section &lt;I&gt;sname&lt;/I&gt; begin | end&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT size="3"&gt;The only way I've been able to get this to work is to do it in assembler. In FlashReg.s:&lt;/FONT&gt;&lt;/P&gt;&lt;BLOCKQUOTE dir="ltr"&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;.export u32KEY_UPPER&lt;BR /&gt;.export u32KEY_LOWER&lt;BR /&gt;.export u32CFMPROT&lt;BR /&gt;.export u32CFMSACC&lt;BR /&gt;.export u32CFMDACC&lt;BR /&gt;.export u32CFMSEC&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;.section .text&lt;BR /&gt;/* CFM Flash Configuration Field */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;u32KEY_UPPER:&amp;nbsp; .long&amp;nbsp;&amp;nbsp; 0x00000000 /* 0x0400 Backdoor Comparison Key */&lt;BR /&gt;u32KEY_LOWER:&amp;nbsp; .long&amp;nbsp;&amp;nbsp; 0x00000000 /* 0x0404 Backdoor Comparison Key */&lt;BR /&gt;u32CFMPROT:&amp;nbsp;&amp;nbsp;&amp;nbsp; .long&amp;nbsp;&amp;nbsp; 0x00000000 /* 0x0408 Flash Protection Bytes */&lt;BR /&gt;u32CFMSACC:&amp;nbsp;&amp;nbsp;&amp;nbsp; .long&amp;nbsp;&amp;nbsp; 0x00000000 /* 0x040C Flash SUPV Access Bytes */&lt;BR /&gt;u32CFMDACC:&amp;nbsp;&amp;nbsp;&amp;nbsp; .long&amp;nbsp;&amp;nbsp; 0x00000000 /* 0x0410 Flash DATA Access Bytes */&lt;BR /&gt;u32CFMSEC:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .long&amp;nbsp;&amp;nbsp; 0x00000000 /* 0x0414 Flash Security Word */&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;.end&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT size="3"&gt;In the linker file:&lt;/FONT&gt;&lt;/P&gt;&lt;BLOCKQUOTE dir="ltr"&gt;&lt;P&gt;&lt;FONT face="Courier New"&gt;FORCE_ACTIVE&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;u32KEY_UPPER, u32KEY_LOWER, u32CFMPROT, u32CFMSACC, u32CFMDACC, u32CFMSEC&lt;BR /&gt;}&lt;BR /&gt;...&lt;BR /&gt;SECTIONS&lt;BR /&gt;{&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size="3"&gt;&amp;nbsp;&amp;nbsp;.Flash_Reg:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;FlashReg.s (.text)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &amp;gt; Flash_Reg&lt;BR /&gt;&amp;nbsp;&amp;nbsp;...&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT size="3"&gt;}&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;FONT size="3"&gt;It really shouldn't be this difficult...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;Steve.&lt;/FONT&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Apr 2007 17:49:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126254#M160</guid>
      <dc:creator>sjmelnikoff</dc:creator>
      <dc:date>2007-04-23T17:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126255#M161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;OK I have been confused as the beginning of the thread was speaking about MPC5xx and the end of the thread about Coldfire &lt;IMG alt=":smileysad:" class="emoticon emoticon-smileysad" id="smileysad" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif" title="Smiley Sad" /&gt;.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;As CodeWarrior might behave differently for different targets, it would be much clearer in the future to&lt;/DIV&gt;&lt;DIV&gt;start separate threads for different target.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;When you are building for Coldfire, you need to define the constants as follows:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;PRE&gt;#pragma define_section _Flash_CFM ".Flash_CFM_Data"  far_absolute R#pragma explicit_zero_data on__declspec(_Flash_CFM)  unsigned long _cfm[6] = {/* CFM Flash Configuration Field *//* 0x0400 Backdoor Comparison Key - High */__declspec(_Flash_CFM) u32 u32KEY_UPPER = 0x00000000;/* 0x0404 Backdoor Comparison Key - Low */__declspec(_Flash_CFM) u32 u32KEY_LOWER = 0x00000000;/* 0x0408 Flash Protection Bytes */__declspec(_Flash_CFM) u32 u32CFMPROT   = 0x00000000;/* 0x040C Flash SUPV Access Bytes */__declspec(_Flash_CFM) u32 u32CFMSACC   = 0x00000000;/* 0x0410 Flash DATA Access Bytes */__declspec(_Flash_CFM) u32 u32CFMDACC   = 0x00000000;/* 0x0414 Flash Security Word */__declspec(_Flash_CFM) u32 u32CFMSEC    = 0x00000000;&lt;/PRE&gt;&lt;DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;One of the trick here is that if your constant are initialized with 0, the compiler is performing a so called optimization (I hate it too) and is placing the constants in .bss.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;In order to prevent that from happening you need to use the pragma&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; #pragma explicit_zero_data on&lt;BR /&gt;prior to defining the constants.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Also I noticed the pragma section begin ... pragma section end are not always working as expected.&lt;/DIV&gt;&lt;DIV&gt;I would recommend using __declspec to place an object in a specific section. This is working more reliably for Coldfire.&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Apr 2007 19:36:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126255#M161</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2007-04-23T19:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126256#M162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;That did the trick! Thank you CrasyCat!&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Steve.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Apr 2007 20:18:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126256#M162</guid>
      <dc:creator>sjmelnikoff</dc:creator>
      <dc:date>2007-04-23T20:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: Coldfire: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126257#M163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I have only just started porting to the ColdFire MCF5223evb and have a requirement to fix an array in Flash. I have tried the suggestions here but think I have become confused in the various earlier iterations.&lt;BR /&gt;&lt;BR /&gt;My array is defined as:&lt;BR /&gt;&lt;BR /&gt;#pragma define_section _MacAddr ".MacAddr" far_absolute R&lt;BR /&gt;#pragma explicit_zero_data on&lt;BR /&gt;//Declare the non-volatile array fixed in Flash&lt;BR /&gt;__declspec (_MacAddr) unsigned char mac_addr[6] = {0x00, 0x0a, 0x8D, 0x0, 0x00, 0x1E};&lt;BR /&gt;&lt;BR /&gt;...and I have the following in my linker file:&lt;BR /&gt;&lt;BR /&gt;MEMORY&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rom&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (RX) : ORIGIN = 0x00000000,&amp;nbsp; LENGTH = 0x0001FFF0&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MacAddr (RX) : ORIGIN = 0x0001FFF0,&amp;nbsp; LENGTH = 0x00000010&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ram&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (RW) : ORIGIN = 0x20000000,&amp;nbsp; LENGTH = 0x00008000&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;...but the build issues the following:&lt;BR /&gt;&lt;BR /&gt;_mac_addr(.MacAddr) in file mac_id.c is referenced but has not been written.&lt;BR /&gt;Check your linker command file.&lt;BR /&gt;&lt;BR /&gt;...and the mac_addr is missing from the xMAP file.&lt;BR /&gt;&lt;BR /&gt;I am obviously missing something but what?&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Trevor&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Oct 2007 20:54:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126257#M163</guid>
      <dc:creator>TrevorCurry_eu</dc:creator>
      <dc:date>2007-10-09T20:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: Coldfire: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126258#M164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Check the Build Tools reference manual.&lt;/DIV&gt;&lt;DIV&gt;The name of the section should not be specified in the MEMORY block, but in the SECTIONS block.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;So I would change the MEMORY block as follows:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;MEMORY&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rom&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (RX) : ORIGIN = 0x00000000,&amp;nbsp; LENGTH = 0x0001FFF0&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MAC_Mem(RX) : ORIGIN = 0x0001FFF0,&amp;nbsp; LENGTH = 0x00000010&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ram&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (RW) : ORIGIN = 0x20000000,&amp;nbsp; LENGTH = 0x00008000&lt;BR /&gt;}&lt;BR /&gt;&amp;nbsp;and add the following to the SECTIONS block&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .MacAddr : {&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *(.MacAddr)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;gt; .MAC_Mem&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;CrasyCat&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2007 17:15:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126258#M164</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2007-10-10T17:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: Coldfire: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126259#M165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Many thanks for that - I am not sure I could have figured out the syntax of the *(.MacAddr) entry for the contents field from the manual description (p112).&lt;BR /&gt;&lt;BR /&gt;Just a minor change, the segment name in SECTIONS does not need the '.'&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; .MacAddr : {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *(.MacAddr)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;gt; MAC_Mem&lt;BR /&gt;&lt;BR /&gt;The xMAP file now confirms that I have a separate .MacAddr memory area at the required address with the mac_addr[] array correctly populated - great!&lt;BR /&gt;&lt;BR /&gt;Many thanks for your speedy response!&lt;BR /&gt;Trevor&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Oct 2007 18:11:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126259#M165</guid>
      <dc:creator>TrevorCurry_eu</dc:creator>
      <dc:date>2007-10-10T18:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: Coldfire: Locating variables at fixed addresses</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126260#M166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt;I tried to use the same piece of code to define an array at fixed location.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#pragma define_section _MacAddr ".MacAddr" far_absolute R&lt;BR /&gt;#pragma explicit_zero_data on&lt;/DIV&gt;&lt;DIV&gt;__declspec (_MacAddr) unsigned char mac_addr[6] = {0x00, 0x0a, 0x8D, 0x0, 0x00, 0x1E};&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;and in lcf&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;MEMORY&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CODE (RX) : ORIGIN = 0x00000000, LENGTH = 0x00700000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RAM&amp;nbsp; (RW) : ORIGIN = 0x00800000, LENGTH = 0x01800000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ROM&amp;nbsp; (RX) : ORIGIN = 0x51900000, LENGTH = 0x00600000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MAC_Mem(RX) : ORIGIN = 0x52500000, LENGTH = 0x00010000&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;FORCE_ACTIVE {VECTOR_TABLE,mac_addr}&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;and add the following to the SECTIONS block&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;.MacAddr : {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *(.MacAddr)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;} &amp;gt; MAC_Mem&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Here Linker Complains:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;"The symbol "mac_addr" was forced in the link with a "FORCE_ACTIVE" clause&lt;BR /&gt;but no definition could be found."&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Map file looks like:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;# Memory map:&lt;BR /&gt;&amp;nbsp; v_addr&amp;nbsp;&amp;nbsp; p_addr&amp;nbsp;&amp;nbsp; size&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name&lt;BR /&gt;&amp;nbsp; 00000000 00000000 00000CE8 .boot_ram&amp;nbsp; CODE&lt;BR /&gt;&amp;nbsp; 00000CE8 51900CE4 00109112 .main_application CODE&lt;BR /&gt;&amp;nbsp; 00800000 51A09DF6 00032268 .main_application_data RAM&lt;BR /&gt;&amp;nbsp; 00832268 00832268 000631A0 .uninitialized_data RAM&lt;BR /&gt;&amp;nbsp; 00895408 51A3C05E 00000030 .romp&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RAM&lt;BR /&gt;&amp;nbsp; 51900000 51900000 00000CE4 .boot&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ROM&lt;BR /&gt;&amp;nbsp; 52500000 52500000 00000000 .MacAddr&amp;nbsp;&amp;nbsp; MAC_Mem&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Can anyone help me to figure out the problem? Why linker is not finding the definition?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks All,&lt;/DIV&gt;&lt;DIV&gt;TT&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jan 2008 23:35:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-QorIQ/Coldfire-Locating-variables-at-fixed-addresses/m-p/126260#M166</guid>
      <dc:creator>TT</dc:creator>
      <dc:date>2008-01-10T23:35:55Z</dc:date>
    </item>
  </channel>
</rss>

