Content originally posted in LPCWare by stephen55 on Thu Jul 25 10:38:43 MST 2013
Quote: TKoe
Uh.. to change the starting address I just to to the project properties -> C/C++ Build -> MCU settings. There I change the "Location" address for the Flash (and size obviously, too) and hit "Apply" (<- that is important, it will have no effect if you don't click on Apply!).
Then in C/C++ Build -> Settings -> Build Steps I use the following command in Post-build steps:
<code>arm-none-eabi-size "${BuildArtifactFileName}"; arm-none-eabi-objcopy -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" ; checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"; arm-none-eabi-objcopy -O ihex "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.hex" ;</code>
That has so far worked perfectly.
Or am I understanding the question wrong?
Hi TKoe,
By doing those steps, it looks like you are creating a .bin file with the checksum, and then creating a .hex file without the checksum. Is the checksum information actually in the .hex file? I tried it out and it wasn't in there.
Quote: TheFallGuy
By definition, a binary file contains no address information. A binary file contains just data. So, converting to binary all address information is lost.
I think you can use objdump to re-base the hex file with the --image-base option.
Alright that makes sense. I still don't understand much about the binary format, but if it's being programmed to flash, I would think that there'd be some way of inferring address information from it.
The --image-base option sounds promising. I tried:
arm-none-eabi-objcopy --image-base 0x10000 -I binary -O ihex ${BuildArtifactFileBaseName}.bin ${BuildArtifactFileBaseName}.hex
It didn't work, but it seems like a possibility. I need to read up a little more.