EmbeddedRelated.com
Forums
Memfault Beyond the Launch

CodeWarrior for HCS12X - ANSI-compliant??

Started by Florian E. Teply May 28, 2008
Hey folks,

i got some strange problems with CodeWarrior for freescale's
HCS12X family. On various occasions it complains about variable types 
like "uint8_t" not being defined. As far as i know, uint8_t is required
by ANSI-C though as some fixed-size type.

Am i plain wrong here or does codewarrior behave strange indeed??

TIA,
Florian
Florian E. Teply wrote:

> i got some strange problems with CodeWarrior for freescale's > HCS12X family. On various occasions it complains about variable types > like "uint8_t" not being defined. As far as i know, uint8_t is required > by ANSI-C though as some fixed-size type. > > Am i plain wrong here or does codewarrior behave strange indeed??
Did you included stdint.h? -- Frank Buss, fb@frank-buss.de http://www.frank-buss.de, http://www.it4-systems.de
Frank Buss <fb@frank-buss.de> wrote:
> Florian E. Teply wrote:
> > i got some strange problems with CodeWarrior for freescale's > > HCS12X family. On various occasions it complains about variable types > > like "uint8_t" not being defined. As far as i know, uint8_t is required > > by ANSI-C though as some fixed-size type. > > > > Am i plain wrong here or does codewarrior behave strange indeed??
> Did you included stdint.h?
I tried to, but the compiler can't find stdint.h (it's not even on disk, i verified that at first). It's defined in PE_Types.h (some custom stuff for freescale's Processor Expert) though, which i included. On the other hand, redefining the function as to return byte doesn't do the trick either :-( Greetings, Florian
Florian E. Teply <onlinefloh@usenet.cnntp.org> wrote:
> Frank Buss <fb@frank-buss.de> wrote: > > Florian E. Teply wrote:
> > > i got some strange problems with CodeWarrior for freescale's > > > HCS12X family. On various occasions it complains about variable types > > > like "uint8_t" not being defined. As far as i know, uint8_t is required > > > by ANSI-C though as some fixed-size type. > > > > > > Am i plain wrong here or does codewarrior behave strange indeed??
> > Did you included stdint.h?
> I tried to, but the compiler can't find stdint.h (it's not even on > disk, i verified that at first). It's defined in PE_Types.h (some custom > stuff for freescale's Processor Expert) though, which i included. > On the other hand, redefining the function as to return byte doesn't do > the trick either :-(
As another strange sidenote: uint8_t is used several times in the same file, and works as it should on every single occasion, as long as the line number doesn't exceed 500... Greetings, Florian
On 2008-05-28, Florian E. Teply <onlinefloh@usenet.cnntp.org> wrote:
> > i got some strange problems with CodeWarrior for freescale's > HCS12X family. On various occasions it complains about variable types > like "uint8_t" not being defined. As far as i know, uint8_t is required > by ANSI-C though as some fixed-size type. > > Am i plain wrong here or does codewarrior behave strange indeed??
As Frank Buss has pointed out, make sure that you have included stdint.h. However, stdint.h is only defined in the ISO C99 standard and not the original ANSI C specification. -- Andrew Smallshaw andrews@sdf.lonestar.org
Andrew Smallshaw <andrews@sdf.lonestar.org> wrote:
> On 2008-05-28, Florian E. Teply <onlinefloh@usenet.cnntp.org> wrote: > > > > i got some strange problems with CodeWarrior for freescale's > > HCS12X family. On various occasions it complains about variable types > > like "uint8_t" not being defined. As far as i know, uint8_t is required > > by ANSI-C though as some fixed-size type. > > > > Am i plain wrong here or does codewarrior behave strange indeed??
> As Frank Buss has pointed out, make sure that you have included > stdint.h. However, stdint.h is only defined in the ISO C99 standard > and not the original ANSI C specification.
Umm, this may explain the missing stdint.h even though C99 is around now for quite some time... Funny thing is: it's defined here in PE_Types.h which i included. And the compiler doesn't complain about it the first two dozen times, but after about line 550 it has forgotten about that and several other standard types and #defines :-( Greetings, Florian
Andrew Smallshaw <andrews@sdf.lonestar.org> wrote:
> On 2008-05-28, Florian E. Teply <onlinefloh@usenet.cnntp.org> wrote: > > > > i got some strange problems with CodeWarrior for freescale's > > HCS12X family. On various occasions it complains about variable types > > like "uint8_t" not being defined. As far as i know, uint8_t is required > > by ANSI-C though as some fixed-size type. > > > > Am i plain wrong here or does codewarrior behave strange indeed??
> As Frank Buss has pointed out, make sure that you have included > stdint.h. However, stdint.h is only defined in the ISO C99 standard > and not the original ANSI C specification.
Ouch, found the mistake i was making: I had one pair of curly brackets left unclosed... I better check that more thoroughly next time. Sorry for the noise Florian
"Florian E. Teply" wrote:
> > i got some strange problems with CodeWarrior for freescale's > HCS12X family. On various occasions it complains about variable > types like "uint8_t" not being defined. As far as i know, uint8_t > is required by ANSI-C though as some fixed-size type. > > Am i plain wrong here or does codewarrior behave strange indeed??
That is required only by C99 (not earlier standards) and even then only if available on the hardware. However the various forms of char (un/signed/char) are always available. -- [mail]: Chuck F (cbfalconer at maineline dot net) [page]: <http://cbfalconer.home.att.net> Try the download section. ** Posted from http://www.teranews.com **
"Florian E. Teply" wrote:
>
... snip ...
> > As another strange sidenote: uint8_t is used several times in the > same file, and works as it should on every single occasion, as > long as the line number doesn't exceed 500...
Please explain how an 8-bit value can express a number outside the range 0 .. 255. -- [mail]: Chuck F (cbfalconer at maineline dot net) [page]: <http://cbfalconer.home.att.net> Try the download section. ** Posted from http://www.teranews.com **
On May 28, 8:01 am, onlinef...@usenet.cnntp.org (Florian E. Teply)
wrote:

> Ouch, found the mistake i was making: > > I had one pair of curly brackets left unclosed... > > I better check that more thoroughly next time.
Yeah, sometimes it's good to periodically put your code through indent or an editor with comparable capability. Not only makes it more readable, but often a fast way to catch unexplained mystery errors. IDE's are nice, but the problem with having so many of them is that you end up with so many different editors.

Memfault Beyond the Launch