avr: split code in multiple files and routines.

This commit is contained in:
Martin Preuss
2023-04-22 11:54:09 +02:00
parent 3e6501c834
commit 3b44fb9c5b
12 changed files with 656 additions and 498 deletions

23
avr/modules/flash/README Normal file
View File

@@ -0,0 +1,23 @@
This implements the boot loader. It can be used to flash new firmware to node.
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 type and version of the currently installed firmware.
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.