how to link data in assembly data file to c code file

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to link data in assembly data file to c code file

1,958 Views
kyk27
Contributor I
Hi, there!
Please help me if someone knows this:
 
I'm programming for mpc5200b in CW mobile GT v.8.5 environment.
I added a assembly file(bitmp.asm) which has bitmap data in the project.
The contents of the file, bitmp.asm, are something like this:
 
.data
 
;public cMyPic line 1
 
cMyPic:  .byte  0x42,0x4D,0x5E,0x0,0x0,0x0,0x0,0x0
               .byte  0x0,0x0,0x3E,0x0,0x0,0x0,0x28,0x0
               .byte  0x0,0x0, ...
               ...
 
I want to use the variable name 'cMyPic' in my main function, so I defined the variable in main:
extern char cMyPic[ ];
, but it did not work.
Does anyone know how to call the 'cMyPic' variable in assembly file from c file?
 
Thanks,
 
K-Young
 
 
 
 
 
Labels (1)
0 Kudos
Reply
2 Replies

540 Views
RichTestardi
Senior Contributor II
Perhaps your assembler file should use the symbol _cMyPic, with a leading underscore?  Many C compilers (used to?) automatically prefix C symbols with an underscore in the object files.
 
0 Kudos
Reply

540 Views
kyk27
Contributor I
Thanks, Rich!
It was .public directive, not the public.
I didn't know that CW's assember include '.' before using directive.
 
Thanks.
 
K-Young
0 Kudos
Reply