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

24 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

  13. FYI I found this post-build set line worked for me:

    “${ARMSourceryDir}/arm-none-eabi-objcopy” -O srec “${ProjName}.${BuildArtifactFileExt}” “${ProjName}.s19″

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