Bootloader self-program - Juno AVR109 Rewrite Part 1 - Advanced AVR 3.0 Core
This is not a rearrange and clone, but a completely rewrite, including the SPM and LPM code and the programming software. Most of the code are done, just need to combine them together and test it out. So Juno AVR109 is just a guinea pig for testing the Advanced AVR 3.0 Core - bootloader doctrines.
Original code Test:
1Mbps At:
4441 bytes/second write (7111-8648 b/s Technically maximum speed)
7772 bytes/second Read
Compiled size: 1288 bytes ( 1288/64= 21 pages )
Objectives:
Flexible, powerful and small:
Basic version: 256 bytes compiled and 7kb/s;
Full version: 512-1024 bytes compiled and 7kb/s;
Switch-less:
The original code uses an I/O pin's status to either enter normal Application section or enter Bootloader section. This is reasonable, but it's a dumb way to solve a simple dilemma. During power-on/plug-in, the MCU can either pick to start from APP or BOOT section, but not both, using a switch solves this problem. To enter bootloader section, so the MCU can be reprogrammed, simply put the switch on the correct position, then reset the MCU. To enter application section, do the same thing; Normally this is not a big problem, but if the board is used as development board, and the board is being programmed many times in a row, switching and resetting are very annoying.
Better solution:
During start up, the MCU goes to bootloader section by default; a 100ms-1s timer is started, if no serial signal is received in the delay period, then MCU switches to APP section automatically. Some serial chips can output a signal to reset the MCU, and the MCU is resetted automatically for the next programming event, or the MCU can be reset with a reset button manually during re-programming; or a micro-code is inserted in all Application code to detect a Serial re-programming request, and jump to the bootloader by itself or the MCU can reset itself using watchdog, and then enter bootloader by default. The option and solution are plentiful, using a jumper is very dumb.