Added support for Atmega1284p.
This commit is contained in:
@@ -3,11 +3,18 @@
|
||||
###############################################################################
|
||||
|
||||
## General Flags
|
||||
ifeq (${MCU},atmega1284p)
|
||||
MCU = atmega1284p
|
||||
AVRDUDE_MCU = m1284p
|
||||
LINT_MCU = __AVR_ATmega1284p__
|
||||
else
|
||||
MCU = atmega644p
|
||||
AVRDUDE_MCU = m644p
|
||||
# ATmega644 bootload is at word address 7000h, 7800h, 7C00h, or 7E00h
|
||||
# Double that value to get the byte address
|
||||
BOOTLOAD = 0xF800
|
||||
LINT_MCU = __AVR_ATmega644p__
|
||||
endif
|
||||
TARGET = bacnet
|
||||
## Tools
|
||||
CC = avr-gcc
|
||||
@@ -17,7 +24,6 @@ OBJDUMP = avr-objdump
|
||||
SIZE = avr-size
|
||||
AVRDUDE = avrdude
|
||||
LINT = splint
|
||||
LINT_MCU = __AVR_ATmega644p__
|
||||
|
||||
SIZE_OPTIONS = -t
|
||||
#SIZE_OPTIONS = -C --mcu=${MCU}
|
||||
@@ -30,11 +36,24 @@ SIZE_OPTIONS = -t
|
||||
# jtag2slow = Atmel JTAG ICE mkII, running at 19200 Bd
|
||||
# avrispmkII = AVR ISP MKII
|
||||
# avr109 = bootloader
|
||||
#AVRDUDE_PROGRAMMERID = avr109
|
||||
#AVRDUDE_PROGRAMMERID = jtag2fast
|
||||
ifeq (${JTAG},avr109)
|
||||
AVRDUDE_PROGRAMMERID = avr109
|
||||
endif
|
||||
ifeq (${JTAG},avrispmkII)
|
||||
#AVRDUDE_PROGRAMMERID = avrispmkII
|
||||
endif
|
||||
ifeq (${JTAG},dragon_isp)
|
||||
#AVRDUDE_PROGRAMMERID = dragon_isp
|
||||
endif
|
||||
ifeq (${JTAG},dragon_jtag)
|
||||
AVRDUDE_PROGRAMMERID = dragon_jtag
|
||||
endif
|
||||
ifeq (${JTAG},jtag2fast)
|
||||
AVRDUDE_PROGRAMMERID = jtag2fast
|
||||
endif
|
||||
ifndef JTAG
|
||||
AVRDUDE_PROGRAMMERID = jtag2fast
|
||||
endif
|
||||
#
|
||||
# port--serial or parallel port to which your
|
||||
# hardware programmer is attached
|
||||
@@ -218,7 +237,9 @@ LDFLAGS = $(COMMON)
|
||||
#dead code removal
|
||||
#LDFLAGS += -Wl,-nostartfiles,-nostdlib
|
||||
LDFLAGS += -Wl,--gc-sections,-static
|
||||
ifneq (${MCU},atmega1284p)
|
||||
LDFLAGS += -Wl,--section-start=.bootloader=$(BOOTLOAD)
|
||||
endif
|
||||
LDFLAGS += -Wl,-Map=$(TARGET).map
|
||||
LDFLAGS += -Wl,-L.,-l$(TARGET)
|
||||
|
||||
|
||||
@@ -167,6 +167,5 @@ void adc_init(
|
||||
1 1 1 Timer/Counter1 Capture Event
|
||||
*/
|
||||
ADCSRB = (0 << ADTS2) | (0 << ADTS1) | (0 << ADTS0);
|
||||
/* Clear the Power Reduction bit */
|
||||
BIT_CLEAR(PRR, PRADC);
|
||||
power_adc_enable();
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -39,8 +39,13 @@
|
||||
#if defined(__GNUC__)
|
||||
#include <avr/io.h>
|
||||
#include <avr/wdt.h>
|
||||
#if !defined(__AVR_ATmega644P__)
|
||||
#error Firmware is configured for ATmega644P only (-mmcu=atmega644p)
|
||||
#include <avr/power.h>
|
||||
#if defined(__AVR_ATmega644P__)
|
||||
/* defined for ATmega644p */
|
||||
#elif defined(__AVR_ATmega1284P__)
|
||||
/* defined for ATmega1284p */
|
||||
#else
|
||||
#error For ATmega644P or ATmega1284p only (-mmcu=atmega644p -mmcu=atmega1284p)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -51,13 +51,13 @@ static void input_switch_workaround(
|
||||
BIT_SET(DDRA, DDA5);
|
||||
BIT_SET(DDRA, DDA6);
|
||||
/* turn off the outputs */
|
||||
BIT_CLEAR(PORTA, PA0);
|
||||
BIT_CLEAR(PORTA, PA1);
|
||||
BIT_CLEAR(PORTA, PA2);
|
||||
BIT_CLEAR(PORTA, PA3);
|
||||
BIT_CLEAR(PORTA, PA4);
|
||||
BIT_CLEAR(PORTA, PA5);
|
||||
BIT_CLEAR(PORTA, PA6);
|
||||
BIT_CLEAR(PORTA, PORTA0);
|
||||
BIT_CLEAR(PORTA, PORTA1);
|
||||
BIT_CLEAR(PORTA, PORTA2);
|
||||
BIT_CLEAR(PORTA, PORTA3);
|
||||
BIT_CLEAR(PORTA, PORTA4);
|
||||
BIT_CLEAR(PORTA, PORTA5);
|
||||
BIT_CLEAR(PORTA, PORTA6);
|
||||
/* configure the port pins for the switch - as inputs */
|
||||
BIT_CLEAR(DDRA, DDA0);
|
||||
BIT_CLEAR(DDRA, DDA1);
|
||||
@@ -156,13 +156,13 @@ void input_init(
|
||||
BIT_CLEAR(DDRA, DDA5);
|
||||
BIT_CLEAR(DDRA, DDA6);
|
||||
/* activate the internal pull up resistors */
|
||||
BIT_SET(PORTA, PA0);
|
||||
BIT_SET(PORTA, PA1);
|
||||
BIT_SET(PORTA, PA2);
|
||||
BIT_SET(PORTA, PA3);
|
||||
BIT_SET(PORTA, PA4);
|
||||
BIT_SET(PORTA, PA5);
|
||||
BIT_SET(PORTA, PA6);
|
||||
BIT_SET(PORTA, PORTA0);
|
||||
BIT_SET(PORTA, PORTA1);
|
||||
BIT_SET(PORTA, PORTA2);
|
||||
BIT_SET(PORTA, PORTA3);
|
||||
BIT_SET(PORTA, PORTA4);
|
||||
BIT_SET(PORTA, PORTA5);
|
||||
BIT_SET(PORTA, PORTA6);
|
||||
/* configure the port pins for binary inputs */
|
||||
BIT_CLEAR(DDRB, DDB1);
|
||||
BIT_CLEAR(DDRB, DDB2);
|
||||
|
||||
@@ -310,8 +310,7 @@ static void rs485_usart_init(
|
||||
/* Set Character Size: UCSZn2 UCSZn1 UCSZn0 = 011 for 8-bit */
|
||||
/* Clock Polarity: UCPOLn = 0 when asynchronous mode is used. */
|
||||
UCSR0C = _BV(UCSZ01) | _BV(UCSZ00);
|
||||
/* Clear Power Reduction */
|
||||
BIT_CLEAR(PRR, PRUSART0);
|
||||
power_usart0_enable();
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -178,8 +178,7 @@ static void serial_usart_init(
|
||||
/* Set Character Size: UCSZn2 UCSZn1 UCSZn0 = 011 for 8-bit */
|
||||
/* Clock Polarity: UCPOLn = 0 when asynchronous mode is used. */
|
||||
UCSR1C = _BV(UCSZ11) | _BV(UCSZ10);
|
||||
/* Clear Power Reduction */
|
||||
BIT_CLEAR(PRR, PRUSART1);
|
||||
power_usart1_enable();
|
||||
}
|
||||
|
||||
void serial_init(
|
||||
|
||||
@@ -161,6 +161,5 @@ void timer_init(
|
||||
TCNT2 = TIMER2_COUNT;
|
||||
/* Enable the overflow interrupt */
|
||||
BIT_SET(TIMSK2, TOIE2);
|
||||
/* Clear the Power Reduction Timer/Counter0 */
|
||||
BIT_CLEAR(PRR, PRTIM2);
|
||||
power_timer2_enable();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user