add funkbridge hardware

This commit is contained in:
Olaf Rempel 2016-05-15 22:21:38 +02:00
parent 788e4dd633
commit 2b2dde9f98
2 changed files with 47 additions and 7 deletions

View File

@ -10,9 +10,10 @@ SOURCE = $(wildcard *.c)
#CONFIG = ispprog
#CONFIG = flightctrl
#CONFIG = funkstuff88
CONFIG = funkstuff168
#CONFIG = funkstuff168
#CONFIG = ispprog2
#CONFIG = avrnetio
CONFIG = funkbridge
AVRDUDE_PROG := -c avr910 -b 115200 -P /dev/ispprog
#AVRDUDE_PROG := -c dragon_isp -P usb
@ -83,6 +84,17 @@ AVRDUDE_FUSES=lfuse:w:0xd7:m hfuse:w:0xdc:m efuse:w:0xfd:m
BOOTLOADER_START=0xF800
endif
# -------------------------
ifeq ($(CONFIG), funkbridge)
MCU=atmega328p
AVRDUDE_MCU=m328p -F
# (16MHz ext. crystal, 2.7V BOD)
AVRDUDE_FUSES=lfuse:w:0xff:m hfuse:w:0xdc:m efuse:w:0x02:m
BOOTLOADER_START=0x7C00
endif
# ---------------------------------------------------------------------------
CFLAGS = -pipe -g -Os -mmcu=$(MCU) -Wall
@ -102,7 +114,7 @@ $(TARGET): $(TARGET).elf
$(TARGET).elf: $(SOURCE:.c=.o) | $(LDSCRIPT_NOVECT)
@echo " Linking file: $@"
@$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-T$(LDSCRIPT_NOVECT) -o $@ $^ #2> /dev/null
@$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-T$(LDSCRIPT_NOVECT) -o $@ $^ 2> /dev/null
@$(OBJDUMP) -h -S $@ > $(@:.elf=.lss)
@$(OBJCOPY) -j .text -j .data -O ihex $@ $(@:.elf=.hex)
@$(OBJCOPY) -j .text -j .data -O binary $@ $(@:.elf=.bin)

38
main.c
View File

@ -84,8 +84,8 @@
#elif defined(CONFIG_funkstuff88)
/*
* using ATmega88 @8MHz:
* Fuse E: 0xFA (512 words bootloader)
* Fuse H: 0xDD (2.7V BOD)
* Fuse E: 0xFD (2.7V BOD)
* Fuse H: 0xDD (512 words bootloader)
* Fuse L: 0xE2 (internal osc)
*/
#define F_CPU 8000000
@ -112,8 +112,8 @@
#elif defined(CONFIG_funkstuff168)
/*
* using ATmega168 @16MHz:
* Fuse E: 0xFA (512 words bootloader)
* Fuse H: 0xDD (2.7V BOD)
* Fuse E: 0xFD (2.7V BOD)
* Fuse H: 0xDD (512 words bootloader)
* Fuse L: 0xFF (external crystal)
*/
#define F_CPU 16000000
@ -140,7 +140,7 @@
#elif defined(CONFIG_ispprog2)
/*
* using ATmega328P @8MHz:
* Fuse E: 0xFA (2.7V BOD)
* Fuse E: 0xFD (2.7V BOD)
* Fuse H: 0xDC (512 words bootloader)
* Fuse L: 0xE2 (internal osc)
*/
@ -186,6 +186,34 @@
#define ISP_NUM PINB1
#define ISP_POL 0
/* *********************************************************************** */
#elif defined(CONFIG_funkbridge)
/*
* using ATmega328P @16MHz:
* Fuse E: 0xFD (2.7V BOD)
* Fuse H: 0xDC (512 words bootloader)
* Fuse L: 0xFF (external crystal)
*/
#define F_CPU 16000000
#define BAUDRATE 19200
#define DEVCODE 0x72 /* mega32 devcode */
/* 100 * 10ms => 1000ms */
#define TIMEOUT 100
/* enter bootloader if PINB1 is low */
//#define ISP_DDR DDRB
//#define ISP_PIN PINB
//#define ISP_PORT PORTB
//#define ISP_NUM PINB1
//#define ISP_POL 0
/* high active led on PORTD4 */
#define LED_DDR DDRD
#define LED_PORT PORTD
#define LED_NUM PORTD4
#define LED_POL 1
/* *********************************************************************** */
#else
#error "unknown CONFIG"