views:

143

answers:

1

For fun, I'm working on a compiler for a small language, and I'm targeting the ARM instruction set first due to its ease. Currently, I'm able to compile the code so I have ARM machine code for the body of each method. At this point I need to start tying a few things together:

  • What format should I persist my machine code to so I can...
  • Run it in what debugger?

Currently there's no I/O support, etc., so debugging will be heavily keyed to my ability to step through the disassembly and view processor registers/memory.

I'm running Windows and my compiler only runs in Windows, so having some sort of emulator on Windows would be preferable.

Edit: It appears I can use the Visual Studio Windows Mobile 6 emulator. For now, I might be able to simply save the results in a simple binary format and load it into emulator memory via a tiny C++ console application, then jump into it with a function pointer. Later, it appears I would need to support the ELF and PE formats.

+3  A: 

Regarding file formats... the most simple would be:

Those formats can record the binary data and the target address range(s) for the data to be loaded. That's about it.

A more capable format to contain more information:

  • ELF
    • for maximum information, include DWARF debug information

ELF is fairly widely supported, and not too complex. DWARF allows you to record very expressive debug information for debugging of complex language constructs. However, to achieve that expressiveness, it can be a very complex format to write.

Craig McQueen
elf is the most used you will need to support it eventually. it is pretty easy but not as easy as srec or intel hex.
dwelch