0

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

DarkKnight
  • 131
  • 10

1 Answers1

2

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.

Sigve Kolbeinson
  • 1,133
  • 1
  • 7
  • 16
  • Thanks for your input, I understand that there are tools. But what is the concept behind not performing a compilation ? – DarkKnight Aug 14 '15 at 18:50
  • 1
    1) @DarkKnight It depends. Compilation translates from source code to machine code. You can, in theory, write machine code directly into a hex file. This will be tedious and complicated, even for a trivial program. What is easier to hand-craft in a hex file is data such as configuration. When I wrote my answer, I think I also thought of "not performing a compilation" to include assembly. Strictly speaking it doesn't. Assembler code maps much closer to the machine instructions than does e.g. C, and can be seen as _human-readable_ machine code. – Sigve Kolbeinson Aug 15 '15 at 09:41
  • 1
    2) @DarkKnight Assembler instructions are composed of operations are described by mnemonics (like ADD, BRZ - branch if zero) and arguments, you can use symbolic names for variables and addresses. In machine code, the operation and its arguments are combined into a specific binary format, and there are no symbolic names. Coding in assembler is much more common than machine code, and often used in embedded where timing is critical, e.g. for generating a very precise signal. – Sigve Kolbeinson Aug 15 '15 at 09:41