From 85b27248b09e2f6e6f23cce053b121dfc7ea9c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Sun, 8 Nov 2015 18:49:49 +0100 Subject: [PATCH] now using optiboot bootloader (arduino bootloader does not support well watchdog) --- arduino_nano/Makefile | 21 +++++++++++---------- 1 file 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