Migrating 68332 HiWare project to CodeWarrior 68K

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

Migrating 68332 HiWare project to CodeWarrior 68K

3,984 Views
powerNZ
Contributor III

Hi All,

We have a major (code size and user base) project that runs on the 68332 MCU and was developed using the HiWare tools. The HiWare tools have some issues with the debugging interface which makes debugging operations 'rather hit and miss'.

 

The code for this project can also be compiled with Turbo C++ allowing us to simulate it on the PC (so the code is somewhat 'universal' with conditionals at critical places).

 

Later this year we will migrate the product and application to a newer ColdFire MCU and as part of that process decided to replace the HiWare tools with the CodeWarrior suite as a familiarity exercise.

 

Has anyone ever migrated such a project to CodeWarrior and what steps were required to get it compilable?

 

I have searched the Freescale site but found no references to such a migration path.

 

Is it possible for CodeWarrior to accept an output file from another compiler, along with symbol information, and debug with it?

 

Any comments or pointer apprecuiated!

 

Regards,

Graham

Labels (1)
0 Kudos
Reply
10 Replies

1,402 Views
CrasyCat
Specialist III

Hello

 

HIWARE and CodeWarrior M68K compiler have completely different front end and object file format.

 

CodeWarrior is able to load and debug any ELF DWARF executable file.

Unfortunately the HIWARE M68K compiler/linker was generating executable files in a proprietary format.

CodeWarrior is not able to debug that file format.

 

Around porting application you need to write a brand new linker command file (.prm file for HIWARE tools). Also you need to port all non standard ANSI C construct you have used in your application to the syntax understood by CodeWarrior.

 

If I remember well all extensions to the ANSI C standard are documented in the compiler manual in a section "ANSI-C Front End" -> "Implementation Features" -> "Language Extensions".

 

I would also recommend looking at section "ANSI-C Front End" -> "Implementation Features" -> "Implementation Defined Behavior". This sections specifies how HIWARE compiler handles features which are not fully defined in the standard.

 

Finally you also need to look at the pragmas and check if they are portable to CodeWarrior and how.

 

CrasyCat

0 Kudos
Reply

1,402 Views
powerNZ
Contributor III

Hello CrassyCat,

Thanks for your suggestions, which I have begun putting into place.

 

My first hurdle is that the HiCross compiler has a number of internal defines that control variable length. When we compile with the Turbo C++ this behaviour is reproduced by setting some 'conditional defines' as project options.

 

I don't see an equivalent capability in the CodeWarrior project options. How can I mimic this behaviour?

 

My second hurdle is that the HiCross compiler allows redefinition which CodeWarrior seems not to do. I may need to provide an example here - let me know. These areas of code could be excluded by knowing when CodeWarrior is compiling - is there a define that indicates this?

 

Thnanks,

graham

 

0 Kudos
Reply

1,402 Views
CrasyCat
Specialist III

Hello

 

In CodeWarrior you use the prefix file to add 'conditional defines' as project options.

 

There should be a default prefix file configured in the Target settings panel.

I would recommend you to use your own prefix file, where you include the one

currently used and add your own defines.

 

I do not have a CodeWarrior for M68K installed right now, but as far as I remember you may find the prefix file in the C/C++ language Panel.

This prefix file is a standard ANSI C header file, which is implicitly included at the beginning of each C source file you are building.

 

When you are building with CodeWarrior there should be a predefined symbol  

__MWERKS__ defined automatically.

You should be able to write conditional code depending on that macro.

 

CrasyCat

0 Kudos
Reply

1,402 Views
powerNZ
Contributor III

Hi CrasyCat,

Knowing about the 'prefix' file and reading the manuals has helped (useful to know the terms to explore). However, this has produced other difficulties:

1) The on-line help does not agree with the Menu in the IDE

 

2) I was unable to induce the IDE to create a default prefix file - I have had to start my present project as an 'empty' one as any made with 'stationary' greated a large and undesired folder structure. I created a dummy project from stationary but still no prefix file.

 

3) I have manually created a prefix file using the guidelines in the on-line help. Unfortunately the first line:

#pragma precompile_target B1000.mch

produces the following error:

Error  : preprocessor syntax error

 

and it is complaining about the character prior to the '.'.

 

This does strick as strange and I have tried a reasonable number of combinations without success.

 

Any thoughts?

 

Thanks about the __MWERKS__ definition - this will be useful in the future.

 

Regards,

Graham

0 Kudos
Reply

1,402 Views
CrasyCat
Specialist III

Hello

 

Here it looks like there is s confusion between prefix file and pre-compiled header files.

 

A prefix file is just a standard .h file

The available prefix files are stored somewhere under {Install}\E68K_Support\Runtime directories and have the word prefix in their name.

 

I do not have a CodeWarrior for 68K installed right now, so I am unable to tell you exactly where these are located.

 

CrasyCat

0 Kudos
Reply

1,402 Views
powerNZ
Contributor III

Hi CasyCat,

We have made some progress by removing the first line from the prefix file (yes - I am confused as the prefix file has a .pch extension, which is what the online help directed me to use).

 

That correction got the compiler to prgress further. One issue we encountered was that the compiler was accessing library files for the HiWare compiler, and they have stdtypes.h file that the CodeWarrior compiler does not (simply copied it).

 

I was then advised to provide a linker control file.

 

This project can be compiled in several versions - how do we specific the LCF file name to use?

 

Does the LCF file name have to match the project name, only with the extension different?

 

Thanks for your help thus far - it is greatly appreciated.

 

Regards,

Graham

0 Kudos
Reply

1,402 Views
CrasyCat
Specialist III

Hello

 

Glad you are able to move forward.

 

If I remember well, in the Target settings dialog under group Linker you should have a Panel called "E68K Linker" or something close.

You need to check the box "Use Linker Command file" there.

 

The linker will then use the first file with extension .lcf listed in the Link Order view from the .mcp window.

I would recommend adding only one .lcf file per build target.

 

If you need to maintain several configurations in parallel, just use one build targets per configuration.

You can create additional Build Targets from the Targets tab in the .mcp window.

 

When adding a file to a project you can select in which build targets it should be added.

 

CrasyCat

0 Kudos
Reply

1,402 Views
powerNZ
Contributor III

Hi CrasyCat,

I have gone through the entire Target Settings dialog and found NO reference to the 'Use linker command file' check box - if it is there in this version then it is not obvious. The Help system also makes no reference to such a checkbox.

 

I also changed the LCF filename to match the project, still with the .LCF extension - still the 'linker command file not found' message.

 

I will concentrate on getting one target to function before broadening my horizons.

 

I spent a good deal of time examining the LCF syntax and it is not obvious how to convert the HIWARE file. The documentation provides details of the commands but little on how to put it all together to produce a result (source is around 100 files, 1000's of lines, and multiple memory areas some initalised at runtime and several not). My questions are growing faster than the answers!

 

Any possiblity you could load this IDE version? 

 

Thanks,

Graham

0 Kudos
Reply

1,402 Views
CrasyCat
Specialist III

Hello

 

I am  in a business trip till end of May and will not have any opportunity to look at that till then.

Will try to find some time when I am back

 

CrasyCat

0 Kudos
Reply

1,402 Views
CrasyCat
Specialist III

Hello

 

I finally could get a quick look at that.

 

If you are building from 4th IDE, just make sure you have one file with extension .lcf in your project.

This file will be used as command file by the linker.

 

If you are building from command line, add the name of the .lcf file to your command line.

 

I get the linker to use my .lcf in both case.

I am using CodeWarrior for M68K V3.2.

 

 

CrasyCat

0 Kudos
Reply