Specifications

Developer’s Serial Bootloader, Rev. 13
FC protocol, version 1, M68HC908 implementation
Freescale Semiconductor16
3.3.1 S19 file
Because the bootloader operation must be transparent to the user S19 file, another piece of intelligence is
built into the PC master code (instead of the MCU slave). The relocation works as follows:
If the data from an S19 record corresponds to an address in the interrupt vector table, the value is relocated
into the corresponding area in the bootloader user table, including a JMP instruction (opcode $CC). For
example, if the user S19 file contains #3 interrupt vector $E123 at address $FFE8, such a vector is
relocated into the sequence $CC, $E1, $23 (JMP $E123) programmed to the $FC81 address in the
bootloader user table.
Using this method, the user S19 file does not need to be modified, but the lower address of the end of
FLASH memory must be considered. In addition, this JMP instruction (3T) delays every interrupt, as
explained in Each interrupt 3T delayed.
3.4 User code start
The user code is started in an unusual way to provide a register setup similar to how it appears after MCU
reset.
3.4.1 Software reset
If the bootloader must quit and run user code, an illegal operation is intentionally executed (M68HC08
illegal opcode $32). This causes an illegal operation reset, and the MCU restarts. During bootloader
startup, the System Integration Module (SIM) Reset Status Register (SRSR) is tested. If a power-on-reset
is not detected, the user code is started instead of the bootloader code. This allows the transparent operation
of all other resets (such as illegal address, and so forth) with only a short additional delay caused by testing
the SRS register and executing associated jump instructions.
3.4.2 Hardware reset
In some implementations, a pin reset (caused by external reset pin) is also included as a valid source of
reset for the bootloader to start. This allows remote in-circuit reprogramming in embedded applications
able to drive the M68HC08 reset pin.
Another test has been added to the real bootloader application: if no reset source is detected (that is, if the
SRS register is 0), the bootloader is selected by default. This may happen when an external pin causes
reset, but the reset pulse is shorter than specified. In that case, the minimum length of reset pulse that will
cause reset is shorter than the length needed for the proper propagation of the external reset flag to the SRS
register.
Because the SRS register is one-time readable (it clears after read), no subsequent reads of this register
provide a valid value. See M68HC08 system limitations for details.