This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

printf from assembly

Note: This was originally posted on 24th June 2011 at http://forums.arm.com

Hi,
I am trying to call printf from an assembly code but getting into some difficulties.
I found this post: How to Call a Function from ARM Assembler
However, when using the printf inside my code I get a linker error:

Error: L6238E: foo.o(.text) contains invalid call from '~PRES8' function to 'REQ8' function foobar

Searched for that as well, and found that I am calling a C function that requires 8-byte stack alignment
from an assembly code that does not preserve 8-bytes. (Hence the ~PRES8 and REQ8)
The article suggested that I should add the PRESERVE8 directive before my AREA directive:

add the PRESERVE8 directive to the top of each assembler file. For example, change:

    AREA Init, CODE, READONLY

to:

    PRESERVE8 AREA Init, CODE, READONLY



But when I do that I get an error that says:

Bad symbol 'AREA' not defined or external.




Can anyone please help me figure out how to do it right?




Thank you
0