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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

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

2,775 次查看
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
 
 
 
 
 
标签 (1)
标记 (1)
0 项奖励
回复
2 回复数

1,357 次查看
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 项奖励
回复

1,357 次查看
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 项奖励
回复