Search code examples
compilationembeddedhexpost-build

Hex file generation without compilation


I heard of a use-case / tool where in a Hex file (executable that can be flashed into a Embedded memory area) can be generated without Compilation or linking.

I am amazed such a thing is possible. Any experts in this area who can tell, What the tool does and how ?

I know a use-case - it is for Post-build configuration variant.

Hex File :

some basics : http://embeddedfun.blogspot.com/2011/07/anatomy-of-hex-file.html

Thanks, MSam


Solution

  • A hex file, the Intel HEX format isn't necessarily "executable" as such. It's a plain-text format for describing binary data. Typically it is used for data to be written to an embedded device. Often, at least part of that data will be executed. But the format could also be used to describe configuration data.

    You can write a hex file with any text editor. But to write a meaningful program by using only a text editor would not be advisable...

    There are tools, like the IntelHex python package which allows you to manipulate hex files at a higher level, for instance, to merge multiple hex files into one (e.g. bootloader, application and configuration hex files into a single hex file). Or replace a placeholder with a unique id/serial number whatever before writing a hex file onto a device.