Arm Community
Site
Search
User
Site
Search
User
Support forums
Arm Development Studio forum
printf from assembly
Jump...
Cancel
Locked
Locked
Replies
2 replies
Subscribers
118 subscribers
Views
5772 views
Users
0 members are here
Options
Share
More actions
Cancel
Related
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
Avi Levi
over 12 years ago
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
Parents
Etienne SOBOLE
over 12 years ago
Note: This was originally posted on 24th June 2011 at
http://forums.arm.com
what assembler do you use ?
gcc ?
if you use gcc, write your code in C and then compile it with
gcc -S myfile.c
that will make the assembly code (myfile.s) of your c program.
Then you'll be able to see how the printf work and the syntax will be correct.
Etienne
Cancel
Vote up
0
Vote down
Cancel
Reply
Etienne SOBOLE
over 12 years ago
Note: This was originally posted on 24th June 2011 at
http://forums.arm.com
what assembler do you use ?
gcc ?
if you use gcc, write your code in C and then compile it with
gcc -S myfile.c
that will make the assembly code (myfile.s) of your c program.
Then you'll be able to see how the printf work and the syntax will be correct.
Etienne
Cancel
Vote up
0
Vote down
Cancel
Children
No data