Hello.
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.
Solved! Go to Solution.
Hi,
I find the answer. The problem was the method to paramerer passing. By default, in codewarrior 11 is set to "register", so my setup in codewarrior classic is in "compact".
I just need to add "#pragma compact_abi" in the code and now can i see the "lost code" (subq.l #4, a7).
Now my board start and appears to be good. Now i'm testing.
Thanks.
Hi David,
How was you project migrated? There are many versions in between the CodeWarrior versions you mention. I would recommend that you follow the the steps mentioned by my colleague Pascal on the following post:
https://community.nxp.com/thread/379597#comment-585434
Hope it helps!
Best Regards,
Carlos Mendoza
Technical Support Engineer
Hi,
I find the answer. The problem was the method to paramerer passing. By default, in codewarrior 11 is set to "register", so my setup in codewarrior classic is in "compact".
I just need to add "#pragma compact_abi" in the code and now can i see the "lost code" (subq.l #4, a7).
Now my board start and appears to be good. Now i'm testing.
Thanks.