Changes to support the Atmel AVR Raven port

This commit is contained in:
adamdunkels 2008-10-14 09:44:12 +00:00
parent db7d9bb131
commit cdb6226598
2 changed files with 38 additions and 12 deletions

View file

@ -1,4 +1,4 @@
# $Id: Makefile.avr,v 1.10 2008/02/07 19:56:56 oliverschmidt Exp $ # $Id: Makefile.avr,v 1.11 2008/10/14 09:44:12 adamdunkels Exp $
### Check if we are running under Windows ### Check if we are running under Windows
@ -12,6 +12,9 @@ endif
.SUFFIXES: .SUFFIXES:
### Optimization setting
OPTI=s
### Define the CPU directory ### Define the CPU directory
CONTIKI_CPU=$(CONTIKI)/cpu/avr CONTIKI_CPU=$(CONTIKI)/cpu/avr
@ -35,12 +38,12 @@ AS = avr-as
AR = avr-ar AR = avr-ar
OBJCOPY = avr-objcopy OBJCOPY = avr-objcopy
STRIP = avr-strip STRIP = avr-strip
CFLAGSNO = -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) \ CFLAGSNO = -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) $(USB_INCLUDES) \
-I$(CONTIKI)/platform/$(TARGET) \ -I$(CONTIKI)/platform/$(TARGET) \
${addprefix -I,$(APPDIRS)} \ ${addprefix -I,$(APPDIRS)} \
-Wall -mmcu=$(MCU) -gstabs -Wall -mmcu=$(MCU) -gdwarf-2 $(CONTIKI_PLAT_DEFS)
CFLAGS = $(CFLAGSNO) -Os CFLAGS += $(CFLAGSNO) -O$(OPTI)
BOOTLOADER_START = 0x1e000 BOOTLOADER_START = 0x1FC00
LDFLAGS = -mmcu=$(MCU) -Wl,-Map=contiki-$(TARGET).map \ LDFLAGS = -mmcu=$(MCU) -Wl,-Map=contiki-$(TARGET).map \
-Wl,--section-start=.bootloader=$(BOOTLOADER_START) -Wl,--section-start=.bootloader=$(BOOTLOADER_START)
@ -50,9 +53,11 @@ LDFLAGS = -mmcu=$(MCU) -Wl,-Map=contiki-$(TARGET).map \
CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \ CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \
$(CONTIKI_TARGET_DIRS)} $(CONTIKI_TARGET_DIRS)}
vpath %.c $(PROJECTDIRS) $(CONTIKI)/cpu/avr/dev \ vpath %.c $(PROJECTDIRS) $(CONTIKI)/cpu/avr/dev $(CONTIKI)/cpu/avr/dev/usb \
$(CONTIKI)/cpu/avr/dev/usb/rndis $(CONTIKI)/cpu/avr/dev/usb/serial \
$(CONTIKI)/cpu/avr/dev/usb/storage \
$(CONTIKIDIRS) $(APPDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \ $(CONTIKIDIRS) $(APPDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \
$(CONTIKI_CPU) $(CONTIKI_CPU) $(CONTIKI)/cpu/avr/radio/rf230 $(CONTIKI)/cpu/avr/radio/mac
### Compilation rules ### Compilation rules

View file

@ -28,7 +28,7 @@
* *
* This file is part of the Contiki operating system. * This file is part of the Contiki operating system.
* *
* $Id: rtimer-arch.c,v 1.2 2007/12/11 17:21:14 joxe Exp $ * $Id: rtimer-arch.c,v 1.3 2008/10/14 09:44:12 adamdunkels Exp $
*/ */
/** /**
@ -49,9 +49,20 @@
#include "sys/rtimer.h" #include "sys/rtimer.h"
#include "rtimer-arch.h" #include "rtimer-arch.h"
#if defined(__AVR_ATmega1284P__)
#define ETIMSK TIMSK3
#define ETIFR TIFR3
#define TICIE3 ICIE3
//Has no 'C', so we just set it to B. The code doesn't really use C so this
//is safe to do but lets it compile
#define OCIE3C OCIE3B
#define OCF3C OCF3B
#endif
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
#ifdef TCNT3 #ifdef TCNT3
SIGNAL (SIG_OUTPUT_COMPARE3A) { ISR (TIMER3_COMPA_vect) {
ENERGEST_ON(ENERGEST_TYPE_IRQ); ENERGEST_ON(ENERGEST_TYPE_IRQ);
ETIMSK &= ~((1 << OCIE3A) | (1 << OCIE3B) | (1 << TOIE3) | ETIMSK &= ~((1 << OCIE3A) | (1 << OCIE3B) | (1 << TOIE3) |
@ -62,6 +73,10 @@ SIGNAL (SIG_OUTPUT_COMPARE3A) {
ENERGEST_OFF(ENERGEST_TYPE_IRQ); ENERGEST_OFF(ENERGEST_TYPE_IRQ);
} }
#else
#error "No Timer3 in rtimer-arch.c"
#endif #endif
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
void void
@ -90,6 +105,9 @@ rtimer_arch_init(void)
/* Maximum prescaler */ /* Maximum prescaler */
TCCR3B |= 5; TCCR3B |= 5;
#else
#error "No Timer3 in rtimer-arch.c"
#endif #endif
/* Restore interrupt state */ /* Restore interrupt state */
@ -111,6 +129,9 @@ rtimer_arch_schedule(rtimer_clock_t t)
(1 << OCF3C); (1 << OCF3C);
ETIMSK |= (1 << OCIE3A); ETIMSK |= (1 << OCIE3A);
#else
#error "No Timer3 in rtimer-arch.c"
#endif #endif
/* Restore interrupt state */ /* Restore interrupt state */