Including A Raw Binary File Into A Linker Script

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

Including A Raw Binary File Into A Linker Script

跳至解决方案
7,781 次查看
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 解答
7,315 次查看
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 项奖励
回复
2 回复数
7,316 次查看
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 项奖励
回复
7,315 次查看
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.