In addition to Rob's comments above, I would also suggest that you take a look at the supplied MCUXpresso IDE User Guide - there is a section in the Appendix called "Creating bin and hex files" that goes into details on the various options.
In particular, if you just need a one-off generation, then rather than modifying the post-build steps, you can use Project Explorer right click menu -> Binary Utilities options.
Regards,
MCUXpresso IDE Support
Hi,
I'm using MCUXpresso IDE V11.2.1 Build 4149 and SDK_2.x_EVK_MIMXRT1064 version 2.8.6.
This is my Post-build steps:
arm-none-eabi-size "${BuildArtifactFileName}"
arm-none-eabi-objcopy -v -O ihex "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.hex"
arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin"
checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"
I also manually followed the steps in MCUXpresso IDE User Guide to create bin and hex records by using the Binary Utilities.
myproject.axf 'file size' on disk is about 4.42 MB. For each of the above two approaches/methods, the generated myproject.hex and/or myproject.bin 'file size' on disk is about 1.2 GB.
I'm puzzled why the generated hex or bin files are so large. Please help with what I'm doing incorrectly.
Thanks in advance.
By definition a BIN file contains just data, no address information. If there are holes in the address space, then these are filled with zeroes so that the memory that does exist (beyond the holes) is correctly filled.
Basically, BIN files are only suitable for single contiguous address spaces and not for address spaces with holes. You should instead use a format that contains address information, such as SREC or similar.
Here is a copy of the MCUXpresso console output:
Memory region Used Size Region Size %age Used
PROGRAM_FLASH: 493856 B 4 MB 11.77%
SRAM_ITC: 51600 B 128 KB 39.37%
SRAM_DTC: 70240 B 128 KB 53.59%
SRAM_OC: 5624 B 768 KB 0.72%
COLLECT_GCC_OPTIONS='-nostdlib' '-v' '-mcpu=cortex-m7' '-mfpu=fpv5-d16' '-mfloat-abi=hard' '-mthumb' '-T' 'myproject_Debug.ld' '-o' 'myproject.axf' '-march=armv7e-m+fp.dp'
Finished building target: myproject.axf
make --no-print-directory post-build
Performing post-build steps
arm-none-eabi-size "myproject.axf" ; arm-none-eabi-objcopy -v -O ihex "myproject.axf" "myproject.hex" ; arm-none-eabi-objcopy -v -O binary "myproject.axf" "myproject.bin" ; arm-none-eabi-objcopy -v -O srec "myproject.axf" "myproject.s19" ; #checksum -p MIMXRT1064xxxxA -d "myproject.bin"
text data bss dec hex filename
492576 71520 47504 611600 95510 myproject.axf
copy from `myproject.axf' [elf32-littlearm] to `myproject.hex' [ihex]
copy from `myproject.axf' [elf32-littlearm] to `myproject.bin' [binary]
copy from `myproject.axf' [elf32-littlearm] to `myproject.s19' [srec]
The console/command line looks fine.
Can you check if the S19 and iHex really have the right content?
(see https://mcuoneclipse.com/2012/09/27/s-record-intel-hex-and-binary-files/ how they should look like).
Other than that: can you share more, for example your .axf file?
Erich
Thanks for your reply Converse.
I tried both hex and s19 formats, same issue.
My axf file is about 4.42 MB but hex, s19 files are about 1.2 GB each.
This is how I generate any of the above two (2) formats:
- Right click on myproject.axf.
- Select Binary Utilities
- Then I select either Create hex or Create S Record.
I'm doing something incorrectly, unfortunately can not figure out what though.
Any help is greatly appreciated.
The IDE uses the GNU objcopy tool (see GNU Binary Utilities for its command line arguments), and afik there is no option to change the line endings. I believe it is controlled by the host machine. I just checked on my Windows machine and there is \r\n present:
I hope this helps,
Erich
in your project properties select the "Build Steps" tab and edit the "Post build steps".
Most likely there is something like:
arm-none-eabi-size "${BuildArtifactFileName}"
# arm-none-eabi-objcopy -v -O binary "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin"
# checksum -p ${TargetChip} -d "${BuildArtifactFileBaseName}.bin"
in there. Just remove the "#" in front of the two lines to create a binary file and place the correct checksum in the file.
When you replace the "-O binary" with "-O srec" or "-O ihex" you get the output in motorola S-record or intel Hex format.
Rob