Post navigation

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

Now I need to press the 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

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

Settings to create S-Record

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

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

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?

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

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.

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.

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.

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 😦

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.

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”