Conversions between HEX and SREC files

The OpenBLT bootloader package includes two PC programs for initiating and monitoring firmware updates (MicroBoot and BootCommander). Both programs expect your firmware file to be in the Motorola S-Record (SREC) format. Several users have requested the additional support of the Intel Hex (HEX) format. This article demonstrates how you can easily convert between the HEX and SREC file formats.

All compiler toolchains that I developed microcontroller software with so far, that support the generation of HEX files, can generate SREC files. Therefore I never saw the need to add HEX file support to the PC programs. However, it has been brought to my attention that some users employ custom developed post-build patch tools that only work with HEX files. To accommodate these users, the HEX file format support is planned for a future version of the OpenBLT bootloader. This article is written for those that need a solution right now.


There is an open source software solution called “SRecord”. It is available from the following website: This software solution includes a versatile program called “srec_cat”, which make it quick and easy to convert between files in the HEX and SREC format. The “srec_cat” program works on both Windows and Linux.

Windows users can download pre-built binaries from the download section of the previously mentioned website. Linux users can install this software through their package manager, by searching for the package named “srecord”. Installation example for Debian/Ubuntu users:

sudo apt-get install srecord


Assuming that you have a HEX file that needs to be converted to SREC, this is how you would do it:

srec_cat input.hex -Intel -o output.srec -Motorola

Most software development IDEs allow you to configure a custom post-build step. You could add this conversion with the “srec_cat” program there. This way, the SREC file is generated automatically each time you build your software program.

Converting the other way around is also possible:

srec_cat input.srec -Motorola -o output.hex -Intel


With the information presented in this article, you can now easily convert your firmware file to the SREC format, for usage with the OpenBLT bootloader. Feel free to leave a comment if you found a better way to achieve this or if you need further assistance.

Follow and like us:
This entry was posted in OpenBLT and tagged , , , , . Bookmark the permalink.