source: etc/campbell/dev-notes/2012-08-08-toolstick.txt

Last change on this file was 2394, checked in by campbell, 7 years ago

I've kept the odd note on bits of CerCo? work I've been doing. James suggested
that it might be useful if these were recorded in the repository just in case
they contain some useful information that doesn't get recorded elsewhere.

File size: 1.6 KB
1I got some code from the prototype compiler running on the Toolstick.  A few
2tweaks were required:
4 0. The fix for comparisons I sent to the mailing list is required.
6 1. The amount of external memory needed to be changed to 512 bytes
7    (src/ASM/, sph_init and ext_ram_size, not sure the second is
8    really necessary), otherwise the stack will be placed in nonexistent
9    memory.
11 2. The microcontroller's watchdog timer needs to be turned off or it will
12    reset after some amount of time (src/LIN/, add
14      `MOV (`U3 (`DIRECT (byte_of_int 0xD9), data_of_int 0));
16    to the main function's preamble).
18Then I put a breakpoint on the infinite loop after the main function completes
19and examined the result (in DPTR and a couple of other registers).  I could
20replace the infinite loop with the appropriate SFR write to suspend the
28Put timings for the processor from the datasheet into the prototype, using the
29higher figure for the branches (which take longer when they branch).  On the
30actual chip set up the Programmable Counter Array to measure the system clock
31by setting
33  PCA0CN = 0x40 to turn on the timer
34  PCA0MD = 0x08 to use the system clock
36in the debugger (after skipping over the instruction I put in to reset PCA0MD
37to disable the watchdog).  When stopping on a breakpoint you can then see the
38elapsed time in PCA0.  For the binary search I had a predicted time of 3552
39cycles, and an actual time of 3541.  Of the difference, 3 cycles is for the
40skipped instruction and the rest is (presumably) differences on branches.
Note: See TracBrowser for help on using the repository browser.