diff options
author | Christian Pointner <equinox@spreadspace.org> | 2012-05-19 16:46:24 +0000 |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2012-05-19 16:46:24 +0000 |
commit | dbf23e8334e9af3605130124e7cb1738fd522771 (patch) | |
tree | bd0bd1bf9de05ea2bd4346df64eea575e1b63633 | |
parent | more generic led example code (diff) |
added support for arduino2009
git-svn-id: https://svn.spreadspace.org/avr/trunk@14 aa12f405-d877-488e-9caf-2d797e2a1cc7
-rw-r--r-- | blink/Makefile | 4 | ||||
-rw-r--r-- | blink/led.c | 6 | ||||
-rw-r--r-- | include.mk | 34 |
3 files changed, 38 insertions, 6 deletions
diff --git a/blink/Makefile b/blink/Makefile index d598f2f..9ac5f8b 100644 --- a/blink/Makefile +++ b/blink/Makefile @@ -22,6 +22,8 @@ NAME := blink
OBJ := blink.o led.o
-BOARD_TYPE := teensy2
+BOARD_TYPE := arduino2009
include ../include.mk
+
+#AVRDUDE_PORT := /dev/arduino
diff --git a/blink/led.c b/blink/led.c index 997edf0..ced853f 100644 --- a/blink/led.c +++ b/blink/led.c @@ -40,6 +40,12 @@ #define LED_PINNUM 6 #endif +#if defined(__BOARD_arduino2009__) +#define LED_PORT PORTB +#define LED_DDR DDRB +#define LED_PINNUM 5 +#endif + void led_init(void) { led_off(); @@ -45,12 +45,21 @@ MCU := atmega32u4 F_CPU := 16000000 PROG := DFU endif +ifeq ($(BOARD_TYPE),arduino2009) +MCU := atmega168 +F_CPU := 16000000 +PROG := avrdude +UPLOAD_RATE := 19200 +PROG_TYPE := stk500v1 +AVRDUDE_PORT := /dev/ttyUSB0 +endif CC = avr-gcc OBJCOPY = avr-objcopy DFU = dfu-programmer teensy = teensy_loader_cli +avrdude = avrdude ## Options common to compile, link and assembly rules COMMON = -mmcu=$(MCU) @@ -125,7 +134,7 @@ define DFU/run $(DFU) $(MCU) start endef -### teensy-Programmer +### teensy-loader define teensy/erase endef @@ -139,15 +148,30 @@ endef define teensy/run endef +### avrdude +define avrdude/erase + $(avrdude) -V -F -p $(MCU) -P $(AVRDUDE_PORT) -c $(PROG_TYPE) -b $(UPLOAD_RATE) -e +endef + +define avrdude/program + $(avrdude) -V -F -p $(MCU) -P $(AVRDUDE_PORT) -c $(PROG_TYPE) -b $(UPLOAD_RATE) -D -U flash:w:$1 +endef + +define avrdude/reset +endef + +define avrdude/run +endef + ### Program Targets erase: - $(call $(PROG)/$@, ) + $(call $(PROG)/$@,) program: $(HEXFILE) erase - $(call $(PROG)/$@, $(HEXFILE)) + $(call $(PROG)/$@,$(HEXFILE)) reset: - $(call $(PROG)/$@, ) + $(call $(PROG)/$@,) run: - $(call $(PROG)/$@, ) + $(call $(PROG)/$@,) |