From 00bc0c920ea91d4cdffed4a2ac2056ee276ff2c3 Mon Sep 17 00:00:00 2001 From: Manfred Steiner Date: Sat, 13 Jul 2024 17:34:11 +0200 Subject: [PATCH] software/bootloader-arduino (STK500) --- software/bootloader-arduino/.gdb_history | 9 + software/bootloader-arduino/.gdbinit | 5 + software/bootloader-arduino/.gitignore | 4 + .../.vscode/c_cpp_properties.json | 26 + .../bootloader-arduino/.vscode/launch.json | 37 ++ .../bootloader-arduino/.vscode/settings.json | 21 + .../bootloader-arduino/.vscode/tasks.json | 23 + software/bootloader-arduino/Makefile | 88 +++ software/bootloader-arduino/README.md | 109 ++++ software/bootloader-arduino/protocol | 323 +++++++++++ .../release/bootloader-arduino_nano-644.elf | Bin 0 -> 9180 bytes .../release/bootloader-arduino_nano-644.hex | 98 ++++ software/bootloader-arduino/src/main.c | 514 ++++++++++++++++++ 13 files changed, 1257 insertions(+) create mode 100644 software/bootloader-arduino/.gdb_history create mode 100644 software/bootloader-arduino/.gdbinit create mode 100644 software/bootloader-arduino/.gitignore create mode 100644 software/bootloader-arduino/.vscode/c_cpp_properties.json create mode 100644 software/bootloader-arduino/.vscode/launch.json create mode 100644 software/bootloader-arduino/.vscode/settings.json create mode 100644 software/bootloader-arduino/.vscode/tasks.json create mode 100644 software/bootloader-arduino/Makefile create mode 100644 software/bootloader-arduino/README.md create mode 100644 software/bootloader-arduino/protocol create mode 100755 software/bootloader-arduino/release/bootloader-arduino_nano-644.elf create mode 100644 software/bootloader-arduino/release/bootloader-arduino_nano-644.hex create mode 100644 software/bootloader-arduino/src/main.c diff --git a/software/bootloader-arduino/.gdb_history b/software/bootloader-arduino/.gdb_history new file mode 100644 index 0000000..3339046 --- /dev/null +++ b/software/bootloader-arduino/.gdb_history @@ -0,0 +1,9 @@ +target remote :1234 +layout split +stepi +quit +target remote :1234 +layout split +stepi +b *main+9 +quit diff --git a/software/bootloader-arduino/.gdbinit b/software/bootloader-arduino/.gdbinit new file mode 100644 index 0000000..a8c4b59 --- /dev/null +++ b/software/bootloader-arduino/.gdbinit @@ -0,0 +1,5 @@ +set history save on +set history size 1000 +set history remove-duplicates 2 +set history filename .gdb_history + diff --git a/software/bootloader-arduino/.gitignore b/software/bootloader-arduino/.gitignore new file mode 100644 index 0000000..a959910 --- /dev/null +++ b/software/bootloader-arduino/.gitignore @@ -0,0 +1,4 @@ +.depend +**/build +**/dist +**/sim diff --git a/software/bootloader-arduino/.vscode/c_cpp_properties.json b/software/bootloader-arduino/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..b3212bc --- /dev/null +++ b/software/bootloader-arduino/.vscode/c_cpp_properties.json @@ -0,0 +1,26 @@ +{ + "configurations": [ + { + "name": "Linux AVR", + "includePath": [ + "/usr/lib/avr/include/**", + "/usr/lib/gcc/avr/**" + ], + "defines": [], + "compilerPath": "/usr/bin/avr-gcc", + "compilerArgs": [ + "-mmcu=atmega644p", + "-Os", + "-DF_CPU=12000000", + "-DBAUD_RATE=115200", + "-DDOUBLE_SPEED", + "-DNUM_LED_FLASHES=4", + "-DMAX_TIME_COUNT=F_CPU>>4" + ], + "cStandard": "gnu11", + "cppStandard": "gnu++11", + "intelliSenseMode": "linux-gcc-x64" + } + ], + "version": 4 +} diff --git a/software/bootloader-arduino/.vscode/launch.json b/software/bootloader-arduino/.vscode/launch.json new file mode 100644 index 0000000..f29cf2e --- /dev/null +++ b/software/bootloader-arduino/.vscode/launch.json @@ -0,0 +1,37 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Build", + // "request": "launch", + "type": "node-terminal", + "preLaunchTask": "build" + },{ + "name": "Flash", + // "request": "launch", + "type": "node-terminal", + "preLaunchTask": "flash" + },{ + "name": "Clean", + // "request": "launch", + "type": "node-terminal", + "preLaunchTask": "clean" + },{ + // es muss mit simuc --board arduino dist/programm.elf der Simulator + // gestartet werden. Dessen gdb-stub öffnet auf localhost:1234 einen Port + "name": "Debug (simuc)", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/sim/atmega328p.elf", + "cwd": "${workspaceFolder}", + "externalConsole": false, + "MIMode": "gdb", + "miDebuggerPath": "/usr/bin/avr-gdb", + "miDebuggerServerAddress": ":1234", + "preLaunchTask": "build" + } + ] +} diff --git a/software/bootloader-arduino/.vscode/settings.json b/software/bootloader-arduino/.vscode/settings.json new file mode 100644 index 0000000..114a717 --- /dev/null +++ b/software/bootloader-arduino/.vscode/settings.json @@ -0,0 +1,21 @@ +{ + "[c]": { + "editor.insertSpaces": true, + "editor.tabSize": 3, + "editor.detectIndentation": false + }, + "[h]": { + "editor.insertSpaces": true, + "editor.tabSize": 3, + "editor.detectIndentation": false + }, + "cSpell.words": [], + "cSpell.ignorePaths": [ + "**/*.json", "**/*.c", "**/*.h", "**/Makefile" + ], + "files.associations": { + "delay.h": "c", + "boot.h": "c", + "stdio.h": "c" + } +} diff --git a/software/bootloader-arduino/.vscode/tasks.json b/software/bootloader-arduino/.vscode/tasks.json new file mode 100644 index 0000000..74fb1c7 --- /dev/null +++ b/software/bootloader-arduino/.vscode/tasks.json @@ -0,0 +1,23 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [{ + "label": "build", + "type": "shell", + "command": "make", + "problemMatcher":[ + "$gcc" + ] + },{ + "label": "clean", + "type": "shell", + "command": "make", + "args": [ "clean" ], + },{ + "label": "flash", + "type": "shell", + "command": "make", + "args": [ "flash" ], + }] +} \ No newline at end of file diff --git a/software/bootloader-arduino/Makefile b/software/bootloader-arduino/Makefile new file mode 100644 index 0000000..cfd5700 --- /dev/null +++ b/software/bootloader-arduino/Makefile @@ -0,0 +1,88 @@ +.PHONY: all info flash picocom clean +$(shell mkdir -p dist >/dev/null) +$(shell mkdir -p build >/dev/null) +$(shell mkdir -p sim >/dev/null) + +NAME="bootloader-arduino_nano-644" +DEVICE="atmega644p" +SRC= $(wildcard src/*.c) +OBJ = $(SRC:src/%.c=build/%.o) +OBJ_SIM = $(SRC:src/%.c=sim/%.o) + +CC= avr-gcc +CFLAGS_DEFINES= -DF_CPU=12000000 -DBAUD_RATE=115200 -DDOUBLE_SPEED -DNUM_LED_FLASHES=4 '-DMAX_TIME_COUNT=F_CPU>>4' +LFLAGS_DEFINES= -DF_CPU=12000000 +CFLAGS= -Wall -mmcu=$(DEVICE) -Os $(CFLAGS_DEFINES) -c +LFLAGS= -Wall -mmcu=$(DEVICE) -Os $(LFLAGS_DEFINES) -Wl,--section-start=.text=0xe000 + +CFLAGS_SIM= -Wall -mmcu=$(DEVICE) -O1 $(CFLAGS_DEFINES) -g -c +LFLAGS_SIM= -Wall -mmcu=$(DEVICE) -O1 $(LFLAGS_DEFINES) -g -Wl,--section-start=.text=0xe000 + + +all: dist/$(NAME).elf dist/$(NAME).s dist/$(NAME).hex sim/$(NAME).elf sim/$(NAME).s info + +info: + @echo + @avr-size --mcu=$(DEVICE) --format=avr dist/$(NAME).elf + +.depend: $(SRC) + $(CC) -mmcu=$(DEVICE) -MM $(SRC) > .depend + +-include $(DEPENDFILE) + +dist/$(NAME).elf: .depend $(OBJ) + $(CC) $(LFLAGS) -o $@ $(OBJ) + +dist/%.s: dist/%.elf + avr-objdump -d $< > $@ + +dist/%.hex: dist/%.elf + avr-objcopy -j .text -j .data -O ihex $< $@ + +sim/$(NAME).elf: .depend $(OBJ_SIM) + $(CC) $(LFLAGS_SIM) -o $@ $(OBJ_SIM) + +build/%.o: src/%.c + $(CC) $(CFLAGS) -o $@ $< + +sim/%.o: src/%.c + $(CC) $(CFLAGS_SIM) -o $@ $< + +sim/%.s: sim/%.elf + avr-objdump -d $< > $@ + +simuc: sim/$(NAME).elf + simuc --board arduino $< + +gdb: sim/$(NAME).elf + avr-gdb $< + +picocom: + # picocom sends CR for ENTER -> convert cr (\r) to lf (\n) + picocom -b 115200 --omap crlf /dev/ttyUSB0 + +flash: dist/$(NAME).elf all + avrdude -c arduino -P /dev/ttyUSB0 -p m644p -e -U flash:w:$< + +isp: + avrdude -c usbasp -p m644p -U lock:r:-:h + +isp-flash: dist/$(NAME).elf all + avrdude -c usbasp -p m644p -e -U flash:w:$< + +isp-read: + avrdude -c usbasp -p m644p -U flash:r:/tmp/flash.bin + +isp-erase: + avrdude -c usbasp -p m644p -e + +isp-fuse: + #avrdude -c usbasp -p m644p -U lfuse:w:0xFF:m -U hfuse:w:0xD8:m -U efuse:w:0xFF:m -U lock:w:0xFF:m + avrdude -c usbasp -p m644p -U lfuse:w:0xFF:m -U hfuse:w:0xD8:m -U efuse:w:0xFE:m -U lock:w:0xEF:m + +clean: + @rm -r dist + @rm -r build + @rm -r sim + @find . -type f -name ".depend" -exec rm {} \; + @echo "clean done" diff --git a/software/bootloader-arduino/README.md b/software/bootloader-arduino/README.md new file mode 100644 index 0000000..bdcf921 --- /dev/null +++ b/software/bootloader-arduino/README.md @@ -0,0 +1,109 @@ +# Arduino-Bootloader (STK500) für Nano-644 + +Dieser Bootloader ermöglicht die Programmierung über das "Arduino-System". Als Kommunikationsprotokoll kommt das [STK500 Protokoll]( https://www.microchip.com/content/dam/mchp/documents/OTH/ApplicationNotes/ApplicationNotes/doc2525.pdf) zur Anwendung (Kommunikationsablauf siehe Datei [protocol](protocol)). + +Beim Bootloader in [src/main.c](src/main.c) handelt es sich um eine Anpassung von [https://github.com/arduino/ArduinoCore-avr/blob/master/bootloaders/atmega/ATmegaBOOT_168.c](https://github.com/arduino/ArduinoCore-avr/blob/master/bootloaders/atmega/ATmegaBOOT_168.c) an die Hardware des Nano-644 Boards. + +Diese Anpassung der Quelltext-Datei umfasst: +* Microcontroller Atmega644P (mit 64KiB Flash, davon die hinteren 8KiB für den Bootloader) +* Frequenz 12MHz +* 3 LEDs (rot, gelb, grün) +* Assembler-Anweisungen durch Macros aus `avr/boot.h` ersetzt +* Quelltextkorrekturen, damit der Bootloader auch bei einer Page-Size von 256 Byte funktioniert + +Der Bootloader kann entweder selbst aus der Quelltextdatei erzeugt werden (siehe [Übersetzung](#%C3%BCbersetzung)), oder es wird eine der bereits fertigen Dateien im Ordner [release](release) verwendet: +* [release/bootloader-arduino_nano-644.elf](release/bootloader-arduino_nano-644.elf) +* [release/bootloader-arduino_nano-644.hex](release/bootloader-arduino_nano-644.hex) + +## Übersetzung + +Folgende Tools sind erforderlich: +* avr-gcc +* avrdude + +Auf einem Linux-Debian System müssen daher folgende Pakete installiert sein: +```sh +sudo apt update +sudo apt install gcc-avr avr-libc binutils-avr avrdude +``` + +Die Übersetzung erfolgt dann mit dem Kommando `make`. + +## Download auf den µC + +Die korrekte Programmierung der Fuses sowie der Download des Bootloaders in den Bootloader-Bereich des µC-Flash kann mit Hilfe eines [USBasp-Programmiergeräts](https://www.fischl.de/usbasp/) mit folgenden Kommandos erfolgen: + +```sh +make isp-fuse +make isp-flash +``` + +Nach der Programmierung sollten die drei LEDs den Start des Bootloader anzeigen (rot -> rot+orange -> grün -> grün blinken). + + +## Download von Programmen mit Hilfe des Bootloaders + +Sobald sich am µC ein Bootloader befindet ist kein Programmiergerät mehr erforderlich. Das Programm wird über die serielle UART-Schnittstelle (via USB-Schnittstelle) in den Flash gespeichert. + +UART-Schnittstelle (Option `-P`) und Name der ELF-Programmdatei (nach `flash:w:`) sind anzupassen... + +```sh +avrdude -c arduino -p m644p -P /dev/ttyUSB0 -b 115200 -e -U flash:w:programm.elf +``` + +## Einbindung in die Arduino IDE + +Zunächst den Ordner mit der Arduino Installation finden. Unter Linux ist das der Pfad: +``` +/usr/share/arduino/hardware/arduino/avr +``` + +Dort im Unterordner `bootloaders` einen Ordner `atmeg644` anlegen und darin die Intel-Hex Datei des Bootloaders ablegen. + +```sh +make +sudo mkdir /usr/share/arduino/hardware/arduino/avr/bootloaders/atmega644 +cp dist/bootloader-arduino_nano-644.hex /usr/share/arduino/hardware/arduino/avr/bootloaders/atmega644/ +``` + +Danach in der Datei `/usr/share/arduino/hardware/arduino/avr/boards.txt` folgende Einträge ergänzen: +``` +######################################################### + +nano644.name=Nano-644 + +nano644.vid.0=0x1a86 +nano644.pid.0=0x7522 +nano644.upload_port.0.vid=0x1a86 +nano644.upload_port.0.pid=0x7522 + +nano644.upload.tool=avrdude +nano644.upload.tool.default=avrdude +nano644.upload.tool.network=arduino_ota +nano644.upload.protocol=arduino +nano644.upload.maximum_size=57344 +nano644.upload.maximum_data_size=4096 +nano644.upload.speed=115200 + +nano644.bootloader.tool=avrdude +nano644.bootloader.tool.default=avrdude +nano644.bootloader.low_fuses=0xFF +nano644.bootloader.high_fuses=0xD8 +nano644.bootloader.extended_fuses=0xFF +nano644.bootloader.unlock_bits=0xFE +nano644.bootloader.lock_bits=0xEF +nano644.bootloader.file=atmega644/bootloader-arduino_nano-644.hex + +nano644.build.mcu=atmega644p +nano644.build.f_cpu=12000000L +nano644.build.board=AVR_NANO644 +nano644.build.core=arduino +nano644.build.variant=standard + +############################################################## +``` + +Nach dem Start der Arduino-IDE kann: +* über das Menü *Werkzeuge->Board* das ***Nano-644*** gewählt werden +* über das Menü *Werkzeuge->Programmer* der ***ArduinoISP*** gewählt werden + diff --git a/software/bootloader-arduino/protocol b/software/bootloader-arduino/protocol new file mode 100644 index 0000000..8c0ea61 --- /dev/null +++ b/software/bootloader-arduino/protocol @@ -0,0 +1,323 @@ + 0.552750 --> 2: 3020 + 0.555474 <-- 2: 1410 + 0.803623 --> 2: 3020 + 0.806825 <-- 2: 1410 + 1.054395 --> 2: 3020 + 1.057282 <-- 2: 1410 + + 1.057514 --> 3: 4181 20 + 1.060837 <-- 3: 1401 10 + 1.061061 --> 3: 4182 20 + 1.063819 <-- 3: 1410 10 + 1.064049 --> 22: 4282 0000 0101 0101 03ff ffff ff01 0008 0000 0100 0020 + 1.068274 <-- 2: 1410 + 1.068436 --> 7: 4505 08d7 a000 20 + 1.071346 <-- 2: 1410 + 1.071432 --> 2: 5020 + 1.074021 <-- 2: 1410 + 1.084349 --> 2: 7520 + 1.087176 <-- 5: 141e 960a 10 + 1.087341 --> 6: 5650 0000 0020 + 1.090435 <-- 3: 1400 10 + 1.090608 --> 6: 5650 0000 0020 + 1.093517 <-- 3: 1400 10 + 1.093662 --> 6: 5650 0000 0020 + 1.096678 <-- 3: 1400 10 + 1.096838 --> 6: 5658 0800 0020 + 1.099974 <-- 3: 1400 10 + 1.100216 --> 6: 5658 0800 0020 + 1.103433 <-- 3: 1400 10 + 1.103621 --> 6: 5658 0800 0020 + 1.106596 <-- 3: 1400 10 + 1.106798 --> 6: 5650 0800 0020 + 1.109878 <-- 3: 1400 10 + 1.110108 --> 6: 5650 0800 0020 + 1.113015 <-- 3: 1400 10 + 1.113141 --> 6: 5650 0800 0020 + 1.116120 <-- 3: 1400 10 + 1.116256 --> 6: 56ac 8000 0020 + 1.119179 <-- 3: 1400 10 + 1.174951 --> 3: 4181 20 + 1.177570 <-- 3: 1401 10 + 1.177770 --> 3: 4182 20 + 1.180450 <-- 3: 1410 10 + 1.180666 --> 22: 4282 0000 0101 0101 03ff ffff ff01 0008 0000 0100 0020 + 1.184868 <-- 2: 1410 + 1.185056 --> 7: 4505 08d7 a000 20 + 1.187956 <-- 2: 1410 + 1.188059 --> 2: 5020 + 1.190517 <-- 2: 1410 + + 1.191326 --> 4: 5500 0020 + 1.193964 <-- 2: 1410 + + 1.194133 --> 32: 6401 0046 0c94 3e00 0c94 5b00 0c94 5b00 0c94 5b00 0c94 5b00 0c94 5b00 0c94 5b00 + 1.194154 --> 32: 0c94 5b00 0c94 5b00 0c94 5b00 0c94 5b00 0c94 5b00 0c94 5b00 0c94 ad00 0c94 5b00 + 1.194285 --> 32: 0c94 5b00 0c94 5b00 0c94 5b00 0c94 5b00 0c94 5b00 0c94 7d00 0c94 5b00 0c94 5b00 + 1.194310 --> 32: 0c94 5b00 0c94 5b00 0c94 5b00 0c94 5b00 0c94 5b00 0c94 9c00 0c94 5b00 0c94 5b00 + 1.197469 --> 32: 1124 1fbe cfef d0e1 debf cdbf 11e0 a0e0 b1e0 e8e2 f8e0 02c0 0590 0d92 aa34 b107 + 1.199991 --> 32: d9f7 21e0 aae4 b1e0 01c0 1d92 a235 b207 e1f7 0e94 d100 0c94 1204 0c94 0000 0f93 + 1.202760 --> 32: 1f93 cf93 c82f 8b01 8a30 19f4 8de0 0e94 5d00 8091 c000 85ff fccf 8091 4e01 9091 + 1.205599 --> 32: 4f01 0817 1907 19f4 c093 c600 02c0 c093 ce00 80e0 90e0 cf91 1f91 0f91 0895 1f92 + 1.208326 --> 5: 0f92 0fb6 20 + 1.255493 <-- 2: 1410 + + 1.255743 --> 4: 5580 0020 + 1.258608 <-- 2: 1410 + + 1.258821 --> 32: 6401 0046 0f92 1124 8f93 9f93 ef93 ff93 98b1 88e0 8927 88b9 8091 c600 8093 ce00 + 1.258842 --> 32: e0e0 f1e0 90e2 9083 8483 ff91 ef91 9f91 8f91 0f90 0fbe 0f90 1f90 1895 1f92 0f92 + 1.258964 --> 32: 0fb6 0f92 1124 8f93 8091 ce00 8032 09f4 429a 8f91 0f90 0fbe 0f90 1f90 1895 1f92 + 1.258995 --> 32: 0f92 0fb6 0f92 1124 2f93 8f93 9f93 8091 4a01 9091 4b01 0196 9093 4b01 8093 4a01 + 1.262021 --> 32: 883e 9340 40f0 98b1 80e1 8927 88b9 1092 4b01 1092 4a01 9f91 8f91 2f91 0f90 0fbe + 1.264633 --> 32: 0f90 1f90 1895 8ce1 87b9 8ce3 88b9 8ae0 8093 8100 8ced 95e0 9093 8900 8093 8800 + 1.267379 --> 32: 82e0 8093 6f00 8093 c000 38e9 3093 c100 26e0 2093 c200 1092 c500 9ce0 9093 c400 + 1.270166 --> 32: 8093 c800 3093 c900 2093 ca00 1092 cd00 9093 cc00 84e1 91e0 9093 4f01 8093 4e01 + 1.272904 --> 5: 86e0 91e0 20 + 1.320139 <-- 2: 1410 + + 1.320378 --> 4: 5500 0120 + 1.323002 <-- 2: 1410 + + 1.323205 --> 32: 6401 0046 9093 5101 8093 5001 1092 0001 7894 80e0 90e0 c0e0 d1e0 0ee2 11e0 359b + 1.323226 --> 32: 03c0 28e4 31e0 02c0 22e2 31e0 7c01 4fef e41a f40a 3f93 2f93 df93 cf93 9f93 8f93 + 1.323364 --> 32: 1f93 0f93 0e94 3401 8db7 9eb7 0896 0fb6 f894 9ebf 0fbe 8dbf 359b 4298 8fe2 95e7 + 1.323390 --> 32: 0197 f1f7 00c0 0000 c701 d9cf a0e0 b0e0 eae3 f1e0 0c94 eb03 ae01 4b5f 5f4f fa01 + 1.326221 --> 32: 6191 7191 af01 8091 4e01 9091 4f01 0e94 4a01 e2e0 0c94 0704 abe0 b0e0 e0e5 f1e0 + 1.329091 --> 32: 0c94 db03 6c01 7b01 8a01 fc01 1782 1682 8381 81ff ccc1 ce01 0196 3c01 f601 9381 + 1.331759 --> 32: f701 93fd 8591 93ff 8191 7f01 8823 09f4 bac1 8532 39f4 93fd 8591 93ff 8191 7f01 + 1.334544 --> 32: 8532 29f4 b601 90e0 0e94 4103 e7cf 912c 212c 312c ffe1 f315 d8f0 8b32 79f0 38f4 + 1.337305 --> 5: 8032 79f0 20 + 1.384623 <-- 2: 1410 + + 1.384878 --> 4: 5580 0120 + 1.387608 <-- 2: 1410 + + 1.387773 --> 32: 6401 0046 8332 a1f4 232d 2061 1dc0 8d32 61f0 8033 69f4 232d 2160 16c0 832d 8260 + 1.387789 --> 32: 382e e32d e460 3e2e 2ac0 f32d f860 1dc0 37fc 2dc0 20ed 280f 2a30 40f0 8e32 b9f4 + 1.387862 --> 32: 36fc 81c1 232d 2064 322e 19c0 36fe 06c0 8ae0 989e 200d 1124 922e 11c0 eae0 2e9e + 1.387921 --> 32: 200d 1124 222e f32d f062 3f2e 08c0 8c36 21f4 832d 8068 382e 02c0 8836 41f4 f701 + 1.390834 --> 32: 93fd 8591 93ff 8191 7f01 8111 b3cf 982f 9f7d 9554 9330 28f4 0c5f 1f4f 9fe3 9983 + 1.393604 --> 32: 0dc0 8336 31f0 8337 71f0 8335 09f0 59c0 21c0 f801 8081 8983 0e5f 1f4f 8824 8394 + 1.396338 --> 32: 912c 5301 13c0 2801 f2e0 4f0e 511c f801 a080 b180 36fe 03c0 692d 70e0 02c0 6fef + 1.399072 --> 32: 7fef c501 0e94 3603 4c01 8201 f32d ff77 3f2e 16c0 2801 22e0 420e 511c f801 a080 + 1.401922 --> 5: b180 36fe 20 + 1.448945 <-- 2: 1410 + + 1.449212 --> 4: 5500 0220 + 1.451904 <-- 2: 1410 + + 1.452121 --> 32: 6401 0046 03c0 692d 70e0 02c0 6fef 7fef c501 0e94 2b03 4c01 f32d f068 3f2e 8201 + 1.452143 --> 32: 33fc 1bc0 822d 90e0 8816 9906 b0f4 b601 80e2 90e0 0e94 4103 2a94 f4cf f501 37fc + 1.452282 --> 32: 8591 37fe 8191 5f01 b601 90e0 0e94 4103 2110 2a94 21e0 821a 9108 8114 9104 71f7 + 1.452308 --> 32: e8c0 8436 11f0 8936 41f5 f801 37fe 07c0 6081 7181 8281 9381 0c5f 1f4f 08c0 6081 + 1.455454 --> 32: 7181 072e 000c 880b 990b 0e5f 1f4f f32d ff76 3f2e 97ff 09c0 9095 8095 7095 6195 + 1.457980 --> 32: 7f4f 8f4f 9f4f f068 3f2e 2ae0 30e0 a301 0e94 7d03 882e 8618 45c0 8537 31f4 232d + 1.460725 --> 32: 2f7e b22e 2ae0 30e0 25c0 932d 997f b92e 8f36 c1f0 18f4 8835 79f0 b5c0 8037 19f0 + 1.463464 --> 32: 8837 21f0 b0c0 e92f e061 be2e b4fe 0dc0 fb2d f460 bf2e 09c0 34fe 0ac0 292f 2660 + 1.466235 --> 5: b22e 06c0 20 + 1.513447 <-- 2: 1410 + + 1.513715 --> 4: 5580 0220 + 1.516432 <-- 2: 1410 + + 1.516636 --> 32: 6401 0046 28e0 30e0 05c0 20e1 30e0 02c0 20e1 32e0 f801 b7fe 07c0 6081 7181 8281 + 1.516663 --> 32: 9381 0c5f 1f4f 06c0 6081 7181 80e0 90e0 0e5f 1f4f a301 0e94 7d03 882e 8618 fb2d + 1.516831 --> 32: ff77 3f2e 36fe 0dc0 232d 2e7f a22e 8914 58f4 34fe 0bc0 32fc 09c0 832d 8e7e a82e + 1.516877 --> 32: 05c0 b82c a32c 03c0 b82c 01c0 b92c a4fe 0fc0 fe01 e80d f11d 8081 8033 21f4 9a2d + 1.519644 --> 32: 997e a92e 09c0 a2fe 06c0 b394 b394 04c0 8a2d 8678 09f0 b394 a3fc 11c0 a0fe 06c0 + 1.522490 --> 32: b214 88f4 280c 922c 9b18 0ec0 b214 60f4 b601 80e2 90e0 0e94 4103 b394 f7cf b214 + 1.525257 --> 32: 18f4 2b18 02c0 982c 212c a4fe 10c0 b601 80e3 90e0 0e94 4103 a2fe 17c0 a1fc 03c0 + 1.527986 --> 32: 88e7 90e0 02c0 88e5 90e0 b601 0cc0 8a2d 8678 59f0 a1fe 02c0 8be2 01c0 80e2 a7fc + 1.530784 --> 5: 8de2 b601 20 + 1.577915 <-- 2: 1410 + + 1.578186 --> 4: 5500 0320 + 1.580952 <-- 2: 1410 + + 1.581190 --> 32: 6401 0046 90e0 0e94 4103 8914 38f4 b601 80e3 90e0 0e94 4103 9a94 f7cf 8a94 f301 + 1.581212 --> 32: e80d f11d 8081 b601 90e0 0e94 4103 8110 f5cf 2220 09f4 42ce b601 80e2 90e0 0e94 + 1.581358 --> 32: 4103 2a94 f6cf f601 8681 9781 02c0 8fef 9fef 2b96 e2e1 0c94 f703 fc01 0590 6150 + 1.581385 --> 32: 7040 0110 d8f7 8095 9095 8e0f 9f1f 0895 fc01 6150 7040 0190 0110 d8f7 8095 9095 + 1.584265 --> 32: 8e0f 9f1f 0895 0f93 1f93 cf93 df93 fb01 2381 21fd 03c0 8fef 9fef 2cc0 22ff 16c0 + 1.587011 --> 32: 4681 5781 2481 3581 4217 5307 44f4 a081 b181 9d01 2f5f 3f4f 3183 2083 8c93 2681 + 1.589734 --> 32: 3781 2f5f 3f4f 3783 2683 14c0 8b01 ec01 fb01 0084 f185 e02d 0995 892b e1f6 d801 + 1.592493 --> 32: 1696 8d91 9c91 1797 0196 1796 9c93 8e93 1697 ce01 df91 cf91 1f91 0f91 0895 fa01 + 1.595249 --> 5: aa27 2830 20 + 1.642464 <-- 2: 1410 + + 1.642718 --> 4: 5580 0320 + 1.645473 <-- 2: 1410 + + 1.645679 --> 32: 6401 0046 51f1 2031 81f1 e894 6f93 6e7f 6e5f 7f4f 8f4f 9f4f af4f b1e0 3ed0 b4e0 + 1.645701 --> 32: 3cd0 670f 781f 891f 9a1f a11d 680f 791f 8a1f 911d a11d 6a0f 711d 811d 911d a11d + 1.645848 --> 32: 20d0 09f4 6894 3f91 2ae0 269f 1124 3019 305d 3193 def6 cf01 0895 462f 4770 405d + 1.645887 --> 32: 4193 b3e0 0fd0 c9f7 f6cf 462f 4f70 405d 4a33 18f0 495d 31fd 4052 4193 02d0 a9f7 + 1.648691 --> 32: eacf b4e0 a695 9795 8795 7795 6795 ba95 c9f7 0097 6105 7105 0895 9b01 ac01 0a2e + 1.651486 --> 32: 0694 5795 4795 3795 2795 ba95 c9f7 620f 731f 841f 951f a01d 0895 2f92 3f92 4f92 + 1.654229 --> 32: 5f92 6f92 7f92 8f92 9f92 af92 bf92 cf92 df92 ef92 ff92 0f93 1f93 cf93 df93 cdb7 + 1.657068 --> 32: deb7 ca1b db0b 0fb6 f894 debf 0fbe cdbf 0994 2a88 3988 4888 5f84 6e84 7d84 8c84 + 1.659779 --> 5: 9b84 aa84 20 + 1.706941 <-- 2: 1410 + + 1.707172 --> 4: 5500 0420 + 1.709845 <-- 2: 1410 + + 1.710064 --> 32: 6401 0046 b984 c884 df80 ee80 fd80 0c81 1b81 aa81 b981 ce0f d11d 0fb6 f894 debf + 1.710085 --> 32: 0fbe cdbf ed01 0895 f894 ffcf 202d 3e20 5800 0000 0002 0000 0000 5d00 0000 0000 + 1.710260 --> 32: 0000 0002 0000 0000 5d00 0000 0000 5357 3220 7072 6573 7365 6400 2530 3478 3a20 + 1.710304 --> 32: 4865 6c6c 6f20 776f 726c 6425 7320 2025 3132 730d 0000 ffff ffff ffff ffff ffff + 1.713085 --> 32: ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff + 1.715997 --> 32: ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff + 1.718639 --> 32: ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff + 1.721439 --> 32: ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff + 1.724135 --> 5: ffff ffff 20 + 1.771467 <-- 2: 1410 + + 1.772647 --> 4: 5500 0020 + 1.775440 <-- 2: 1410 + + 1.775659 --> 5: 7401 0046 20 + 1.779386 <-- 32: 140c 943e 000c 945b 000c 945b 000c 945b 000c 945b 000c 945b 000c 945b 000c 945b + 1.781924 <-- 32: 000c 945b 000c 945b 000c 945b 000c 945b 000c 945b 000c 94ad 000c 945b 000c 945b + 1.784614 <-- 32: 000c 945b 000c 945b 000c 945b 000c 945b 000c 947d 000c 945b 000c 945b 000c 945b + 1.787364 <-- 32: 000c 945b 000c 945b 000c 945b 000c 945b 000c 949c 000c 945b 000c 945b 0011 241f + 1.790456 <-- 32: becf efd0 e1de bfcd bf11 e0a0 e0b1 e0e8 e2f8 e002 c005 900d 92aa 34b1 07d9 f721 + 1.792965 <-- 32: e0aa e4b1 e001 c01d 92a2 35b2 07e1 f70e 94d1 000c 9412 040c 9400 000f 931f 93cf + 1.795688 <-- 32: 93c8 2f8b 018a 3019 f48d e00e 945d 0080 91c0 0085 fffc cf80 914e 0190 914f 0108 + 1.798432 <-- 32: 1719 0719 f4c0 93c6 0002 c0c0 93ce 0080 e090 e0cf 911f 910f 9108 951f 920f 920f + 1.800632 <-- 2: b610 + + 1.800878 --> 4: 5580 0020 + 1.803619 <-- 2: 1410 + + 1.803814 --> 5: 7401 0046 20 + 1.807479 <-- 32: 140f 9211 248f 939f 93ef 93ff 9398 b188 e089 2788 b980 91c6 0080 93ce 00e0 e0f1 + 1.809984 <-- 32: e090 e290 8384 83ff 91ef 919f 918f 910f 900f be0f 901f 9018 951f 920f 920f b60f + 1.812844 <-- 32: 9211 248f 9380 91ce 0080 3209 f442 9a8f 910f 900f be0f 901f 9018 951f 920f 920f + 1.815639 <-- 32: b60f 9211 242f 938f 939f 9380 914a 0190 914b 0101 9690 934b 0180 934a 0188 3e93 + 1.818304 <-- 32: 4040 f098 b180 e189 2788 b910 924b 0110 924a 019f 918f 912f 910f 900f be0f 901f + 1.821082 <-- 32: 9018 958c e187 b98c e388 b98a e080 9381 008c ed95 e090 9389 0080 9388 0082 e080 + 1.823911 <-- 32: 936f 0080 93c0 0038 e930 93c1 0026 e020 93c2 0010 92c5 009c e090 93c4 0080 93c8 + 1.826612 <-- 32: 0030 93c9 0020 93ca 0010 92cd 0090 93cc 0084 e191 e090 934f 0180 934e 0186 e091 + 1.828744 <-- 2: e010 + + 1.828876 --> 4: 5500 0120 + 1.831444 <-- 2: 1410 + + 1.831620 --> 5: 7401 0046 20 + 1.835129 <-- 32: 1490 9351 0180 9350 0110 9200 0178 9480 e090 e0c0 e0d1 e00e e211 e035 9b03 c028 + 1.837845 <-- 32: e431 e002 c022 e231 e07c 014f efe4 1af4 0a3f 932f 93df 93cf 939f 938f 931f 930f + 1.840579 <-- 32: 930e 9434 018d b79e b708 960f b6f8 949e bf0f be8d bf35 9b42 988f e295 e701 97f1 + 1.843432 <-- 32: f700 c000 00c7 01d9 cfa0 e0b0 e0ea e3f1 e00c 94eb 03ae 014b 5f5f 4ffa 0161 9171 + 1.846426 <-- 32: 91af 0180 914e 0190 914f 010e 944a 01e2 e00c 9407 04ab e0b0 e0e0 e5f1 e00c 94db + 1.848837 <-- 32: 036c 017b 018a 01fc 0117 8216 8283 8181 ffcc c1ce 0101 963c 01f6 0193 81f7 0193 + 1.851649 <-- 32: fd85 9193 ff81 917f 0188 2309 f4ba c185 3239 f493 fd85 9193 ff81 917f 0185 3229 + 1.854442 <-- 32: f4b6 0190 e00e 9441 03e7 cf91 2c21 2c31 2cff e1f3 15d8 f08b 3279 f038 f480 3279 + 1.856623 <-- 2: f010 + + 1.856748 --> 4: 5580 0120 + 1.859363 <-- 2: 1410 + + 1.859447 --> 5: 7401 0046 20 + 1.862911 <-- 32: 1483 32a1 f423 2d20 611d c08d 3261 f080 3369 f423 2d21 6016 c083 2d82 6038 2ee3 + 1.865610 <-- 32: 2de4 603e 2e2a c0f3 2df8 601d c037 fc2d c020 ed28 0f2a 3040 f08e 32b9 f436 fc81 + 1.868409 <-- 32: c123 2d20 6432 2e19 c036 fe06 c08a e098 9e20 0d11 2492 2e11 c0ea e02e 9e20 0d11 + 1.871210 <-- 32: 2422 2ef3 2df0 623f 2e08 c08c 3621 f483 2d80 6838 2e02 c088 3641 f4f7 0193 fd85 + 1.873963 <-- 32: 9193 ff81 917f 0181 11b3 cf98 2f9f 7d95 5493 3028 f40c 5f1f 4f9f e399 830d c083 + 1.876709 <-- 32: 3631 f083 3771 f083 3509 f059 c021 c0f8 0180 8189 830e 5f1f 4f88 2483 9491 2c53 + 1.879571 <-- 32: 0113 c028 01f2 e04f 0e51 1cf8 01a0 80b1 8036 fe03 c069 2d70 e002 c06f ef7f efc5 + 1.882458 <-- 32: 010e 9436 034c 0182 01f3 2dff 773f 2e16 c028 0122 e042 0e51 1cf8 01a0 80b1 8036 + 1.884340 <-- 2: fe10 + + 1.884567 --> 4: 5500 0220 + 1.887255 <-- 2: 1410 + + 1.887443 --> 5: 7401 0046 20 + 1.890818 <-- 32: 1403 c069 2d70 e002 c06f ef7f efc5 010e 942b 034c 01f3 2df0 683f 2e82 0133 fc1b + 1.893598 <-- 32: c082 2d90 e088 1699 06b0 f4b6 0180 e290 e00e 9441 032a 94f4 cff5 0137 fc85 9137 + 1.896393 <-- 32: fe81 915f 01b6 0190 e00e 9441 0321 102a 9421 e082 1a91 0881 1491 0471 f7e8 c084 + 1.899280 <-- 32: 3611 f089 3641 f5f8 0137 fe07 c060 8171 8182 8193 810c 5f1f 4f08 c060 8171 8107 + 1.902001 <-- 32: 2e00 0c88 0b99 0b0e 5f1f 4ff3 2dff 763f 2e97 ff09 c090 9580 9570 9561 957f 4f8f + 1.904757 <-- 32: 4f9f 4ff0 683f 2e2a e030 e0a3 010e 947d 0388 2e86 1845 c085 3731 f423 2d2f 7eb2 + 1.907577 <-- 32: 2e2a e030 e025 c093 2d99 7fb9 2e8f 36c1 f018 f488 3579 f0b5 c080 3719 f088 3721 + 1.910469 <-- 32: f0b0 c0e9 2fe0 61be 2eb4 fe0d c0fb 2df4 60bf 2e09 c034 fe0a c029 2f26 60b2 2e06 + 1.912524 <-- 2: c010 + + 1.912815 --> 4: 5580 0220 + 1.915611 <-- 2: 1410 + + 1.915811 --> 5: 7401 0046 20 + 1.919244 <-- 32: 1428 e030 e005 c020 e130 e002 c020 e132 e0f8 01b7 fe07 c060 8171 8182 8193 810c + 1.921988 <-- 32: 5f1f 4f06 c060 8171 8180 e090 e00e 5f1f 4fa3 010e 947d 0388 2e86 18fb 2dff 773f + 1.924734 <-- 32: 2e36 fe0d c023 2d2e 7fa2 2e89 1458 f434 fe0b c032 fc09 c083 2d8e 7ea8 2e05 c0b8 + 1.927531 <-- 32: 2ca3 2c03 c0b8 2c01 c0b9 2ca4 fe0f c0fe 01e8 0df1 1d80 8180 3321 f49a 2d99 7ea9 + 1.930309 <-- 32: 2e09 c0a2 fe06 c0b3 94b3 9404 c08a 2d86 7809 f0b3 94a3 fc11 c0a0 fe06 c0b2 1488 + 1.933091 <-- 32: f428 0c92 2c9b 180e c0b2 1460 f4b6 0180 e290 e00e 9441 03b3 94f7 cfb2 1418 f42b + 1.935886 <-- 32: 1802 c098 2c21 2ca4 fe10 c0b6 0180 e390 e00e 9441 03a2 fe17 c0a1 fc03 c088 e790 + 1.938647 <-- 32: e002 c088 e590 e0b6 010c c08a 2d86 7859 f0a1 fe02 c08b e201 c080 e2a7 fc8d e2b6 + 1.940863 <-- 2: 0110 + + 1.941071 --> 4: 5500 0320 + 1.943869 <-- 2: 1410 + + 1.944088 --> 5: 7401 0046 20 + 1.947433 <-- 32: 1490 e00e 9441 0389 1438 f4b6 0180 e390 e00e 9441 039a 94f7 cf8a 94f3 01e8 0df1 + 1.950256 <-- 32: 1d80 81b6 0190 e00e 9441 0381 10f5 cf22 2009 f442 ceb6 0180 e290 e00e 9441 032a + 1.953054 <-- 32: 94f6 cff6 0186 8197 8102 c08f ef9f ef2b 96e2 e10c 94f7 03fc 0105 9061 5070 4001 + 1.955732 <-- 32: 10d8 f780 9590 958e 0f9f 1f08 95fc 0161 5070 4001 9001 10d8 f780 9590 958e 0f9f + 1.958565 <-- 32: 1f08 950f 931f 93cf 93df 93fb 0123 8121 fd03 c08f ef9f ef2c c022 ff16 c046 8157 + 1.961369 <-- 32: 8124 8135 8142 1753 0744 f4a0 81b1 819d 012f 5f3f 4f31 8320 838c 9326 8137 812f + 1.964157 <-- 32: 5f3f 4f37 8326 8314 c08b 01ec 01fb 0100 84f1 85e0 2d09 9589 2be1 f6d8 0116 968d + 1.966902 <-- 32: 919c 9117 9701 9617 969c 938e 9316 97ce 01df 91cf 911f 910f 9108 95fa 01aa 2728 + 1.969047 <-- 2: 3010 + + 1.969248 --> 4: 5580 0320 + 1.972047 <-- 2: 1410 + + 1.972246 --> 5: 7401 0046 20 + 1.975748 <-- 32: 1451 f120 3181 f1e8 946f 936e 7f6e 5f7f 4f8f 4f9f 4faf 4fb1 e03e d0b4 e03c d067 + 1.978498 <-- 32: 0f78 1f89 1f9a 1fa1 1d68 0f79 1f8a 1f91 1da1 1d6a 0f71 1d81 1d91 1da1 1d20 d009 + 1.981514 <-- 32: f468 943f 912a e026 9f11 2430 1930 5d31 93de f6cf 0108 9546 2f47 7040 5d41 93b3 + 1.983891 <-- 32: e00f d0c9 f7f6 cf46 2f4f 7040 5d4a 3318 f049 5d31 fd40 5241 9302 d0a9 f7ea cfb4 + 1.986799 <-- 32: e0a6 9597 9587 9577 9567 95ba 95c9 f700 9761 0571 0508 959b 01ac 010a 2e06 9457 + 1.989512 <-- 32: 9547 9537 9527 95ba 95c9 f762 0f73 1f84 1f95 1fa0 1d08 952f 923f 924f 925f 926f + 1.992260 <-- 32: 927f 928f 929f 92af 92bf 92cf 92df 92ef 92ff 920f 931f 93cf 93df 93cd b7de b7ca + 1.995029 <-- 32: 1bdb 0b0f b6f8 94de bf0f becd bf09 942a 8839 8848 885f 846e 847d 848c 849b 84aa + 1.997163 <-- 2: 8410 + + 1.997338 --> 4: 5500 0420 + 2.000161 <-- 2: 1410 + + 2.000367 --> 5: 7401 0046 20 + 2.003803 <-- 32: 14b9 84c8 84df 80ee 80fd 800c 811b 81aa 81b9 81ce 0fd1 1d0f b6f8 94de bf0f becd + 2.006477 <-- 32: bfed 0108 95f8 94ff cf20 2d3e 2058 0000 0000 0200 0000 005d 0000 0000 0000 0000 + 2.009429 <-- 32: 0200 0000 005d 0000 0000 0053 5732 2070 7265 7373 6564 0025 3034 783a 2048 656c + 2.012149 <-- 32: 6c6f 2077 6f72 6c64 2573 2020 2531 3273 0d00 00ff ffff ffff ffff ffff ffff ffff + 2.014971 <-- 32: ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff + 2.017659 <-- 32: ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff + 2.020387 <-- 32: ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff + 2.023167 <-- 32: ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff ffff + 2.025368 <-- 2: ff10 + + 2.025949 --> 6: 5650 0000 0020 + 2.028775 <-- 3: 1400 10 + 2.028918 --> 6: 5650 0000 0020 + 2.031848 <-- 3: 1400 10 + 2.031977 --> 6: 5650 0000 0020 + 2.034973 <-- 3: 1400 10 + 2.035141 --> 6: 5658 0800 0020 + 2.038215 <-- 3: 1400 10 + 2.038413 --> 6: 5658 0800 0020 + 2.041454 <-- 3: 1400 10 + 2.041646 --> 6: 5658 0800 0020 + 2.044533 <-- 3: 1400 10 + 2.044682 --> 6: 5650 0800 0020 + 2.047749 <-- 3: 1400 10 + 2.047987 --> 6: 5650 0800 0020 + 2.050921 <-- 3: 1400 10 + 2.051154 --> 6: 5650 0800 0020 + 2.054178 <-- 3: 1400 10 + + 2.054415 --> 2: 5120 + 2.056864 <-- 2: 1410 diff --git a/software/bootloader-arduino/release/bootloader-arduino_nano-644.elf b/software/bootloader-arduino/release/bootloader-arduino_nano-644.elf new file mode 100755 index 0000000000000000000000000000000000000000..55dab47aec84dcd05378834357bcc4376da2ae92 GIT binary patch literal 9180 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 L)PjLJt-t>UfTAfm literal 0 HcmV?d00001 diff --git a/software/bootloader-arduino/release/bootloader-arduino_nano-644.hex b/software/bootloader-arduino/release/bootloader-arduino_nano-644.hex new file mode 100644 index 0000000..dbb4b22 --- /dev/null +++ b/software/bootloader-arduino/release/bootloader-arduino_nano-644.hex @@ -0,0 +1,98 @@ +:10E000000C943E700C9450700C9450700C945070A2 +:10E010000C9450700C9450700C9450700C94507080 +:10E020000C9450700C9450700C9450700C94507070 +:10E030000C9450700C9450700C9450700C94507060 +:10E040000C9450700C9450700C9450700C94507050 +:10E050000C9450700C9450700C9450700C94507040 +:10E060000C9450700C9450700C9450700C94507030 +:10E070000C9450700C9450700C94507011241FBE6E +:10E08000CFEFD0E1DEBFCDBF22E0A0E0B1E001C024 +:10E090001D92AC30B207E1F70E9435710C94FC720E +:10E0A0000C9400709091C00095FFFCCF8093C60047 +:10E0B0000895CF93982F8595859585958595805D55 +:10E0C0009F709A3014F0C7E501C0C0E3C90F0E94E9 +:10E0D00052708C2FCF910C945270CF92DF92EF92AE +:10E0E000FF92C12CD12C76018091C00087FD15C014 +:10E0F0008FEFC81AD80AE80AF80A81EBC81681E738 +:10E10000D8068BE0E806F10478F317B818B8E09168 +:10E110000001F09101010995E7CF8091C600FF90C1 +:10E12000EF90DF90CF900895CF930E946D70C82F2D +:10E130000E945270C13614F089EA03C0C0331CF04B +:10E1400080ED8C0F01C08C2FCF910895CF930E944A +:10E150009470C82F0E94947090E1C99F800D112483 +:10E16000CF910895CF93C82FCC2321F00E946D70DA +:10E17000C150FACFCF910895CF93C82F0E946D70F0 +:10E18000803251F484E10E9452708C2F0E945270B0 +:10E1900080E1CF910C945270809102018F5F809347 +:10E1A0000201853041F417B818B8E0910001F091F0 +:10E1B0000101CF910994CF9108950E946D70803232 +:10E1C00031F484E10E94527080E10C94527080918D +:10E1D00002018F5F80930201853039F417B818B8B7 +:10E1E000E0910001F091010109940895CF93DF932C +:10E1F00000D000D0CDB7DEB719821A821B821C82F4 +:10E2000089819A81AB81BC8181159042A140B10581 +:10E2100080F48091C00087FD0CC089819A81AB8118 +:10E22000BC810196A11DB11D89839A83AB83BC83F8 +:10E23000E7CF0F900F900F900F90DF91CF9108953F +:10E24000CF93C82F429A0E94F670439A0E94F670AC +:10E2500018B8CC2341F0449A0E94F67044980E946A +:10E26000F670C150F6CFCF91089500008CE187B9C8 +:10E2700018B882E08093C0008CE08093C4001092B4 +:10E28000C50088E18093C10086E08093C20098E0D9 +:10E290009093C9008093CA0084E00E94207113E02B +:10E2A00001E0E5E0FE2EF1E1EF2E0E946D7080337B +:10E2B00009F447C0813319F50E946D708032B9F4BA +:10E2C00084E10E94527081E40E94527086E50E94AF +:10E2D000527082E50E94527080E20E94527089E47E +:10E2E0000E94527083E50E94527080E56CC180915B +:10E2F00002018F5F809302018530B9F671C18034CD +:10E3000039F40E946D708638E0F00E946D7019C07B +:10E31000813491F40E946D70803811F481EF44C013 +:10E32000813811F481E040C0823811F480E13CC0B2 +:10E330008839C9F583E038C0823431F484E10E9421 +:10E34000B2700E94DD70B1CF853411F485E0F7CF53 +:10E35000982F9D7F9035A9F3813599F3853549F440 +:10E360000E946D70809304010E946D70809305017E +:10E37000E8CF8635E1F40E946D70803389F40E9405 +:10E380006D700E946D70C82F0E946D70C11102C027 +:10E390008EE10AC0C13011F486E906C08AE004C0EB +:10E3A00083E00E94B27080E00E94BC707ECF843611 +:10E3B00009F0A5C00E946D70809308020E946D70E4 +:10E3C0008093070280910B028E7F80930B020E9444 +:10E3D0006D70853429F480910B02816080930B026B +:10E3E000C6E0D1E06E012091070230910802C6011B +:10E3F000865091408217930730F40E946D70F601A9 +:10E4000081936F01F0CF0E946D70803209F0E1C0FE +:10E4100020910B028091040190910501880F991FB2 +:10E42000909305018093040120FF23C0E6E0F1E012 +:10E430002091070230910802CF0186509140821747 +:10E44000930708F05AC0F999FECF8091040190918A +:10E45000050192BD81BD819180BDFA9AF99A8091A2 +:10E4600004019091050101969093050180930401A8 +:10E47000DFCF8091070280FF09C080910702909151 +:10E48000080201969093080280930702F894409145 +:10E49000040150910501F999FECF07B600FCFDCFAC +:10E4A000FA0110935700E89507B600FCFDCF20E075 +:10E4B00030E0FA01E20FF31F898190E0982F88275E +:10E4C0006881860F911D0C0100935700E895112477 +:10E4D0002E5F3F4F22962115F1E03F0751F7309311 +:10E4E0000A0220930902FA01F0925700E89507B654 +:10E4F00000FCFDCFE0925700E89584E164C08437CA +:10E5000009F051C00E946D70809308020E946D70E6 +:10E51000809307028091040190910501880F991F53 +:10E5200090930501809304010E946D7090910B02FD +:10E53000853411F4916001C09E7F90930B020E947C +:10E540006D70803209F041C084E10E945270C0E0D9 +:10E55000D0E08091070290910802C817D907A8F56A +:10E5600080910B0280FF0BC0F999FECF80910401CE +:10E570009091050192BD81BDF89A80B507C081FDDB +:10E5800007C0E0910401F091050184910E9452704E +:10E59000809104019091050101969093050180936B +:10E5A00004012196D6CF853719F50E946D7080320F +:10E5B00081F484E10E9452708EE10E94527086E9DB +:10E5C0000E9452708AE00E94527080E10E94527054 +:10E5D0006CCE809102018F5F80930201853009F437 +:10E5E00017B818B8E0910001F091010109955DCECE +:0CE5F000863709F05ACED7CEF894FFCF42 +:040000030000E00019 +:00000001FF diff --git a/software/bootloader-arduino/src/main.c b/software/bootloader-arduino/src/main.c new file mode 100644 index 0000000..32ccfbd --- /dev/null +++ b/software/bootloader-arduino/src/main.c @@ -0,0 +1,514 @@ +/*************************************************************************************************/ +/* Serial Bootloader for Atmel megaAVR Controllers */ +/* */ +/* Source-code taken from: */ +/* https://github.com/arduino/ArduinoCore-avr/blob/master/bootloaders/atmega/ATmegaBOOT_168.c */ +/* Branch@hash: master@321fca0b */ +/* */ +/* Licence can be viewed at http://www.fsf.org/licenses/gpl.txt */ +/* */ +/*************************************************************************************************/ + +#include + +#include +#include +#include +#include +#include +// #include + +// #define DEBUG_UART1 +#ifdef DEBUG_UART1 + #include +#endif + +// after this many errors give up and launch application +#define MAX_ERROR_COUNT 5 + +#define HW_VER 0xF1 +#define SW_MAJOR 0x01 +#define SW_MINOR 0x10 + +// onboard LED is used to indicate, that the bootloader was entered +#define SET_LED_RED (PORTC |= (1 << PC2)) +#define CLR_LED_RED (PORTC &= ~(1 << PC2)) +#define SET_LED_ORANGE (PORTC |= (1 << PC3)) +#define CLR_LED_ORANGE (PORTC &= ~(1 << PC3)) +#define SET_LED_GREEN (PORTC |= (1 << PC4)) +#define CLR_LED_GREEN (PORTC &= ~(1 << PC4)) + +// define various device id's +// manufacturer byte is always the same +#define SIG1 0x1E // Yep, Atmel is the only manufacturer of AVR micros. Single source :( +#define SIG2 0x96 +#define SIG3 0x0A +#define PAGE_SIZE 0x80U // 128 words + +// function prototypes +void putch(char); +char getch(void); +void getNch(uint8_t); +void byte_response(uint8_t); +void nothing_response(void); +char gethex(void); +void puthex(char); +void flash_led(uint8_t); + +#ifdef DEBUG_UART1 + int uart_putchar(char c, FILE *stream) { + if (c == '\n') { + uart_putchar('\r', stream); + } + loop_until_bit_is_set(UCSR1A, UDRE1); + UDR1 = c; + return 0; + } + + static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE); +#endif + +// some variables +union address_union { + uint16_t word; + uint8_t byte[2]; +} address; + +union length_union { + uint16_t word; + uint8_t byte[2]; +} length; + +struct flags_struct { + unsigned eeprom : 1; + unsigned rampz : 1; +} flags; + +uint8_t buff[SPM_PAGESIZE + 1]; +// uint8_t address_high; +// uint8_t pagesz=0x80; + +uint16_t i; +uint8_t bootuart = 0; + +uint8_t error_count = 0; + +void (*app_start)(void) = 0x0000; + +int main () { + uint8_t ch, ch2; + uint16_t w; + + #ifdef WATCHDOG_MODS + ch = MCUSR; + MCUSR = 0; + + WDTCSR |= _BV(WDCE) | _BV(WDE); + WDTCSR = 0; + + // Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot. + if (! (ch & _BV(EXTRF))) // if its a not an external reset... + app_start(); // skip bootloader + #else + asm volatile("nop\n\t"); + #endif + + // LED ports output and off + DDRC = (1 << PC4) | (1 << PC3) |(1 << PC2); + PORTC = 0; + + #ifdef DOUBLE_SPEED + UCSR0A = (1 << U2X0); // Double speed mode USART0 + UBRR0L = (uint8_t)(F_CPU / (BAUD_RATE *8L) - 1); + UBRR0H = (F_CPU / (BAUD_RATE * 8L) - 1) >> 8; + #ifdef DEBUG_UART1 + UCSR1A = (1 << U2X1); // Double speed mode USART0 + UBRR1L = (uint8_t)(F_CPU / (BAUD_RATE *8L) - 1); + UBRR1H = (F_CPU / (BAUD_RATE * 8L) - 1) >> 8; + #endif + #else + UBRR0L = (uint8_t)(F_CPU / (BAUD_RATE * 16L) - 1); + UBRR0H = (F_CPU / (BAUD_RATE*16L)-1) >> 8; + #ifdef DEBUG_UART1 + UBRR1L = (uint8_t)(F_CPU / (BAUD_RATE * 16L) - 1); + UBRR1H = (F_CPU / (BAUD_RATE*16L)-1) >> 8; + #endif + #endif + + UCSR0B = (1< 0x85) getch(); + nothing_response(); + + // ***************************** + // AVR ISP/STK500 board requests + // ***************************** + + } else if (ch == 'A') { // 0x41 + ch2 = getch(); + if (ch2 == 0x80) { + byte_response(HW_VER); // Hardware version + } else if (ch2 == 0x81) { + byte_response(SW_MAJOR); // Software major version + } else if(ch2 == 0x82) { + byte_response(SW_MINOR); // Software minor version + } else if(ch2==0x98) { + byte_response(0x03); // Unknown but seems to be required by avr studio 3.56 + } else { + byte_response(0x00); // Covers various unnecessary responses we don't care about + } + + } else if (ch == 'B') { // B: 0x42 + // Device Parameters DON'T CARE, DEVICE IS FIXED + getNch(20); + nothing_response(); + + + } else if (ch == 'E') { // E: 0x45 + // Parallel programming stuff DON'T CARE + getNch(5); + nothing_response(); + + } else if (ch == 'P' || ch == 'R') { // P: 0x50, R: 0x52 + // P: Enter programming mode + // R: Erase device, don't care as we will erase one page at a time anyway. + nothing_response(); + + } else if (ch == 'Q') { // Q: 0x51 + // Leave programming mode + nothing_response(); + #ifdef WATCHDOG_MODS + // autoreset via watchdog (sneaky!) + WDTCSR = _BV(WDE); + while (1); // 16 ms + #endif + + } else if(ch == 'U') { // U: 0x55 + // Set address, little endian. EEPROM in bytes, FLASH in words + // Perhaps extra address bytes may be added in future to support > 128kB FLASH. + // This might explain why little endian was used here, big endian used everywhere else. + address.byte[0] = getch(); + address.byte[1] = getch(); + nothing_response(); + + + } else if (ch == 'V') { // V: 0x56 + // Universal SPI programming command, disabled. Would be used for fuses and lock bits. + if (getch() == 0x30) { + getch(); + ch = getch(); + getch(); + if (ch == 0) { + byte_response(SIG1); + } else if (ch == 1) { + byte_response(SIG2); + } else { + byte_response(SIG3); + } + } else { + getNch(3); + byte_response(0x00); + } + + } else if (ch == 'd') { // d: 0x64 + // Write memory, length is big endian and is in bytes + length.byte[1] = getch(); + length.byte[0] = getch(); + flags.eeprom = 0; + if (getch() == 'E') { + flags.eeprom = 1; + } + for (w = 0; w < length.word; w++) { + // Store data in buffer, can't keep up with serial data stream whilst programming pages + buff[w] = getch(); + } + if (getch() == ' ') { + if (flags.eeprom) { + // Write to EEPROM one byte at a time + address.word <<= 1; + for(w = 0; w < length.word; w++) { + while(EECR & (1< 127) { + //Only possible with m128, m256 will need 3rd address byte. FIXME + // RAMPZ = 0x01; + } else { + // RAMPZ = 0x00; + } + + // address * 2 -> byte location + address.word = address.word << 1; + if ((length.byte[0] & 0x01)) { + // Even up an odd number of bytes + length.word++; + } + cli(); + + uint16_t addr = address.word; + #ifdef DEBUG_UART1 + printf("Programming: address=0x%04x length=0x%04x\n", addr, length.word); + printf(" eeprom_busy_wait() ..."); + #endif + eeprom_busy_wait(); + boot_spm_busy_wait(); + #ifdef DEBUG_UART1 + printf("done\n"); + printf(" boot_page_erase(0x%04x)...", address.word); + #endif + boot_page_erase(addr); + boot_spm_busy_wait (); + #ifdef DEBUG_UART1 + printf("done\n"); + printf(" boot_page_fill(0x%04x, ...): ", address.word); + #endif + for (i = 0; i < SPM_PAGESIZE; i += 2) { + uint16_t w = buff[i] + (buff[i + 1] << 8); + #ifdef DEBUG_UART1 + printf("."); + #endif + boot_page_fill(addr + i, w); + } + #ifdef DEBUG_UART1 + printf("\n boot_page_write(0x%04x)...", address.word); + #endif + boot_page_write(addr); + boot_spm_busy_wait(); + #ifdef DEBUG_UART1 + printf("done\n"); + printf(" boot_rww_enable()\n"); + #endif + boot_rww_enable(); + } + putch(0x14); + putch(0x10); + + } else { + if (++error_count == MAX_ERROR_COUNT) + DDRC = 0; PORTC = 0; + app_start(); + } + + } else if (ch == 't') { // t: 0x74 + // Read memory block mode, length is big endian. */ + length.byte[1] = getch(); + length.byte[0] = getch(); + // if (address.word>0x7FFF) flags.rampz = 1; // No go with m256, FIXME + // else flags.rampz = 0; + address.word = address.word << 1; // address * 2 -> byte location + if (getch() == 'E') { + flags.eeprom = 1; + } else { + flags.eeprom = 0; + } + if (getch() == ' ') { + // Command terminator + putch(0x14); + for (w = 0; w < length.word; w++) { + // Can handle odd and even lengths okay + if (flags.eeprom) { // Byte access EEPROM read + while(EECR & (1<= 'a') { + return (a - 'a' + 0x0a); + } else if (a >= '0') { + return (a - '0'); + } + return a; +} + + +char gethex () { + return (gethexnib() << 4) + gethexnib(); +} + + +void puthex (char ch) { + char ah; + + ah = ch >> 4; + if(ah >= 0x0a) { + ah = ah - 0x0a + 'a'; + } else { + ah += '0'; + } + + ch &= 0x0f; + if(ch >= 0x0a) { + ch = ch - 0x0a + 'a'; + } else { + ch += '0'; + } + + putch(ah); + putch(ch); +} + + +void putch (char ch) { + while (!(UCSR0A & _BV(UDRE0))); + UDR0 = ch; +} + + +char getch () { + uint32_t count = 0; + while( !(UCSR0A & _BV(RXC0)) ) { + count++; + if (count > MAX_TIME_COUNT) { + DDRC = 0; PORTC = 0; + app_start(); + } + } + return UDR0; +} + + +void getNch (uint8_t count) { + while(count--) { + getch(); + } +} + + +void byte_response (uint8_t val) { + if (getch() == ' ') { + putch(0x14); + putch(val); + putch(0x10); + } else if (++error_count == MAX_ERROR_COUNT) { + DDRC = 0; PORTC = 0; + app_start(); + } +} + +void nothing_response () { + if (getch() == ' ') { + putch(0x14); + putch(0x10); + } else if (++error_count == MAX_ERROR_COUNT) { + DDRC = 0; PORTC = 0; + app_start(); + } +} + +void delay () { + // app. 200ms + for (volatile uint32_t timer = 0; timer < 0x12000; timer++) { + if (UCSR0A & _BV(RXC0)) { + return; + } + } +} + +void flash_led (uint8_t count) { + SET_LED_RED; + delay(); + SET_LED_ORANGE; + delay(); + PORTC = 0; + + while (count--) { + SET_LED_GREEN; + delay(); + CLR_LED_GREEN; + delay(); + } +} -- 2.39.5