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/atmega/ATmegaBOOT_168.c | 21 +++++++++++++-------- bootloaders/atmega/Makefile | 25 ++++++++++++++++++++----- bootloaders/bt/ATmegaBOOT_168.c | 21 +++++++++++++-------- bootloaders/optiboot/optiboot.c | 2 +- bootloaders/optiboot/pin_defs.h | 2 +- bootloaders/stk500v2/avrinterruptnames.h | 8 ++++---- 6 files changed, 52 insertions(+), 27 deletions(-) diff --git a/bootloaders/atmega/ATmegaBOOT_168.c b/bootloaders/atmega/ATmegaBOOT_168.c index 90899a2..d0d4dab 100644 --- a/bootloaders/atmega/ATmegaBOOT_168.c +++ b/bootloaders/atmega/ATmegaBOOT_168.c @@ -73,7 +73,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 @@ -202,6 +202,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 @@ -367,7 +372,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__) #ifdef DOUBLE_SPEED UCSR0A = (1< #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