now using optiboot bootloader (arduino bootloader does not support well watchdog)

This commit is contained in:
King Kévin 2015-11-08 18:49:49 +01:00
parent ad4d3496b2
commit 85b27248b0
1 changed files with 11 additions and 10 deletions

View File

@ -12,9 +12,9 @@ F_CPU = 16000000UL
PROGRAMMER = arduino
PORT = /dev/ttyUSB0
# to flash
# use the aduino bootlaoder, with a baudrate of 57600
# reset the device to start bootlaoder
FLASHER = avrdude -p $(DEVICE) -c $(PROGRAMMER) -P $(PORT) -b 57600 -D
# use the aduino bootloader, with a baudrate of 57600
# reset the device to start (optiboot) bootloader
FLASHER = avrdude -p $(DEVICE) -c $(PROGRAMMER) -P $(PORT) -b 115200 -D
# compiler executables
CC = avr-gcc
@ -56,21 +56,22 @@ debug: map lst all
# after reset the bootloader is start
# the bootloader can be used to reflash the device
reset:
stty 57600 raw ignbrk hup < $(PORT)
stty 115200 raw ignbrk hup < $(PORT)
# flash the device using the internal bootloader
flash: $(TARGET).hex reset
$(FLASHER) -U flash:w:$<:i
# write EEPROM on the device
# write EEPROM on the device (optiboot has EEPROM capabilities disabled by default)
eeprom: $(TARGET)_eeprom.hex reset
$(FLASHER) -U eeprom:w:$<:i
# write bootloader and fuses
bootloader:
wget https://arduino.googlecode.com/svn/trunk/hardware/arduino/bootloaders/atmega/ATmegaBOOT_168_atmega328.hex
avrdude -p $(DEVICE) -c usbtiny -U lfuse:w:0xff:m -U hfuse:w:0xda:m -U efuse:w:0x05:m -U flash:w:ATmegaBOOT_168_atmega328.hex:i
rm ATmegaBOOT_168_atmega328.hex
# write bootloader (optiboot) and fuses
bootloader.hex:
wget -O $@ https://github.com/Optiboot/optiboot/raw/master/optiboot/bootloaders/optiboot/optiboot_atmega328.hex
bootloader: bootloader.hex
avrdude -p $(DEVICE) -c usbtiny -U lfuse:w:0xff:m -U hfuse:w:0xda:m -U efuse:w:0x05:m -U flash:w:$<:i
# create main target firmware
compile: $(TARGET).elf