Update README

This commit is contained in:
Olaf Rempel 2020-10-26 19:20:07 +01:00
parent f4952aaa63
commit baf5a895b5
1 changed files with 18 additions and 8 deletions

View File

@ -1,5 +1,5 @@
# twiboot - a TWI / I2C bootloader for AVR MCUs ##
twiboot is a simple/small bootloader for AVR MCUs with integrated TWI peripheral written in C.
twiboot is a simple/small bootloader for AVR MCUs written in C. It uses the integrated TWI or USI peripheral of the controller to implement a I2C slave.
It was originally created to update I2C controlled BLMCs (Brushless Motor Controller) without an AVR ISP adapter.
twiboot acts as a slave device on a TWI/I2C bus and allows reading/writing of the internal flash memory.
@ -10,6 +10,7 @@ Currently the following AVR MCUs are supported:
AVR MCU | Flash bytes used (.text + .data) | Bootloader region size
--- | --- | ---
attiny85 | 956 (0x3BC) | 512 words
atmega8 | 802 (0x322) | 512 words
atmega88 | 826 (0x33A) | 512 words
atmega168 | 826 (0x33A) | 512 words
@ -19,9 +20,10 @@ atmega328p | 826 (0x33A) | 512 words
## Operation ##
twiboot is installed in the bootloader memory region and executed directly after reset (BOOTRST fuse is programmed).
twiboot is installed in the bootloader section and executed directly after reset (BOOTRST fuse is programmed).
For MCUs without bootloader section see [Virtual bootloader section](#virtual-bootloader-section) below.
While running, twiboot configures the TWI peripheral as slave device and waits for valid protocol messages
While running, twiboot configures the TWI/USI peripheral as slave device and waits for valid protocol messages
directed to its address on the TWI/I2C bus. The slave address is configured during compile time of twiboot.
When receiving no messages for 1000ms after reset, the bootloader exits and executes the main application at address 0x0000.
@ -38,6 +40,19 @@ One LED will flash with a frequency of 20Hz while twiboot is active (including b
A second LED will flash when the bootloader is addressed on the TWI/I2C bus.
### Virtual Bootloader Section ###
For MCUs without bootloader section twiboot will patch the vector table on the fly during flash programming to stay active.
The reset vector is patched to execute twiboot instead of the application code.
Another vector entry will be patched to store the original entry point of the application.
This vector entry is overridden and MUST NOT be used by the application.
twiboot uses this vector to start the application after the initial timeout.
This live patching changes the content of the vector table, which would result in a verification error after programming.
To counter this kind of error, twiboot caches the original vector table entries in RAM and return those on a read command.
The real content of the vector table is only returned after a reset.
## Build and install twiboot ##
twiboot uses gcc, avr-libc and GNU Make for building, avrdude is used for flashing the MCU.
The build and install procedures are only tested under linux.
@ -102,8 +117,3 @@ Please note that there are some TWI/I2C masters that do not support clockstretch
## Development ##
Issue reports, feature requests, patches or simply success stories are much appreciated.
## Roadmap ##
Some ideas that I want to investigate / implement in twiboot:
- support AVR TINYs (USI peripheral, no bootloader fuse, no Read-While-Write flash)