With my Freedom KL25Z board I’m using the GNU/gcc build tools and Eclipse/CodeWarrior. When I wanted to create an S19 file of my application using the GNU tools, this was not that easy to find out. So here are the steps to do this:
I open the project setting using the menu Project > Properties and go to C/C++ Build > Settings > Additional Tools and enable’Create Flash Image‘:
Now I need to press the Apply button:
Pressing the Apply button will show up an additional ‘Create Flash Image’ group. Many other formats are available in the drop down as shown in the screenshot.
Now I can specify S-Record/S19 as output format:
Pressing OK, and building my project again will show up the S19 file together with the application file:
Post Build Step
A generic way to generate the S19 file is to use a post build step:
In the above screenshot, I’m using the objcopy (which is present in my PATH environment variable). It is using the command line options described here. See DIY Free Toolchain for Kinetis: Part 2 – Eclipse IDE for more details.
Happy Tooling 🙂
Reblogged this on Sutoprise Avenue, A SutoCom Source.
LikeLike
Pingback: Code Size Information with gcc for ARM/Kinetis | MCU on Eclipse
Pingback: S-Record, Intel Hex and Binary Files | MCU on Eclipse
I think it is better to use suffix .s19 for a s-record file instead of suffix .hex, right?
LikeLike
Yes, agreed. I see that the output file name in the plugin is hard-coded always to use the .hex extension. But it is possible to overwrite this. In the settings, change the command line pattern from
“${ARMSourceryDir}/${COMMAND}” ${INPUTS} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX} ${OUTPUT}
to
“${ARMSourceryDir}/${COMMAND}” ${INPUTS} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX} myFile.s19
LikeLike
You can use the Variable ProjName so that the file will be “demo.s19” if your project name is “demo”
“${ARMSourceryDir}/${COMMAND}” ${INPUTS} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX}${ProjName}.s19
LikeLike
Many thanks for that solution, very useful!
LikeLike
Very useful. Thanks for the tips. But one additional question. The size of a line is only 43 characters (16 bytes of binaries.) It should have an option to specify the size, isn’t it? What would that be?
LikeLike
Yes, there is an option:
–srec-len
But you need to add this option to the command line, or to use a post build step.
I have updated the post with that information.
I hope this helps.
LikeLike
Pingback: The Quotation Problem | MCU on Eclipse
I have a FRDM Board and I loaded CodeWarrior Dev Studio and when I follow these steps Everything looks like it should work, but I don’t get the srec file showing up in the project explorer like it does in this example.. What am I doing wrong? I see my .elf and .map but i’m not getting an srec..
LikeLike
Hi Jeff,
Can you check the Console view if it shows that it generates the file?
It should write something like ‘Invoking: ARM Ltd Windows GNU Create Flash Image’.
Then be aware that by default the file name extension is .hex (and not .S19 or something similar).
I hope this helps.
LikeLike
Hi Jeff,
just as an FYI: I have found the S19 or Code size information not generated if I had a linked file to a non-existing HTML file in project. I had this linked file to the index.html of my doxygen files. For whatever reason this impacted the build process. Having that linked file removed or having the destination of the link present fixed the problem. Just in case you run into that same corner case.
LikeLike
Eric,
What if the ‘Invoking: ARM Ltd Windows GNU Create Flash Image’ is not showing up?
LikeLike
Hi Mike,
maybe this one helps:
https://mcuoneclipse.com/2013/06/12/traps-and-pitfalls-no-hexbins19-file-created-with-gnu/
?
LikeLike
Pingback: Decoding S19 Files | MCU on Eclipse
Pingback: Using the Freedom Board as JTAG Programmer | MCU on Eclipse
Pingback: Serial Bootloader for the Freedom Board with Processor Expert | MCU on Eclipse
Pingback: Traps and Pitfalls: No Hex/Bin/S19 File Created with GNU? | MCU on Eclipse
Thank you Erich!!!
Recently I had a problem, I burn my FRDM-KL25Z board when soldering, and it is not possible to debug from Codewarrior with its debugger (it shows the open SDA communication error, I tried all ways you say on this blog and others without results), so the only solution I could figure was to work only with mbed and its drag and drop style.
Now I learned how to do the same but with my programs made on CW, and I am very happy because thanks to you I save my board.
LikeLike
Hi Cesar,
glad to hear that things worked out for you. I’m wondering what happened with your soldering, as you did not destroy the the processor?
LikeLike
Pingback: GNU Additional Tools: Create Flash Image, Print Size and Extended Listing Options | MCU on Eclipse
Pingback: Binary Files for the mbed Bootloader with Eclipse and GNU ARM Eclipse Plugins | MCU on Eclipse
FYI I found this post-build set line worked for me:
“${ARMSourceryDir}/arm-none-eabi-objcopy” -O srec “${ProjName}.${BuildArtifactFileExt}” “${ProjName}.s19”
LikeLike
warning — beware of the quotes. This website changed them, re-type the regular straight-up-and-down double quotes.
Another example for making a binary:
“${ARMSourceryDir}/arm-none-eabi-objcopy” -O binary “${BuildArtifactFileName}” “${BuildArtifactFileBaseName}.bin”
I found that some of these variables may be different for different project, just go to the C/C++ Build->Build Variables area in properties and check the ‘show system variables’ box to see what’s available.
LikeLike
Hi Marc,
yes, thanks for the warning. That’s a typcial problem of web page copy-paste, and gives strange errors in the tools :-(. And yes, variables are different from Eclipse distribution to another, and can cause issues moving projects with Eclipse releases too 😦
LikeLike
Hi Erich,
As you suggested i have typed the command (arm-none-eabi-objcopy -O srec “${ProjDirPath}/Debug/${ProjName}.${BuildArtifactFileExt}””${ProjName}.s19” ) in post build steps command. But I am getting the error : “arm-none-eabi-objcopy’ is not recognized as an internal or external command.
LikeLike
instead of arm-none-eabi-objcopy, can you use the full path to the arm-none-eabi-objcopy.exe? I think that it might not be present in your PATH, as the error message indicates that it cannot be found.
LikeLike
Pingback: Converting S19 Files into Binary Files with GNU objcopy | MCU on Eclipse
Pingback: Executing Multiple Commands as Post-Build Steps in Eclipse | MCU on Eclipse
Is it possible to have s19 file output re-formatted with word size address aligment instead of byte address aligment with some additional option flag set?
LikeLike
Not with this GNU tool, but have a look at http://srecord.sourceforge.net/ and https://mcuoneclipse.com/2013/10/29/s-record-manipulation-with-gnu-objcopy-and-burner-utility/
LikeLike
Hello,
I am new to code warrior.
I set output file format srec, and build the project.
After that I am getting following error:
“arm-none-eabi-gcc: warning: ‘-x assembler-with-cpp’ after last input file has no effect”
Please help
LikeLike
You can simply ignore that warning. It is an oversight of the CodeWarrior tool chain command line generation.
LikeLike
Pingback: CRC Checksum Generation with ‘SRecord’ Tools for GNU and Eclipse | MCU on Eclipse
Pingback: Merging S19 Files | MCU on Eclipse
Hey Erich,
I am using Kinetis Design Studio. I don’t have any option called “Additional Tools” as explained here. What should I Do ?
Thanks
Ganesh R
LikeLike
Hey Erich I got it. It was under Toolchains tab. Thanks
LikeLike
Hi ,
i have created srec file for my project and try to download using MSD application,nothing is happening. How ever precompiled example files are downloading and working succefully
LikeLike
What kind of MSD are you using? Note that the mbed MSD only accepts bin files (not s19), see https://mcuoneclipse.com/2014/04/20/binary-files-for-the-mbed-bootloader-with-eclipse-and-gnu-arm-eclipse-plugins/
LikeLike
Hello Eric sir,
I am using KDS IDE. I want to create .s19 file.
SIGN_BOARD_100_10_2016 is my project name….
I write following command in post
${ARMSourceryDir}/arm-none-eabi-objcopy” -O srec “${ProjName}.${BuildArtifactFileExt}” “${ProjName}.s19
Description;
serc s19 file
but I am getting follwoing error
c:/freescale/kds_v3/eclipse/../bin/sh: /arm-none-eabi-objcopy”: not found
makefile:85: recipe for target ‘post-build’ failed
make[1]: [post-build] Error 127 (ignored)
post-build:
-@echo ‘serc s19’
-/arm-none-eabi-objcopy” -O srec “SIGN_BOARD_100_10_2016.elf” “SIGN_BOARD_100_10_2016.s19
-@echo ‘ ‘
And how do I use arm-none-eabi-objcopy.exe file..
Thank you..
LikeLike
Hello,
with KDS there is very simply way to generate S19 files (or other files), see https://mcuoneclipse.com/2014/04/20/binary-files-for-the-mbed-bootloader-with-eclipse-and-gnu-arm-eclipse-plugins/. There is an option under the toolchain path for this.
Your problem is that you Eclipse does not find the objcopy, plus you are missing a double quote at the end.
What works for me is this:
"C:\nxp\KDS_3.2.0\Toolchain\bin\arm-none-eabi-objcopy.exe" -O srec "${ProjName}.${BuildArtifactFileExt}" "${ProjName}.s19"
Of course update the path to where you have placed the binary on your machine.
I hope this helps,
Erich
LikeLiked by 1 person
Here is another version:
"${eclipse_home}/../toolchain/bin/arm-none-eabi-objcopy.exe" -O srec "${ProjName}.${BuildArtifactFileExt}" "${ProjName}.s19"
LikeLiked by 1 person
Hi Erich,
I’m using MCUXpresso IDE to build demo application image file. I have .s19 file, I need to know how to generate boot_image.sb using s19 for MIMXRT1050-EVK ?
LikeLike
So you are really using the EVK and not the EVKB? I don’t recommend the EVK (non-B) version because this is using an outdated silicon version. See https://mcuoneclipse.com/2018/08/04/i-mx-rt1050-evk-vs-evkb/
LikeLike
I have documented the steps how to create a boot image to boot from SD card on i.MX RT1050: https://mcuoneclipse.com/2019/01/22/tutorial-booting-the-nxp-i-mx-rt-from-micro-sd-card/
I hope this helps?
LikeLike