Search code examples
embeddedexecutablefirmware

What are common structures for firmware files?


I'm a total n00b in embedded programming. Suppose I'm building a firmware using a compiler. The result of this operation is a file that will be flashed into (I guess) the flash memory of a MCU such an ARM or a AVR.

My question is: What common structures (if any) are used for such generated files containing the firmware?

I came from desktop development and I understand that for example for Windows the compiler will most likely generate a PE or PE+, while Unix-like systems I may get a ELF and COFF, but have no idea for embedded systems.

I also understand that this highly depends on many factors (Compiler, ISA, MCU vendor, OS, etc.) so I'm fine with at least one example.


Update: I will up vote all answers providing examples of used structures and will select the one I feel best surveys the state of the art.


Solution

  • Most tools output either an ELF, or a COFF, or something similar that can eventually boil down to a HEX/bin file.

    That isn't necessarily what your target wants to see, however. Every vendor has their own format of "firmware" files. Sometimes they're encrypted and signed, sometimes plain text. Sometimes there's compression, sometimes it's raw. It might be a simple file, or something complex that is more than just your program.

    An integral part of doing embedded work is the build flow and system startup/booting procedure, plus getting your code onto the part. Don't underestimate the effort.