weAut_01 / weAutSys    R 2.2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Functions | Variables
D:/eclipCeWS/atMegaBootloader/bootloader/bootLib.c File Reference

Overview

Implementation ofweAutSys' bootloader helper functions.

weAutSys comes with a serial bootloader according to Atmel Corporation application note AVR109 on "Self-programming".

This bootloader was implemented for and tested on some quite different target platforms, ref intro_secH "weAut_01" being on of them. It can easily be adapted to all similar platforms respectively to all AVR µCs with self-programming support.

One development goal was the tight integration with the system / application software. That means

a) not re-doing all or part of the platform initialisation and
b) re-using bootloader functions in application software,
c) which can also be done for final (flash) bootloader variables.

See file boot109.c and
    Albrecht Weinert
    A serial bootloader for weAut_01, ArduinoMega and akin

Revision:
1
Date:
2017-01-25 12:03:06 +0100 (Mi, 25 Jan 2017)

Functions

void appMain (uint8_t init)
 Jump to application program.
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 bootMain (void)
 Jump to the bootloader.
char * copyChars_P (char *dst, ADDR_T src, uint8_t mxLen)
 Copy a string from flash memory to RAM.
uint16_t div16 (uint16_t *rem, uint16_t dividend, uint16_t divisor)
 Unsigned 16 bit divide.
uint32_t div24 (uint32_t *rem, uint32_t dividend, uint32_t divisor)
 Unsigned 24 bit divide.
uint32_t div32 (uint32_t *rem, uint32_t dividend, uint32_t divisor)
 Unsigned 32 bit divide.
uint32_t div32by16 (uint16_t *rem, uint32_t dividend, uint16_t divisor)
 Unsigned 32 bit divide by 16 bit.
uint32_t div32by24 (uint32_t *rem, uint32_t dividend, uint32_t divisor)
 Unsigned 32 bit divide by 24 bit.
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.
uint32_t uartBaud (uint16_t uartPresc, uint8_t x2)
 Calculate the true baudrate for a prescaler setting.
uint16_t uartPrescaler (uint32_t baudRate, uint8_t x2)
 Calculate the prescaler setting for a desired baudrate.
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 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 bootTextReset []
 The text "Reset by:".
char const bootTextRevis []
 The text "Revision:".
char const greetEmptFlash []
 Greeting for empty application flash.
char const systBld []
 The build date and time.
uint8_t const timOutCountPatr []
 An eight bit count down display pattern.