Specifications

PC bootloader master software
Developer’s Serial Bootloader, Rev. 13
Freescale Semiconductor 59
hc08sprg.h
main.c
M68HC(S)08, ColdFire and Kinetis specific programming files:
prog.c
9.2 8-Bit and 32-Bit MCU image operations
To perform the necessary operations with the code, the master software keeps a binary image of the
memory. In addition, it stores the information about whether an actual byte is to be programmed into the
MCU is stored. This can be achieved using the following structure:
typedef struct {
BYTE d[0x10000]; // data
BYTE f[0x10000]; // valid flag 0=empty; 1=usercode; 2=systemcode
} BOARD_MEM;
where, image is the actual variable defined as follows:
BOARD_MEM image;
After the source S19 files are read, this array contains the actual data to be programmed into the MCU
irrespective of its original order in the S19 file. The function int read_s19(char *fn) defined in s19.c
implements the S19 file opening, reading, and relocation from S19 hexadecimal format into this binary
array.
9.2.1 Interrupt vector table relocation
After the ident information is read out by the MCU, the following operations within the image are
performed:
The code is scanned to determine if any interrupt vectors are present between the MCU interrupt
vector table address and 0xFFFF (the last existing physical address of the M68HC(S)08 MCU).
If interrupt vectors are present, relocation of these vectors is done as described in Interrupt vector
table relocation. Then, the original address spaces in the interrupt vector table are marked as
unused, thus, not being reprogrammed.
These operations are executed in the function
int setup_vect_tbl(void) defined in prog.c file.
9.2.2 Checking memory boundaries
The last check performed before the code is actually programmed into the MCU is to determine if the code
from the S19 file is in the correct memory locations (between the memory boundaries reported by the
MCU in the ident table).
If any value outside the range of addresses between the start address of reprogrammable memory area and
the end address of reprogrammable memory area is found, a warning is generated.
This check is done in
int check_image(void) also defined in the prog.c file.