External RAM booter.

This 68HC11 bootstrap program acts as a simple server for uploading a program in external memory. It supports only two commands:

M{ADDR-HIGH}{ADDR-LOW}{SIZE}[{DATA}]

Write the memory at given address.

G{ADDR-HIGH}{ADDR-LOW}

Jump to program at given address.

This bootstrap program is uploaded by GTAM to be able to upload larger program in external RAM.

Implementation Notes:

  1. This program must not be linked with a startup file. It implements the startup entry point.
  2. The _start function must be at beginning of this file. By doing so, it will be mapped at address 0 by the linker and we avoid to have some jump to call it (since the boot will jump there).
  3. It must be compiled with -mshort -Os -fomit-frame-pointer to make sure it fits in less than 240 bytes (keep a few bytes at end for the stack).
  4. It must be compiled with -msoft-reg-count=0 or =1 to reduce the use of soft-registers (since they are mapped in RAM in .page0).
  5. The pointer used to write the memory is marked volatile to prevent GCC from optimizing memory accesses. We rely on this for the good computation of the CRC.
  6. Before scanning the memory, we switch the bus in the expanded mode. We do not switch back to single chip when jumping to the program.
  7. The soft registers must be located at beginning of the .page0. This will clobber the beginning of the _start function. We don't care because this clobbers some initialisation part.
Caveats:
  • Another booter program is necessary to upload in EEPROM.

  • It is not possible to write in the 68HC11 RAM. We don't check for this and this will probably crash.
Source file: booter.c