I decided to migrate a codewarrior for coldfire (V2), 5.9 version project to new codewarrior based on eclipse, version 11. This is forced because upgrading PC from windows XP to windows 10.
I maked some changes in the code, and now it compiles and generate a ELF file.
But when i run the board with this ELF file, it doesn't start.
When i debug this program, it stops with a "adress error". The code is the same with codewarriro classic. Viewing registry, i can see a wrong values in A7 address (stack pointer). And the value son the stack is no linear.
I debug now in disassembly, and view differences from classic IDE.
When the code call the first function, the code is:
- link a6, #0
- move.l a4, -(a7)
- move.l a3, -(a7)
but in classic codewarrior, and not in eclipse, has too:
- subq.l #4, a7.
This line (subq.l...) not appears in all functions, so i think there is special instruction in this location for something that i don't know.
I try to put this assembly line manually, and when the code runs, all is ok, but a few lines later it falls again. So i discarded put some assembly code manually because it's impossible to know what and where.
In the project properties of both IDEs, i have marked "A6 Stack Frames".
My questions are:
- How works stack pointer? Is A7 or A6? Why uses both in assembly code?
- I think there is two possible reason to this error: some incorrect project property or a bug in the compiler. I checked all properties, so i can only think that is the compiler. The compiler is not GNU. What i can do?
Thanks in advanced.