How to generate srec or bin file in MCUXpresso IDE

cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate srec or bin file in MCUXpresso IDE

Jump to solution
7,688 Views
Contributor III

Hello, can you help to check where to set generating srec file or bin file when compiling in MCUXpresso? Thanks!

Best Regards,

Shaowei

Tags (2)
1 Solution
966 Views
NXP Employee
NXP Employee

I have posted a document on that topic here:

https://community.nxp.com/docs/DOC-333991 

Erich

View solution in original post

0 Kudos
7 Replies
966 Views
NXP Employee
NXP Employee

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

0 Kudos
967 Views
NXP Employee
NXP Employee

I have posted a document on that topic here:

https://community.nxp.com/docs/DOC-333991 

Erich

View solution in original post

0 Kudos
966 Views
Contributor I

Is there a way to specify the EOL character?  I am wanting the output to match the format of an output file from Code Warrior that specified the EOL character as DOS(\r\n).

0 Kudos
966 Views
Senior Contributor II

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:

pastedImage_2.png

I hope this helps,

Erich

0 Kudos
966 Views
Contributor III

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

966 Views
Contributor III

One more question, if I want to specify dedicated data per line in srec format, how to set it.

For example, 32 byts per line or 64 byts per line.

Best Regards,

Shaowei

0 Kudos
966 Views
Contributor III

Add the option --srec-len 32 or --srec-len 64 tp the options, so the line then reads:

arm-none-eabi-objcopy -v -O srec --srec-len 64 "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin"