Hello.
I am developing an embedded system with S32DS and I have a problem.
I have to write an assembly function as below:
asm volatile void OSPendSVException (void)
{
add sp, sp, #(9*4)
pop {pc}
bx lr
}
__asm void OSPendSVException1(void)
{
add sp, sp, #(9*4)
pop {pc}
bx lr
}
__asm__ void OSPendSVException2(void)
{
add sp, sp, #(9*4)
pop {pc}
bx lr
}
When compiling, the three functions above all have errors as below.
I wonder to know how to write assembly function in S32DS.
Thank you very much.
Hello Jiri. Thank you very much for the help.
In the document about ARM and GCC, there are methods about how to write incline assembly code in C function.
My problem is that the whole function should be written as assembly function instead of some statements are written in assembly code.
This problem is in using the AutoSAR OS provided by NXP. In Os_hw_core_compiler.h file, there are some functions as below:
OSASM OSDWORD OSGETSTACKPOINTER_ (void)
{
mr r3, r1
}
The micro OSASM is defined as:
#if defined(OSDIABPPC)
#define OSASM __asm volatile
#endif /* defined(OSDIABPPC) */#if defined(OSCWPPC)
#define OSASM asm
#endif /* defined(OSCWPPC) */#if defined(OSGHSPPC)
#define OSASM asm
#endif /* defined(OSGHSPPC) */
In S32DS, I could not figure out how to define to OSASM write a whole assembly function.
Please help me about above problem.
Thank you very much.
Have a nice work.
Hi,
I'm afraid that gcc doesn't have such functionality. You can use only inline assembly.
You can move your existing assembly code into .S file in S32DS project and call it from C code.
Jiri
Hi,
in S32DS you can use GNU inline assembly syntax. For more details you can look here:
http://www.ic.unicamp.br/~celio/mc404-s2-2015/docs/ARM-GCC-Inline-Assembler-Cookbook.pdf
Jiri