[188] | 1 | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
---|
| 2 | Running the O'Caml 8051/8052 emulator. |
---|
| 3 | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
---|
| 4 | |
---|
| 5 | * Compile the C source file with SDCC. SDCC will generate a number of files, |
---|
| 6 | including two files in the standard Intel Hex format (extensions .hex and |
---|
| 7 | .ihx). These files (both are the same, just with differing extensions) are |
---|
| 8 | understood by the O'Caml emulator. |
---|
| 9 | * Build the emulator by running: |
---|
[429] | 10 | $ ocamlbuild Test.native |
---|
[188] | 11 | * The emulator outputs on stderr. As all 8051 programs loop infinitely, you |
---|
| 12 | must manually terminate the emulator process after a few seconds, in order |
---|
| 13 | to view the execution trace. To execute the emulator, run: |
---|
[429] | 14 | $ ./Test.native Test.hex 2> /tmp/log |
---|
[188] | 15 | (assuming you are using the Bash shell, where 2> /tmp/log is a pipe from |
---|
[429] | 16 | stderr to a temporary log file and Test.hex is any Intex Hex file). |
---|
[188] | 17 | * Open /tmp/log. The first section, above the dotted lines, is a sequential |
---|
| 18 | readout from the emulator's code memory. You can turn this off by editing |
---|
| 19 | test.ml. The number of code memory cells that are printed is hard coded in |
---|
| 20 | test.ml, also, so if loading a large program, you may need to change this |
---|
| 21 | hard coding (alternatively, the hard coded limit may be too large, in which |
---|
| 22 | case NOP is printed). |
---|
| 23 | |
---|
| 24 | Following the dotted lines, the execution trace begins. Usually, you have |
---|
| 25 | to scroll down quite some way until you see the `interesting' part of the |
---|
| 26 | execution (i.e. after the standard preamble). |
---|
| 27 | |
---|
| 28 | NOTE: the emulator does not replace fixed memory locations with their |
---|
| 29 | mnenomics. For instance, DPL and DPH are memory locations 0x81 and 0x82, |
---|
| 30 | respectively, and the B register is 0xFF (if I remember correctly). |
---|
| 31 | |
---|
[429] | 32 | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
---|
| 33 | Translating an INTEL HEX file to Matita. |
---|
| 34 | -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |
---|
| 35 | |
---|
| 36 | * Compile the C source file with SDCC. SDCC will generate a number of files, |
---|
| 37 | including two files in the standard Intel Hex format (extensions .hex and |
---|
| 38 | .ihx). These files (both are the same, just with differing extensions) are |
---|
| 39 | understood by the O'Caml translator. |
---|
| 40 | * Build the translator by running: |
---|
| 41 | $ ocamlbuild ToMatita.native |
---|
| 42 | * The translator outputs on stdout. To execute the translator, run: |
---|
| 43 | $ ./ToMatita.native Test.hex > Test.ma |
---|
| 44 | (assuming you are using the Bash shell, where > Test.ma is a pipe from |
---|
| 45 | stdout to a file and Test.hex is any Intex Hex file). |
---|