aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKing Kévin <kingkevin@cuvoodoo.info>2015-11-08 18:49:49 +0100
committerKing Kévin <kingkevin@cuvoodoo.info>2015-11-08 18:49:49 +0100
commit85b27248b09e2f6e6f23cce053b121dfc7ea9c07 (patch)
tree686c708d1244a6fbcafaef10a44cf030ea782e44
parentad4d3496b22f017e73e3c0df88685b2fb09afe09 (diff)
now using optiboot bootloader (arduino bootloader does not support well watchdog)
-rw-r--r--arduino_nano/Makefile21
1 files changed, 11 insertions, 10 deletions
diff --git a/arduino_nano/Makefile b/arduino_nano/Makefile
index a84e246..f68c63d 100644
--- a/arduino_nano/Makefile
+++ b/arduino_nano/Makefile
@@ -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