Converting projects from Cosmic to CW

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Converting projects from Cosmic to CW

Jump to solution
3,223 Views
Bruce_andrew
Contributor I
I'm investigating whether to move from using Cosmic to CW, for the HC08 family.

Cosmic allows the project to include some defines. This is useful where you have several target boards using common code. I have 2 boards that use different MCUs (GP32 & GZ16), as well as internal/external CAN controller.

Is there a simple way to add some defines at project level, so that I don't have to change all the source files. I can't see anywhere in CW how to do this.

I found the info in the helpfile - "Porting from Cosmic", but it doesn't seem to mention anything about defines.

I was hoping that CW would be able to import Cosmic projects, but that doesn't seem possible. Seems to be a lot of work to do so manually for each project.

Any help and suggestions appreciated.
Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
1,100 Views
BlackNight
NXP Employee
NXP Employee
Hello,
there is the compiler option -D you can use to add your own defines. Something like
-DmyDefine=1
Simply add this to your make file (if you use one) or add it to the compiler options inside CodeWarrior.
The other thing is you could use the option -AddIncl where you can specify a file to be included for every file compiled, something like
-AddIncl=myheader.h

Regards,
Erich

View solution in original post

0 Kudos
Reply
3 Replies
1,100 Views
Bruce_andrew
Contributor I
Thanks for the reply. I'll give that a go.
0 Kudos
Reply
1,100 Views
Bruce_andrew
Contributor I
I've tried using an include file. It works, but I get some strange error messages.

Looking further, I've found that CW does allow you to use defines. However it's buried in the settings.

Goto Project Settings, Compiler, Language, and then check "preprocessor defines". You can then enter the defines.

IMHO this should be more accessible, but maybe other people don't care for reusing code. We use common source files for multiple projects, so using defines for things like PCB variant, MCU used, etc is VERY handy.

With Cosmic not only can you easily set defines for the project, you can also set defines specific to each source file.
0 Kudos
Reply
1,101 Views
BlackNight
NXP Employee
NXP Employee
Hello,
there is the compiler option -D you can use to add your own defines. Something like
-DmyDefine=1
Simply add this to your make file (if you use one) or add it to the compiler options inside CodeWarrior.
The other thing is you could use the option -AddIncl where you can specify a file to be included for every file compiled, something like
-AddIncl=myheader.h

Regards,
Erich
0 Kudos
Reply