AVR Bootloader
Inhaltsverzeichnis
Basisinformation
https://web.archive.org/web/20140803113418/http://www.atmel.com/Images/doc7618.pdf
Vorsicht bei diesem Artikel, da steht ziemlich viel Verwirrendes/Unzutreffendes drin.
Bootloader Code
Am Beispiel ATmega328(P) Den Bootloader für diesen Typ findet man im Sourcecode und als kompilierte Version (.hex) unter hier. Im Installationsverzeichnis der Arduino IDE auch im /hardware/arduino/avr/bootloaders/atmega zu finden.
ATmegaBOOT_168.c
ATmegaBOOT_168_atmega328.hex
ATmegaBOOT_168_diecimila.hex
ATmegaBOOT_168_pro_8MHz.hex
ATmegaBOOT_168_atmega1280.hex
ATmegaBOOT_168_atmega328_pro_8MHz.hex
ATmegaBOOT_168_ng.hex
Makefile
Wie diesem Artikel zu entnehmen ist, wurde der (Original-)Bootloader des Nano ab Januar 2018 von o.g. Bootloader zu Optiboot geändert. Dies erklärt auch in der Arduino IDE mit der Boardauswahl 'Nano' die Menüauswahl Werkzeuge->Prozessor-ATmega328P (ab 01/2018)und ATmega328P(Old Bootloader bis 01/2018).
Man findet unter /hardware/arduino/avr/bootloaders/optiboot folgendes:
Makefile
boot.h
omake
optiboot.c
optiboot_atmega168.lst
optiboot_atmega328.hex
optiboot_atmega8.hex
pin_defs.h
README.TXT
makeall
omake.bat
optiboot_atmega168.hex
optiboot_atmega328-Mini.hex
optiboot_atmega328.lst
optiboot_atmega8.lst
stk500.h
Wer tiefer in die Booloader-Programmierung einsteigen möchte findet hier einen sehr gelungenen Artikel.
Bootloader auslesen
Bootloader schreiben
Wichtiger beim Schreiben als beim Lesen, bzw. Abspeichern ist zu wissen in welchem (internen) Format ein HEX-File abgelegt ist. Die Extension .hex , .intel, . bin oder .raw sind KEIN Indiz für das Format des Dateiinhaltes.
The filename field indicates the name of the file to read or write. The format field is optional and contains the format of the file to read or write. Possible values are:
i Intel Hex
s Motorola S-record
r raw binary; little-endian byte order, in the case of the flash ROM data
m immediate mode; actual byte values specified on the command line, separated by commas or spaces in place of the filename field of the ‘-U’ option. This is useful for programming fuse bytes without having to create a single-byte file or enter terminal mode. If the number specified begins with 0x, it is treated as a hex value. If the number otherwise begins with a leading zero (0) it is treated as octal. Otherwise, the value is treated as decimal.
a auto detect; valid for input only, and only if the input is not provided at stdin. d decimal; this and the following formats are only valid on output. They generate one line of output for the respective memory section, forming a comma-separated list of the values. This can be particularly useful for subsequent processing, like for fuse bit settings.
h hexadecimal; each value will get the string 0x prepended. o octal; each value will get a 0 prepended unless it is less than 8 in which case it gets no prefix.
b binary; each value will get the string 0b prepended.
The default is to use auto detection for input files, and raw binary format for output files.