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,497件の閲覧回数
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,079件の閲覧回数
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,079件の閲覧回数
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 件の賞賛
返信