Arm Community
Site
Search
User
Site
Search
User
Support forums
Arm Development Studio forum
C headers in assembly
Jump...
Cancel
Locked
Locked
Replies
3 replies
Subscribers
119 subscribers
Views
3118 views
Users
0 members are here
Options
Share
More actions
Cancel
Related
How was your experience today?
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
C headers in assembly
Rohan Gandhi
over 12 years ago
Note: This was originally posted on 5th April 2011 at
http://forums.arm.com
Hello!
I am facing a problem while including a C header in the assembly.
My assembly code is as follows -
#include "header01.h"
.syntax unified
.text
.thumb
/* uint8 mycode_func(void) */
.global mycode_func
.func mycode_func, mycode_func
.type mycode_func, %function
.thumb_func
mycode_func:
mov R0, #MY_CONSTANT
.endfunc
header01.h has -
#define MY_CONSTANT 10
This code gives an error - undefined symbol MY_CONSTANT.
If I change mov R0, #MY_CONSTANT to mov R0, 10, it works well.
What do I need to do to get this to work?
Thanks in advance!!
Parents
Scott Douglass
over 12 years ago
Note: This was originally posted on 5th April 2011 at
http://forums.arm.com
You need to have the assembler run the preprocessor over the input file first. I think the usual way to get this done by GNU tools is to name the file 'foo.S' instead of 'foo.s'. Possibly you need to build it using gcc, for example: 'gcc -c foo.S'. There's probably also an option to the assembler to force the preprocessing.
Cancel
Vote up
0
Vote down
Cancel
Reply
Scott Douglass
over 12 years ago
Note: This was originally posted on 5th April 2011 at
http://forums.arm.com
You need to have the assembler run the preprocessor over the input file first. I think the usual way to get this done by GNU tools is to name the file 'foo.S' instead of 'foo.s'. Possibly you need to build it using gcc, for example: 'gcc -c foo.S'. There's probably also an option to the assembler to force the preprocessing.
Cancel
Vote up
0
Vote down
Cancel
Children
No data