Commit Graph

12 Commits

Author SHA1 Message Date
Olaf Rempel f4952aaa63 Implement a virtual bootloader section
- patch reset vector while programming flash page0
  Let the reset vector always point to the twiboot start.
- Use another (must be unused!) ISR vector to store the original
  reset vector as jump to the application.
- Cache the values for the verification read
- currently works only for devices < 8kB flash (2 byte vector entries)
- using a attiny85 as target

This change is heavily based on the optiboot bootloader.
2020-10-26 18:54:00 +01:00
Olaf Rempel 9f3781a3eb Implement USI peripheral slave statemachine
- Implement a TWI slave using the USI peripheral found in AVR tiny MCUs
- using attiny85 as target (has no bootloader section!)
- USI peripheral in general needs clock stretching support from the
  master since the whole statemachine is software based.
  For now the actual writing to flash/eeprom is also done during
  clock stretching (like original twiboot implementation).
  This might be changed later.
- ACK/NAK handling is different:
  For TWI peripheral the ACK/NAK of the *next* byte has to be returned
  by TWI_data_write(). For USI peripheral the ACK/NAK of the *current*
  byte needs to be returned. For now the TWI version remains in the
  code and might be changed later.
2020-10-26 13:51:07 +01:00
Olaf Rempel fc61d39288 Do not use IRQs and remove vector table
Do not use ISRs and poll for interrupt flags in the main loop.
No need for moving vector table into bootloader and back.

Remove vector table by adding LDFLAGS = -nostartfiles.
Manually add some code which is now removed, but still needed by C
runtime:
- make sure that r1 is 0x00 (zero register).
- on some MCUs the stack pointer is not initialized correctly after
reset.
- main() need to be placed in special section .init9 to be called at all.

Not sure why the BSS and DATA segment are still initialized.

This change is heavily based on the optiboot bootloader.
2019-11-06 13:18:53 +01:00
Olaf Rempel f4ef7a7b1e Update code style
Update indention to spaces
Fix comments
Add README.md and GPL-2 LICENSE files
2019-11-06 13:18:53 +01:00
Olaf Rempel bc5d45359a Fix sizeof(VERSION_STRING)
- sizeof(info) should not be increased (16->18) since the size is never
  exchanged with the I2C master. Also using a non 2^x size will result
  in bigger code since the compiler can no longer use a simple AND to
  implement the bcnt %= sizeof(info).

- when using a info[16] the firmware is small enough to fit in a 512
  word bootloader again :)
2015-03-21 09:15:43 +01:00
Jason Lefley 89b3251dde add support for atmega328p 2015-03-18 15:28:12 -07:00
Olaf Rempel 5e4b562608 update Makefile 2014-10-05 14:32:07 +02:00
Olaf Rempel 8a98e09c46 corrections 2010-10-16 19:28:05 +02:00
Olaf Rempel f73b52bc3c multicpu support 2010-08-15 16:44:54 +02:00
Olaf Rempel b39087eb8e change programmer 2009-01-24 16:52:22 +01:00
Olaf Rempel dbef89dc6e mega88 version 2008-06-17 18:02:07 +02:00
Olaf Rempel 914150f707 initial commit 2007-09-21 21:39:09 +02:00