2.5. Generating PROM Programming Files

By default, the executable file is in Common Object File Format (COFF). Using the object code utility program leon-coff-objcopy, COFF files may be converted into several other industry-standard formats, such as ELF, Intel Hex, and Motorola S Records.

The following example shows how we convert a COFF file to Intel Hex format.

Example 2-9. Converting to Intel Hex

$ leon-coff-objcopy --output-target=ihex hello hello.ihex

If you don't need the COFF file, then you can get the linker to generate the Intel Hex file directly. Note that the Intel Hex file contains no debug information, so if you expect to use the debugger, you should generate the COFF file too.

Example 2-10. Generating a HEX File

$ leon-coff-gnatmake hello -largs -Wl,-oformat=ihex
$ more hello.ihex
:020000040200F8
:14000000A14800002900800281C52200A6102000A148000031
:140014002900800481C52088A6102001A148000029008004D0
:1400280081C52088A6102002A14800002900800481C520887A
:14003C00A6102003A14800002900800481C52088A610200479
:14005000A14800002900800281C52344A6102005A148000097
...lots of output...
$ 

We can run the Intel Hex file, as in the following example:

Example 2-11. Running an Intel Hex File

$ leon-coff-run hello
Hello world
$

Or we can generate Motorola S Records, and run from there. Note that we use the option -f to force a rebuild.

Example 2-12. Running an S-Record File

$ leon-coff-gnatmake -f hello.adb -largs -Wl,-oformat=srec
$ more hello
S008000068656C6C6FE3
S31902000000A14800002900800281C52200A6102000A148000029
S319020000142900800481C52088A6102001A148000029008004C8
S3190200002881C52088A6102002A14800002900800481C5208872
...lots of output...
$ leon-coff-run hello
Hello world
$