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

About these ads

29 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} ${OUTPUT}
      to
      “${ARMSourceryDir}/${COMMAND}” ${INPUTS} ${FLAGS} ${OUTPUT_FLAG}${OUTPUT_PREFIX} myFile.s19

      Like

  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

    Like

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

    Like

  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.

    Like

  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.

      Like

      • 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 :-(

        Like

  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.

    Like

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

      Like

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

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 )

Google+ photo

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

Connecting to %s