Definitions of weAutSys' bootloader and helper functions.
These functions are to be used in situations before or after a reset or a system re-initialisation, that is without any threading support (or interrupts). This condition is met
Everything defined here is to be linked and put to the NMWR (no modify while read) respectively bootloader section of the flash/program memory. It is usable by normal system and application software through certain linkage mechanisms described in in Albrecht Weinert
A serial bootloader for weAut_01, ArduinoMega and akin
Copyright © 2015 Albrecht Weinert, Bochum
History Rev. 8..13 2014-10-16 : stable _ext.tab; check this out for clients linked threreto Rev. 14 2014-10-17 .. : library cleanup; separate "light show" from serial I/O functions
Defines | |
#define | FAR_ADD(varHF) |
Generate a far address for high flash memory items. | |
#define | getFlashByte(addr) |
Read a flash byte also from high addresses. | |
#define | getSerByte() |
Basic function: UART(0) get one byte already received. | |
#define | hwCritEntBoot() |
Hardware criterion for entering bootloader after reset. | |
#define | isSerByteRec() |
Basic function: UART(0) has one byte received. | |
#define | LOW_ADD(varLF) |
Generate a far address for low flash memory items. | |
#define | PARTCODE 0x44 |
The (outdated) single byte part code. | |
#define | PROG_HW_VER |
The programmerHWver. | |
#define | PROG_SIGN "AVRBOOT" |
The programmerSign. | |
#define | PROG_SW_VER "10" |
The programmerSWver. | |
#define | SEC_with_F0 (72-61) |
timeout value for timOutCountPatr | |
#define | SEC_with_F8 (75-56) |
timeout value for timOutCountPatr | |
#define | SEC_with_FF (72-35) |
timeout value for timOutCountPatr | |
#define | TIMEOUT_LIGHTSHOW |
Time out HMI display. | |
Functions | |
void | appMain (uint8_t init) __attribute__((noreturn)) |
Jump to application program. | |
void | basicSystemInit (void) |
Initialise system resources. | |
ADDR_T | blockLoadEE (uint16_t size, ADDR_T address) |
Write a sequence of bytes read from UART(0) to EEPROM. | |
ADDR_T | blockLoadFl (uint16_t size, ADDR_T address) |
Write a sequence of words read from UART(0) to flash memory. | |
ADDR_T | blockReadEE (uint16_t size, ADDR_T address) |
Read a sequence of bytes from EEPROM and send them via UART(0) | |
ADDR_T | blockReadFl (uint16_t size, ADDR_T address) |
Read a sequence of bytes from flash memory and send them via UART(0) | |
void | bootLoaderGreet (void) |
Send the greeting lines for bootloader's start. | |
void | bootMain (void) __attribute__((noreturn)) |
Jump to the bootloader. | |
char * | copyChars_P (char *dst, ADDR_T src, uint8_t mxLen) |
Copy a string from flash memory to RAM. | |
void | initUART0 (uint32_t baudRate, uint8_t x2, uint8_t parity, uint8_t stopBits, uint8_t useInt) |
Initialise the serial input (UART0) | |
uint8_t | isFlashCleared (void) |
Flash memory has no program. | |
uint8_t | recvErrorState (void) |
Get UART receive error status and flush receiver on error. | |
uint8_t | recvSerByte (void) |
Basic UART receive one byte. | |
ADDR_T | resetCauseText_P (uint8_t resetCauses) |
The reset cause text. | |
void | sendSerByte (uint8_t c) |
Basic UART send one byte (guarded) | |
void | sendSerBytes (char *src) |
Basic UART0 send multiple bytes from RAM. | |
void | sendSerBytes_P (ADDR_T src) |
Basic UART send multiple bytes from flash. | |
void | setTheLed (uint8_t state) |
Set the LED. | |
void | toHMI8LEDchain (uint8_t val) |
Output to a chain of eight HMI/visible LEDs. | |
void | wait25 (void) |
A very basic delay function keeping the CPU busy for about 25µs. | |
uint8_t | waitSerByte (uint8_t tOut) |
Basic UART wait for a byte received. | |
Variables | |
char const | bootAut [] |
The author of weAutSys and its bootloader. | |
char | bootBld [] |
The build date and time. | |
char const | bootCop [] |
The copyright notice for weAutSys and its bootloader. | |
char const | bootloaderPlatf [] |
Bootloader's platform name and CPU frequency. | |
char const | bootloaderWlc [] |
Bootloader's welcome greeting and copyright notice. | |
char const | bootResetCause0 [] |
no reset cause: exit from from active bootloader or by command | |
char const | bootResetCause1 [] |
reset cause: power on | |
char const | bootResetCause2 [] |
reset cause: external | |
char const | bootResetCause4 [] |
reset cause: brown out | |
char const | bootResetCause8 [] |
reset cause: watchdog | |
char const | bootResetCauseG [] |
reset cause: JTAG | |
char const | bootResetCauseN [] |
reset cause: not known | |
char const | bootRevDat [] |
The bootloader's revision and date. | |
char const | bootTextReset [] |
The text "Reset by:". | |
char const | bootTextRevis [] |
The text "Revision:". | |
char const | greetEmptFlash [] |
Greeting for empty application flash. | |
char const | programmerHWver [] |
The programmers hardware version. | |
char const | programmerSign [] |
Software identifier/programmer signature. | |
char const | programmerSWver [] |
The programmers software version. | |
uint8_t const | timOutCountPatr [] |
An eight bit count down display pattern. |