Hey All,
I'm using LPC1765 and MCUXpresso IDE v24.9.25.
I have 2 projects, the first one is secondary bootloader, and the second is the main FW.
I was trying to build a combined file so the bootloader will start on address 0x0 until 0x7000 and the FW will start from 0X7000 to the end.
I wrote the linker as the following:
arm-none-eabi-size "${BuildArtifactFileName}"
-print-memory-usage
arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin"
arm-none-eabi-objcopy -O ihex ${BuildArtifactFileName} ${BuildArtifactFileBaseName}.hex
# checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"
cat "${WorkspaceDirPath}\912LT_Bootloader\Debug\912LT_Bootloader.hex" "${BuildArtifactFileBaseName}.hex" > "912LT_Combined.hex"
and also the ld liner script file of the memory:
MEMORY
{
/* Define each memory region */
MFlash256 (rx) : ORIGIN = 0x7000, LENGTH = 0x38000 /* 256K bytes (alias Flash) */
crcSection (rx) : ORIGIN = 0x38000, LENGTH = 0x4 /* 4 bytes (alias Flash2) */
progsizeSection (rx) : ORIGIN = 0x38004, LENGTH = 0x4 /* 4 bytes (alias Flash3) */
progstartSection (rx) : ORIGIN = 0x38008, LENGTH = 0x4 /* 4 bytes (alias Flash4) */
RamLoc32 (rwx) : ORIGIN = 0x10000000, LENGTH = 0x8000 /* 32K bytes (alias RAM) */
RamAHB32 (rwx) : ORIGIN = 0x2007c000, LENGTH = 0x8000 /* 32K bytes (alias RAM2) */
}
I can't figure why the linker doesn't create me a combined file.
I will appreciate any assist in the issue.
Thanks in advance.
Hi Guy_mego
It's difficult to include hex file to linker file. But there is a way to include bin file with linker. See this article below:
https://mcuoneclipse.com/2022/06/17/include-bin-binary-files-in-a-gnu-linker-file/
Hope this helps,
Jun Zhang
Hi ZhangJennie,
Thanks for your answer.
The way I mentioned in my post worked for me with another project.
Since in my project I'm using FOTA that works based on hex file, I've must created a combined hex file.
Is there something else I can or may I missing something in my linker script?
Hi Guy_mego,
We can't combine hex files directly. We suggest converting hex to bin then combining bin files with the article's method.
Hope this helps,
Jun Zhang