Specifications

Developer’s Serial Bootloader, Rev. 13
PC bootloader master software
Freescale Semiconductor60
9.3 UART manipulations
In seriallinux.c or serialw32.c, depending on the platform used, the following UART manipulation
functions are defined:
int init_uart(char* nm);
int close_uart(void);
int send_break10(void);
int flush_uart(int out, int in);
int wb(const void* data, unsigned len);
int rb(void* dest, unsigned len);
The pair int init_uart(char* nm) and int close_uart(void) manage opening (initialization) and
closing of the specified UART port.
The pair int wb(const void* data, unsigned len) and int rb(void* dest, unsigned len) is
used for writing and reading blocks of data into/out of UART.
Two additional functions are required for the bootloader to work:, int send_break10(void) and
int flush_uart(int out, int in). The first sends a BREAK character to the UART, the second cleans
up both directions (in/out) of the UART buffers.
9.4 System platform dependent files
The header file sysdep.h includes either sysdeplinux.h or sysdepw32.h, depending on the platform
software being compiled. The platform-specific declarations are then used.
9.5 Generic and main program files
The header file hc08sprg.h contains the rest of the generic declarations needed to compile the application.
The file main.c contains the main program and is shown at the beginning of this section (Figure 37).
9.6 M68HC(S)08, ColdFire and Kinetis specific programming files
The most important part of the PC Bootloader software is contained in the file prog.c implements most
of the intelligence of the PC bootloader software as mentioned in previous sections.
Numerous routines are implemented in the
prog.c file:
int hook_reset(void)
int could_be_ack(unsigned b)
int calibrate_speed(void)
int read_mcu_info(void)
int setup_vect_tbl(void)
int check_image()
int read_blk(unsigned adr, int len, BYTE *dest)
int erase_blk(unsigned a)
int prg_blk(unsigned a, int len)
int prg_area(unsigned start, unsigned end)
int prg_mem(void)
int erase_mem(unsigned all)
int verify_mem(int byS19_range)
int prg_only_mem(void)
int unhook(void)