From 912a4093e5a1c207cd7d456f7b86908f26d71049 Mon Sep 17 00:00:00 2001 From: Manfred Steiner Date: Thu, 5 Sep 2024 13:06:22 +0200 Subject: [PATCH] software/nano-644/bootloader-arduino (release/2024-09-05_120027) --- .../nano-644/bootloader-arduino/.gdb_history | 9 + software/nano-644/bootloader-arduino/.gdbinit | 5 + .../nano-644/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/nano-644/bootloader-arduino/Makefile | 147 +++++ .../nano-644/bootloader-arduino/README.md | 115 ++++ software/nano-644/bootloader-arduino/protocol | 323 +++++++++++ .../bootloader-arduino_nano-644.elf | Bin 0 -> 9292 bytes .../bootloader-arduino_nano-644.hex | 100 ++++ .../nano-644/bootloader-arduino/src/main.c | 520 ++++++++++++++++++ 13 files changed, 1330 insertions(+) create mode 100644 software/nano-644/bootloader-arduino/.gdb_history create mode 100644 software/nano-644/bootloader-arduino/.gdbinit create mode 100644 software/nano-644/bootloader-arduino/.gitignore create mode 100644 software/nano-644/bootloader-arduino/.vscode/c_cpp_properties.json create mode 100644 software/nano-644/bootloader-arduino/.vscode/launch.json create mode 100644 software/nano-644/bootloader-arduino/.vscode/settings.json create mode 100644 software/nano-644/bootloader-arduino/.vscode/tasks.json create mode 100644 software/nano-644/bootloader-arduino/Makefile create mode 100644 software/nano-644/bootloader-arduino/README.md create mode 100644 software/nano-644/bootloader-arduino/protocol create mode 100755 software/nano-644/bootloader-arduino/release/2024-09-05_120027/bootloader-arduino_nano-644.elf create mode 100644 software/nano-644/bootloader-arduino/release/2024-09-05_120027/bootloader-arduino_nano-644.hex create mode 100644 software/nano-644/bootloader-arduino/src/main.c diff --git a/software/nano-644/bootloader-arduino/.gdb_history b/software/nano-644/bootloader-arduino/.gdb_history new file mode 100644 index 0000000..3339046 --- /dev/null +++ b/software/nano-644/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/nano-644/bootloader-arduino/.gdbinit b/software/nano-644/bootloader-arduino/.gdbinit new file mode 100644 index 0000000..a8c4b59 --- /dev/null +++ b/software/nano-644/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/nano-644/bootloader-arduino/.gitignore b/software/nano-644/bootloader-arduino/.gitignore new file mode 100644 index 0000000..a959910 --- /dev/null +++ b/software/nano-644/bootloader-arduino/.gitignore @@ -0,0 +1,4 @@ +.depend +**/build +**/dist +**/sim diff --git a/software/nano-644/bootloader-arduino/.vscode/c_cpp_properties.json b/software/nano-644/bootloader-arduino/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..b3212bc --- /dev/null +++ b/software/nano-644/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/nano-644/bootloader-arduino/.vscode/launch.json b/software/nano-644/bootloader-arduino/.vscode/launch.json new file mode 100644 index 0000000..f29cf2e --- /dev/null +++ b/software/nano-644/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/nano-644/bootloader-arduino/.vscode/settings.json b/software/nano-644/bootloader-arduino/.vscode/settings.json new file mode 100644 index 0000000..114a717 --- /dev/null +++ b/software/nano-644/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/nano-644/bootloader-arduino/.vscode/tasks.json b/software/nano-644/bootloader-arduino/.vscode/tasks.json new file mode 100644 index 0000000..74fb1c7 --- /dev/null +++ b/software/nano-644/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/nano-644/bootloader-arduino/Makefile b/software/nano-644/bootloader-arduino/Makefile new file mode 100644 index 0000000..171fe67 --- /dev/null +++ b/software/nano-644/bootloader-arduino/Makefile @@ -0,0 +1,147 @@ +#.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 + +.PHONY: all info flash picocom clean +$(shell mkdir -p dist >/dev/null) +$(shell mkdir -p build >/dev/null) +$(shell mkdir -p sim >/dev/null) +$(shell mkdir -p sim/build >/dev/null) + +NAME="bootloader-arduino_nano-644" +SRC= $(wildcard src/*.c src/*.cpp src/*/*.c src/*/*.cpp) +HDR= $(wildcard src/*.h src/*.hpp src/*/*.h src/*/*.hpp) +OBJ_CPP = $(SRC:src/%.cpp=build/%.o) +OBJ = $(OBJ_CPP:src/%.c=build/%.o) +OBJ_SIM_CPP = $(SRC:src/%.cpp=sim/build/%.o) +OBJ_SIM = $(OBJ_SIM_CPP:src/%.c=sim/build/%.o) + +DEVICE=atmega644p + +CC= avr-g++ +CFLAGS= -Wall -mmcu=$(DEVICE) -Os -DF_CPU=12000000 -DBAUD_RATE=115200 -DDOUBLE_SPEED -DNUM_LED_FLASHES=4 '-DMAX_TIME_COUNT=F_CPU>>4' -c +#LFLAGS= -Wall -mmcu=$(DEVICE) -Os -DF_CPU=12000000 -Wl,-u,vfprintf -lprintf_flt -lm +LFLAGS= -Wall -mmcu=$(DEVICE) -Os -DF_CPU=12000000 -Wl,--section-start=.text=0xe000 + +CFLAGS_SIM= -Wall -mmcu=$(DEVICE) -Og -DF_CPU=12000000 -g -DBAUD_RATE=115200 -DDOUBLE_SPEED -DNUM_LED_FLASHES=4 '-DMAX_TIME_COUNT=F_CPU>>4' -c +#LFLAGS_SIM= -Wall -mmcu=$(DEVICE) -Og -DF_CPU=12000000 -g -Wl,-u,vfprintf -lprintf_flt -lm +LFLAGS_SIM= -Wall -mmcu=$(DEVICE) -Og -DF_CPU=12000000 -g -Wl,--section-start=.text=0xe000 + + +all: dist/$(NAME).elf dist/$(NAME).s dist/$(NAME).hex sim/$(NAME).elf sim/$(NAME).s info + +dbg: + @echo --HDR--------------------------------- + @echo $(HDR) + @echo --SRC--------------------------------- + @echo $(SRC) + @echo --OBJ--------------------------------- + @echo $(OBJ) + @echo --OBJ_CPP----------------------------- + @echo $(OBJ_CPP) + @echo --OBJ--------------------------------- + @echo $(OBJ) + @echo =================================== + @echo + +info: + @avr-size --mcu=$(DEVICE) --format=avr dist/$(NAME).elf + +.depend: $(SRC) $(HDR) + $(CC) -mmcu=$(DEVICE) -MM $(SRC) | sed --regexp-extended 's/^(.*\.o)\: src\/(.*)(\.cpp|\.c) (.*)/build\/\2\.o\: src\/\2\3 \4/g' > .depend + +-include .depend + +# .depend solte auch auf Header Files achten! + +dist/$(NAME).elf: .depend $(OBJ) + $(CC) $(LFLAGS) -o $@ $(OBJ) + +dist/%.s: dist/%.elf + avr-objdump -d $< > $@ + +dist/%.hex: dist/%.elf + avr-objcopy -O ihex $(HEX_FLASH_FLAGS) $< $@ + +sim/$(NAME).elf: .depend $(OBJ_SIM) + $(CC) $(LFLAGS_SIM) -o $@ $(OBJ_SIM) + + +build/%.o: src/%.c + @mkdir -p $(dir $@) + $(CC) $(CFLAGS) -o $@ $< + +build/%.o: src/%.cpp + @mkdir -p $(dir $@) + $(CC) $(CFLAGS) -o $@ $< + +sim/build/%.o: src/%.c + @mkdir -p $(dir $@) + $(CC) $(CFLAGS_SIM) -o $@ $< + +sim/build/%.o: src/%.cpp + @mkdir -p $(dir $@) + $(CC) $(CFLAGS_SIM) -o $@ $< + +sim/%.s: sim/%.elf + avr-objdump -d $< > $@ + +simuc: sim/$(NAME).elf + simuc --board arduino $< + +gdb: sim/$(NAME).elf + avr-gdb $< + +isp-644p: + avrdude -c usbasp -p m644p + +isp-flash-644p: dist/$(NAME).elf all + avrdude -c usbasp -p m644p -e -U flash:w:$< + +isp-flash-644p-latest-release: + avrdude -c usbasp -p m644p -e -U flash:w:release/$(shell ls -A release | tail -n 1)/$(NAME).elf + +isp-read-flash-644p: + avrdude -c usbasp -p m644p -U flash:r:/tmp/flash-nano-644__$(shell date +"%Y-%m-%d_%H%M%S") + +flash-644p: dist/$(NAME).elf all + avrdude -c arduino -p m644p -P /dev/ttyUSB0 -b 115200 -e -U flash:w:$< + + +picocom: + # picocom sends CR for ENTER -> convert cr (\r) to lf (\n) + picocom -b 115200 --omap crlf /dev/ttyUSB0 + +isp-erase-644p: + avrdude -c usbasp -p m644p -e + +isp-fuse-644p: + #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 + # LFUSE=0xEE -> startuptime 1K CLOCKS + 0ms -> 83us + #avrdude -c usbasp -p m644p -U lfuse:w:0xEE:m -U hfuse:w:0xD8:m -U efuse:w:0xFE:m -U lock:w:0xEF:m + # LFUSE=0xE7 -> startuptime 16K CLOCKS + 4.1ms -> 5.4ms + avrdude -c usbasp -p m644p -U lfuse:w:0xEF: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/nano-644/bootloader-arduino/README.md b/software/nano-644/bootloader-arduino/README.md new file mode 100644 index 0000000..29ced57 --- /dev/null +++ b/software/nano-644/bootloader-arduino/README.md @@ -0,0 +1,115 @@ +# Arduino-Bootloader (STK500) für Nano-644 (ATmega644P) + +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/2024-09-05_120027/bootloader-arduino_nano-644.elf](release/2024-09-05_120027/bootloader-arduino_nano-644.elf) +* [release/2024-09-05_120027/bootloader-arduino_nano-644.hex](release/2024-09-05_120027/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-644p +make isp-flash-644p +``` + +... oder die aktuellste Version im Unterordner [release](release) ... +```sh +make isp-fuse-644p +make isp-flash-644p-latest-release +``` + +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/nano-644/bootloader-arduino/protocol b/software/nano-644/bootloader-arduino/protocol new file mode 100644 index 0000000..8c0ea61 --- /dev/null +++ b/software/nano-644/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/nano-644/bootloader-arduino/release/2024-09-05_120027/bootloader-arduino_nano-644.elf b/software/nano-644/bootloader-arduino/release/2024-09-05_120027/bootloader-arduino_nano-644.elf new file mode 100755 index 0000000000000000000000000000000000000000..ec61e7f0532a443dbe2775865e3d822dd3c25e36 GIT binary patch literal 9292 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 literal 0 HcmV?d00001 diff --git a/software/nano-644/bootloader-arduino/release/2024-09-05_120027/bootloader-arduino_nano-644.hex b/software/nano-644/bootloader-arduino/release/2024-09-05_120027/bootloader-arduino_nano-644.hex new file mode 100644 index 0000000..d57cf5c --- /dev/null +++ b/software/nano-644/bootloader-arduino/release/2024-09-05_120027/bootloader-arduino_nano-644.hex @@ -0,0 +1,100 @@ +:10E000000C9449700C945B700C945B700C945B7076 +:10E010000C945B700C945B700C945B700C945B7054 +:10E020000C945B700C945B700C945B700C945B7044 +:10E030000C945B700C945B700C945B700C945B7034 +:10E040000C945B700C945B700C945B700C945B7024 +:10E050000C945B700C945B700C945B700C945B7014 +:10E060000C945B700C945B700C945B700C945B7004 +:10E070000C945B700C945B700C945B7031323A3092 +:10E08000303A323700536570202035203230323438 +:10E09000000011241FBECFEFD0E1DEBFCDBF22E0D4 +:10E0A000A0E0B1E001C01D92AC30B207E1F70E94E0 +:10E0B00040710C9407730C9400709091C00095FF10 +:10E0C000FCCF8093C6000895CF93982F85958595B2 +:10E0D00085958595805D9F709A3014F0C7E501C0E5 +:10E0E000C0E3C90F0E945D708C2FCF910C945D70BE +:10E0F000CF92DF92EF92FF92C12CD12C76018091CA +:10E10000C00087FD15C08FEFC81AD80AE80AF80AC0 +:10E1100081EBC81681E7D8068BE0E806F10478F3B6 +:10E1200017B818B8E0910001F09101010995E7CF07 +:10E130008091C600FF90EF90DF90CF900895CF932D +:10E140000E947870C82F0E945D70C13614F089EA71 +:10E1500003C0C0331CF080ED8C0F01C08C2FCF9119 +:10E160000895CF930E949F70C82F0E949F7090E1E6 +:10E17000C99F800D1124CF910895CF93C82FCC2330 +:10E1800021F00E947870C150FACFCF910895CF93BB +:10E19000C82F0E947870803251F484E10E945D7033 +:10E1A0008C2F0E945D7080E1CF910C945D70809106 +:10E1B00002018F5F80930201853041F417B818B8CF +:10E1C000E0910001F0910101CF910994CF91089560 +:10E1D0000E947870803231F484E10E945D7080E1A9 +:10E1E0000C945D70809102018F5F809302018530F5 +:10E1F00039F417B818B8E0910001F09101010994C1 +:10E200000895CF93DF9300D000D0CDB7DEB7198249 +:10E210001A821B821C8289819A81AB81BC81811503 +:10E220009042A140B10580F48091C00087FD0CC0F0 +:10E2300089819A81AB81BC810196A11DB11D898321 +:10E240009A83AB83BC83E7CF0F900F900F900F9012 +:10E25000DF91CF910895CF93C82F429A0E94017108 +:10E26000439A0E94017118B8CC2341F0449A0E944D +:10E27000017144980E940171C150F6CFCF91089569 +:10E28000000018B88CE987B982E08093C0008CE068 +:10E290008093C4001092C50088E18093C10086E09D +:10E2A0008093C20098E09093C9008093CA0084E0F4 +:10E2B0000E942B7113E001E0E5E0FE2EF1E1EF2E6C +:10E2C0000E947870803309F447C0813319F50E94A9 +:10E2D00078708032B9F484E10E945D7081E40E941C +:10E2E0005D7086E50E945D7082E50E945D7080E24F +:10E2F0000E945D7089E40E945D7083E50E945D70FC +:10E3000080E56CC1809102018F5F809302018530AE +:10E31000B9F671C1803439F40E9478708638E0F023 +:10E320000E94787019C0813491F40E94787080380E +:10E3300011F481EF44C0813811F481E040C082388B +:10E3400011F480E13CC08839C9F583E038C08234DB +:10E3500031F484E10E94BD700E94E870B1CF853431 +:10E3600011F485E0F7CF982F9D7F9035A9F3813583 +:10E3700099F3853549F40E94787080930A020E94CF +:10E38000787080930B02E8CF8635E1F40E947870B4 +:10E39000803389F40E9478700E947870C82F0E94A0 +:10E3A0007870C11102C08EE10AC0C13011F486E953 +:10E3B00006C08AE004C083E00E94BD7080E00E9435 +:10E3C000C7707ECF843609F0A7C00E947870809312 +:10E3D00009020E94787080930802809107028E7F64 +:10E3E000809307020E947870853429F48091070297 +:10E3F000816080930702C6E0D1E06E01209108029F +:10E4000030910902C601865091408217930730F47B +:10E410000E947870F60181936F01F0CF0E947870AE +:10E42000803209F0E1C02091070280910A029091A8 +:10E430000B02880F991F90930B0280930A0220FF12 +:10E4400023C0E6E0F1E02091080230910902CF01FB +:10E45000865091408217930708F05CC0F999FECF6F +:10E4600080910A0290910B0292BD81BD819180BD85 +:10E47000FA9AF99A80910A0290910B020196909370 +:10E480000B0280930A02DFCF8091080280FF09C04F +:10E49000809108029091090201969093090280935D +:10E4A0000802F89440910A0250910B02F999FECFAC +:10E4B00007B600FCFDCF429AFA0110935700E89589 +:10E4C00007B600FCFDCF429820E030E0FA01E20FF1 +:10E4D000F31F898190E0982F88276881860F911D0E +:10E4E0000C0100935700E89511242E5F3F4F2296B0 +:10E4F0002115F1E03F0751F7309305012093040106 +:10E50000FA01F0925700E89507B600FCFDCFE092C3 +:10E510005700E89584E162C0843709F04FC00E943B +:10E520007870809309020E9478708093080280912D +:10E530000A0290910B02880F991F90930B0280930F +:10E540000A020E94787090910702853411F491605C +:10E5500001C09E7F909307020E947870803209F07C +:10E560003FC084E10E945D70C0E0D0E0809108026D +:10E5700090910902C817D90798F58091070280FF8A +:10E580000BC0F999FECF80910A0290910B0292BDC7 +:10E5900081BDF89A80B505C0E0910A02F0910B02A6 +:10E5A00084910E945D7080910A0290910B02019605 +:10E5B00090930B0280930A022196D8CF853719F5E4 +:10E5C0000E947870803281F484E10E945D708EE157 +:10E5D0000E945D7086E90E945D708AE00E945D7015 +:10E5E00080E10E945D706CCE809102018F5F80930C +:10E5F0000201853009F417B818B8E0910001F091D4 +:10E60000010109955DCE863709F05ACED7CEF89430 +:02E61000FFCF3A +:040000030000E00019 +:00000001FF diff --git a/software/nano-644/bootloader-arduino/src/main.c b/software/nano-644/bootloader-arduino/src/main.c new file mode 100644 index 0000000..3162adc --- /dev/null +++ b/software/nano-644/bootloader-arduino/src/main.c @@ -0,0 +1,520 @@ +/*************************************************************************************************/ +/* 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)) + +// 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); + +volatile const char DATE [] PROGMEM = __DATE__; +volatile const char TIME [] PROGMEM = __TIME__; + +#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, ensure that Q1 (battery power) on (PC7) + PORTC = 0; + DDRC = (1 << PC7) | (1 << PC4) | (1 << PC3) |(1 << PC2); + + + #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(SIGNATURE_0); + } else if (ch == 1) { + byte_response(SIGNATURE_1); + } else { + byte_response(SIGNATURE_2); + } + } 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; + } + #endif + + // 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 + SET_LED_RED; + boot_page_erase(addr); + boot_spm_busy_wait (); + CLR_LED_RED; + #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