The following are the coding notes when porting from CodeWarrior to GCC.
- User-defined sections declaration:
- GCC does not support the use of variable for global array initialization. However, this support is available in CodeWarrior.
- CodeWarrior
const int var=5;
int arr[var] = {1,2,3,4,var}; // error on gcc
- GCC
int arr[5] = {1,2,3,4,5};
- GCC does not support the use of variable for constant initialization. However, this support is available in CodeWarrior.
- CodeWarrior
const int var=1;
const int var2 = var;
- GCC
const int var2 = 1;
- -n option should be passed to gcc linker.
The program segment gets aligned to its page size which is 0x8000 by default.
This can be removed by -n option. This will disable the page alignment and use the section alignment
on program segment.
- -fextended- identifiers are used in GCC to accept universal characters. However, in CodeWarrior universal characters are accepted by default.
- Changes required in porting CW assembly .s files to GCC syntax:
- Use .global instead of .public.
- Comments to begin with @.
- Put .syntax unified near the start of your assembly source. This turns on Unified Assembly Language, which is required to get all the features of Thumb-2.
- sreg01 .textequ "r1" change to #define sreg01 r1.
- Use option -mimplicit-it=always.