Converting Binary Files to Intel Hex Format with the SRecord Tool

I’m dealing a lot with bootloaders recently (see “Flash-Resident USB-HID Bootloader with the NXP Kinetis K22 Microcontroller“), and bootloaders are sometimes very picky about what file format they are able to consume. So what if I have a binary (see “S-Record, Intel Hex and Binary Files“) file and I need to convert it into the Intel Hex format?

converted binary to intel hex

converted binary to intel hex

Using the ‘SRecord‘ tool it is actually very simple:

srec_cat.exe srcFile.bin -binary -output dstFile.hex -Intel

With the -binary option I load the binary file and with the -Intel option used with the -output I can convert the file.

Below it shows a binary and its converted version in Eclipse (see “5 Best Eclipse Plugins: #4 (EHEP)“).

converted binary to intel hex

converted binary to intel hex

Done :-).

Happy Hexing ๐Ÿ™‚

Links

Advertisements

3 thoughts on “Converting Binary Files to Intel Hex Format with the SRecord Tool

  1. hex format is what is needed for a boot loader for the most part. They have horizontal checksums on each line which makes sure you’re reading each line correctly. What this particular one is lacking is vertical checksums.

    There needs to be chain of custody when updating code like that in the field and the file itself should have some sort of checksum to it so that when you tell the processor to go ahead and reboot, it can compare what it has written with you think it should be before you go ahead and brick it.

    Like

  2. Eric

    Take a look at the uTasker conversion tools too: http://www.utasker.com/forum/index.php?topic=1445.0
    These allow combining boot loaders with applications, converting formats (including Motorola Binary which older CW tools produced, rather than raw binary), or converting binary file, images, web pages etc. into arrays for including in programs.
    They also allow authenticating/encrypting applications for working with secure boot loaders.
    Basically they are utilities which have evolved over the years to do thing that are always needed again and again in real-world embedded projects to avoid the need to search for various tools to do the different jobs.

    Regards

    Mark

    Like

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 )

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s