Linker Command File Conditional On Including Files

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

Linker Command File Conditional On Including Files

2,562 Views
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?

Labels (1)
0 Kudos
Reply
3 Replies

1,252 Views
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 Kudos
Reply

1,252 Views
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 Kudos
Reply

1,252 Views
Ioline
Contributor I
Update:  Still not working...
0 Kudos
Reply