Including A Raw Binary File Into A Linker Script

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

Including A Raw Binary File Into A Linker Script

Jump to solution
5,924 Views
kackle123
Contributor IV

I am using CodeWarrior 10.6 (CW), with gcc, for a Kinetis project, with MQX 4.  I want to include an external binary file from another project and have it linked into this project's output. I read a number of PDFs and forum posts, but I have found the following problems: In the linker script/command file (.ld), the INCLUDE command here means "include another .ld script", NOT "include a binary file".  And, the commands TARGET and OUTPUT_FORMAT are NOT recognized by the linker (arm-none-eabi-gcc); they only cause syntax errors. 

Is this possible in this environment?

1 Solution
5,458 Views
BlackNight
NXP Employee
NXP Employee

If you want to do it with the linker, then there are many possible (maybe more) approaches:

- use a binary include in the as (assembler). This creates a object file you can link with

- use the objcopy to create an object file (See as well Converting a Raw Binary File into an ELF/Dwarf File for Loading and Debugging | MCU on Eclipse  on that subject)

- see Include binary file with GNU ld linker script - Stack Overflow 

I hope this helps,

Erich

View solution in original post

0 Kudos
Reply
2 Replies
5,459 Views
BlackNight
NXP Employee
NXP Employee

If you want to do it with the linker, then there are many possible (maybe more) approaches:

- use a binary include in the as (assembler). This creates a object file you can link with

- use the objcopy to create an object file (See as well Converting a Raw Binary File into an ELF/Dwarf File for Loading and Debugging | MCU on Eclipse  on that subject)

- see Include binary file with GNU ld linker script - Stack Overflow 

I hope this helps,

Erich

0 Kudos
Reply
5,458 Views
kackle123
Contributor IV

I've been searching and trying so hard to get the linker commands to do what I want that I didn't even look for alternative ways.  I'm sure that one of your suggestions will work since it seems the linker commands themselves fall short (despite the fact that the "MCU_Kinetis_Compiler.pdf" that came with the CW installation says "INCLUDE" handles binary files).  Thank you.  And let me say that it is an honor to have you reply to my inquiry; your MCU/Eclipse website has been helpful many times.