Page 1 of 1

Updating .h etc files in project?

Posted: Thu Nov 04, 2010 10:55 am
by GrahamB
Hello,
I'm a noob, so please forgive some naivety...

I've just tried "make"ing the ver 2.891 code in the free version of Codewarrior 5.90
I get lots of undeclared variable and type mis-match errors. I fixed some of them by searching
the megamanual site and discovering that the timer variables pTC0 etc are defined in the
.h file directly linked here:
http://www.megamanual.com/ms2/hcs12def.h
but are named as TCO etc in the corresponding file in the zipped project download.

Are there other files that should be updated?

Some other stuff is hard to see as an update issue, ie pTIC and pTOC are defined as arrays of
pointers to volative unsigned shorts, but are assigned as though having one less level
of indirection, viz arrays of volatile unsigned shorts...

So what am I doing wrong :?:

Also, as a hint, just how much code would I need to junk to get below the 32k limit?
I can certainly live without knock sensing, flex fuel, EDIS and a lot of other trigger options
(this is for a uS going on a motorcycle with toothed wheel)... but will that be enough?

Re: Updating .h etc files in project?

Posted: Thu Nov 04, 2010 3:05 pm
by grippo
GrahamB wrote:Hello,
I'm a noob, so please forgive some naivety...

I've just tried "make"ing the ver 2.891 code in the free version of Codewarrior 5.90
I get lots of undeclared variable and type mis-match errors. I fixed some of them by searching
the megamanual site and discovering that the timer variables pTC0 etc are defined in the
.h file directly linked here:
http://www.megamanual.com/ms2/hcs12def.h
but are named as TCO etc in the corresponding file in the zipped project download.

Are there other files that should be updated?

Some other stuff is hard to see as an update issue, ie pTIC and pTOC are defined as arrays of
pointers to volative unsigned shorts, but are assigned as though having one less level
of indirection, viz arrays of volatile unsigned shorts...

So what am I doing wrong :?:

Also, as a hint, just how much code would I need to junk to get below the 32k limit?
I can certainly live without knock sensing, flex fuel, EDIS and a lot of other trigger options
(this is for a uS going on a motorcycle with toothed wheel)... but will that be enough?
I don't know anything about CW above V4.5, but the types of variables are what they are - I can't believe CW changed these conventions, unless it is to use uint8, uint16, etc instead of char and short - that makes sense. But other than this, you should not have to change anything. The p in PTOC means it is a pointer, so it would be set to an address directly and *pTOC means the value at the address. The only other thing I can think of is that the compiler often goes nuts after it finds one error, for example leaving out a ;, and spews out dozens of errors thereafter, all of which may be cleared when you correct the first error.

The biggest change when 4.5 came out was that all variables called tmpn, n=1,2,3,.. had to be renamed tmpxn to make it happy - evidently tmp became a reserved word.

Other files used are the cltfactor, matfactor, egofactor, etc, which are sensor calibrations.

With 2.89x code don't think it is that hard to get below the 32k. If you don't need CAN, I would start with that - its fairly large. Once you get a good compile, the compiler will tell you what the code size is.