<?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 use src code with on-chip register data type definitions that differ from rest of project</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-src-code-with-on-chip-register-data-type-definitions/m-p/134304#M1563</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;You have two solutions to do that:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; 1- Use a macro, which will just be an alternate name for the register defined by processor expert:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For example&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; #define MyAltData PORTA&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;2- You can remap the error message about overlap allocation to a warning or information message.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Start IDE&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Open your project&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Open the target setting dialog&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Switch to "Linker for HC12" panel&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Click on Messages&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Go to the Error Tab, search for your error message (You should have got a message identification number)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Select the message and press Information or Warning. The message is redefined as a warning or information.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I do not like the second solution as it may hide some other un-wanted overlap allocation.&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, 27 Oct 2006 15:18:13 GMT</pubDate>
    <dc:creator>CrasyCat</dc:creator>
    <dc:date>2006-10-27T15:18:13Z</dc:date>
    <item>
      <title>How to use src code with on-chip register data type definitions that differ from rest of project</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-src-code-with-on-chip-register-data-type-definitions/m-p/134303#M1562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;I am trying to use code from AN2720, designed for use with HCS12 stationery,&lt;/DIV&gt;&lt;DIV&gt;and its header files, but my project is&amp;nbsp;based on Processor Expert and its header files.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This means that datatypes, in this case flash memory data types,&amp;nbsp;are not recognized&lt;/DIV&gt;&lt;DIV&gt;by my PE based datatypes.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have imported som stationery headers and finally managed to compile correctly,&lt;/DIV&gt;&lt;DIV&gt;but the linker protests since I am trying to overlay my flash register on memory space&lt;/DIV&gt;&lt;DIV&gt;already defined by PE, at 0x100 + REG_BASE)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Q1. What is needed to locate a variable of one datatype at the same adress as another?&lt;/DIV&gt;&lt;DIV&gt;Q2. What is the best and correct way to use HCS12 stationery based sw, in a otherwise PE based environment?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt;Anders J&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The c&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&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>Wed, 25 Oct 2006 20:03:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-src-code-with-on-chip-register-data-type-definitions/m-p/134303#M1562</guid>
      <dc:creator>AndersJ</dc:creator>
      <dc:date>2006-10-25T20:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to use src code with on-chip register data type definitions that differ from rest of project</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-src-code-with-on-chip-register-data-type-definitions/m-p/134304#M1563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello&lt;/DIV&gt;&lt;DIV&gt;You have two solutions to do that:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; 1- Use a macro, which will just be an alternate name for the register defined by processor expert:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For example&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; #define MyAltData PORTA&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;2- You can remap the error message about overlap allocation to a warning or information message.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Start IDE&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Open your project&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Open the target setting dialog&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Switch to "Linker for HC12" panel&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Click on Messages&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Go to the Error Tab, search for your error message (You should have got a message identification number)&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - Select the message and press Information or Warning. The message is redefined as a warning or information.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I do not like the second solution as it may hide some other un-wanted overlap allocation.&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, 27 Oct 2006 15:18:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-src-code-with-on-chip-register-data-type-definitions/m-p/134304#M1563</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2006-10-27T15:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to use src code with on-chip register data type definitions that differ from rest of project</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-src-code-with-on-chip-register-data-type-definitions/m-p/134305#M1564</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 face="Courier New"&gt;Thanks for your comments on the issue.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;1-I have tried the define suggestion.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;It seems to work up and until I get to a point where&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;my&lt;/FONT&gt; &lt;FONT face="Courier New"&gt;original&amp;nbsp;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;register name&amp;nbsp;includes&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;periods which the&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;compiler possibly&amp;nbsp;dislikes.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;Original source code:&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Flash.fclkdiv.byte = Flash.fclkdiv.byte | fclk_val| FDIV8;&lt;BR /&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;Attempt to define:&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;#define Flash.fclkdiv.byte FCLKDIV&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;(FCLKDIV is how PE defines this particular register.)&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;This line compiles OK, but later on when the substitiution needs&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;to take place, there is a a complaint about '}' missing error C2801,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;and fclkdiv not declared, error C1815.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;I have hardcoded this instead, and tried the same method with FDIV&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;which works OK. The only difference between them seem to be the&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;periods in the "Flash.fclkdiv.byte" line.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;2-I also dislike ignoring warnings and errors.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;I want clean compiles/links.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;The define method seems to be best, if I could make it work.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;Can you figure out what is wrong?&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;Thanks,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;Anders&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;Source cutout follows:&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;// Attempt to redefine offending defintions, but it seems the periods are disliked.......&lt;BR /&gt;&lt;FONT color="#3333CC"&gt;#define Flash.fclkdiv.byte FCLKDIV&lt;/FONT&gt;&lt;BR /&gt;#define FDIV8 PRDIV8&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;extern DoOnStack(unsigned int *far address);&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;//*****************************************************************************&lt;BR /&gt;//* Function Name&amp;nbsp;: Flash_Init&lt;BR /&gt;//* Description &amp;nbsp;: Initialize Flash NVM for HC9S12 by programming&lt;BR /&gt;//* &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCLKDIV based on passed oscillator frequency, then&lt;BR /&gt;//*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uprotect the array, and finally ensure PVIOL and&lt;BR /&gt;//*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ACCERR are cleared by writing to them.&lt;BR /&gt;//*&lt;BR /&gt;//*****************************************************************************&lt;BR /&gt;void Flash_Init(unsigned long oscclk)&lt;BR /&gt;{&lt;BR /&gt;unsigned char fclk_val;&lt;BR /&gt;unsigned long temp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;/* Next, initialize FCLKDIV register to ensure we can program/erase */&lt;BR /&gt;&amp;nbsp;temp = oscclk;&lt;BR /&gt;&amp;nbsp;if (oscclk &amp;gt;= 12000) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;fclk_val = oscclk/8/200 - 1; /* FDIV8 set since above 12MHz clock */&lt;BR /&gt;&lt;FONT color="#3333FF"&gt;&amp;nbsp;&amp;nbsp;Flash.fclkdiv.byte = Flash.fclkdiv.byte | fclk_val| FDIV8;&lt;BR /&gt;&lt;/FONT&gt;//&amp;nbsp; &amp;nbsp;&amp;nbsp;FCLKDIV = FCLKDIV | fclk_val| FDIV8;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // WORKS!!!!!!!!!!&lt;BR /&gt;//&amp;nbsp;&amp;nbsp;FCLKDIV = FCLKDIV | fclk_val| FCLKDIV_PRDIV8;&amp;nbsp;&amp;nbsp;&amp;nbsp; // WORKS!!!!!!!!!!&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;&amp;nbsp;else&lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;fclk_val = oscclk/8/200 - 1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;Flash.fclkdiv.byte = Flash.fclkdiv.byte | fclk_val;&lt;BR /&gt;&amp;nbsp;}&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;Flash.fprot.byte = 0xFF; /* Disable all protection (only in special modes)*/&lt;BR /&gt;&amp;nbsp;Flash.fstat.byte = Flash.fstat.byte | (PVIOL|ACCERR);/* Clear any errors&amp;nbsp; */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;}&lt;/FONT&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Oct 2006 16:23:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-src-code-with-on-chip-register-data-type-definitions/m-p/134305#M1564</guid>
      <dc:creator>AndersJ</dc:creator>
      <dc:date>2006-10-27T16:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to use src code with on-chip register data type definitions that differ from rest of project</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-src-code-with-on-chip-register-data-type-definitions/m-p/134306#M1565</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;According to ANSI C definition you cannot have dots in macro names.&lt;/DIV&gt;&lt;DIV&gt;Additionally the two register definition are not compatible at all (there is one level ore in the definition of AN2720.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Here the only choice you have is to either disable the linker message or rewrite the source code to use register names according to Processor Expert definition.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Sorry about that.&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, 31 Oct 2006 19:07:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/How-to-use-src-code-with-on-chip-register-data-type-definitions/m-p/134306#M1565</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2006-10-31T19:07:20Z</dc:date>
    </item>
  </channel>
</rss>

