From bcbd3a6ef4980682c5b6d83947098bc53b2c855d Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Sun, 9 Nov 2008 21:02:20 +0000 Subject: Adding ATmega328 support. --- bootloaders/atmega168/ATmegaBOOT_168.c | 23 ++++++++++++++--------- bootloaders/atmega168/Makefile | 7 +++++++ 2 files changed, 21 insertions(+), 9 deletions(-) (limited to 'bootloaders') diff --git a/bootloaders/atmega168/ATmegaBOOT_168.c b/bootloaders/atmega168/ATmegaBOOT_168.c index 6a3c634..90bef67 100755 --- a/bootloaders/atmega168/ATmegaBOOT_168.c +++ b/bootloaders/atmega168/ATmegaBOOT_168.c @@ -69,7 +69,7 @@ /* the current avr-libc eeprom functions do not support the ATmega168 */ /* own eeprom write/read functions are used instead */ -#ifndef __AVR_ATmega168__ +#if !defined(__AVR_ATmega168__) || !defined(__AVR_ATmega328P__) #include #endif @@ -179,6 +179,11 @@ #define SIG3 0x06 #define PAGE_SIZE 0x40U //64 words +#elif defined __AVR_ATmega328P__ +#define SIG2 0x95 +#define SIG3 0x0F +#define PAGE_SIZE 0x40U //64 words + #elif defined __AVR_ATmega162__ #define SIG2 0x94 #define SIG3 0x04 @@ -337,7 +342,7 @@ int main(void) UBRRHI = (F_CPU/(BAUD_RATE*16L)-1) >> 8; UCSRA = 0x00; UCSRB = _BV(TXEN)|_BV(RXEN); -#elif defined __AVR_ATmega168__ +#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) UBRR0L = (uint8_t)(F_CPU/(BAUD_RATE*16L)-1); UBRR0H = (F_CPU/(BAUD_RATE*16L)-1) >> 8; UCSR0B = (1<