From d76d58a12e6982c54ca8a1d51b96fb9f864fc569 Mon Sep 17 00:00:00 2001 From: Martyn Ranyard Date: Fri, 2 Nov 2012 21:45:58 +0000 Subject: Bootloaders: adds support for 328-nonp chips --- bootloaders/bt/ATmegaBOOT_168.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'bootloaders/bt/ATmegaBOOT_168.c') diff --git a/bootloaders/bt/ATmegaBOOT_168.c b/bootloaders/bt/ATmegaBOOT_168.c index c73eefa..7ce2832 100644 --- a/bootloaders/bt/ATmegaBOOT_168.c +++ b/bootloaders/bt/ATmegaBOOT_168.c @@ -79,7 +79,7 @@ /* the current avr-libc eeprom functions do not support the ATmega168 */ /* own eeprom write/read functions are used instead */ -#if !defined(__AVR_ATmega168__) || !defined(__AVR_ATmega328P__) +#if !defined(__AVR_ATmega168__) || !defined(__AVR_ATmega328P__) || !defined(__AVR_ATmega328__) #include #endif @@ -194,6 +194,11 @@ #define SIG3 0x0F #define PAGE_SIZE 0x40U //64 words +#elif defined __AVR_ATmega328__ +#define SIG2 0x95 +#define SIG3 0x14 +#define PAGE_SIZE 0x40U //64 words + #elif defined __AVR_ATmega162__ #define SIG2 0x94 #define SIG3 0x04 @@ -335,7 +340,7 @@ int main(void) UBRRHI = (F_CPU/(BAUD_RATE*16L)-1) >> 8; UCSRA = 0x00; UCSRB = _BV(TXEN)|_BV(RXEN); -#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) +#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__) UBRR0H = ((F_CPU / 16 + BAUD_RATE / 2) / BAUD_RATE - 1) >> 8; UBRR0L = ((F_CPU / 16 + BAUD_RATE / 2) / BAUD_RATE - 1); @@ -557,7 +562,7 @@ putch(0x0D); if (getch() == ' ') { if (flags.eeprom) { //Write to EEPROM one byte at a time for(w=0;w