2.4. Generating PROM Programming Files

By default, the executable file is in Common Object File Format (COFF). Using the object code utility program m68k-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-8. Converting to Intel Hex

$ m68k-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-9. Generating a HEX File

$ m68k-coff-gnatmake hello -largs -Wl,-oformat=ihex
$ more hello.ihex
:100000000013FFFC00000100000001DC000001DC27
:10001000000001D4000001E4000001E4000001E45C
:10002000000001D400000258000001D400000204C6
:1000300000000260000001DC000001DC0000026042
:100040000000026000000260000002600000026028
:100050000000026000000260000002600000026018
:100060000000020C00000214000002280000023010
:100070000000023800000240000002480000025068
:100080000000026A00000280000002880000045E96
:100090000000047E0000049E000004BE000004DE98
...lots of output...
$ 

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

Example 2-10. Running an Intel Hex File

$ m68k-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-11. Running an S-Record File

$ m68k-coff-gnatmake -f hello.adb -largs -Wl,-oformat=srec
$ more hello
S008000068656C6C6FE3
S11300000013FFFC00000100000001DC000001DC23
S1130010000001D4000001E4000001E4000001E458
S1130020000001D400000258000001D400000204C2
S113003000000260000001DC000001DC000002603E
S11300400000026000000260000002600000026024
S11300500000026000000260000002600000026014
S11300600000020C0000021400000228000002300C
S11300700000023800000240000002480000025064
S11300800000026A00000280000002880000045E92
S11300900000047E0000049E000004BE000004DE94
S11300A0000004F2000004FE000004FE000004FE50
S11300B0000004FE000004FE000004FE000004FE34
S11300C0000001E4000001E4000001E4000001E498
...lots of output...
$ m68k-coff-run hello
Hello world
$