<?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 MCUのトピックRe: How to link const vars not referenced in source code, without modifying PRM file?</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-link-const-vars-not-referenced-in-source-code-without/m-p/182949#M6290</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello FordFairlane,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume you don't want to use PRM file solution "ENTRIES" due to fact you would add all the ROMVars defined in it, right?&lt;/P&gt;&lt;P&gt;What about disable Smart Linking for the module that defines ROMVars only e.g.:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.PRM:&lt;/P&gt;&lt;P&gt;-------&lt;/P&gt;&lt;P&gt;ENTRIES&lt;/P&gt;&lt;P&gt;&amp;nbsp;main.c.o:*&lt;BR /&gt;&lt;/P&gt;END &lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or you can separate all the ROMVar definitions in separate module e.g. "ROMVars.C" &amp;amp; "ROMVars.h" and then you can avoid Smart Linking for the ROMVars only.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.PRM:&lt;/P&gt;&lt;P&gt;-------&lt;/P&gt;&lt;P&gt;ENTRIES&lt;/P&gt;&lt;P&gt;&amp;nbsp;ROMVars.c.o:*&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;END&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Stanish&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 May 2009 20:14:19 GMT</pubDate>
    <dc:creator>stanish</dc:creator>
    <dc:date>2009-05-20T20:14:19Z</dc:date>
    <item>
      <title>How to link const vars not referenced in source code, without modifying PRM file?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-link-const-vars-not-referenced-in-source-code-without/m-p/182948#M6289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;* Codewarrior 6.1 for microcontrollers&lt;/P&gt;&lt;P&gt;* S08AW60&lt;/P&gt;&lt;SPAN&gt;* PRM file:&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new,courier';"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new,courier';"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;PRE&gt;
SEGMENTS Z_RAM&amp;nbsp; =&amp;nbsp; READ_WRITE&amp;nbsp;&amp;nbsp; 0x0070 TO 0x00FF; RAM_A&amp;nbsp; =&amp;nbsp; READ_WRITE&amp;nbsp;&amp;nbsp; 0x0100 TO 0x025F; RAM_B&amp;nbsp; =&amp;nbsp; READ_WRITE&amp;nbsp;&amp;nbsp; 0x0260 TO 0x086F; ROM_A&amp;nbsp; =&amp;nbsp; READ_ONLY&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x1A00 TO 0x21FF; ROM_B&amp;nbsp; =&amp;nbsp; READ_ONLY&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x2200 TO 0xFFAF; ROM_C&amp;nbsp; =&amp;nbsp; READ_ONLY&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFFC0 TO 0xFFCB; END PLACEMENT NVRAM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO&amp;nbsp; RAM_A; NVROM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO&amp;nbsp; ROM_A; DEFAULT_RAM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO&amp;nbsp; RAM_B; _PRESTART, ... DEFAULT_ROM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INTO&amp;nbsp; ROM_B; ...END&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*C Source code:&lt;/P&gt;&lt;PRE&gt;
unsigned char RAMVar1 @"NVRAM";unsigned char ROMVar1 @"NVROM"=0;unsigned char RAMVar2 @"NVRAM";unsigned char ROMVar2 @"NVROM"=245;...unsigned char RAMVar200 @"NVRAM";unsigned char ROMVar200 @"NVROM"=27;void InitNonVolatileVars(void){ unsigned char *pRAM; unsigned char *pROM; unsigned char n; n=__SEG_SIZE_NVRAM; pRAM=__SEG_START_NVRAM; pROM=__SEG_START_NVROM+LastCopyAddress(); do{*pRAM++=*pROM++;}while(--n);}void MyFunc(void)&amp;nbsp;&amp;nbsp; { RAMVar1=RAMVar2;&amp;nbsp; ... }void SynchroRAM2ROM(void){...}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;* Problem: ROMVars are not linked because they are not referenced in source code.&lt;/P&gt;&lt;P&gt;* Undesired solution: modify PRM file like this:&lt;/P&gt;&lt;PRE&gt;ENTRIES&amp;nbsp;&amp;nbsp; ROMVar1&amp;nbsp;&amp;nbsp; ROMVar2&amp;nbsp;&amp;nbsp; ...&amp;nbsp;&amp;nbsp; ROMVar200END&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;* Desired solution: modify source code like this:&lt;/P&gt;&lt;PRE&gt;
unsigned char RAMVar1 @"NVRAM";&lt;SPAN style="color: #ff0000;"&gt;__root&lt;/SPAN&gt; unsigned char ROMVar1 @"NVROM"=0;unsigned char RAMVar2 @"NVRAM";&lt;SPAN style="color: #ff0000;"&gt;__root&lt;/SPAN&gt; unsigned char ROMVar2 @"NVROM"=245;...&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use "__root"&amp;nbsp;for Atmel ATmega compiler, but I'd like the same code to run in&amp;nbsp;Freescale's AW60:&lt;/P&gt;&lt;PRE&gt;
#define __root __AlwaysLinkFreescale&lt;/PRE&gt;&lt;P&gt;How to do it?, is there a reserved word to tell the compiler and linker not to remove non&amp;nbsp;referenced const vars?.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:33:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-link-const-vars-not-referenced-in-source-code-without/m-p/182948#M6289</guid>
      <dc:creator>FordFairlane</dc:creator>
      <dc:date>2020-10-29T09:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to link const vars not referenced in source code, without modifying PRM file?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-link-const-vars-not-referenced-in-source-code-without/m-p/182949#M6290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello FordFairlane,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume you don't want to use PRM file solution "ENTRIES" due to fact you would add all the ROMVars defined in it, right?&lt;/P&gt;&lt;P&gt;What about disable Smart Linking for the module that defines ROMVars only e.g.:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.PRM:&lt;/P&gt;&lt;P&gt;-------&lt;/P&gt;&lt;P&gt;ENTRIES&lt;/P&gt;&lt;P&gt;&amp;nbsp;main.c.o:*&lt;BR /&gt;&lt;/P&gt;END &lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or you can separate all the ROMVar definitions in separate module e.g. "ROMVars.C" &amp;amp; "ROMVars.h" and then you can avoid Smart Linking for the ROMVars only.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;.PRM:&lt;/P&gt;&lt;P&gt;-------&lt;/P&gt;&lt;P&gt;ENTRIES&lt;/P&gt;&lt;P&gt;&amp;nbsp;ROMVars.c.o:*&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;END&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Stanish&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2009 20:14:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-link-const-vars-not-referenced-in-source-code-without/m-p/182949#M6290</guid>
      <dc:creator>stanish</dc:creator>
      <dc:date>2009-05-20T20:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to link const vars not referenced in source code, without modifying PRM file?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-link-const-vars-not-referenced-in-source-code-without/m-p/182950#M6291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you stanish, your solution is better than mine, but this is not what I'm looking for. I have a lot of non volatile variables defined in a lot of C files, I'd like not to modify all of them because it takes too much time and I'd like to use the same source code for Freescale and Atmel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2009 20:47:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-link-const-vars-not-referenced-in-source-code-without/m-p/182950#M6291</guid>
      <dc:creator>FordFairlane</dc:creator>
      <dc:date>2009-05-20T20:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to link const vars not referenced in source code, without modifying PRM file?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-link-const-vars-not-referenced-in-source-code-without/m-p/182951#M6292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;If you want the code to be portable, use ENTRIES and not some obscure __root syntax in the source itself. Also, don't use @ as it is equally obsucre and equally non-portable. You can't even port it to another Freescale compiler. The more you can stuff in the .prm file, the better.&lt;BR /&gt;&lt;BR /&gt;Regarding modifying variables... any IDE has find &amp;amp; replace. If that isn't good enough, how hard is it for a programmer to write a text parser program on a Windows compiler? 1 hour of work at most.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2009 21:28:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-link-const-vars-not-referenced-in-source-code-without/m-p/182951#M6292</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2009-05-20T21:28:23Z</dc:date>
    </item>
  </channel>
</rss>

