Files
aqhomecontrol/avr/modules/flash
Martin Preuss 10e4aa8f85 fixed a problem with m8515 UART.
UBRRH and UCSRC share the same io register location, bit URSEL needs to
be set in order to access UCSRC!!
2025-05-17 13:18:50 +02:00
..
2025-05-17 13:17:16 +02:00
2025-05-17 13:16:46 +02:00

This implements the boot loader. It can be used to flash new firmware to nodes.


How it works
============


Whenever the MCU reboots the bootloader is started. The first thing it does is to send a FLASH_READY message to the bus
containing its UID (if any) as well as a device info block (containing manufacturer, device id and version).

If no FLASH_START message is received for the UID of the device then the bootloader tries to start the main firmware.

If a FLASH_START message is received from manager software (e.g. on a Linux machine) the MCU responds with a positive FLASH_RESPONSE
message.
After that the manager software sends FLASH_DATA messages to which the MCU responds with positive or negative FLASH_RESPONSE messages.
The last flash page is followed by a FLASH_END message.
Then the MCU tries to start the freshly installed firmware.

If at any point in the flashing process an unrecoverable error occurrs the bootloader is restarted, waiting again for a FLASH_START
message.