S-Record Generation with gcc for ARM/Kinetis

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‘:

Additional Tools gcc Settings

Additional Tools gcc Settings

Now I need to press the Apply button:

Apply Button

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.

Create Flash Image Option

Create Flash Image Option

Now I can specify S-Record/S19 as output format:

Settings to create S-Record

Settings to create S-Record

Pressing OK, and building my project again will show up the S19 file together with the application file:

S19 File Generated

S19 File Generated

Post Build Step

A generic way to generate the S19 file is to use a post build step:

Post Build Step to produce S19 file

Post Build Step to produce S19 file

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 🙂

46 thoughts on “S-Record Generation with gcc for ARM/Kinetis

  1. Pingback: Code Size Information with gcc for ARM/Kinetis | MCU on Eclipse

  2. Pingback: S-Record, Intel Hex and Binary Files | MCU on Eclipse

    • 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} myFile.s19


  3. 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


  4. Pingback: The Quotation Problem | MCU on Eclipse

  5. 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..


  6. Pingback: Decoding S19 Files | MCU on Eclipse

  7. Pingback: Using the Freedom Board as JTAG Programmer | MCU on Eclipse

  8. Pingback: Serial Bootloader for the Freedom Board with Processor Expert | MCU on Eclipse

  9. Pingback: Traps and Pitfalls: No Hex/Bin/S19 File Created with GNU? | MCU on Eclipse

  10. 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.


  11. Pingback: GNU Additional Tools: Create Flash Image, Print Size and Extended Listing Options | MCU on Eclipse

  12. Pingback: Binary Files for the mbed Bootloader with Eclipse and GNU ARM Eclipse Plugins | MCU on Eclipse

    • 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.


      • 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 😦


  13. 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.


    • 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.


  14. Pingback: Converting S19 Files into Binary Files with GNU objcopy | MCU on Eclipse

  15. Pingback: Executing Multiple Commands as Post-Build Steps in Eclipse | MCU on Eclipse

  16. 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?


  17. 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


  18. Pingback: CRC Checksum Generation with ‘SRecord’ Tools for GNU and Eclipse | MCU on Eclipse

  19. Pingback: Merging S19 Files | MCU on Eclipse

  20. Hey Erich,
    I am using Kinetis Design Studio. I don’t have any option called “Additional Tools” as explained here. What should I Do ?
    Ganesh R


  21. 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


  22. 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

    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)

    -@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..


  23. 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 ?


What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.