more flags

This commit is contained in:
Olaf Rempel 2012-03-12 22:11:02 +01:00
parent 5a603ef90f
commit 61d25b1b7d
2 changed files with 20 additions and 6 deletions

View File

@ -3,13 +3,16 @@ OBJ = main.o
MCU_TARGET = atmega32 MCU_TARGET = atmega32
OPTIMIZE = -Os OPTIMIZE = -Os
#AVRDUDE_PROG = -c avr910 -b 115200 -P /dev/ttyUSB2
AVRDUDE_PROG = -c dragon_isp -P usb
ifeq ($(MCU_TARGET), atmega32) ifeq ($(MCU_TARGET), atmega32)
# hfuse = 0x?A (2k bootloader) # hfuse = 0x?A (2k bootloader)
BOOTLOADER_START=0x7800 BOOTLOADER_START=0x7800
AVRDUDE_MCU=m32 AVRDUDE_MCU=m32
endif endif
DEFS = -DBOOTLOADER_START=$(BOOTLOADER_START) -DOSCCAL_VALUE=0xAA DEFS = -DBOOTLOADER_START=$(BOOTLOADER_START) -DOSCCAL_VALUE=0xA8 -DOSCCAL_CHECK=0 -DMPM_ADDRESS=0x11
LIBS = LIBS =
# Override is only needed by avr-lib build system. # Override is only needed by avr-lib build system.
@ -50,7 +53,14 @@ bin: $(PRG).bin
$(OBJCOPY) -j .text -j .data -O binary $< $@ $(OBJCOPY) -j .text -j .data -O binary $< $@
install: text install: text
avrdude -c dragon_isp -P usb -p $(AVRDUDE_MCU) -V -U flash:w:$(PRG).hex avrdude $(AVRDUDE_PROG) -p $(AVRDUDE_MCU) -V -U flash:w:$(PRG).hex
fuses:
avrdude $(AVRDUDE_PROG) -p $(AVRDUDE_MCU) -U hfuse:w:0xda:m
avrdude $(AVRDUDE_PROG) -p $(AVRDUDE_MCU) -U lfuse:w:0xd4:m
osccal:
avrdude $(AVRDUDE_PROG) -p $(AVRDUDE_MCU) -U calibration:r:-:h
reset: reset:
avrdude -c dragon_isp -P usb -p $(AVRDUDE_MCU) avrdude $(AVRDUDE_PROG) -p $(AVRDUDE_MCU)

10
main.c
View File

@ -46,7 +46,9 @@
#define LED PORTD3 #define LED PORTD3
#define BAUDRATE 115200 #define BAUDRATE 115200
#ifndef MPM_ADDRESS
#define MPM_ADDRESS 0x11 #define MPM_ADDRESS 0x11
#endif /* MPM_ADDRESS */
#define EEPROM_SUPPORT 1 #define EEPROM_SUPPORT 1
@ -438,7 +440,7 @@ ISR(TIMER0_OVF_vect)
} }
} }
#if 0 #if (OSCCAL_CHECK)
static void uart_send(char *p) static void uart_send(char *p)
{ {
while (*p) { while (*p) {
@ -446,7 +448,7 @@ static void uart_send(char *p)
UDR = *p++; UDR = *p++;
} }
} }
#endif #endif /* (OSCCAL_CHECK) */
static void (*jump_to_app)(void) __attribute__ ((noreturn)) = 0x0000; static void (*jump_to_app)(void) __attribute__ ((noreturn)) = 0x0000;
@ -481,9 +483,11 @@ int main(void)
/* store MPM address in TWI register for application */ /* store MPM address in TWI register for application */
TWAR = MPM_ADDRESS; TWAR = MPM_ADDRESS;
#if (OSCCAL_CHECK)
/* 11.354ms for 109 bits @9600 */ /* 11.354ms for 109 bits @9600 */
/* 946.18us for 109 bits @115200 */ /* 946.18us for 109 bits @115200 */
// uart_send("1234567890"); uart_send("1234567890");
#endif /* (OSCCAL_CHECK) */
sei(); sei();