From 792d34f4e39b19bceeeb7dc3386ed824266ea807 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 20 May 2012 20:41:12 +0000 Subject: updated avr utils from spreadspace (minor bugfixes) git-svn-id: https://svn.spreadspace.org/mur.sat@459 7de4ea59-55d0-425e-a1af-a3118ea81d4c --- software/avr.include.mk | 101 +++++++++++++++++++++++++++++------------- software/hhd70dongle/Makefile | 2 +- software/hhd70dongle/led.c | 23 ++++++++-- software/hhd70dongle/led.h | 2 +- 4 files changed, 91 insertions(+), 37 deletions(-) diff --git a/software/avr.include.mk b/software/avr.include.mk index 8542449..93a34fb 100644 --- a/software/avr.include.mk +++ b/software/avr.include.mk @@ -3,7 +3,7 @@ ## ## ## Copyright (C) 2012 Christian Pointner -## +## ## This file is part of spreadspace avr utils. ## ## spreadspace avr utils is free software: you can redistribute it and/or modify @@ -21,37 +21,77 @@ ## ifeq ($(BOARD_TYPE),teensy1) -MCU := at90usb162 -F_CPU := 16000000 -PROG := teensy + MCU := at90usb162 + F_CPU := 16000000 + PROG := teensy endif ifeq ($(BOARD_TYPE),teensy2) -MCU := atmega32u4 -F_CPU := 16000000 -PROG := teensy + MCU := atmega32u4 + F_CPU := 16000000 + PROG := teensy endif -ifeq ($(BOARD_TYPE),teensypp1) -MCU := at90usb646 -F_CPU := 16000000 -PROG := teensy +ifeq ($(BOARD_TYPE),teensy1pp) + MCU := at90usb646 + F_CPU := 16000000 + PROG := teensy endif -ifeq ($(BOARD_TYPE),teensypp2) -MCU := at90usb1286 -F_CPU := 16000000 -PROG := teensy +ifeq ($(BOARD_TYPE),teensy2pp) + MCU := at90usb1286 + F_CPU := 16000000 + PROG := teensy endif ifeq ($(BOARD_TYPE),hhd70dongle) -MCU := atmega32u4 -F_CPU := 16000000 -PROG := DFU + MCU := atmega32u4 + F_CPU := 16000000 + PROG := DFU +endif +ifeq ($(BOARD_TYPE),arduinoUno) + MCU := atmega328p + F_CPU := 16000000 + PROG := avrdude + UPLOAD_RATE := 57600 + PROG_TYPE := stk500v1 + AVRDUDE_PORT := /dev/ttyUSB0 + RESET_FUNC := ../tools/reset_arduino + RESET_PARAM = $(AVRDUDE_PORT) +endif +ifeq ($(BOARD_TYPE),arduino2009v2) + MCU := atmega328p + F_CPU := 16000000 + PROG := avrdude + UPLOAD_RATE := 57600 + PROG_TYPE := stk500v1 + AVRDUDE_PORT := /dev/ttyUSB0 + RESET_FUNC := ../tools/reset_arduino + RESET_PARAM = $(AVRDUDE_PORT) endif ifeq ($(BOARD_TYPE),arduino2009) -MCU := atmega168 -F_CPU := 16000000 -PROG := avrdude -UPLOAD_RATE := 19200 -PROG_TYPE := stk500v1 -AVRDUDE_PORT := /dev/ttyUSB0 + MCU := atmega168 + F_CPU := 16000000 + PROG := avrdude + UPLOAD_RATE := 19200 + PROG_TYPE := stk500v1 + AVRDUDE_PORT := /dev/ttyUSB0 + RESET_FUNC := ../tools/reset_arduino + RESET_PARAM = $(AVRDUDE_PORT) +endif +ifeq ($(BOARD_TYPE),arduino10000) + MCU := atmega168 + F_CPU := 16000000 + PROG := avrdude + UPLOAD_RATE := 19200 + PROG_TYPE := stk500v1 + AVRDUDE_PORT := /dev/ttyUSB0 + RESET_FUNC := ../tools/reset_arduino + RESET_PARAM = $(AVRDUDE_PORT) +endif +ifeq ($(BOARD_TYPE),arduinoNG) + MCU := atmega8 + F_CPU := 16000000 + PROG := avrdude + UPLOAD_RATE := 19200 + PROG_TYPE := stk500v1 + AVRDUDE_PORT := /dev/ttyUSB0 endif CC = avr-gcc @@ -143,11 +183,10 @@ endef ### avrdude define avrdude/erase - $(avrdude) -V -F -p $(MCU) -P $(AVRDUDE_PORT) -c $(PROG_TYPE) -b $(UPLOAD_RATE) -e endef define avrdude/flash - $(avrdude) -V -F -p $(MCU) -P $(AVRDUDE_PORT) -c $(PROG_TYPE) -b $(UPLOAD_RATE) -D -U flash:w:$1 + $(avrdude) -V -F -p $(MCU) -P $(AVRDUDE_PORT) -c $(PROG_TYPE) -b $(UPLOAD_RATE) -U flash:w:$1 endef define avrdude/run @@ -166,10 +205,10 @@ run: $(call $(PROG)/$@,) reset: - @if [ -n "$(RESET_FUNC)" ]; then \ - if [ -x "$(RESET_FUNC)" ]; then \ - "$(RESET_FUNC)"; \ - else \ + @if [ -n "$(RESET_FUNC)" ]; then \ + if [ -x "$(RESET_FUNC)" ]; then \ + eval $(RESET_FUNC) $(RESET_PARAM); \ + else \ echo "WARNING: ignoring non-existing or non-executable reset script"; \ - fi \ + fi \ fi diff --git a/software/hhd70dongle/Makefile b/software/hhd70dongle/Makefile index 65907fc..0f5441f 100644 --- a/software/hhd70dongle/Makefile +++ b/software/hhd70dongle/Makefile @@ -3,7 +3,7 @@ ## ## ## Copyright (C) 2011 Christian Pointner -## +## ## This file is part of spreadspace teensy utils. ## ## spreadspace teensy utils is free software: you can redistribute it and/or modify diff --git a/software/hhd70dongle/led.c b/software/hhd70dongle/led.c index ced853f..c945564 100644 --- a/software/hhd70dongle/led.c +++ b/software/hhd70dongle/led.c @@ -3,7 +3,7 @@ * * * Copyright (C) 2012 Christian Pointner - * + * * This file is part of spreadspace avr utils. * * spreadspace avr utils is free software: you can redistribute it and/or modify @@ -23,12 +23,19 @@ #include "avr/io.h" #include "led.h" -#define LED_DIR 1 +#if defined(__BOARD_arduinoUno__) +#define HAS_LED 0 +#else +#define HAS_LED 1 +#endif + #if defined(__BOARD_teensy1__) || defined(__BOARD_teensy1pp__) #define LED_DIR 0 +#else +#define LED_DIR 1 #endif -#if defined(__BOARD_teensy2__) || defined(__BOARD_teensy2pp__) || defined(__BOARD_teensy2__) || defined(__BOARD_teensy2pp__) +#if defined(__BOARD_teensy1__) || defined(__BOARD_teensy1pp__) || defined(__BOARD_teensy2__) || defined(__BOARD_teensy2pp__) #define LED_PORT PORTD #define LED_DDR DDRD #define LED_PINNUM 6 @@ -40,7 +47,7 @@ #define LED_PINNUM 6 #endif -#if defined(__BOARD_arduino2009__) +#if defined(__BOARD_arduino2009v2__) || defined(__BOARD_arduino2009__) || defined(__BOARD_arduino10000__) || defined(__BOARD_arduinoNG__) #define LED_PORT PORTB #define LED_DDR DDRB #define LED_PINNUM 5 @@ -48,29 +55,37 @@ void led_init(void) { +#if HAS_LED == 1 led_off(); LED_DDR = 1< - * + * * This file is part of spreadspace avr utils. * * spreadspace avr utils is free software: you can redistribute it and/or modify -- cgit v1.2.3