Content originally posted in LPCWare by ahp on Tue Jul 03 03:09:17 MST 2012
Thank you very much for your very helpful replies.
I found the part in usb-boot-loader example about starting the user application and updating the interrupt vector, and after remembering to only call SystemInit(); from CMSIS once (I left it in the user application and removed it from the boot switch), then it worked like a charm.
Updating the link script also worked perfectly, thank you. I updated the line:
MFlash512 (rx) : ORIGIN = 0x3000, LENGTH = 0x3D000 /* 256k */
and it works when I download from Red Suite (via Program Flash). The only problem is that my hex file is still not generated correctly. The first three lines of the generated hex file is:
:1000000000800010453100001D310000213100004A
:1000100025310000293100002D3100000259FEEF8A
:10002000000000000000000000000000313100006E
The build command to generate the hex file is:
arm-none-eabi-size ${BuildArtifactFileName}; arm-none-eabi-objcopy -O binary ${BuildArtifactFileName} ${BuildArtifactFileBaseName}.bin ; checksum -p ${TargetChip} -d ${BuildArtifactFileBaseName}.bin; arm-none-eabi-objcopy -I binary -O ihex ${BuildArtifactFileBaseName}.bin ${BuildArtifactFileBaseName}.hex
The .axf file has the correct address, as it works when I download it from Red Suite. The .bin file do not work correctly when I download it from Red Suite, so it must be
arm-none-eabi-objcopy -O binary ${BuildArtifactFileName} ${BuildArtifactFileBaseName}.bin
that does not generate the correct offset (or if the .bin per definition do not include to-data, then it is arm-none-eabi-objcopy -I binary -O ihex ${BuildArtifactFileBaseName}.bin ${BuildArtifactFileBaseName}.hex).
Do you know if I need to update my Post build command for generating the .hex file? I know there are some start address parameters for arm-none-eabi-objcopy, but I have not been able to get them to work. Does anyone know what I am doing wrong, and perhaps have an example of how to use the arm-none-eabi-objcopy to get an offset in the origin / start address?
Thank you again for all the valuable help.