Hi,
I am trying to migrate my project to ARM compiler 6.19 from an older version (5.xx).
In Compiler 5.xx, I know that the asm instruction "PRESERVE8" is used to specify that the current file preserves the eight-byte alignment of the stack.
This instruction is causing a linker error and I couldn't find any translation in the document "Migrate ARM Compiler 5 to ARM Compiler 6" or any other online forum.
How do I rewrite this instruction compatible with ARM Compiler 6? Is there any documentation available that describes how to resolve this issue?
Any help is much appreciated. Thank you
It would be something like:
void test(void) { __asm{ "PUSH {r0-r3,lr}" } ...
See developer.arm.com/.../Inline-assembly-with-Arm-Compiler-for-Embedded-6
Are you sure I need to use curly brackets?
From the compiler user manual and reference manual. I also checked the link you provided and after the __asm I need to use normal brackets ().
And I dont see where you put the PRESERVE8 ? Also THUMB is not recognized.
Best regards, Frenk
Apologies for the bracketing typo.
You would not specify PRESERVE8 (or THUMB). Again, the inline/embedded assembler is not the same as the 'full' assembler.
Ok, I understand.
So for inline assembly I dont need to specify this 2 statements as armclang will use them automatically OR do I need to specify any specific flag for this? I know armclang has -mthumb (which is set but also set by default) and in the armlink I can specify 8 byte alignment. But do I need to specify anything else?
I am porting from the very old code and there is everything written :-), so now I have to figure out how to port it to new armclang and this is a working example (check how to call C function and that at end of each line you need \n\t otherwise build fails):
void test(void){ __asm{ "PUSH {r0-r3,lr}\n\t"
void test(void)
{
__asm{
"PUSH {r0-r3,lr}\n\t"
"BL testC\n\t"
Best regards, Iknerf
I don't think there is any special flag needed.
Compiling for Cortex-M implies Thumb code (they do not have the concept of Arm and Thumb state).
I appreciate that porting such code can be a non-trivial task.