I don't know if this is recommended or not but I am sure someone will give me a stern warning if not. I have posted a duplicate question in stackoverflow, however this may be just as appropriate here given that it's for an embedded platform and a number of embedded developers frequent this stackexchange. Not getting much traction over there either...
I have a bit of assembly in a hard fault handler. The assembly is basically meant to pass the current stack pointer as a parameter (in R0). It looks like so...
__asm(" mov r0, sp\n"
" bl SavePC\n"
" bx lr");
This works fine when SavePC is in the same c file. However, when SavePC is placed in another c file I have no luck. I have tried to IMPORT the function like so...
__asm("IMPORT SavePC\n"
" mov r0, sp\n"
" bl SavePC\n"
" bx lr");
... but I must be doing something incorrect. The compiler reports the following...
Error[Og005]: Unknown symbol in inline assembly: "IMPORT"
Error[Og005]: Unknown symbol in inline assembly: "SavePC"
Error[Og006]: Syntax error in inline assembly: "Error[54]: Expression can not be forward"
Error[Og005]: Unknown symbol in inline assembly: "SavePC"
Error while running C/C++ Compiler
The c file with the assembly includes the header file with the SavePC prototype...
extern void SavePC(unsigned long);
Suggestions?
Error[Og006]: Syntax error in inline assembly: "Error[54]: Expression can not be forward"... – perilbrain Oct 5 '12 at 22:02