Linker Command File Conditional On Including Files

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

Linker Command File Conditional On Including Files

2,697 次查看
Ioline
Contributor I

It is easy to have a linker file include a .bin file, however, is there anyway to have an INCLUDE statement subject to a switch outside the LCF?  To put it another way, can a switch be created in C to tell the lcf to include or not include a file?

标签 (1)
0 项奖励
回复
3 回复数

1,387 次查看
SimonMarsden_de
Contributor II
Sorry, I don't know the answer to your question, but I have a suggestion which might help.

The CodeWarrior assembler also has an incbin statement, so you could add a small assembler file to your project along the lines of:

        .data
        .globl  _myData
_myData:
 #ifdef foo
       .incbin 'file1.bin'
#else
       .incbin 'file2.bin'
#endif


From C, the data would be refered to by the symbol 'myData' without the leading underscore.


Hope this helps


Simon
0 项奖励
回复

1,387 次查看
Ioline
Contributor I

Simon, thanks for your response.  I tried your suggestion and for some reason it says that the binary file does not exist or cannot be opened.  Any thoughts?

0 项奖励
回复

1,387 次查看
Ioline
Contributor I
Update:  Still not working...
0 项奖励
回复