<?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: Cosmic Compiler Port in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Cosmic-Compiler-Port/m-p/207946#M8050</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi Steve,&lt;BR /&gt;&lt;BR /&gt;I think you misunderstood here what _BASE is for.&lt;BR /&gt;I dont think this is the multiple time inclusion guard, instead for the S12's, the register block is moveable and this _BASE is a way an user could adapt this library to use an alterative base address.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Apr 2008 09:33:32 GMT</pubDate>
    <dc:creator>CompilerGuru</dc:creator>
    <dc:date>2008-04-11T09:33:32Z</dc:date>
    <item>
      <title>Cosmic Compiler Port</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Cosmic-Compiler-Port/m-p/207943#M8047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying to port a MicroC OS II project from Cosmic CrapPiler to Codewarrior. I'm getting like 51 L1818 errors.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's an example of one...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Link Error&amp;nbsp;&amp;nbsp; : L1818: Symbol 241 - PORTA duplicated in OS_FLAG.C.o and OS_CORE.C.o&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;I have no idea why its doing this. I have PORTA defined in iosc32.h which is a Cosmic include file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's part of the source:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/*&amp;nbsp;&amp;nbsp;&amp;nbsp; IO DEFINITIONS FOR MCS912C32&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;*&amp;nbsp;&amp;nbsp;&amp;nbsp; Copyright (c) 2003 by COSMIC Software&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#ifndef _BASE&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define _BASE&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#endif&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define _IO(x)&amp;nbsp;&amp;nbsp;&amp;nbsp; @(_BASE)+(x)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;typedef unsigned char __uchar;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;typedef unsigned int __uint;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/*&amp;nbsp;&amp;nbsp;&amp;nbsp; MEBI Module&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;volatile __uchar PORTA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _IO(0x00);&amp;nbsp;&amp;nbsp; /* port A */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;volatile __uchar PORTB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _IO(0x01);&amp;nbsp;&amp;nbsp; /* port B */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;volatile __uchar DDRA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _IO(0x02);&amp;nbsp;&amp;nbsp; /* data direction port A */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;volatile __uchar DDRB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _IO(0x03);&amp;nbsp;&amp;nbsp; /* data direction port B */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;volatile __uchar PORTE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _IO(0x08);&amp;nbsp;&amp;nbsp; /* port E */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;volatile __uchar DDRE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _IO(0x09);&amp;nbsp;&amp;nbsp; /* data direction port E */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So PortA is defined here...and not in OS_FLAG.c.o or that other file. Infact its not even used in any of those files? Anyone know what this is?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Also I have not set any linker settings...not sure how that's done here. I heard that Codewarrior links for you?&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Mar 2008 04:00:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Cosmic-Compiler-Port/m-p/207943#M8047</guid>
      <dc:creator>Ken32</dc:creator>
      <dc:date>2008-03-30T04:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Cosmic Compiler Port</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Cosmic-Compiler-Port/m-p/207944#M8048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;CW wants for every variable one definition, but your header is&lt;BR /&gt;currently defining all the variables (and not just declares them). Basically&lt;BR /&gt;absolute allocated variables with @ are behaving not different from any other variable (or function).&lt;BR /&gt;To fix your case, the simplest is to add an extern, which is disabled for all but a single use case.&lt;BR /&gt;E.g. something like:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;// header.h#ifndef DEFINE_VARS_IO#define EXT_IO extern#else#define EXT_IO#endif...EXT_IO volatile __uchar PORTA       _IO(0x00);   /* port A */EXT_IO volatile __uchar PORTB       _IO(0x01);   /* port B */....and in  one C file, or in a new dedicated one:#define DEFINE_VARS_IO#include "header.h"&lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;Daniel&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Mar 2008 09:18:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Cosmic-Compiler-Port/m-p/207944#M8048</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2008-03-30T09:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Cosmic Compiler Port</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Cosmic-Compiler-Port/m-p/207945#M8049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Ken&lt;/DIV&gt;&lt;DIV&gt;Just looked at your code - happens to be very similar to an issue I have been sorting out with a colleague who has previously used a different compiler. Can I suggest the following change:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Here's part of the source:&lt;BR /&gt;/*&amp;nbsp;&amp;nbsp;&amp;nbsp; IO DEFINITIONS FOR MCS912C32&lt;BR /&gt;&amp;nbsp;*&amp;nbsp;&amp;nbsp;&amp;nbsp; Copyright (c) 2003 by COSMIC Software&lt;BR /&gt;&amp;nbsp;*/&lt;BR /&gt;#ifndef _BASE&lt;BR /&gt;#define _BASE&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;BR /&gt;&lt;FONT color="#ff0000"&gt;&lt;STRONG&gt;&lt;STRIKE&gt;#endif&lt;/STRIKE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;- MOVE THIS STATEMENT to the end of the file&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;#define _IO(x)&amp;nbsp;&amp;nbsp;&amp;nbsp; @(_BASE)+(x)&lt;BR /&gt;&lt;BR /&gt;typedef unsigned char __uchar;&lt;BR /&gt;typedef unsigned int __uint;&lt;BR /&gt;&lt;BR /&gt;/*&amp;nbsp;&amp;nbsp;&amp;nbsp; MEBI Module&lt;BR /&gt;&amp;nbsp;*/&lt;BR /&gt;volatile __uchar PORTA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _IO(0x00);&amp;nbsp;&amp;nbsp; /* port A */&lt;BR /&gt;volatile __uchar PORTB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _IO(0x01);&amp;nbsp;&amp;nbsp; /* port B */&lt;BR /&gt;volatile __uchar DDRA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _IO(0x02);&amp;nbsp;&amp;nbsp; /* data direction port A */&lt;BR /&gt;volatile __uchar DDRB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _IO(0x03);&amp;nbsp;&amp;nbsp; /* data direction port B */&lt;BR /&gt;volatile __uchar PORTE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _IO(0x08);&amp;nbsp;&amp;nbsp; /* port E */&lt;BR /&gt;volatile __uchar DDRE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _IO(0x09);&amp;nbsp;&amp;nbsp; /* data direction port E */&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;&lt;FONT color="#339900"&gt;&lt;STRONG&gt;#endif&lt;/STRONG&gt;&amp;nbsp; &lt;STRONG&gt;/* _BASE */&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;&amp;lt;- put the statement here&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Now the first time the compiler goes through the file, it will define _BASE and process the rest of the header. The second time the compiler opens the header file, it sees _BASE is defined and skips everything else.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;IMHO the CodeWarrior compiler is more strict (sensitive) about stuff like this.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Good luck with your coding&lt;/DIV&gt;&lt;DIV&gt;Steve&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2008 07:51:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Cosmic-Compiler-Port/m-p/207945#M8049</guid>
      <dc:creator>Stephen</dc:creator>
      <dc:date>2008-04-11T07:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: Cosmic Compiler Port</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Cosmic-Compiler-Port/m-p/207946#M8050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi Steve,&lt;BR /&gt;&lt;BR /&gt;I think you misunderstood here what _BASE is for.&lt;BR /&gt;I dont think this is the multiple time inclusion guard, instead for the S12's, the register block is moveable and this _BASE is a way an user could adapt this library to use an alterative base address.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2008 09:33:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Cosmic-Compiler-Port/m-p/207946#M8050</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2008-04-11T09:33:32Z</dc:date>
    </item>
  </channel>
</rss>

