Hello. I am using LPCXpresso to develop software for LPC11C12.
The generated build-artifact has the .axf extension. I would like to generate a binary file from that so I am using the following command:
arm-none-eabi-objcopy --reverse-bytes=4 -v -O binary "myArtifact.axf" "myArtifact.bin"
I am getting this error:
arm-none-eabi-objcopy.exe: cannot reverse bytes: length of section .debug_info must be evenly divisible by 4
A .bin file is generated but when I write it to the flash memory it does not work (it works when I write the axf file to flash). If I inspect the axf and bin files using a hex-editor the bytes order is reversed.
Can anyone suggest a solution, maybe a way to add a padding to debug_info to make it divisible by 4? I would prefer not to reverse the bytes order manually as I want to use the .bin file in production.
Why are you using "reverse-bytes"? It is not needed when converting an AXF file into a binary. In fact (as you have discovered) it will reverse the byte order, thus breaking your binary!
See chapter 16.11 "Creating bin hex or S-Record files" in the MCUXpresso User Guide for more information.