So,
I was working on some of my projects involving Atmel AVR development and, as the code got bigger and bigger, it didn’t fit into the flash anymore.
I needed a tool to show me the binary size of the HEX files the IDE was generating, but to no avail. Converters on the Internet were either too complicated, either part of a programming tool, either in Chinese, either not working at all.
So I wrote my own version of a tool that converts from Intel HEX to binary and viceversa files up to 10Mbytes. The tool runs fine on Windows XP, Windows 7, Windows 8, Windows 8.1 and Windows 10.
It works in a very simple way: Load either Hex or binary files, save them as either Hex or binary. The “file length” caption shows the binary bytes, not the number of bytes actually on the file. Very useful to see if we went over the microcontroller flash or eeprom capacity.
Because a Intel HEX file may load not contiguous data and leave memory blocks not addressed, the application automatically fills all the memory block with 0xFF (not programmed memory location).
The hex editor works this way:
After loading a file, double click on the panel displaying the file name and a hex editor will appear:
Data may be edited, deleted or inserted. Once data is modified, the status bar will indicate this, along with the new size of the data:
At this time, whenever the editor window or the main application is closed, warning dialogs will pop up, telling you that data is modified and that it should be saved.
Saving data in either format or loading a new file resets both the app and the editor, suppressing the warnings pop-ups until a new data edit is performed.
After using the editor to alter data, double clicking on the file name does not reload the file but shows the modified data into the editor instead.
In case one wishes to repeat the same conversion over and over during a project development, pressing the “Silent Op” button after having performed one conversion will redo that conversion silently, without popping the dialog windows for file names. Also, upon performing the first conversion manually, the tool remembers file names but also file types, and sets the radio buttons accordingly.
The “Silent Op” button does not do data manipulation. It just loads a file, converts it according to your choice and saves it.
This tool was written in Pascal and compiled with the free pascal IDE, Lazarus.
The hex editor is provided as-is by tkweb, here.
The tool is free for non commercial use.
Download here the Lazarus source files, including the hex editor package.
Download here the zipped Windows executable.
13 Comments
Thanks for sharing!
Thank you very much !!
You are welcome!
Installer won’t run on Windows 7. Error message says to check of x32 or x64 is required
It is not an installer, it is the zipped executable itself. Testes on Windows 10 as I do not use Windows 7 anymore.
But you can always recompile it with Lazarus from sources.
Hi,
were is the file/executeable to download?
thanks
jay
http://www.copcea.ro/files/electronica/hex2bin.zip
access violation when it loads a binary file it created. i have two hex files, one 16 bytes/line and one 32 bytes/line. i was hoping to take one file, convert to binary then convert the binary back to hex and make a file compare. nice idea though.
Hey Scott,
send the binary file that’s causing issues along with info on the microcontroller using it.
There may be a bug hiding in the code, I may be able to solve it or come with an answer on why this is happening.
Use my email address cristian@copcea.ro
Hello Cristian.
I would like to ask you if you want to build an x32bit version for this utility to work with older systems like XP.
Thank you.
Marian
Hi Marian,
the sources are provided in the page. Feel free to compile a 32-bit version. It all depends on Lazarus, I did not care much for this but I think it would be doable.
Muchísimas gracias
1 Trackback