From 5515442dbb3efe23bc7572c80270829257371bb8 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Fri, 25 Feb 2011 18:36:46 -0500 Subject: Small optimization in HardwareSerial. begin(long) -> begin(unsigned long) --- cores/arduino/HardwareSerial.cpp | 2 +- cores/arduino/HardwareSerial.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cores/arduino/HardwareSerial.cpp b/cores/arduino/HardwareSerial.cpp index 4397efb..38e87c4 100644 --- a/cores/arduino/HardwareSerial.cpp +++ b/cores/arduino/HardwareSerial.cpp @@ -191,7 +191,7 @@ HardwareSerial::HardwareSerial(ring_buffer *rx_buffer, // Public Methods ////////////////////////////////////////////////////////////// -void HardwareSerial::begin(long baud) +void HardwareSerial::begin(unsigned long baud) { uint16_t baud_setting; bool use_u2x = true; diff --git a/cores/arduino/HardwareSerial.h b/cores/arduino/HardwareSerial.h index 3efa775..9dc67c4 100644 --- a/cores/arduino/HardwareSerial.h +++ b/cores/arduino/HardwareSerial.h @@ -48,7 +48,7 @@ class HardwareSerial : public Stream volatile uint8_t *ucsra, volatile uint8_t *ucsrb, volatile uint8_t *udr, uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udre, uint8_t u2x); - void begin(long); + void begin(unsigned long); void end(); virtual int available(void); virtual int peek(void); -- cgit v1.2.3-18-g5258 From 5e721df32a49d8f74058ba0f824ffe9686a0c9d7 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Thu, 3 Mar 2011 22:56:20 -0500 Subject: Fixing warnings (David H. Lynch Jr). --- cores/arduino/Print.cpp | 2 +- cores/arduino/WString.h | 2 +- cores/arduino/pins_arduino.c | 84 ++++++++++++++++++++++---------------------- 3 files changed, 44 insertions(+), 44 deletions(-) diff --git a/cores/arduino/Print.cpp b/cores/arduino/Print.cpp index 4ee556d..fd68942 100755 --- a/cores/arduino/Print.cpp +++ b/cores/arduino/Print.cpp @@ -45,7 +45,7 @@ void Print::write(const uint8_t *buffer, size_t size) void Print::print(const String &s) { - for (int i = 0; i < s.length(); i++) { + for (unsigned int i = 0; i < s.length(); i++) { write(s[i]); } } diff --git a/cores/arduino/WString.h b/cores/arduino/WString.h index cadddb9..56faf9a 100644 --- a/cores/arduino/WString.h +++ b/cores/arduino/WString.h @@ -67,7 +67,7 @@ class String int lastIndexOf( char ch, unsigned int fromIndex ) const; int lastIndexOf( const String &str ) const; int lastIndexOf( const String &str, unsigned int fromIndex ) const; - const unsigned int length( ) const { return _length; } + unsigned int length( ) const { return _length; } void setCharAt(unsigned int index, const char ch); unsigned char startsWith( const String &prefix ) const; unsigned char startsWith( const String &prefix, unsigned int toffset ) const; diff --git a/cores/arduino/pins_arduino.c b/cores/arduino/pins_arduino.c index 0c816e9..62e10ad 100755 --- a/cores/arduino/pins_arduino.c +++ b/cores/arduino/pins_arduino.c @@ -81,50 +81,50 @@ #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) const uint16_t PROGMEM port_to_mode_PGM[] = { NOT_A_PORT, - &DDRA, - &DDRB, - &DDRC, - &DDRD, - &DDRE, - &DDRF, - &DDRG, - &DDRH, + (uint16_t) &DDRA, + (uint16_t) &DDRB, + (uint16_t) &DDRC, + (uint16_t) &DDRD, + (uint16_t) &DDRE, + (uint16_t) &DDRF, + (uint16_t) &DDRG, + (uint16_t) &DDRH, NOT_A_PORT, - &DDRJ, - &DDRK, - &DDRL, + (uint16_t) &DDRJ, + (uint16_t) &DDRK, + (uint16_t) &DDRL, }; const uint16_t PROGMEM port_to_output_PGM[] = { NOT_A_PORT, - &PORTA, - &PORTB, - &PORTC, - &PORTD, - &PORTE, - &PORTF, - &PORTG, - &PORTH, + (uint16_t) &PORTA, + (uint16_t) &PORTB, + (uint16_t) &PORTC, + (uint16_t) &PORTD, + (uint16_t) &PORTE, + (uint16_t) &PORTF, + (uint16_t) &PORTG, + (uint16_t) &PORTH, NOT_A_PORT, - &PORTJ, - &PORTK, - &PORTL, + (uint16_t) &PORTJ, + (uint16_t) &PORTK, + (uint16_t) &PORTL, }; const uint16_t PROGMEM port_to_input_PGM[] = { NOT_A_PIN, - &PINA, - &PINB, - &PINC, - &PIND, - &PINE, - &PINF, - &PING, - &PINH, + (uint16_t) &PINA, + (uint16_t) &PINB, + (uint16_t) &PINC, + (uint16_t) &PIND, + (uint16_t) &PINE, + (uint16_t) &PINF, + (uint16_t) &PING, + (uint16_t) &PINH, NOT_A_PIN, - &PINJ, - &PINK, - &PINL, + (uint16_t) &PINJ, + (uint16_t) &PINK, + (uint16_t) &PINL, }; const uint8_t PROGMEM digital_pin_to_port_PGM[] = { @@ -358,25 +358,25 @@ const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { const uint16_t PROGMEM port_to_mode_PGM[] = { NOT_A_PORT, NOT_A_PORT, - &DDRB, - &DDRC, - &DDRD, + (uint16_t) &DDRB, + (uint16_t) &DDRC, + (uint16_t) &DDRD, }; const uint16_t PROGMEM port_to_output_PGM[] = { NOT_A_PORT, NOT_A_PORT, - &PORTB, - &PORTC, - &PORTD, + (uint16_t) &PORTB, + (uint16_t) &PORTC, + (uint16_t) &PORTD, }; const uint16_t PROGMEM port_to_input_PGM[] = { NOT_A_PORT, NOT_A_PORT, - &PINB, - &PINC, - &PIND, + (uint16_t) &PINB, + (uint16_t) &PINC, + (uint16_t) &PIND, }; const uint8_t PROGMEM digital_pin_to_port_PGM[] = { -- cgit v1.2.3-18-g5258 From f25e71c3c1e96d50ffd5684d0409890a2378d113 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Sat, 14 May 2011 12:25:39 -0400 Subject: Fixing 300 baud communication for serial. Because UBBR is only 12 bits, we were overflowing it at 300 baud because of the use of the U2X bit. Now we turn off U2X if it would yield a UBBR value that would overflow. Note that this breaks 300 baud communication with the computer on the Uno and Mega 2560 because the 8U2 USB-serial firmware has this same bug (and previously they cancelled each other out). Since, however, it seems more likely that people will need to use 300 baud to communicate with other (legacy) hardware than with the computer, I'm making this change. Issue for 8U2 firmware bug: http://code.google.com/p/arduino/issues/detail?id=542 http://code.google.com/p/arduino/issues/detail?id=522 --- cores/arduino/HardwareSerial.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cores/arduino/HardwareSerial.cpp b/cores/arduino/HardwareSerial.cpp index 38e87c4..b5dba1e 100644 --- a/cores/arduino/HardwareSerial.cpp +++ b/cores/arduino/HardwareSerial.cpp @@ -204,6 +204,8 @@ void HardwareSerial::begin(unsigned long baud) use_u2x = false; } #endif + +try_again: if (use_u2x) { *_ucsra = 1 << _u2x; @@ -212,6 +214,12 @@ void HardwareSerial::begin(unsigned long baud) *_ucsra = 0; baud_setting = (F_CPU / 8 / baud - 1) / 2; } + + if ((baud_setting > 4095) && use_u2x) + { + use_u2x = false; + goto try_again; + } // assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register) *_ubrrh = baud_setting >> 8; -- cgit v1.2.3-18-g5258 From bac72096b31cb5f7b063c3ae00dca237376995b5 Mon Sep 17 00:00:00 2001 From: WestfW Date: Thu, 9 Jun 2011 22:36:05 -0700 Subject: Makefile modification to allow building optiboot in more environments. Allows building within the Arduino Source tree, and within the Arduino IDE tree, as well as using CrossPack on Mac. Adds README.TXT to track arduino-specific changes (and documents the new build options.) This addresses Arduino issue: http://code.google.com/p/arduino/issues/detail?id=487 And optiboot issue http://code.google.com/p/optiboot/issues/detail?id=1 (which can be thought of as a subset of the Arduno issue.) Note that the binaries produced after these Makefile changes (using any of the compile environments) are identical to those produced by the crosspack-20100115 environment on a Mac. --- bootloaders/optiboot/Makefile | 77 ++++++++++++++++++++++++++--- bootloaders/optiboot/README.TXT | 55 +++++++++++++++++++++ bootloaders/optiboot/omake | 2 + bootloaders/optiboot/omake.bat | 1 + bootloaders/optiboot/optiboot_atmega328.lst | 22 ++++----- 5 files changed, 138 insertions(+), 19 deletions(-) create mode 100644 bootloaders/optiboot/README.TXT create mode 100644 bootloaders/optiboot/omake create mode 100644 bootloaders/optiboot/omake.bat diff --git a/bootloaders/optiboot/Makefile b/bootloaders/optiboot/Makefile index 0fd6005..92f9c61 100644 --- a/bootloaders/optiboot/Makefile +++ b/bootloaders/optiboot/Makefile @@ -19,6 +19,17 @@ # program name should not be changed... PROGRAM = optiboot +# The default behavior is to build using tools that are in the users +# current path variables, but we can also build using an installed +# Arduino user IDE setup, or the Arduino source tree. +# Uncomment this next lines to build within the arduino environment, +# using the arduino-included avrgcc toolset (mac and pc) +# ENV ?= arduino +# ENV ?= arduinodev +# OS ?= macosx +# OS ?= windows + + # enter the parameters for the avrdude isp tool ISPTOOL = stk500v2 ISPPORT = usb @@ -27,6 +38,50 @@ ISPSPEED = -b 115200 MCU_TARGET = atmega168 LDSECTION = --section-start=.text=0x3e00 +# Build environments +# Start of some ugly makefile-isms to allow optiboot to be built +# in several different environments. See the README.TXT file for +# details. + +# default +fixpath = $(1) + +ifeq ($(ENV), arduino) +# For Arduino, we assume that we're connected to the optiboot directory +# included with the arduino distribution, which means that the full set +# of avr-tools are "right up there" in standard places. +TOOLROOT = ../../../tools +GCCROOT = $(TOOLROOT)/avr/bin/ +AVRDUDE_CONF = -C$(TOOLROOT)/avr/etc/avrdude.conf + +ifeq ($(OS), windows) +# On windows, SOME of the tool paths will need to have backslashes instead +# of forward slashes (because they use windows cmd.exe for execution instead +# of a unix/mingw shell?) +fixpath = $(subst /,\,$1) +endif + +else ifeq ($(ENV), arduinodev) +# Arduino IDE source code environment. Use the unpacked compilers created +# by the build (you'll need to do "ant build" first.) +ifeq ($(OS), macosx) +TOOLROOT = ../../../../build/macosx/work/Arduino.app/Contents/Resources/Java/hardware/tools +endif +ifeq ($(OS), windows) +TOOLROOT = ../../../../build/windows/work/hardware/tools +endif + +GCCROOT = $(TOOLROOT)/avr/bin/ +AVRDUDE_CONF = -C$(TOOLROOT)/avr/etc/avrdude.conf + +else +GCCROOT = +AVRDUDE_CONF = +endif +# +# End of build environment code. + + # the efuse should really be 0xf8; since, however, only the lower # three bits of that byte are used on the atmega168, avrdude gets # confused if you specify 1's for the higher bits, see: @@ -37,10 +92,13 @@ LDSECTION = --section-start=.text=0x3e00 # lock it), but since the high two bits of the lock byte are # unused, avrdude would get confused. -ISPFUSES = avrdude -c $(ISPTOOL) -p $(MCU_TARGET) -P $(ISPPORT) $(ISPSPEED) \ --e -u -U lock:w:0x3f:m -U efuse:w:0x$(EFUSE):m -U hfuse:w:0x$(HFUSE):m -U lfuse:w:0x$(LFUSE):m -ISPFLASH = avrdude -c $(ISPTOOL) -p $(MCU_TARGET) -P $(ISPPORT) $(ISPSPEED) \ --U flash:w:$(PROGRAM)_$(TARGET).hex -U lock:w:0x0f:m +ISPFUSES = $(GCCROOT)avrdude $(AVRDUDE_CONF) -c $(ISPTOOL) \ + -p $(MCU_TARGET) -P $(ISPPORT) $(ISPSPEED) \ + -e -u -U lock:w:0x3f:m -U efuse:w:0x$(EFUSE):m \ + -U hfuse:w:0x$(HFUSE):m -U lfuse:w:0x$(LFUSE):m +ISPFLASH = $(GCCROOT)avrdude $(AVRDUDE_CONF) -c $(ISPTOOL) \ + -p $(MCU_TARGET) -P $(ISPPORT) $(ISPSPEED) \ + -U flash:w:$(PROGRAM)_$(TARGET).hex -U lock:w:0x0f:m STK500 = "C:\Program Files\Atmel\AVR Tools\STK500\Stk500.exe" STK500-1 = $(STK500) -e -d$(MCU_TARGET) -pf -vf -if$(PROGRAM)_$(TARGET).hex \ @@ -53,15 +111,17 @@ OPTIMIZE = -Os -fno-inline-small-functions -fno-split-wide-types -mshort-calls DEFS = LIBS = -CC = avr-gcc +CC = $(GCCROOT)avr-gcc # Override is only needed by avr-lib build system. override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -DF_CPU=$(AVR_FREQ) $(DEFS) -override LDFLAGS = -Wl,$(LDSECTION) -Wl,--relax -nostartfiles +override LDFLAGS = -Wl,$(LDSECTION) -Wl,--relax -Wl,--gc-sections -nostartfiles -nostdlib + +OBJCOPY = $(GCCROOT)avr-objcopy +OBJDUMP = $(call fixpath,$(GCCROOT)avr-objdump) -OBJCOPY = avr-objcopy -OBJDUMP = avr-objdump +SIZE = $(GCCROOT)avr-size # 20MHz clocked platforms # @@ -222,6 +282,7 @@ isp-stk500: $(PROGRAM)_$(TARGET).hex %.elf: $(OBJ) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) + $(SIZE) $@ clean: rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep *.srec *.bin *.hex diff --git a/bootloaders/optiboot/README.TXT b/bootloaders/optiboot/README.TXT new file mode 100644 index 0000000..9a68e23 --- /dev/null +++ b/bootloaders/optiboot/README.TXT @@ -0,0 +1,55 @@ +This directory contains the Optiboot small bootloader for AVR +microcontrollers, somewhat modified specifically for the Arduino +environment. + +Optiboot is more fully described here: http://code.google.com/p/optiboot/ +and is the work of Peter Knight (aka Cathedrow), building on work of Jason P +Kyle, Spiff, and Ladyada. Arduino-specific modification are by Bill +Westfield (aka WestfW) + +Arduino-specific issues are tracked as part of the Arduino project +at http://code.google.com/p/arduino + + +------------------------------------------------------------ +Building optiboot for Arduino. + +Production builds of optiboot for Arduino are done on a Mac in "unix mode" +using CrossPack-AVR-20100115. CrossPack tracks WINAVR (for windows), which +is just a package of avr-gcc and related utilities, so similar builds should +work on Windows or Linux systems. + +One of the Arduino-specific changes is modifications to the makefile to +allow building optiboot using only the tools installed as part of the +Arduino environment, or the Arduino source development tree. All three +build procedures should yield identical binaries (.hex files) (although +this may change if compiler versions drift apart between CrossPack and +the Arduino IDE.) + + +Building optiboot in the arduino IDE install. + +Work in the .../hardware/arduino/bootloaders/optiboot/ and use the +"omake " command, which just generates a command that uses +the arduino-included "make" utility with a command like: + make OS=windows ENV=arduino +or make OS=macosx ENV=arduino +On windows, this assumes you're using the windows command shell. If +you're using a cygwin or mingw shell, or have one of those in your +path, the build will probably break due to slash vs backslash issues. +On a Mac, if you have the developer tools installed, you can use the +Apple-supplied version of make. +The makefile uses relative paths ("../../../tools/" and such) to find +the programs it needs, so you need to work in the existing optiboot +directory (or something created at the same "level") for it to work. + + +Building optiboot in the arduino source development install. + +In this case, there is no special shell script, and you're assumed to +have "make" installed somewhere in your path. +Build the Arduino source ("ant build") to unpack the tools into the +expected directory. +Work in Arduino/hardware/arduino/bootloaders/optiboot and use + make OS=windows ENV=arduinodev +or make OS=macosx ENV=arduinodev diff --git a/bootloaders/optiboot/omake b/bootloaders/optiboot/omake new file mode 100644 index 0000000..cc7c6bc --- /dev/null +++ b/bootloaders/optiboot/omake @@ -0,0 +1,2 @@ +echo ../../../tools/avr/bin/make OS=macosx ENV=arduino $* +../../../tools/avr/bin/make OS=macosx ENV=arduino $* diff --git a/bootloaders/optiboot/omake.bat b/bootloaders/optiboot/omake.bat new file mode 100644 index 0000000..f6815da --- /dev/null +++ b/bootloaders/optiboot/omake.bat @@ -0,0 +1 @@ +..\..\..\tools\avr\utils\bin\make OS=windows ENV=arduino %* diff --git a/bootloaders/optiboot/optiboot_atmega328.lst b/bootloaders/optiboot/optiboot_atmega328.lst index dd879dc..104799f 100644 --- a/bootloaders/optiboot/optiboot_atmega328.lst +++ b/bootloaders/optiboot/optiboot_atmega328.lst @@ -13,15 +13,15 @@ Idx Name Size VMA LMA File off Algn CONTENTS, READONLY, DEBUGGING 4 .debug_abbrev 00000196 00000000 00000000 0000053d 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_line 000003db 00000000 00000000 000006d3 2**0 + 5 .debug_line 0000043f 00000000 00000000 000006d3 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_frame 00000090 00000000 00000000 00000ab0 2**2 + 6 .debug_frame 00000090 00000000 00000000 00000b14 2**2 CONTENTS, READONLY, DEBUGGING - 7 .debug_str 00000124 00000000 00000000 00000b40 2**0 + 7 .debug_str 00000136 00000000 00000000 00000ba4 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_loc 000001d1 00000000 00000000 00000c64 2**0 + 8 .debug_loc 000001d1 00000000 00000000 00000cda 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_ranges 00000068 00000000 00000000 00000e35 2**0 + 9 .debug_ranges 00000068 00000000 00000000 00000eab 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -153,7 +153,7 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 7e5e: 81 e0 ldi r24, 0x01 ; 1 - 7e60: be d0 rcall .+380 ; 0x7fde + 7e60: be d0 rcall .+380 ; 0x7fde putch(0x03); 7e62: 83 e0 ldi r24, 0x03 ; 3 7e64: 24 c0 rjmp .+72 ; 0x7eae @@ -172,7 +172,7 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 7e72: 85 e0 ldi r24, 0x05 ; 5 - 7e74: b4 d0 rcall .+360 ; 0x7fde + 7e74: b4 d0 rcall .+360 ; 0x7fde 7e76: 8a c0 rjmp .+276 ; 0x7f8c } else if(ch == STK_LOAD_ADDRESS) { @@ -206,7 +206,7 @@ void watchdogReset() { // UNIVERSAL command is ignored getNch(4); 7ea8: 84 e0 ldi r24, 0x04 ; 4 - 7eaa: 99 d0 rcall .+306 ; 0x7fde + 7eaa: 99 d0 rcall .+306 ; 0x7fde putch(0x00); 7eac: 80 e0 ldi r24, 0x00 ; 0 7eae: 71 d0 rcall .+226 ; 0x7f92 @@ -503,6 +503,8 @@ void verifySpace() { 7fda: 84 e1 ldi r24, 0x14 ; 20 } 7fdc: da cf rjmp .-76 ; 0x7f92 + +00007fde : ::[count] "M" (UART_B_VALUE) ); } @@ -511,12 +513,10 @@ void verifySpace() { void getNch(uint8_t count) { 7fde: 1f 93 push r17 7fe0: 18 2f mov r17, r24 - -00007fe2 : do getch(); while (--count); 7fe2: df df rcall .-66 ; 0x7fa2 7fe4: 11 50 subi r17, 0x01 ; 1 - 7fe6: e9 f7 brne .-6 ; 0x7fe2 + 7fe6: e9 f7 brne .-6 ; 0x7fe2 verifySpace(); 7fe8: f4 df rcall .-24 ; 0x7fd2 } -- cgit v1.2.3-18-g5258 From e115bd8643e2dfab00757ba1074a536024a894cf Mon Sep 17 00:00:00 2001 From: WestfW Date: Thu, 9 Jun 2011 22:57:27 -0700 Subject: http://code.google.com/p/arduino/issues/detail?id=517 Remove the trailing comments when setting fuse values for the various *_isp targets, so that they won't cause avrdude errors. This was done the same way as in the optiboot source tree: http://code.google.com/p/optiboot/issues/detail?id=17 http://code.google.com/p/optiboot/source/detail?r=005fb033fc08c551b2f86f7c90c5db21549b3f20 --- bootloaders/optiboot/Makefile | 81 ++++++++++++++++++++++++++++--------------- 1 file changed, 54 insertions(+), 27 deletions(-) diff --git a/bootloaders/optiboot/Makefile b/bootloaders/optiboot/Makefile index 92f9c61..0f8d09e 100644 --- a/bootloaders/optiboot/Makefile +++ b/bootloaders/optiboot/Makefile @@ -136,9 +136,12 @@ pro20: $(PROGRAM)_pro_20mhz.lst pro20_isp: pro20 pro20_isp: TARGET = pro_20mhz -pro20_isp: HFUSE = DD # 2.7V brownout -pro20_isp: LFUSE = C6 # Full swing xtal (20MHz) 258CK/14CK+4.1ms -pro20_isp: EFUSE = 02 # 512 byte boot +# 2.7V brownout +pro20_isp: HFUSE = DD +# Full swing xtal (20MHz) 258CK/14CK+4.1ms +pro20_isp: LFUSE = C6 +# 512 byte boot +pro20_isp: EFUSE = 02 pro20_isp: isp # 16MHz clocked platforms @@ -154,9 +157,12 @@ pro16: $(PROGRAM)_pro_16MHz.lst pro16_isp: pro16 pro16_isp: TARGET = pro_16MHz -pro16_isp: HFUSE = DD # 2.7V brownout -pro16_isp: LFUSE = C6 # Full swing xtal (20MHz) 258CK/14CK+4.1ms -pro16_isp: EFUSE = 02 # 512 byte boot +# 2.7V brownout +pro16_isp: HFUSE = DD +# Full swing xtal (20MHz) 258CK/14CK+4.1ms +pro16_isp: LFUSE = C6 +# 512 byte boot +pro16_isp: EFUSE = 02 pro16_isp: isp # Diecimila and NG use identical bootloaders @@ -169,9 +175,12 @@ diecimila: $(PROGRAM)_diecimila.lst diecimila_isp: diecimila diecimila_isp: TARGET = diecimila -diecimila_isp: HFUSE = DD # 2.7V brownout -diecimila_isp: LFUSE = FF # Low power xtal (16MHz) 16KCK/14CK+65ms -diecimila_isp: EFUSE = 02 # 512 byte boot +# 2.7V brownout +diecimila_isp: HFUSE = DD +# Low power xtal (16MHz) 16KCK/14CK+65ms +diecimila_isp: LFUSE = FF +# 512 byte boot +diecimila_isp: EFUSE = 02 diecimila_isp: isp atmega328: TARGET = atmega328 @@ -185,9 +194,12 @@ atmega328: $(PROGRAM)_atmega328.lst atmega328_isp: atmega328 atmega328_isp: TARGET = atmega328 atmega328_isp: MCU_TARGET = atmega328p -atmega328_isp: HFUSE = DE # 512 byte boot -atmega328_isp: LFUSE = FF # Low power xtal (16MHz) 16KCK/14CK+65ms -atmega328_isp: EFUSE = 05 # 2.7V brownout +# 512 byte boot +atmega328_isp: HFUSE = DE +# Low power xtal (16MHz) 16KCK/14CK+65ms +atmega328_isp: LFUSE = FF +# 2.7V brownout +atmega328_isp: EFUSE = 05 atmega328_isp: isp # 8MHz clocked platforms @@ -203,9 +215,12 @@ lilypad: $(PROGRAM)_lilypad.lst lilypad_isp: lilypad lilypad_isp: TARGET = lilypad -lilypad_isp: HFUSE = DD # 2.7V brownout -lilypad_isp: LFUSE = E2 # Internal 8MHz osc (8MHz) Slow rising power -lilypad_isp: EFUSE = 02 # 512 byte boot +# 2.7V brownout +lilypad_isp: HFUSE = DD +# Internal 8MHz osc (8MHz) Slow rising power +lilypad_isp: LFUSE = E2 +# 512 byte boot +lilypad_isp: EFUSE = 02 lilypad_isp: isp lilypad_resonator: TARGET = lilypad_resonator @@ -216,9 +231,12 @@ lilypad_resonator: $(PROGRAM)_lilypad_resonator.lst lilypad_resonator_isp: lilypad_resonator lilypad_resonator_isp: TARGET = lilypad_resonator -lilypad_resonator_isp: HFUSE = DD # 2.7V brownout -lilypad_resonator_isp: LFUSE = C6 # Full swing xtal (20MHz) 258CK/14CK+4.1ms -lilypad_resonator_isp: EFUSE = 02 # 512 byte boot +# 2.7V brownout +lilypad_resonator_isp: HFUSE = DD +# Full swing xtal (20MHz) 258CK/14CK+4.1ms +lilypad_resonator_isp: LFUSE = C6 +# 512 byte boot +lilypad_resonator_isp: EFUSE = 02 lilypad_resonator_isp: isp pro8: TARGET = pro_8MHz @@ -229,9 +247,12 @@ pro8: $(PROGRAM)_pro_8MHz.lst pro8_isp: pro8 pro8_isp: TARGET = pro_8MHz -pro8_isp: HFUSE = DD # 2.7V brownout -pro8_isp: LFUSE = C6 # Full swing xtal (20MHz) 258CK/14CK+4.1ms -pro8_isp: EFUSE = 02 # 512 byte boot +# 2.7V brownout +pro8_isp: HFUSE = DD +# Full swing xtal (20MHz) 258CK/14CK+4.1ms +pro8_isp: LFUSE = C6 +# 512 byte boot +pro8_isp: EFUSE = 02 pro8_isp: isp atmega328_pro8: TARGET = atmega328_pro_8MHz @@ -245,9 +266,12 @@ atmega328_pro8: $(PROGRAM)_atmega328_pro_8MHz.lst atmega328_pro8_isp: atmega328_pro8 atmega328_pro8_isp: TARGET = atmega328_pro_8MHz atmega328_pro8_isp: MCU_TARGET = atmega328p -atmega328_pro8_isp: HFUSE = DE # 512 byte boot -atmega328_pro8_isp: LFUSE = FF # Low power xtal (16MHz) 16KCK/14CK+65ms -atmega328_pro8_isp: EFUSE = 05 # 2.7V brownout +# 512 byte boot +atmega328_pro8_isp: HFUSE = DE +# Low power xtal (16MHz) 16KCK/14CK+65ms +atmega328_pro8_isp: LFUSE = FF +# 2.7V brownout +atmega328_pro8_isp: EFUSE = 05 atmega328_pro8_isp: isp # 1MHz clocked platforms @@ -267,9 +291,12 @@ luminet: $(PROGRAM)_luminet.lst luminet_isp: luminet luminet_isp: TARGET = luminet luminet_isp: MCU_TARGET = attiny84 -luminet_isp: HFUSE = DF # Brownout disabled -luminet_isp: LFUSE = 62 # 1MHz internal oscillator, slowly rising power -luminet_isp: EFUSE = FE # Self-programming enable +# Brownout disabled +luminet_isp: HFUSE = DF +# 1MHz internal oscillator, slowly rising power +luminet_isp: LFUSE = 62 +# Self-programming enable +luminet_isp: EFUSE = FE luminet_isp: isp isp: $(TARGET) -- cgit v1.2.3-18-g5258 From 4f44d2893a506ee3924785c91a5f8983c013150c Mon Sep 17 00:00:00 2001 From: WestfW Date: Fri, 10 Jun 2011 16:17:13 -0700 Subject: This is a relatively significant edit that brings the Arduino copy of optiboot up-to-date with the optiboot source repository as of Jun-2011 (the last changes made in the optiboot repository were in Oct-2010) This adds support for several plaforms, fixes the "30k bug", and refactors the source to have separate stk500.h, boot.h, and pin_defs.h These are the arduino opticode issues fixed: http://code.google.com/p/arduino/issues/detail?id=380 optiboot has problems upload sketches bigger than 30 KB http://code.google.com/p/arduino/issues/detail?id=556 update optiboot to the point of the latest optiboot project sources. These are issues that had been solved in the optiboot source aready: http://code.google.com/p/arduino/issues/detail?id=364 optiboot leaves timer1 configured when starting app, breaks PWM on pin 9 and 10. (fixed with a workaround in arduino core.) aka http://code.google.com/p/optiboot/source/detail?r=c778fbe72df6ac13ef730c25283358c3c970f73e Support for ATmega8 and mega88. Fix fuse settings for mega168 _ISP targets Additional new platforms (mega, sanguino) http://code.google.com/p/optiboot/issues/detail?id=26 Set R1 to 0 (already in arduino code) http://code.google.com/p/optiboot/issues/detail?id=36&can=1 Fails to build correctly for mega88 After this commit, the only differences between the Arduino optiboot.c and the optiboot repository optiboot.c are cosmetic. --- bootloaders/optiboot/Makefile | 125 ++- bootloaders/optiboot/boot.h | 848 +++++++++++++++++++++ bootloaders/optiboot/optiboot.c | 288 ++++--- bootloaders/optiboot/optiboot_atmega328.hex | 59 +- bootloaders/optiboot/optiboot_atmega328.lst | 486 ++++++------ .../optiboot/optiboot_atmega328_pro_8MHz.hex | 63 +- .../optiboot/optiboot_atmega328_pro_8MHz.lst | 542 +++++++------ bootloaders/optiboot/optiboot_diecimila.hex | 63 +- bootloaders/optiboot/optiboot_diecimila.lst | 542 +++++++------ bootloaders/optiboot/optiboot_lilypad.hex | 62 +- bootloaders/optiboot/optiboot_lilypad.lst | 539 ++++++------- .../optiboot/optiboot_lilypad_resonator.hex | 62 +- .../optiboot/optiboot_lilypad_resonator.lst | 539 ++++++------- bootloaders/optiboot/optiboot_luminet.hex | 80 +- bootloaders/optiboot/optiboot_luminet.lst | 670 ++++++++-------- bootloaders/optiboot/optiboot_pro_16MHz.hex | 63 +- bootloaders/optiboot/optiboot_pro_16MHz.lst | 542 +++++++------ bootloaders/optiboot/optiboot_pro_20mhz.hex | 63 +- bootloaders/optiboot/optiboot_pro_20mhz.lst | 542 +++++++------ bootloaders/optiboot/optiboot_pro_8MHz.hex | 62 +- bootloaders/optiboot/optiboot_pro_8MHz.lst | 539 ++++++------- bootloaders/optiboot/pin_defs.h | 79 ++ bootloaders/optiboot/stk500.h | 39 + 23 files changed, 4141 insertions(+), 2756 deletions(-) create mode 100644 bootloaders/optiboot/boot.h create mode 100644 bootloaders/optiboot/pin_defs.h create mode 100644 bootloaders/optiboot/stk500.h diff --git a/bootloaders/optiboot/Makefile b/bootloaders/optiboot/Makefile index 0f8d09e..88cb9a2 100644 --- a/bootloaders/optiboot/Makefile +++ b/bootloaders/optiboot/Makefile @@ -123,12 +123,23 @@ OBJDUMP = $(call fixpath,$(GCCROOT)avr-objdump) SIZE = $(GCCROOT)avr-size +# Test platforms +# Virtual boot block test +virboot328: TARGET = atmega328 +virboot328: MCU_TARGET = atmega328p +virboot328: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' '-DVIRTUAL_BOOT' +virboot328: AVR_FREQ = 16000000L +virboot328: LDSECTION = --section-start=.text=0x7e00 +virboot328: $(PROGRAM)_atmega328.hex +virboot328: $(PROGRAM)_atmega328.lst + # 20MHz clocked platforms # # These are capable of 230400 baud, or 115200 baud on PC (Arduino Avrdude issue) # pro20: TARGET = pro_20mhz +pro20: MCU_TARGET = atmega168 pro20: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' pro20: AVR_FREQ = 20000000L pro20: $(PROGRAM)_pro_20mhz.hex @@ -141,7 +152,7 @@ pro20_isp: HFUSE = DD # Full swing xtal (20MHz) 258CK/14CK+4.1ms pro20_isp: LFUSE = C6 # 512 byte boot -pro20_isp: EFUSE = 02 +pro20_isp: EFUSE = 04 pro20_isp: isp # 16MHz clocked platforms @@ -150,6 +161,7 @@ pro20_isp: isp # pro16: TARGET = pro_16MHz +pro16: MCU_TARGET = atmega168 pro16: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' pro16: AVR_FREQ = 16000000L pro16: $(PROGRAM)_pro_16MHz.hex @@ -162,12 +174,13 @@ pro16_isp: HFUSE = DD # Full swing xtal (20MHz) 258CK/14CK+4.1ms pro16_isp: LFUSE = C6 # 512 byte boot -pro16_isp: EFUSE = 02 +pro16_isp: EFUSE = 04 pro16_isp: isp # Diecimila and NG use identical bootloaders # diecimila: TARGET = diecimila +diecimila: MCU_TARGET = atmega168 diecimila: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' diecimila: AVR_FREQ = 16000000L diecimila: $(PROGRAM)_diecimila.hex @@ -180,7 +193,7 @@ diecimila_isp: HFUSE = DD # Low power xtal (16MHz) 16KCK/14CK+65ms diecimila_isp: LFUSE = FF # 512 byte boot -diecimila_isp: EFUSE = 02 +diecimila_isp: EFUSE = 04 diecimila_isp: isp atmega328: TARGET = atmega328 @@ -194,7 +207,7 @@ atmega328: $(PROGRAM)_atmega328.lst atmega328_isp: atmega328 atmega328_isp: TARGET = atmega328 atmega328_isp: MCU_TARGET = atmega328p -# 512 byte boot +# 512 byte boot, SPIEN atmega328_isp: HFUSE = DE # Low power xtal (16MHz) 16KCK/14CK+65ms atmega328_isp: LFUSE = FF @@ -202,13 +215,96 @@ atmega328_isp: LFUSE = FF atmega328_isp: EFUSE = 05 atmega328_isp: isp +# Sanguino has a minimum boot size of 1024 bytes, so enable extra functions +# +sanguino: TARGET = atmega644p +sanguino: MCU_TARGET = atmega644p +sanguino: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' '-DBIGBOOT' +sanguino: AVR_FREQ = 16000000L +sanguino: LDSECTION = --section-start=.text=0xfc00 +sanguino: $(PROGRAM)_atmega644p.hex +sanguino: $(PROGRAM)_atmega644p.lst + +sanguino_isp: sanguino +sanguino_isp: TARGET = atmega644p +sanguino_isp: MCU_TARGET = atmega644p +# 1024 byte boot +sanguino_isp: HFUSE = DE +# Low power xtal (16MHz) 16KCK/14CK+65ms +sanguino_isp: LFUSE = FF +# 2.7V brownout +sanguino_isp: EFUSE = 05 +sanguino_isp: isp + +# Mega has a minimum boot size of 1024 bytes, so enable extra functions +#mega: TARGET = atmega1280 +mega: MCU_TARGET = atmega1280 +mega: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' '-DBIGBOOT' +mega: AVR_FREQ = 16000000L +mega: LDSECTION = --section-start=.text=0x1fc00 +mega: $(PROGRAM)_atmega1280.hex +mega: $(PROGRAM)_atmega1280.lst + +mega_isp: mega +mega_isp: TARGET = atmega1280 +mega_isp: MCU_TARGET = atmega1280 +# 1024 byte boot +mega_isp: HFUSE = DE +# Low power xtal (16MHz) 16KCK/14CK+65ms +mega_isp: LFUSE = FF +# 2.7V brownout +mega_isp: EFUSE = 05 +mega_isp: isp + +# ATmega8 +# +atmega8: TARGET = atmega8 +atmega8: MCU_TARGET = atmega8 +atmega8: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' +atmega8: AVR_FREQ = 16000000L +atmega8: LDSECTION = --section-start=.text=0x1e00 +atmega8: $(PROGRAM)_atmega8.hex +atmega8: $(PROGRAM)_atmega8.lst + +atmega8_isp: atmega8 +atmega8_isp: TARGET = atmega8 +atmega8_isp: MCU_TARGET = atmega8 +# SPIEN, CKOPT, Bootsize=512B +atmega8_isp: HFUSE = CC +# 2.7V brownout, Low power xtal (16MHz) 16KCK/14CK+65ms +atmega8_isp: LFUSE = BF +atmega8_isp: isp + +# ATmega88 +# +atmega88: TARGET = atmega88 +atmega88: MCU_TARGET = atmega88 +atmega88: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' +atmega88: AVR_FREQ = 16000000L +atmega88: LDSECTION = --section-start=.text=0x1e00 +atmega88: $(PROGRAM)_atmega88.hex +atmega88: $(PROGRAM)_atmega88.lst + +atmega88_isp: atmega88 +atmega88_isp: TARGET = atmega88 +atmega88_isp: MCU_TARGET = atmega88 +# 2.7V brownout +atmega88_isp: HFUSE = DD +# Low power xtal (16MHz) 16KCK/14CK+65ms +atemga88_isp: LFUSE = FF +# 512 byte boot +atmega88_isp: EFUSE = 04 +atmega88_isp: isp + + # 8MHz clocked platforms # # These are capable of 115200 baud # lilypad: TARGET = lilypad -lilypad: CFLAGS += '-DLED_START_FLASHES=3' '-DSOFT_UART' '-DBAUD_RATE=115200' +lilypad: MCU_TARGET = atmega168 +lilypad: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' lilypad: AVR_FREQ = 8000000L lilypad: $(PROGRAM)_lilypad.hex lilypad: $(PROGRAM)_lilypad.lst @@ -220,11 +316,12 @@ lilypad_isp: HFUSE = DD # Internal 8MHz osc (8MHz) Slow rising power lilypad_isp: LFUSE = E2 # 512 byte boot -lilypad_isp: EFUSE = 02 +lilypad_isp: EFUSE = 04 lilypad_isp: isp lilypad_resonator: TARGET = lilypad_resonator -lilypad_resonator: CFLAGS += '-DLED_START_FLASHES=3' '-DSOFT_UART' '-DBAUD_RATE=115200' +lilypad_resonator: MCU_TARGET = atmega168 +lilypad_resonator: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' lilypad_resonator: AVR_FREQ = 8000000L lilypad_resonator: $(PROGRAM)_lilypad_resonator.hex lilypad_resonator: $(PROGRAM)_lilypad_resonator.lst @@ -236,11 +333,12 @@ lilypad_resonator_isp: HFUSE = DD # Full swing xtal (20MHz) 258CK/14CK+4.1ms lilypad_resonator_isp: LFUSE = C6 # 512 byte boot -lilypad_resonator_isp: EFUSE = 02 +lilypad_resonator_isp: EFUSE = 04 lilypad_resonator_isp: isp pro8: TARGET = pro_8MHz -pro8: CFLAGS += '-DLED_START_FLASHES=3' '-DSOFT_UART' '-DBAUD_RATE=115200' +pro8: MCU_TARGET = atmega168 +pro8: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' pro8: AVR_FREQ = 8000000L pro8: $(PROGRAM)_pro_8MHz.hex pro8: $(PROGRAM)_pro_8MHz.lst @@ -252,7 +350,7 @@ pro8_isp: HFUSE = DD # Full swing xtal (20MHz) 258CK/14CK+4.1ms pro8_isp: LFUSE = C6 # 512 byte boot -pro8_isp: EFUSE = 02 +pro8_isp: EFUSE = 04 pro8_isp: isp atmega328_pro8: TARGET = atmega328_pro_8MHz @@ -266,7 +364,7 @@ atmega328_pro8: $(PROGRAM)_atmega328_pro_8MHz.lst atmega328_pro8_isp: atmega328_pro8 atmega328_pro8_isp: TARGET = atmega328_pro_8MHz atmega328_pro8_isp: MCU_TARGET = atmega328p -# 512 byte boot +# 512 byte boot, SPIEN atmega328_pro8_isp: HFUSE = DE # Low power xtal (16MHz) 16KCK/14CK+65ms atmega328_pro8_isp: LFUSE = FF @@ -299,6 +397,11 @@ luminet_isp: LFUSE = 62 luminet_isp: EFUSE = FE luminet_isp: isp +# +# Generic build instructions +# +# + isp: $(TARGET) $(ISPFUSES) $(ISPFLASH) diff --git a/bootloaders/optiboot/boot.h b/bootloaders/optiboot/boot.h new file mode 100644 index 0000000..2639cd8 --- /dev/null +++ b/bootloaders/optiboot/boot.h @@ -0,0 +1,848 @@ +/* Modified to use out for SPM access +** Peter Knight, Optiboot project http://optiboot.googlecode.com +** +** Todo: Tidy up +** +** "_short" routines execute 1 cycle faster and use 1 less word of flash +** by using "out" instruction instead of "sts". +** +** Additional elpm variants that trust the value of RAMPZ +*/ + +/* Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007 Eric B. Weddington + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of the copyright holders nor the names of + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. */ + +/* $Id: boot.h,v 1.27.2.3 2008/09/30 13:58:48 arcanum Exp $ */ + +#ifndef _AVR_BOOT_H_ +#define _AVR_BOOT_H_ 1 + +/** \file */ +/** \defgroup avr_boot : Bootloader Support Utilities + \code + #include + #include + \endcode + + The macros in this module provide a C language interface to the + bootloader support functionality of certain AVR processors. These + macros are designed to work with all sizes of flash memory. + + Global interrupts are not automatically disabled for these macros. It + is left up to the programmer to do this. See the code example below. + Also see the processor datasheet for caveats on having global interrupts + enabled during writing of the Flash. + + \note Not all AVR processors provide bootloader support. See your + processor datasheet to see if it provides bootloader support. + + \todo From email with Marek: On smaller devices (all except ATmega64/128), + __SPM_REG is in the I/O space, accessible with the shorter "in" and "out" + instructions - since the boot loader has a limited size, this could be an + important optimization. + + \par API Usage Example + The following code shows typical usage of the boot API. + + \code + #include + #include + #include + + void boot_program_page (uint32_t page, uint8_t *buf) + { + uint16_t i; + uint8_t sreg; + + // Disable interrupts. + + sreg = SREG; + cli(); + + eeprom_busy_wait (); + + boot_page_erase (page); + boot_spm_busy_wait (); // Wait until the memory is erased. + + for (i=0; i +#include +#include +#include + +/* Check for SPM Control Register in processor. */ +#if defined (SPMCSR) +# define __SPM_REG SPMCSR +#elif defined (SPMCR) +# define __SPM_REG SPMCR +#else +# error AVR processor does not provide bootloader support! +#endif + + +/* Check for SPM Enable bit. */ +#if defined(SPMEN) +# define __SPM_ENABLE SPMEN +#elif defined(SELFPRGEN) +# define __SPM_ENABLE SELFPRGEN +#else +# error Cannot find SPM Enable bit definition! +#endif + +/** \ingroup avr_boot + \def BOOTLOADER_SECTION + + Used to declare a function or variable to be placed into a + new section called .bootloader. This section and its contents + can then be relocated to any address (such as the bootloader + NRWW area) at link-time. */ + +#define BOOTLOADER_SECTION __attribute__ ((section (".bootloader"))) + +/* Create common bit definitions. */ +#ifdef ASB +#define __COMMON_ASB ASB +#else +#define __COMMON_ASB RWWSB +#endif + +#ifdef ASRE +#define __COMMON_ASRE ASRE +#else +#define __COMMON_ASRE RWWSRE +#endif + +/* Define the bit positions of the Boot Lock Bits. */ + +#define BLB12 5 +#define BLB11 4 +#define BLB02 3 +#define BLB01 2 + +/** \ingroup avr_boot + \def boot_spm_interrupt_enable() + Enable the SPM interrupt. */ + +#define boot_spm_interrupt_enable() (__SPM_REG |= (uint8_t)_BV(SPMIE)) + +/** \ingroup avr_boot + \def boot_spm_interrupt_disable() + Disable the SPM interrupt. */ + +#define boot_spm_interrupt_disable() (__SPM_REG &= (uint8_t)~_BV(SPMIE)) + +/** \ingroup avr_boot + \def boot_is_spm_interrupt() + Check if the SPM interrupt is enabled. */ + +#define boot_is_spm_interrupt() (__SPM_REG & (uint8_t)_BV(SPMIE)) + +/** \ingroup avr_boot + \def boot_rww_busy() + Check if the RWW section is busy. */ + +#define boot_rww_busy() (__SPM_REG & (uint8_t)_BV(__COMMON_ASB)) + +/** \ingroup avr_boot + \def boot_spm_busy() + Check if the SPM instruction is busy. */ + +#define boot_spm_busy() (__SPM_REG & (uint8_t)_BV(__SPM_ENABLE)) + +/** \ingroup avr_boot + \def boot_spm_busy_wait() + Wait while the SPM instruction is busy. */ + +#define boot_spm_busy_wait() do{}while(boot_spm_busy()) + +#define __BOOT_PAGE_ERASE (_BV(__SPM_ENABLE) | _BV(PGERS)) +#define __BOOT_PAGE_WRITE (_BV(__SPM_ENABLE) | _BV(PGWRT)) +#define __BOOT_PAGE_FILL _BV(__SPM_ENABLE) +#define __BOOT_RWW_ENABLE (_BV(__SPM_ENABLE) | _BV(__COMMON_ASRE)) +#define __BOOT_LOCK_BITS_SET (_BV(__SPM_ENABLE) | _BV(BLBSET)) + +#define __boot_page_fill_short(address, data) \ +(__extension__({ \ + __asm__ __volatile__ \ + ( \ + "movw r0, %3\n\t" \ + "out %0, %1\n\t" \ + "spm\n\t" \ + "clr r1\n\t" \ + : \ + : "i" (_SFR_IO_ADDR(__SPM_REG)), \ + "r" ((uint8_t)__BOOT_PAGE_FILL), \ + "z" ((uint16_t)address), \ + "r" ((uint16_t)data) \ + : "r0" \ + ); \ +})) + +#define __boot_page_fill_normal(address, data) \ +(__extension__({ \ + __asm__ __volatile__ \ + ( \ + "movw r0, %3\n\t" \ + "sts %0, %1\n\t" \ + "spm\n\t" \ + "clr r1\n\t" \ + : \ + : "i" (_SFR_MEM_ADDR(__SPM_REG)), \ + "r" ((uint8_t)__BOOT_PAGE_FILL), \ + "z" ((uint16_t)address), \ + "r" ((uint16_t)data) \ + : "r0" \ + ); \ +})) + +#define __boot_page_fill_alternate(address, data)\ +(__extension__({ \ + __asm__ __volatile__ \ + ( \ + "movw r0, %3\n\t" \ + "sts %0, %1\n\t" \ + "spm\n\t" \ + ".word 0xffff\n\t" \ + "nop\n\t" \ + "clr r1\n\t" \ + : \ + : "i" (_SFR_MEM_ADDR(__SPM_REG)), \ + "r" ((uint8_t)__BOOT_PAGE_FILL), \ + "z" ((uint16_t)address), \ + "r" ((uint16_t)data) \ + : "r0" \ + ); \ +})) + +#define __boot_page_fill_extended(address, data) \ +(__extension__({ \ + __asm__ __volatile__ \ + ( \ + "movw r0, %4\n\t" \ + "movw r30, %A3\n\t" \ + "sts %1, %C3\n\t" \ + "sts %0, %2\n\t" \ + "spm\n\t" \ + "clr r1\n\t" \ + : \ + : "i" (_SFR_MEM_ADDR(__SPM_REG)), \ + "i" (_SFR_MEM_ADDR(RAMPZ)), \ + "r" ((uint8_t)__BOOT_PAGE_FILL), \ + "r" ((uint32_t)address), \ + "r" ((uint16_t)data) \ + : "r0", "r30", "r31" \ + ); \ +})) + +#define __boot_page_fill_extended_short(address, data) \ +(__extension__({ \ + __asm__ __volatile__ \ + ( \ + "movw r0, %4\n\t" \ + "movw r30, %A3\n\t" \ + "out %1, %C3\n\t" \ + "out %0, %2\n\t" \ + "spm\n\t" \ + "clr r1\n\t" \ + : \ + : "i" (_SFR_IO_ADDR(__SPM_REG)), \ + "i" (_SFR_IO_ADDR(RAMPZ)), \ + "r" ((uint8_t)__BOOT_PAGE_FILL), \ + "r" ((uint32_t)address), \ + "r" ((uint16_t)data) \ + : "r0", "r30", "r31" \ + ); \ +})) + +#define __boot_page_erase_short(address) \ +(__extension__({ \ + __asm__ __volatile__ \ + ( \ + "out %0, %1\n\t" \ + "spm\n\t" \ + : \ + : "i" (_SFR_IO_ADDR(__SPM_REG)), \ + "r" ((uint8_t)__BOOT_PAGE_ERASE), \ + "z" ((uint16_t)address) \ + ); \ +})) + + +#define __boot_page_erase_normal(address) \ +(__extension__({ \ + __asm__ __volatile__ \ + ( \ + "sts %0, %1\n\t" \ + "spm\n\t" \ + : \ + : "i" (_SFR_MEM_ADDR(__SPM_REG)), \ + "r" ((uint8_t)__BOOT_PAGE_ERASE), \ + "z" ((uint16_t)address) \ + ); \ +})) + +#define __boot_page_erase_alternate(address) \ +(__extension__({ \ + __asm__ __volatile__ \ + ( \ + "sts %0, %1\n\t" \ + "spm\n\t" \ + ".word 0xffff\n\t" \ + "nop\n\t" \ + : \ + : "i" (_SFR_MEM_ADDR(__SPM_REG)), \ + "r" ((uint8_t)__BOOT_PAGE_ERASE), \ + "z" ((uint16_t)address) \ + ); \ +})) + +#define __boot_page_erase_extended(address) \ +(__extension__({ \ + __asm__ __volatile__ \ + ( \ + "movw r30, %A3\n\t" \ + "sts %1, %C3\n\t" \ + "sts %0, %2\n\t" \ + "spm\n\t" \ + : \ + : "i" (_SFR_MEM_ADDR(__SPM_REG)), \ + "i" (_SFR_MEM_ADDR(RAMPZ)), \ + "r" ((uint8_t)__BOOT_PAGE_ERASE), \ + "r" ((uint32_t)address) \ + : "r30", "r31" \ + ); \ +})) +#define __boot_page_erase_extended_short(address) \ +(__extension__({ \ + __asm__ __volatile__ \ + ( \ + "movw r30, %A3\n\t" \ + "out %1, %C3\n\t" \ + "out %0, %2\n\t" \ + "spm\n\t" \ + : \ + : "i" (_SFR_IO_ADDR(__SPM_REG)), \ + "i" (_SFR_IO_ADDR(RAMPZ)), \ + "r" ((uint8_t)__BOOT_PAGE_ERASE), \ + "r" ((uint32_t)address) \ + : "r30", "r31" \ + ); \ +})) + +#define __boot_page_write_short(address) \ +(__extension__({ \ + __asm__ __volatile__ \ + ( \ + "out %0, %1\n\t" \ + "spm\n\t" \ + : \ + : "i" (_SFR_IO_ADDR(__SPM_REG)), \ + "r" ((uint8_t)__BOOT_PAGE_WRITE), \ + "z" ((uint16_t)address) \ + ); \ +})) + +#define __boot_page_write_normal(address) \ +(__extension__({ \ + __asm__ __volatile__ \ + ( \ + "sts %0, %1\n\t" \ + "spm\n\t" \ + : \ + : "i" (_SFR_MEM_ADDR(__SPM_REG)), \ + "r" ((uint8_t)__BOOT_PAGE_WRITE), \ + "z" ((uint16_t)address) \ + ); \ +})) + +#define __boot_page_write_alternate(address) \ +(__extension__({ \ + __asm__ __volatile__ \ + ( \ + "sts %0, %1\n\t" \ + "spm\n\t" \ + ".word 0xffff\n\t" \ + "nop\n\t" \ + : \ + : "i" (_SFR_MEM_ADDR(__SPM_REG)), \ + "r" ((uint8_t)__BOOT_PAGE_WRITE), \ + "z" ((uint16_t)address) \ + ); \ +})) + +#define __boot_page_write_extended(address) \ +(__extension__({ \ + __asm__ __volatile__ \ + ( \ + "movw r30, %A3\n\t" \ + "sts %1, %C3\n\t" \ + "sts %0, %2\n\t" \ + "spm\n\t" \ + : \ + : "i" (_SFR_MEM_ADDR(__SPM_REG)), \ + "i" (_SFR_MEM_ADDR(RAMPZ)), \ + "r" ((uint8_t)__BOOT_PAGE_WRITE), \ + "r" ((uint32_t)address) \ + : "r30", "r31" \ + ); \ +})) +#define __boot_page_write_extended_short(address) \ +(__extension__({ \ + __asm__ __volatile__ \ + ( \ + "movw r30, %A3\n\t" \ + "out %1, %C3\n\t" \ + "out %0, %2\n\t" \ + "spm\n\t" \ + : \ + : "i" (_SFR_IO_ADDR(__SPM_REG)), \ + "i" (_SFR_IO_ADDR(RAMPZ)), \ + "r" ((uint8_t)__BOOT_PAGE_WRITE), \ + "r" ((uint32_t)address) \ + : "r30", "r31" \ + ); \ +})) + +#define __boot_rww_enable_short() \ +(__extension__({ \ + __asm__ __volatile__ \ + ( \ + "out %0, %1\n\t" \ + "spm\n\t" \ + : \ + : "i" (_SFR_IO_ADDR(__SPM_REG)), \ + "r" ((uint8_t)__BOOT_RWW_ENABLE) \ + ); \ +})) + +#define __boot_rww_enable() \ +(__extension__({ \ + __asm__ __volatile__ \ + ( \ + "sts %0, %1\n\t" \ + "spm\n\t" \ + : \ + : "i" (_SFR_MEM_ADDR(__SPM_REG)), \ + "r" ((uint8_t)__BOOT_RWW_ENABLE) \ + ); \ +})) + +#define __boot_rww_enable_alternate() \ +(__extension__({ \ + __asm__ __volatile__ \ + ( \ + "sts %0, %1\n\t" \ + "spm\n\t" \ + ".word 0xffff\n\t" \ + "nop\n\t" \ + : \ + : "i" (_SFR_MEM_ADDR(__SPM_REG)), \ + "r" ((uint8_t)__BOOT_RWW_ENABLE) \ + ); \ +})) + +/* From the mega16/mega128 data sheets (maybe others): + + Bits by SPM To set the Boot Loader Lock bits, write the desired data to + R0, write "X0001001" to SPMCR and execute SPM within four clock cycles + after writing SPMCR. The only accessible Lock bits are the Boot Lock bits + that may prevent the Application and Boot Loader section from any + software update by the MCU. + + If bits 5..2 in R0 are cleared (zero), the corresponding Boot Lock bit + will be programmed if an SPM instruction is executed within four cycles + after BLBSET and SPMEN (or SELFPRGEN) are set in SPMCR. The Z-pointer is + don't care during this operation, but for future compatibility it is + recommended to load the Z-pointer with $0001 (same as used for reading the + Lock bits). For future compatibility It is also recommended to set bits 7, + 6, 1, and 0 in R0 to 1 when writing the Lock bits. When programming the + Lock bits the entire Flash can be read during the operation. */ + +#define __boot_lock_bits_set_short(lock_bits) \ +(__extension__({ \ + uint8_t value = (uint8_t)(~(lock_bits)); \ + __asm__ __volatile__ \ + ( \ + "ldi r30, 1\n\t" \ + "ldi r31, 0\n\t" \ + "mov r0, %2\n\t" \ + "out %0, %1\n\t" \ + "spm\n\t" \ + : \ + : "i" (_SFR_IO_ADDR(__SPM_REG)), \ + "r" ((uint8_t)__BOOT_LOCK_BITS_SET), \ + "r" (value) \ + : "r0", "r30", "r31" \ + ); \ +})) + +#define __boot_lock_bits_set(lock_bits) \ +(__extension__({ \ + uint8_t value = (uint8_t)(~(lock_bits)); \ + __asm__ __volatile__ \ + ( \ + "ldi r30, 1\n\t" \ + "ldi r31, 0\n\t" \ + "mov r0, %2\n\t" \ + "sts %0, %1\n\t" \ + "spm\n\t" \ + : \ + : "i" (_SFR_MEM_ADDR(__SPM_REG)), \ + "r" ((uint8_t)__BOOT_LOCK_BITS_SET), \ + "r" (value) \ + : "r0", "r30", "r31" \ + ); \ +})) + +#define __boot_lock_bits_set_alternate(lock_bits) \ +(__extension__({ \ + uint8_t value = (uint8_t)(~(lock_bits)); \ + __asm__ __volatile__ \ + ( \ + "ldi r30, 1\n\t" \ + "ldi r31, 0\n\t" \ + "mov r0, %2\n\t" \ + "sts %0, %1\n\t" \ + "spm\n\t" \ + ".word 0xffff\n\t" \ + "nop\n\t" \ + : \ + : "i" (_SFR_MEM_ADDR(__SPM_REG)), \ + "r" ((uint8_t)__BOOT_LOCK_BITS_SET), \ + "r" (value) \ + : "r0", "r30", "r31" \ + ); \ +})) + +/* + Reading lock and fuse bits: + + Similarly to writing the lock bits above, set BLBSET and SPMEN (or + SELFPRGEN) bits in __SPMREG, and then (within four clock cycles) issue an + LPM instruction. + + Z address: contents: + 0x0000 low fuse bits + 0x0001 lock bits + 0x0002 extended fuse bits + 0x0003 high fuse bits + + Sounds confusing, doesn't it? + + Unlike the macros in pgmspace.h, no need to care for non-enhanced + cores here as these old cores do not provide SPM support anyway. + */ + +/** \ingroup avr_boot + \def GET_LOW_FUSE_BITS + address to read the low fuse bits, using boot_lock_fuse_bits_get + */ +#define GET_LOW_FUSE_BITS (0x0000) +/** \ingroup avr_boot + \def GET_LOCK_BITS + address to read the lock bits, using boot_lock_fuse_bits_get + */ +#define GET_LOCK_BITS (0x0001) +/** \ingroup avr_boot + \def GET_EXTENDED_FUSE_BITS + address to read the extended fuse bits, using boot_lock_fuse_bits_get + */ +#define GET_EXTENDED_FUSE_BITS (0x0002) +/** \ingroup avr_boot + \def GET_HIGH_FUSE_BITS + address to read the high fuse bits, using boot_lock_fuse_bits_get + */ +#define GET_HIGH_FUSE_BITS (0x0003) + +/** \ingroup avr_boot + \def boot_lock_fuse_bits_get(address) + + Read the lock or fuse bits at \c address. + + Parameter \c address can be any of GET_LOW_FUSE_BITS, + GET_LOCK_BITS, GET_EXTENDED_FUSE_BITS, or GET_HIGH_FUSE_BITS. + + \note The lock and fuse bits returned are the physical values, + i.e. a bit returned as 0 means the corresponding fuse or lock bit + is programmed. + */ +#define boot_lock_fuse_bits_get_short(address) \ +(__extension__({ \ + uint8_t __result; \ + __asm__ __volatile__ \ + ( \ + "ldi r30, %3\n\t" \ + "ldi r31, 0\n\t" \ + "out %1, %2\n\t" \ + "lpm %0, Z\n\t" \ + : "=r" (__result) \ + : "i" (_SFR_IO_ADDR(__SPM_REG)), \ + "r" ((uint8_t)__BOOT_LOCK_BITS_SET), \ + "M" (address) \ + : "r0", "r30", "r31" \ + ); \ + __result; \ +})) + +#define boot_lock_fuse_bits_get(address) \ +(__extension__({ \ + uint8_t __result; \ + __asm__ __volatile__ \ + ( \ + "ldi r30, %3\n\t" \ + "ldi r31, 0\n\t" \ + "sts %1, %2\n\t" \ + "lpm %0, Z\n\t" \ + : "=r" (__result) \ + : "i" (_SFR_MEM_ADDR(__SPM_REG)), \ + "r" ((uint8_t)__BOOT_LOCK_BITS_SET), \ + "M" (address) \ + : "r0", "r30", "r31" \ + ); \ + __result; \ +})) + +/** \ingroup avr_boot + \def boot_signature_byte_get(address) + + Read the Signature Row byte at \c address. For some MCU types, + this function can also retrieve the factory-stored oscillator + calibration bytes. + + Parameter \c address can be 0-0x1f as documented by the datasheet. + \note The values are MCU type dependent. +*/ + +#define __BOOT_SIGROW_READ (_BV(__SPM_ENABLE) | _BV(SIGRD)) + +#define boot_signature_byte_get_short(addr) \ +(__extension__({ \ + uint16_t __addr16 = (uint16_t)(addr); \ + uint8_t __result; \ + __asm__ __volatile__ \ + ( \ + "out %1, %2\n\t" \ + "lpm %0, Z" "\n\t" \ + : "=r" (__result) \ + : "i" (_SFR_IO_ADDR(__SPM_REG)), \ + "r" ((uint8_t) __BOOT_SIGROW_READ), \ + "z" (__addr16) \ + ); \ + __result; \ +})) + +#define boot_signature_byte_get(addr) \ +(__extension__({ \ + uint16_t __addr16 = (uint16_t)(addr); \ + uint8_t __result; \ + __asm__ __volatile__ \ + ( \ + "sts %1, %2\n\t" \ + "lpm %0, Z" "\n\t" \ + : "=r" (__result) \ + : "i" (_SFR_MEM_ADDR(__SPM_REG)), \ + "r" ((uint8_t) __BOOT_SIGROW_READ), \ + "z" (__addr16) \ + ); \ + __result; \ +})) + +/** \ingroup avr_boot + \def boot_page_fill(address, data) + + Fill the bootloader temporary page buffer for flash + address with data word. + + \note The address is a byte address. The data is a word. The AVR + writes data to the buffer a word at a time, but addresses the buffer + per byte! So, increment your address by 2 between calls, and send 2 + data bytes in a word format! The LSB of the data is written to the lower + address; the MSB of the data is written to the higher address.*/ + +/** \ingroup avr_boot + \def boot_page_erase(address) + + Erase the flash page that contains address. + + \note address is a byte address in flash, not a word address. */ + +/** \ingroup avr_boot + \def boot_page_write(address) + + Write the bootloader temporary page buffer + to flash page that contains address. + + \note address is a byte address in flash, not a word address. */ + +/** \ingroup avr_boot + \def boot_rww_enable() + + Enable the Read-While-Write memory section. */ + +/** \ingroup avr_boot + \def boot_lock_bits_set(lock_bits) + + Set the bootloader lock bits. + + \param lock_bits A mask of which Boot Loader Lock Bits to set. + + \note In this context, a 'set bit' will be written to a zero value. + Note also that only BLBxx bits can be programmed by this command. + + For example, to disallow the SPM instruction from writing to the Boot + Loader memory section of flash, you would use this macro as such: + + \code + boot_lock_bits_set (_BV (BLB11)); + \endcode + + \note Like any lock bits, the Boot Loader Lock Bits, once set, + cannot be cleared again except by a chip erase which will in turn + also erase the boot loader itself. */ + +/* Normal versions of the macros use 16-bit addresses. + Extended versions of the macros use 32-bit addresses. + Alternate versions of the macros use 16-bit addresses and require special + instruction sequences after LPM. + + FLASHEND is defined in the ioXXXX.h file. + USHRT_MAX is defined in . */ + +#if defined(__AVR_ATmega161__) || defined(__AVR_ATmega163__) \ + || defined(__AVR_ATmega323__) + +/* Alternate: ATmega161/163/323 and 16 bit address */ +#define boot_page_fill(address, data) __boot_page_fill_alternate(address, data) +#define boot_page_erase(address) __boot_page_erase_alternate(address) +#define boot_page_write(address) __boot_page_write_alternate(address) +#define boot_rww_enable() __boot_rww_enable_alternate() +#define boot_lock_bits_set(lock_bits) __boot_lock_bits_set_alternate(lock_bits) + +#elif (FLASHEND > USHRT_MAX) + +/* Extended: >16 bit address */ +#define boot_page_fill(address, data) __boot_page_fill_extended_short(address, data) +#define boot_page_erase(address) __boot_page_erase_extended_short(address) +#define boot_page_write(address) __boot_page_write_extended_short(address) +#define boot_rww_enable() __boot_rww_enable_short() +#define boot_lock_bits_set(lock_bits) __boot_lock_bits_set_short(lock_bits) + +#else + +/* Normal: 16 bit address */ +#define boot_page_fill(address, data) __boot_page_fill_short(address, data) +#define boot_page_erase(address) __boot_page_erase_short(address) +#define boot_page_write(address) __boot_page_write_short(address) +#define boot_rww_enable() __boot_rww_enable_short() +#define boot_lock_bits_set(lock_bits) __boot_lock_bits_set_short(lock_bits) + +#endif + +/** \ingroup avr_boot + + Same as boot_page_fill() except it waits for eeprom and spm operations to + complete before filling the page. */ + +#define boot_page_fill_safe(address, data) \ +do { \ + boot_spm_busy_wait(); \ + eeprom_busy_wait(); \ + boot_page_fill(address, data); \ +} while (0) + +/** \ingroup avr_boot + + Same as boot_page_erase() except it waits for eeprom and spm operations to + complete before erasing the page. */ + +#define boot_page_erase_safe(address) \ +do { \ + boot_spm_busy_wait(); \ + eeprom_busy_wait(); \ + boot_page_erase (address); \ +} while (0) + +/** \ingroup avr_boot + + Same as boot_page_write() except it waits for eeprom and spm operations to + complete before writing the page. */ + +#define boot_page_write_safe(address) \ +do { \ + boot_spm_busy_wait(); \ + eeprom_busy_wait(); \ + boot_page_write (address); \ +} while (0) + +/** \ingroup avr_boot + + Same as boot_rww_enable() except waits for eeprom and spm operations to + complete before enabling the RWW mameory. */ + +#define boot_rww_enable_safe() \ +do { \ + boot_spm_busy_wait(); \ + eeprom_busy_wait(); \ + boot_rww_enable(); \ +} while (0) + +/** \ingroup avr_boot + + Same as boot_lock_bits_set() except waits for eeprom and spm operations to + complete before setting the lock bits. */ + +#define boot_lock_bits_set_safe(lock_bits) \ +do { \ + boot_spm_busy_wait(); \ + eeprom_busy_wait(); \ + boot_lock_bits_set (lock_bits); \ +} while (0) + +#endif /* _AVR_BOOT_H_ */ diff --git a/bootloaders/optiboot/optiboot.c b/bootloaders/optiboot/optiboot.c index c7d817a..4b4a10a 100644 --- a/bootloaders/optiboot/optiboot.c +++ b/bootloaders/optiboot/optiboot.c @@ -1,6 +1,11 @@ /**********************************************************/ /* Optiboot bootloader for Arduino */ /* */ +/* http://optiboot.googlecode.com */ +/* */ +/* Arduino-maintained version : See README.TXT */ +/* http://code.google.com/p/arduino/ */ +/* */ /* Heavily optimised bootloader that is faster and */ /* smaller than the Arduino standard bootloader */ /* */ @@ -10,6 +15,8 @@ /* Higher baud rate speeds up programming */ /* Written almost entirely in C */ /* Customisable timeout with accurate timeconstant */ +/* Optional virtual UART. No hardware UART required. */ +/* Optional virtual boot partition for devices without. */ /* */ /* What you lose: */ /* Implements a skeleton STK500 protocol which is */ @@ -18,12 +25,19 @@ /* High baud rate breaks compatibility with standard */ /* Arduino flash settings */ /* */ -/* Currently supports: */ -/* ATmega168 based devices (Diecimila etc) */ +/* Fully supported: */ +/* ATmega168 based devices (Diecimila etc) */ /* ATmega328P based devices (Duemilanove etc) */ /* */ +/* Alpha test */ +/* ATmega1280 based devices (Arduino Mega) */ +/* */ +/* Work in progress: */ +/* ATmega644P based devices (Sanguino) */ +/* ATtiny84 based devices (Luminet) */ +/* */ /* Does not support: */ -/* ATmega1280 based devices (eg. Mega) */ +/* USB based devices (eg. Teensy) */ /* */ /* Assumptions: */ /* The code makes several assumptions that reduce the */ @@ -64,102 +78,85 @@ /* */ /**********************************************************/ + +/**********************************************************/ +/* */ +/* Optional defines: */ +/* */ +/**********************************************************/ +/* */ +/* BIG_BOOT: */ +/* Build a 1k bootloader, not 512 bytes. This turns on */ +/* extra functionality. */ +/* */ +/* BAUD_RATE: */ +/* Set bootloader baud rate. */ +/* */ +/* LUDICROUS_SPEED: */ +/* 230400 baud :-) */ +/* */ +/* SOFT_UART: */ +/* Use AVR305 soft-UART instead of hardware UART. */ +/* */ +/* LED_START_FLASHES: */ +/* Number of LED flashes on bootup. */ +/* */ +/* LED_DATA_FLASH: */ +/* Flash LED when transferring data. For boards without */ +/* TX or RX LEDs, or for people who like blinky lights. */ +/* */ +/* SUPPORT_EEPROM: */ +/* Support reading and writing from EEPROM. This is not */ +/* used by Arduino, so off by default. */ +/* */ +/* TIMEOUT_MS: */ +/* Bootloader timeout period, in milliseconds. */ +/* 500,1000,2000,4000,8000 supported. */ +/* */ +/**********************************************************/ + #include #include #include -#include -//#define LED_DATA_FLASH +// uses sts instructions, but this version uses out instructions +// This saves cycles and program memory. +#include "boot.h" + + +// We don't use as those routines have interrupt overhead we don't need. + +#include "pin_defs.h" +#include "stk500.h" #ifndef LED_START_FLASHES #define LED_START_FLASHES 0 #endif -/* Build-time variables */ -/* BAUD_RATE Programming baud rate */ -/* LED_NO_FLASHES Number of LED flashes on boot */ -/* FLASH_TIME_MS Duration of each LED flash */ -/* BOOT_TIMEOUT_MS Serial port wait time before exiting bootloader */ +#ifdef LUDICROUS_SPEED +#define BAUD_RATE 230400L +#endif -/* set the UART baud rate */ +/* set the UART baud rate defaults */ #ifndef BAUD_RATE -#define BAUD_RATE 19200 +#if F_CPU >= 8000000L +#define BAUD_RATE 115200L // Highest rate Avrdude win32 will support +#elsif F_CPU >= 1000000L +#define BAUD_RATE 9600L // 19200 also supported, but with significant error +#elsif F_CPU >= 128000L +#define BAUD_RATE 4800L // Good for 128kHz internal RC +#else +#define BAUD_RATE 1200L // Good even at 32768Hz +#endif #endif -#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) -/* Onboard LED is connected to pin PB5 in Arduino NG, Diecimila, and Duemilanove */ -#define LED_DDR DDRB -#define LED_PORT PORTB -#define LED_PIN PINB -#define LED PINB5 - -/* Ports for soft UART */ -#ifdef SOFT_UART -#define UART_PORT PORTD -#define UART_PIN PIND -#define UART_DDR DDRD -#define UART_TX_BIT 1 -#define UART_RX_BIT 0 +/* Switch in soft UART for hard baud rates */ +#if (F_CPU/BAUD_RATE) > 280 // > 57600 for 16MHz +#ifndef SOFT_UART +#define SOFT_UART #endif #endif -#if defined(__AVR_ATtiny84__) -/* Onboard LED is connected to pin PB5 in Arduino NG, Diecimila, and Duemilanove */ -#define LED_DDR DDRA -#define LED_PORT PORTA -#define LED_PIN PINA -#define LED PINA4 - -/* Ports for soft UART - left port only for now*/ -#ifdef SOFT_UART -#define UART_PORT PORTA -#define UART_PIN PINA -#define UART_DDR DDRA -#define UART_TX_BIT 2 -#define UART_RX_BIT 3 -#endif -#endif - -/* STK500 constants list, from AVRDUDE */ -#define STK_OK 0x10 -#define STK_FAILED 0x11 // Not used -#define STK_UNKNOWN 0x12 // Not used -#define STK_NODEVICE 0x13 // Not used -#define STK_INSYNC 0x14 // ' ' -#define STK_NOSYNC 0x15 // Not used -#define ADC_CHANNEL_ERROR 0x16 // Not used -#define ADC_MEASURE_OK 0x17 // Not used -#define PWM_CHANNEL_ERROR 0x18 // Not used -#define PWM_ADJUST_OK 0x19 // Not used -#define CRC_EOP 0x20 // 'SPACE' -#define STK_GET_SYNC 0x30 // '0' -#define STK_GET_SIGN_ON 0x31 // '1' -#define STK_SET_PARAMETER 0x40 // '@' -#define STK_GET_PARAMETER 0x41 // 'A' -#define STK_SET_DEVICE 0x42 // 'B' -#define STK_SET_DEVICE_EXT 0x45 // 'E' -#define STK_ENTER_PROGMODE 0x50 // 'P' -#define STK_LEAVE_PROGMODE 0x51 // 'Q' -#define STK_CHIP_ERASE 0x52 // 'R' -#define STK_CHECK_AUTOINC 0x53 // 'S' -#define STK_LOAD_ADDRESS 0x55 // 'U' -#define STK_UNIVERSAL 0x56 // 'V' -#define STK_PROG_FLASH 0x60 // '`' -#define STK_PROG_DATA 0x61 // 'a' -#define STK_PROG_FUSE 0x62 // 'b' -#define STK_PROG_LOCK 0x63 // 'c' -#define STK_PROG_PAGE 0x64 // 'd' -#define STK_PROG_FUSE_EXT 0x65 // 'e' -#define STK_READ_FLASH 0x70 // 'p' -#define STK_READ_DATA 0x71 // 'q' -#define STK_READ_FUSE 0x72 // 'r' -#define STK_READ_LOCK 0x73 // 's' -#define STK_READ_PAGE 0x74 // 't' -#define STK_READ_SIGN 0x75 // 'u' -#define STK_READ_OSCCAL 0x76 // 'v' -#define STK_READ_FUSE_EXT 0x77 // 'w' -#define STK_READ_OSCCAL_EXT 0x78 // 'x' - /* Watchdog settings */ #define WATCHDOG_OFF (0) #define WATCHDOG_16MS (_BV(WDE)) @@ -170,8 +167,10 @@ #define WATCHDOG_500MS (_BV(WDP2) | _BV(WDP0) | _BV(WDE)) #define WATCHDOG_1S (_BV(WDP2) | _BV(WDP1) | _BV(WDE)) #define WATCHDOG_2S (_BV(WDP2) | _BV(WDP1) | _BV(WDP0) | _BV(WDE)) +#ifndef __AVR_ATmega8__ #define WATCHDOG_4S (_BV(WDE3) | _BV(WDE)) #define WATCHDOG_8S (_BV(WDE3) | _BV(WDE0) | _BV(WDE)) +#endif /* Function Prototypes */ /* The main function is in init9, which removes the interrupt vector table */ @@ -191,18 +190,41 @@ void uartDelay() __attribute__ ((naked)); #endif void appStart() __attribute__ ((naked)); +#if defined(__AVR_ATmega168__) +#define RAMSTART (0x100) +#define NRWWSTART (0x3800) +#elif defined(__AVR_ATmega328P__) +#define RAMSTART (0x100) +#define NRWWSTART (0x7000) +#elif defined (__AVR_ATmega644P__) +#define RAMSTART (0x100) +#define NRWWSTART (0xE000) +#elif defined(__AVR_ATtiny84__) +#define RAMSTART (0x100) +#define NRWWSTART (0x0000) +#elif defined(__AVR_ATmega1280__) +#define RAMSTART (0x200) +#define NRWWSTART (0xE000) +#elif defined(__AVR_ATmega8__) || defined(__AVR_ATmega88__) +#define RAMSTART (0x100) +#define NRWWSTART (0x1800) +#endif + /* C zero initialises all global variables. However, that requires */ /* These definitions are NOT zero initialised, but that doesn't matter */ /* This allows us to drop the zero init code, saving us memory */ -#define buff ((uint8_t*)(0x100)) -#define address (*(uint16_t*)(0x200)) -#define length (*(uint8_t*)(0x202)) +#define buff ((uint8_t*)(RAMSTART)) +#define address (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2)) +#define length (*(uint8_t*)(RAMSTART+SPM_PAGESIZE*2+2)) #ifdef VIRTUAL_BOOT_PARTITION -#define rstVect (*(uint16_t*)(0x204)) -#define wdtVect (*(uint16_t*)(0x206)) +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif + /* main program starts here */ int main(void) { + uint8_t ch; + // After the zero init loop, this is the first code to run. // // This code makes the following assumptions: @@ -212,29 +234,36 @@ int main(void) { // // If not, uncomment the following instructions: // cli(); - // SP=RAMEND; // This is done by hardware reset asm volatile ("clr __zero_reg__"); +#ifdef __AVR_ATmega8__ + SP=RAMEND; // This is done by hardware reset +#endif - uint8_t ch; + // Adaboot no-wait mod + ch = MCUSR; + MCUSR = 0; + if (!(ch & _BV(EXTRF))) appStart(); #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 #endif #ifndef SOFT_UART +#ifdef __AVR_ATmega8__ + UCSRA = _BV(U2X); //Double speed mode USART + UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx + UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 + UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); +#else UCSR0A = _BV(U2X0); //Double speed mode USART0 UCSR0B = _BV(RXEN0) | _BV(TXEN0); UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); #endif - - // Adaboot no-wait mod - ch = MCUSR; - MCUSR = 0; - if (!(ch & _BV(EXTRF))) appStart(); +#endif // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_500MS); + watchdogConfig(WATCHDOG_1S); /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -269,9 +298,15 @@ int main(void) { } else if(ch == STK_LOAD_ADDRESS) { // LOAD ADDRESS - address = getch(); - address = (address & 0xff) | (getch() << 8); - address += address; // Convert from word address to byte address + uint16_t newAddress; + newAddress = getch(); + newAddress = (newAddress & 0xff) | (getch() << 8); +#ifdef RAMPZ + // Transfer top bit to RAMPZ + RAMPZ = (newAddress & 0x8000) ? 1 : 0; +#endif + newAddress += newAddress; // Convert from word address to byte address + address = newAddress; verifySpace(); } else if(ch == STK_UNIVERSAL) { @@ -279,7 +314,7 @@ int main(void) { getNch(4); putch(0x00); } - /* Write memory, length is big endian and is in bytes */ + /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; @@ -287,14 +322,18 @@ int main(void) { getLen(); - // Immediately start page erase - this will 4.5ms - boot_page_erase((uint16_t)(void*)address); - + // If we are in RWW section, immediately start page erase + if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); while (--length); + // If we are in NRWW section, page erase has to be delayed until now. + // Todo: Take RAMPZ into account + if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + // Read command terminator, start reply verifySpace(); @@ -310,10 +349,10 @@ int main(void) { // Move RESET vector to WDT vector uint16_t vect = buff[0] | (buff[1]<<8); rstVect = vect; - wdtVect = buff[10] | (buff[11]<<8); + wdtVect = buff[8] | (buff[9]<<8); vect -= 4; // Instruction is a relative jump (rjmp), so recalculate. - buff[10] = vect & 0xff; - buff[11] = vect >> 8; + buff[8] = vect & 0xff; + buff[9] = vect >> 8; // Add jump to bootloader at RESET vector buff[0] = 0x7f; @@ -329,12 +368,12 @@ int main(void) { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; - boot_page_fill((uint16_t)(void*)addrPtr,a); + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); // Write from programming buffer - boot_page_write((uint16_t)(void*)address); + __boot_page_write_short((uint16_t)(void*)address); boot_spm_busy_wait(); #if defined(RWWSRE) @@ -353,15 +392,27 @@ int main(void) { // Undo vector patch in bottom page so verify passes if (address == 0) ch=rstVect & 0xff; else if (address == 1) ch=rstVect >> 8; - else if (address == 10) ch=wdtVect & 0xff; - else if (address == 11) ch=wdtVect >> 8; + else if (address == 8) ch=wdtVect & 0xff; + else if (address == 9) ch=wdtVect >> 8; else ch = pgm_read_byte_near(address); address++; putch(ch); } while (--length); +#else +#ifdef __AVR_ATmega1280__ +// do putch(pgm_read_byte_near(address++)); +// while (--length); + do { + uint8_t result; + __asm__ ("elpm %0,Z\n":"=r"(result):"z"(address)); + putch(result); + address++; + } + while (--length); #else do putch(pgm_read_byte_near(address++)); while (--length); +#endif #endif } @@ -422,8 +473,12 @@ uint8_t getch(void) { watchdogReset(); #ifdef LED_DATA_FLASH +#ifdef __AVR_ATmega8__ + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); #endif +#endif #ifdef SOFT_UART __asm__ __volatile__ ( @@ -455,14 +510,19 @@ uint8_t getch(void) { #endif #ifdef LED_DATA_FLASH +#ifdef __AVR_ATmega8__ + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); +#endif #endif return ch; } #ifdef SOFT_UART -//#define UART_B_VALUE (((F_CPU/BAUD_RATE)-23)/6) +// AVR350 equation: #define UART_B_VALUE (((F_CPU/BAUD_RATE)-23)/6) +// Adding 3 to numerator simulates nearest rounding for more accurate baud rates #define UART_B_VALUE (((F_CPU/BAUD_RATE)-20)/6) #if UART_B_VALUE > 255 #error Baud rate too slow for soft UART @@ -495,7 +555,11 @@ void flash_led(uint8_t count) { TCNT1 = -(F_CPU/(1024*16)); TIFR1 = _BV(TOV1); while(!(TIFR1 & _BV(TOV1))); +#ifdef __AVR_ATmega8__ + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); +#endif watchdogReset(); } while (--count); } @@ -524,7 +588,7 @@ void appStart() { __asm__ __volatile__ ( #ifdef VIRTUAL_BOOT_PARTITION // Jump to WDT vector - "ldi r30,5\n" + "ldi r30,4\n" "clr r31\n" #else // Jump to RST vector diff --git a/bootloaders/optiboot/optiboot_atmega328.hex b/bootloaders/optiboot/optiboot_atmega328.hex index e8aa31c..72108ee 100644 --- a/bootloaders/optiboot/optiboot_atmega328.hex +++ b/bootloaders/optiboot/optiboot_atmega328.hex @@ -1,33 +1,34 @@ -:107E0000112485E08093810082E08093C00088E1A6 -:107E10008093C10086E08093C20080E18093C4001B -:107E200084B714BE81FFD0D08DE0C8D0259A86E0FB +:107E0000112484B714BE81FFE6D085E08093810001 +:107E100082E08093C00088E18093C10086E0809377 +:107E2000C20080E18093C4008EE0CFD0259A86E026 :107E300020E33CEF91E0309385002093840096BBD3 :107E4000B09BFECF1D9AA8958150A9F7DD24D3944D -:107E5000A5E0EA2EF1E1FF2EA4D0813421F481E0E7 -:107E6000BED083E024C0823411F484E103C08534A1 -:107E700019F485E0B4D08AC08535A1F492D0082FDA -:107E800010E010930102009300028BD090E0982F35 -:107E90008827802B912B880F991F90930102809344 -:107EA000000273C0863529F484E099D080E071D057 -:107EB0006DC0843609F043C07CD0E0910002F0919F -:107EC000010283E080935700E895C0E0D1E069D0DB -:107ED0008993809102028150809302028823B9F72E -:107EE00078D007B600FCFDCF40910002509101020E -:107EF000A0E0B1E02C9130E011968C91119790E0C8 -:107F0000982F8827822B932B1296FA010C01D0927E -:107F10005700E89511244E5F5F4FF1E0A038BF078E -:107F200049F7E0910002F0910102E0925700E895D4 -:107F300007B600FCFDCFF0925700E89527C08437C4 -:107F4000B9F437D046D0E0910002F09101023196A9 -:107F5000F0930102E09300023197E4918E2F19D043 -:107F600080910202815080930202882361F70EC043 -:107F7000853739F42ED08EE10CD085E90AD08FE018 -:107F800096CF813511F488E019D023D080E101D05B -:107F900063CF982F8091C00085FFFCCF9093C600DF -:107FA0000895A8958091C00087FFFCCF8091C600FE -:107FB0000895F7DFF6DF80930202F3CFE0E6F0E00A -:107FC00098E190838083089580E0F8DFEE27FF2713 -:107FD0000994E7DF803209F0F7DF84E1DACF1F93FD -:0E7FE000182FDFDF1150E9F7F4DF1F9108952D +:107E5000A5E0EA2EF1E1FF2EABD0813421F481E0E0 +:107E6000C5D083E020C0823411F484E103C085349E +:107E700019F485E0BBD091C0853581F499D0082FE5 +:107E800010E096D090E0982F8827802B912B880FB8 +:107E9000991F90930102809300027EC0863529F4D9 +:107EA00084E0A4D080E07CD078C0843609F04EC055 +:107EB00087D0E0910002F091010280E7E030F807FE +:107EC00018F483E087BFE895C0E0D1E071D08993D2 +:107ED000809102028150809302028823B9F7E091D9 +:107EE0000002F091010280E7E030F80718F083E02B +:107EF00087BFE89575D007B600FCFDCF4091000222 +:107F000050910102A0E0B1E02C9130E011968C91EB +:107F1000119790E0982F8827822B932B1296FA01C5 +:107F20000C01D7BEE89511244E5F5F4FF1E0A038F9 +:107F3000BF0751F7E0910002F0910102E7BEE8951A +:107F400007B600FCFDCFF7BEE89527C08437B9F42B +:107F500037D046D0E0910002F09101023196F093C3 +:107F60000102E09300023197E4918E2F19D08091A5 +:107F70000202815080930202882361F70EC0853788 +:107F800039F42ED08EE10CD085E90AD08FE08BCF6A +:107F9000813511F488E019D023D080E101D05CCF85 +:107FA000982F8091C00085FFFCCF9093C600089564 +:107FB000A8958091C00087FFFCCF8091C6000895EE +:107FC000F7DFF6DF80930202F3CFE0E6F0E098E11E +:107FD00090838083089580E0F8DFEE27FF270994DF +:107FE000E7DF803209F0F7DF84E1DACF1F93182F43 +:0C7FF000DFDF1150E9F7F4DF1F91089566 :0400000300007E007B :00000001FF diff --git a/bootloaders/optiboot/optiboot_atmega328.lst b/bootloaders/optiboot/optiboot_atmega328.lst index 104799f..1af4a3c 100644 --- a/bootloaders/optiboot/optiboot_atmega328.lst +++ b/bootloaders/optiboot/optiboot_atmega328.lst @@ -3,74 +3,79 @@ optiboot_atmega328.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001ee 00007e00 00007e00 00000054 2**1 + 0 .text 000001fc 00007e00 00007e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .debug_aranges 00000028 00000000 00000000 00000242 2**0 + 1 .debug_aranges 00000028 00000000 00000000 00000250 2**0 CONTENTS, READONLY, DEBUGGING - 2 .debug_pubnames 0000006a 00000000 00000000 0000026a 2**0 + 2 .debug_pubnames 0000006a 00000000 00000000 00000278 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_info 00000269 00000000 00000000 000002d4 2**0 + 3 .debug_info 00000284 00000000 00000000 000002e2 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_abbrev 00000196 00000000 00000000 0000053d 2**0 + 4 .debug_abbrev 000001ae 00000000 00000000 00000566 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_line 0000043f 00000000 00000000 000006d3 2**0 + 5 .debug_line 00000450 00000000 00000000 00000714 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_frame 00000090 00000000 00000000 00000b14 2**2 + 6 .debug_frame 00000090 00000000 00000000 00000b64 2**2 CONTENTS, READONLY, DEBUGGING - 7 .debug_str 00000136 00000000 00000000 00000ba4 2**0 + 7 .debug_str 00000141 00000000 00000000 00000bf4 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_loc 000001d1 00000000 00000000 00000cda 2**0 + 8 .debug_loc 000001e1 00000000 00000000 00000d35 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_ranges 00000068 00000000 00000000 00000eab 2**0 + 9 .debug_ranges 00000068 00000000 00000000 00000f16 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: 00007e00
: -#ifdef VIRTUAL_BOOT_PARTITION -#define rstVect (*(uint16_t*)(0x204)) -#define wdtVect (*(uint16_t*)(0x206)) +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif + /* main program starts here */ int main(void) { 7e00: 11 24 eor r1, r1 +#ifdef __AVR_ATmega8__ + SP=RAMEND; // This is done by hardware reset +#endif - uint8_t ch; + // Adaboot no-wait mod + ch = MCUSR; + 7e02: 84 b7 in r24, 0x34 ; 52 + MCUSR = 0; + 7e04: 14 be out 0x34, r1 ; 52 + if (!(ch & _BV(EXTRF))) appStart(); + 7e06: 81 ff sbrs r24, 1 + 7e08: e6 d0 rcall .+460 ; 0x7fd6 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 7e02: 85 e0 ldi r24, 0x05 ; 5 - 7e04: 80 93 81 00 sts 0x0081, r24 -#endif -#ifndef SOFT_UART + 7e0a: 85 e0 ldi r24, 0x05 ; 5 + 7e0c: 80 93 81 00 sts 0x0081, r24 + UCSRA = _BV(U2X); //Double speed mode USART + UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx + UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 + UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); +#else UCSR0A = _BV(U2X0); //Double speed mode USART0 - 7e08: 82 e0 ldi r24, 0x02 ; 2 - 7e0a: 80 93 c0 00 sts 0x00C0, r24 + 7e10: 82 e0 ldi r24, 0x02 ; 2 + 7e12: 80 93 c0 00 sts 0x00C0, r24 UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 7e0e: 88 e1 ldi r24, 0x18 ; 24 - 7e10: 80 93 c1 00 sts 0x00C1, r24 + 7e16: 88 e1 ldi r24, 0x18 ; 24 + 7e18: 80 93 c1 00 sts 0x00C1, r24 UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 7e14: 86 e0 ldi r24, 0x06 ; 6 - 7e16: 80 93 c2 00 sts 0x00C2, r24 + 7e1c: 86 e0 ldi r24, 0x06 ; 6 + 7e1e: 80 93 c2 00 sts 0x00C2, r24 UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 7e1a: 80 e1 ldi r24, 0x10 ; 16 - 7e1c: 80 93 c4 00 sts 0x00C4, r24 + 7e22: 80 e1 ldi r24, 0x10 ; 16 + 7e24: 80 93 c4 00 sts 0x00C4, r24 +#endif #endif - - // Adaboot no-wait mod - ch = MCUSR; - 7e20: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 7e22: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 7e24: 81 ff sbrs r24, 1 - 7e26: d0 d0 rcall .+416 ; 0x7fc8 // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_500MS); - 7e28: 8d e0 ldi r24, 0x0D ; 13 - 7e2a: c8 d0 rcall .+400 ; 0x7fbc + watchdogConfig(WATCHDOG_1S); + 7e28: 8e e0 ldi r24, 0x0E ; 14 + 7e2a: cf d0 rcall .+414 ; 0x7fca /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -99,6 +104,9 @@ void flash_led(uint8_t count) { while(!(TIFR1 & _BV(TOV1))); 7e40: b0 9b sbis 0x16, 0 ; 22 7e42: fe cf rjmp .-4 ; 0x7e40 +#ifdef __AVR_ATmega8__ + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); 7e44: 1d 9a sbi 0x03, 5 ; 3 return getch(); @@ -108,10 +116,10 @@ void flash_led(uint8_t count) { void watchdogReset() { __asm__ __volatile__ ( 7e46: a8 95 wdr - TCNT1 = -(F_CPU/(1024*16)); - TIFR1 = _BV(TOV1); - while(!(TIFR1 & _BV(TOV1))); + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); +#endif watchdogReset(); } while (--count); 7e48: 81 50 subi r24, 0x01 ; 1 @@ -124,12 +132,12 @@ void watchdogReset() { getNch(1); 7e4c: dd 24 eor r13, r13 7e4e: d3 94 inc r13 - boot_page_fill((uint16_t)(void*)addrPtr,a); + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); // Write from programming buffer - boot_page_write((uint16_t)(void*)address); + __boot_page_write_short((uint16_t)(void*)address); 7e50: a5 e0 ldi r26, 0x05 ; 5 7e52: ea 2e mov r14, r26 boot_spm_busy_wait(); @@ -145,7 +153,7 @@ void watchdogReset() { for (;;) { /* get character from UART */ ch = getch(); - 7e58: a4 d0 rcall .+328 ; 0x7fa2 + 7e58: ab d0 rcall .+342 ; 0x7fb0 if(ch == STK_GET_PARAMETER) { 7e5a: 81 34 cpi r24, 0x41 ; 65 @@ -153,10 +161,10 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 7e5e: 81 e0 ldi r24, 0x01 ; 1 - 7e60: be d0 rcall .+380 ; 0x7fde + 7e60: c5 d0 rcall .+394 ; 0x7fec putch(0x03); 7e62: 83 e0 ldi r24, 0x03 ; 3 - 7e64: 24 c0 rjmp .+72 ; 0x7eae + 7e64: 20 c0 rjmp .+64 ; 0x7ea6 } else if(ch == STK_SET_DEVICE) { 7e66: 82 34 cpi r24, 0x42 ; 66 @@ -172,353 +180,375 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 7e72: 85 e0 ldi r24, 0x05 ; 5 - 7e74: b4 d0 rcall .+360 ; 0x7fde - 7e76: 8a c0 rjmp .+276 ; 0x7f8c + 7e74: bb d0 rcall .+374 ; 0x7fec + 7e76: 91 c0 rjmp .+290 ; 0x7f9a } else if(ch == STK_LOAD_ADDRESS) { 7e78: 85 35 cpi r24, 0x55 ; 85 - 7e7a: a1 f4 brne .+40 ; 0x7ea4 + 7e7a: 81 f4 brne .+32 ; 0x7e9c // LOAD ADDRESS - address = getch(); - 7e7c: 92 d0 rcall .+292 ; 0x7fa2 + uint16_t newAddress; + newAddress = getch(); + 7e7c: 99 d0 rcall .+306 ; 0x7fb0 + newAddress = (newAddress & 0xff) | (getch() << 8); 7e7e: 08 2f mov r16, r24 7e80: 10 e0 ldi r17, 0x00 ; 0 - 7e82: 10 93 01 02 sts 0x0201, r17 - 7e86: 00 93 00 02 sts 0x0200, r16 - address = (address & 0xff) | (getch() << 8); - 7e8a: 8b d0 rcall .+278 ; 0x7fa2 - 7e8c: 90 e0 ldi r25, 0x00 ; 0 - 7e8e: 98 2f mov r25, r24 - 7e90: 88 27 eor r24, r24 - 7e92: 80 2b or r24, r16 - 7e94: 91 2b or r25, r17 - address += address; // Convert from word address to byte address - 7e96: 88 0f add r24, r24 - 7e98: 99 1f adc r25, r25 - 7e9a: 90 93 01 02 sts 0x0201, r25 - 7e9e: 80 93 00 02 sts 0x0200, r24 - 7ea2: 73 c0 rjmp .+230 ; 0x7f8a + 7e82: 96 d0 rcall .+300 ; 0x7fb0 + 7e84: 90 e0 ldi r25, 0x00 ; 0 + 7e86: 98 2f mov r25, r24 + 7e88: 88 27 eor r24, r24 + 7e8a: 80 2b or r24, r16 + 7e8c: 91 2b or r25, r17 +#ifdef RAMPZ + // Transfer top bit to RAMPZ + RAMPZ = (newAddress & 0x8000) ? 1 : 0; +#endif + newAddress += newAddress; // Convert from word address to byte address + 7e8e: 88 0f add r24, r24 + 7e90: 99 1f adc r25, r25 + address = newAddress; + 7e92: 90 93 01 02 sts 0x0201, r25 + 7e96: 80 93 00 02 sts 0x0200, r24 + 7e9a: 7e c0 rjmp .+252 ; 0x7f98 verifySpace(); } else if(ch == STK_UNIVERSAL) { - 7ea4: 86 35 cpi r24, 0x56 ; 86 - 7ea6: 29 f4 brne .+10 ; 0x7eb2 + 7e9c: 86 35 cpi r24, 0x56 ; 86 + 7e9e: 29 f4 brne .+10 ; 0x7eaa // UNIVERSAL command is ignored getNch(4); - 7ea8: 84 e0 ldi r24, 0x04 ; 4 - 7eaa: 99 d0 rcall .+306 ; 0x7fde + 7ea0: 84 e0 ldi r24, 0x04 ; 4 + 7ea2: a4 d0 rcall .+328 ; 0x7fec putch(0x00); - 7eac: 80 e0 ldi r24, 0x00 ; 0 - 7eae: 71 d0 rcall .+226 ; 0x7f92 - 7eb0: 6d c0 rjmp .+218 ; 0x7f8c + 7ea4: 80 e0 ldi r24, 0x00 ; 0 + 7ea6: 7c d0 rcall .+248 ; 0x7fa0 + 7ea8: 78 c0 rjmp .+240 ; 0x7f9a } - /* Write memory, length is big endian and is in bytes */ + /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 7eb2: 84 36 cpi r24, 0x64 ; 100 - 7eb4: 09 f0 breq .+2 ; 0x7eb8 - 7eb6: 43 c0 rjmp .+134 ; 0x7f3e + 7eaa: 84 36 cpi r24, 0x64 ; 100 + 7eac: 09 f0 breq .+2 ; 0x7eb0 + 7eae: 4e c0 rjmp .+156 ; 0x7f4c // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; getLen(); - 7eb8: 7c d0 rcall .+248 ; 0x7fb2 - - // Immediately start page erase - this will 4.5ms - boot_page_erase((uint16_t)(void*)address); - 7eba: e0 91 00 02 lds r30, 0x0200 - 7ebe: f0 91 01 02 lds r31, 0x0201 + 7eb0: 87 d0 rcall .+270 ; 0x7fc0 + + // If we are in RWW section, immediately start page erase + if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 7eb2: e0 91 00 02 lds r30, 0x0200 + 7eb6: f0 91 01 02 lds r31, 0x0201 + 7eba: 80 e7 ldi r24, 0x70 ; 112 + 7ebc: e0 30 cpi r30, 0x00 ; 0 + 7ebe: f8 07 cpc r31, r24 + 7ec0: 18 f4 brcc .+6 ; 0x7ec8 7ec2: 83 e0 ldi r24, 0x03 ; 3 - 7ec4: 80 93 57 00 sts 0x0057, r24 - 7ec8: e8 95 spm - 7eca: c0 e0 ldi r28, 0x00 ; 0 - 7ecc: d1 e0 ldi r29, 0x01 ; 1 - + 7ec4: 87 bf out 0x37, r24 ; 55 + 7ec6: e8 95 spm + 7ec8: c0 e0 ldi r28, 0x00 ; 0 + 7eca: d1 e0 ldi r29, 0x01 ; 1 + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 7ece: 69 d0 rcall .+210 ; 0x7fa2 - 7ed0: 89 93 st Y+, r24 + 7ecc: 71 d0 rcall .+226 ; 0x7fb0 + 7ece: 89 93 st Y+, r24 while (--length); - 7ed2: 80 91 02 02 lds r24, 0x0202 - 7ed6: 81 50 subi r24, 0x01 ; 1 - 7ed8: 80 93 02 02 sts 0x0202, r24 - 7edc: 88 23 and r24, r24 - 7ede: b9 f7 brne .-18 ; 0x7ece + 7ed0: 80 91 02 02 lds r24, 0x0202 + 7ed4: 81 50 subi r24, 0x01 ; 1 + 7ed6: 80 93 02 02 sts 0x0202, r24 + 7eda: 88 23 and r24, r24 + 7edc: b9 f7 brne .-18 ; 0x7ecc + + // If we are in NRWW section, page erase has to be delayed until now. + // Todo: Take RAMPZ into account + if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 7ede: e0 91 00 02 lds r30, 0x0200 + 7ee2: f0 91 01 02 lds r31, 0x0201 + 7ee6: 80 e7 ldi r24, 0x70 ; 112 + 7ee8: e0 30 cpi r30, 0x00 ; 0 + 7eea: f8 07 cpc r31, r24 + 7eec: 18 f0 brcs .+6 ; 0x7ef4 + 7eee: 83 e0 ldi r24, 0x03 ; 3 + 7ef0: 87 bf out 0x37, r24 ; 55 + 7ef2: e8 95 spm // Read command terminator, start reply verifySpace(); - 7ee0: 78 d0 rcall .+240 ; 0x7fd2 + 7ef4: 75 d0 rcall .+234 ; 0x7fe0 // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 7ee2: 07 b6 in r0, 0x37 ; 55 - 7ee4: 00 fc sbrc r0, 0 - 7ee6: fd cf rjmp .-6 ; 0x7ee2 + 7ef6: 07 b6 in r0, 0x37 ; 55 + 7ef8: 00 fc sbrc r0, 0 + 7efa: fd cf rjmp .-6 ; 0x7ef6 } #endif // Copy buffer into programming buffer bufPtr = buff; addrPtr = (uint16_t)(void*)address; - 7ee8: 40 91 00 02 lds r20, 0x0200 - 7eec: 50 91 01 02 lds r21, 0x0201 - 7ef0: a0 e0 ldi r26, 0x00 ; 0 - 7ef2: b1 e0 ldi r27, 0x01 ; 1 + 7efc: 40 91 00 02 lds r20, 0x0200 + 7f00: 50 91 01 02 lds r21, 0x0201 + 7f04: a0 e0 ldi r26, 0x00 ; 0 + 7f06: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 7ef4: 2c 91 ld r18, X - 7ef6: 30 e0 ldi r19, 0x00 ; 0 + 7f08: 2c 91 ld r18, X + 7f0a: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 7ef8: 11 96 adiw r26, 0x01 ; 1 - 7efa: 8c 91 ld r24, X - 7efc: 11 97 sbiw r26, 0x01 ; 1 - 7efe: 90 e0 ldi r25, 0x00 ; 0 - 7f00: 98 2f mov r25, r24 - 7f02: 88 27 eor r24, r24 - 7f04: 82 2b or r24, r18 - 7f06: 93 2b or r25, r19 -#ifdef VIRTUAL_BOOT_PARTITION -#define rstVect (*(uint16_t*)(0x204)) -#define wdtVect (*(uint16_t*)(0x206)) + 7f0c: 11 96 adiw r26, 0x01 ; 1 + 7f0e: 8c 91 ld r24, X + 7f10: 11 97 sbiw r26, 0x01 ; 1 + 7f12: 90 e0 ldi r25, 0x00 ; 0 + 7f14: 98 2f mov r25, r24 + 7f16: 88 27 eor r24, r24 + 7f18: 82 2b or r24, r18 + 7f1a: 93 2b or r25, r19 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif + /* main program starts here */ int main(void) { - 7f08: 12 96 adiw r26, 0x02 ; 2 + 7f1c: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; - boot_page_fill((uint16_t)(void*)addrPtr,a); - 7f0a: fa 01 movw r30, r20 - 7f0c: 0c 01 movw r0, r24 - 7f0e: d0 92 57 00 sts 0x0057, r13 - 7f12: e8 95 spm - 7f14: 11 24 eor r1, r1 + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); + 7f1e: fa 01 movw r30, r20 + 7f20: 0c 01 movw r0, r24 + 7f22: d7 be out 0x37, r13 ; 55 + 7f24: e8 95 spm + 7f26: 11 24 eor r1, r1 addrPtr += 2; - 7f16: 4e 5f subi r20, 0xFE ; 254 - 7f18: 5f 4f sbci r21, 0xFF ; 255 + 7f28: 4e 5f subi r20, 0xFE ; 254 + 7f2a: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 7f1a: f1 e0 ldi r31, 0x01 ; 1 - 7f1c: a0 38 cpi r26, 0x80 ; 128 - 7f1e: bf 07 cpc r27, r31 - 7f20: 49 f7 brne .-46 ; 0x7ef4 + 7f2c: f1 e0 ldi r31, 0x01 ; 1 + 7f2e: a0 38 cpi r26, 0x80 ; 128 + 7f30: bf 07 cpc r27, r31 + 7f32: 51 f7 brne .-44 ; 0x7f08 // Write from programming buffer - boot_page_write((uint16_t)(void*)address); - 7f22: e0 91 00 02 lds r30, 0x0200 - 7f26: f0 91 01 02 lds r31, 0x0201 - 7f2a: e0 92 57 00 sts 0x0057, r14 - 7f2e: e8 95 spm + __boot_page_write_short((uint16_t)(void*)address); + 7f34: e0 91 00 02 lds r30, 0x0200 + 7f38: f0 91 01 02 lds r31, 0x0201 + 7f3c: e7 be out 0x37, r14 ; 55 + 7f3e: e8 95 spm boot_spm_busy_wait(); - 7f30: 07 b6 in r0, 0x37 ; 55 - 7f32: 00 fc sbrc r0, 0 - 7f34: fd cf rjmp .-6 ; 0x7f30 + 7f40: 07 b6 in r0, 0x37 ; 55 + 7f42: 00 fc sbrc r0, 0 + 7f44: fd cf rjmp .-6 ; 0x7f40 #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 7f36: f0 92 57 00 sts 0x0057, r15 - 7f3a: e8 95 spm - 7f3c: 27 c0 rjmp .+78 ; 0x7f8c + 7f46: f7 be out 0x37, r15 ; 55 + 7f48: e8 95 spm + 7f4a: 27 c0 rjmp .+78 ; 0x7f9a #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 7f3e: 84 37 cpi r24, 0x74 ; 116 - 7f40: b9 f4 brne .+46 ; 0x7f70 + 7f4c: 84 37 cpi r24, 0x74 ; 116 + 7f4e: b9 f4 brne .+46 ; 0x7f7e // READ PAGE - we only read flash getLen(); - 7f42: 37 d0 rcall .+110 ; 0x7fb2 + 7f50: 37 d0 rcall .+110 ; 0x7fc0 verifySpace(); - 7f44: 46 d0 rcall .+140 ; 0x7fd2 - else ch = pgm_read_byte_near(address); + 7f52: 46 d0 rcall .+140 ; 0x7fe0 + putch(result); address++; - putch(ch); - } while (--length); + } + while (--length); #else do putch(pgm_read_byte_near(address++)); - 7f46: e0 91 00 02 lds r30, 0x0200 - 7f4a: f0 91 01 02 lds r31, 0x0201 - 7f4e: 31 96 adiw r30, 0x01 ; 1 - 7f50: f0 93 01 02 sts 0x0201, r31 - 7f54: e0 93 00 02 sts 0x0200, r30 - 7f58: 31 97 sbiw r30, 0x01 ; 1 - 7f5a: e4 91 lpm r30, Z+ - 7f5c: 8e 2f mov r24, r30 - 7f5e: 19 d0 rcall .+50 ; 0x7f92 + 7f54: e0 91 00 02 lds r30, 0x0200 + 7f58: f0 91 01 02 lds r31, 0x0201 + 7f5c: 31 96 adiw r30, 0x01 ; 1 + 7f5e: f0 93 01 02 sts 0x0201, r31 + 7f62: e0 93 00 02 sts 0x0200, r30 + 7f66: 31 97 sbiw r30, 0x01 ; 1 + 7f68: e4 91 lpm r30, Z+ + 7f6a: 8e 2f mov r24, r30 + 7f6c: 19 d0 rcall .+50 ; 0x7fa0 while (--length); - 7f60: 80 91 02 02 lds r24, 0x0202 - 7f64: 81 50 subi r24, 0x01 ; 1 - 7f66: 80 93 02 02 sts 0x0202, r24 - 7f6a: 88 23 and r24, r24 - 7f6c: 61 f7 brne .-40 ; 0x7f46 - 7f6e: 0e c0 rjmp .+28 ; 0x7f8c + 7f6e: 80 91 02 02 lds r24, 0x0202 + 7f72: 81 50 subi r24, 0x01 ; 1 + 7f74: 80 93 02 02 sts 0x0202, r24 + 7f78: 88 23 and r24, r24 + 7f7a: 61 f7 brne .-40 ; 0x7f54 + 7f7c: 0e c0 rjmp .+28 ; 0x7f9a +#endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 7f70: 85 37 cpi r24, 0x75 ; 117 - 7f72: 39 f4 brne .+14 ; 0x7f82 + 7f7e: 85 37 cpi r24, 0x75 ; 117 + 7f80: 39 f4 brne .+14 ; 0x7f90 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 7f74: 2e d0 rcall .+92 ; 0x7fd2 + 7f82: 2e d0 rcall .+92 ; 0x7fe0 putch(SIGNATURE_0); - 7f76: 8e e1 ldi r24, 0x1E ; 30 - 7f78: 0c d0 rcall .+24 ; 0x7f92 + 7f84: 8e e1 ldi r24, 0x1E ; 30 + 7f86: 0c d0 rcall .+24 ; 0x7fa0 putch(SIGNATURE_1); - 7f7a: 85 e9 ldi r24, 0x95 ; 149 - 7f7c: 0a d0 rcall .+20 ; 0x7f92 + 7f88: 85 e9 ldi r24, 0x95 ; 149 + 7f8a: 0a d0 rcall .+20 ; 0x7fa0 putch(SIGNATURE_2); - 7f7e: 8f e0 ldi r24, 0x0F ; 15 - 7f80: 96 cf rjmp .-212 ; 0x7eae + 7f8c: 8f e0 ldi r24, 0x0F ; 15 + 7f8e: 8b cf rjmp .-234 ; 0x7ea6 } else if (ch == 'Q') { - 7f82: 81 35 cpi r24, 0x51 ; 81 - 7f84: 11 f4 brne .+4 ; 0x7f8a + 7f90: 81 35 cpi r24, 0x51 ; 81 + 7f92: 11 f4 brne .+4 ; 0x7f98 // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 7f86: 88 e0 ldi r24, 0x08 ; 8 - 7f88: 19 d0 rcall .+50 ; 0x7fbc + 7f94: 88 e0 ldi r24, 0x08 ; 8 + 7f96: 19 d0 rcall .+50 ; 0x7fca verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 7f8a: 23 d0 rcall .+70 ; 0x7fd2 + 7f98: 23 d0 rcall .+70 ; 0x7fe0 } putch(STK_OK); - 7f8c: 80 e1 ldi r24, 0x10 ; 16 - 7f8e: 01 d0 rcall .+2 ; 0x7f92 - 7f90: 63 cf rjmp .-314 ; 0x7e58 + 7f9a: 80 e1 ldi r24, 0x10 ; 16 + 7f9c: 01 d0 rcall .+2 ; 0x7fa0 + 7f9e: 5c cf rjmp .-328 ; 0x7e58 -00007f92 : +00007fa0 : } } void putch(char ch) { - 7f92: 98 2f mov r25, r24 + 7fa0: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); - 7f94: 80 91 c0 00 lds r24, 0x00C0 - 7f98: 85 ff sbrs r24, 5 - 7f9a: fc cf rjmp .-8 ; 0x7f94 + 7fa2: 80 91 c0 00 lds r24, 0x00C0 + 7fa6: 85 ff sbrs r24, 5 + 7fa8: fc cf rjmp .-8 ; 0x7fa2 UDR0 = ch; - 7f9c: 90 93 c6 00 sts 0x00C6, r25 + 7faa: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 7fa0: 08 95 ret + 7fae: 08 95 ret -00007fa2 : +00007fb0 : return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 7fa2: a8 95 wdr + 7fb0: a8 95 wdr [uartBit] "I" (UART_RX_BIT) : "r25" ); #else while(!(UCSR0A & _BV(RXC0))); - 7fa4: 80 91 c0 00 lds r24, 0x00C0 - 7fa8: 87 ff sbrs r24, 7 - 7faa: fc cf rjmp .-8 ; 0x7fa4 + 7fb2: 80 91 c0 00 lds r24, 0x00C0 + 7fb6: 87 ff sbrs r24, 7 + 7fb8: fc cf rjmp .-8 ; 0x7fb2 ch = UDR0; - 7fac: 80 91 c6 00 lds r24, 0x00C6 -#ifdef LED_DATA_FLASH + 7fba: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); +#endif #endif return ch; } - 7fb0: 08 95 ret + 7fbe: 08 95 ret -00007fb2 : +00007fc0 : } while (--count); } #endif uint8_t getLen() { getch(); - 7fb2: f7 df rcall .-18 ; 0x7fa2 + 7fc0: f7 df rcall .-18 ; 0x7fb0 length = getch(); - 7fb4: f6 df rcall .-20 ; 0x7fa2 - 7fb6: 80 93 02 02 sts 0x0202, r24 + 7fc2: f6 df rcall .-20 ; 0x7fb0 + 7fc4: 80 93 02 02 sts 0x0202, r24 return getch(); } - 7fba: f3 cf rjmp .-26 ; 0x7fa2 + 7fc8: f3 cf rjmp .-26 ; 0x7fb0 -00007fbc : +00007fca : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 7fbc: e0 e6 ldi r30, 0x60 ; 96 - 7fbe: f0 e0 ldi r31, 0x00 ; 0 - 7fc0: 98 e1 ldi r25, 0x18 ; 24 - 7fc2: 90 83 st Z, r25 + 7fca: e0 e6 ldi r30, 0x60 ; 96 + 7fcc: f0 e0 ldi r31, 0x00 ; 0 + 7fce: 98 e1 ldi r25, 0x18 ; 24 + 7fd0: 90 83 st Z, r25 WDTCSR = x; - 7fc4: 80 83 st Z, r24 + 7fd2: 80 83 st Z, r24 } - 7fc6: 08 95 ret + 7fd4: 08 95 ret -00007fc8 : +00007fd6 : void appStart() { watchdogConfig(WATCHDOG_OFF); - 7fc8: 80 e0 ldi r24, 0x00 ; 0 - 7fca: f8 df rcall .-16 ; 0x7fbc + 7fd6: 80 e0 ldi r24, 0x00 ; 0 + 7fd8: f8 df rcall .-16 ; 0x7fca __asm__ __volatile__ ( - 7fcc: ee 27 eor r30, r30 - 7fce: ff 27 eor r31, r31 - 7fd0: 09 94 ijmp + 7fda: ee 27 eor r30, r30 + 7fdc: ff 27 eor r31, r31 + 7fde: 09 94 ijmp -00007fd2 : +00007fe0 : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) appStart(); - 7fd2: e7 df rcall .-50 ; 0x7fa2 - 7fd4: 80 32 cpi r24, 0x20 ; 32 - 7fd6: 09 f0 breq .+2 ; 0x7fda - 7fd8: f7 df rcall .-18 ; 0x7fc8 + 7fe0: e7 df rcall .-50 ; 0x7fb0 + 7fe2: 80 32 cpi r24, 0x20 ; 32 + 7fe4: 09 f0 breq .+2 ; 0x7fe8 + 7fe6: f7 df rcall .-18 ; 0x7fd6 putch(STK_INSYNC); - 7fda: 84 e1 ldi r24, 0x14 ; 20 + 7fe8: 84 e1 ldi r24, 0x14 ; 20 } - 7fdc: da cf rjmp .-76 ; 0x7f92 + 7fea: da cf rjmp .-76 ; 0x7fa0 -00007fde : +00007fec : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 7fde: 1f 93 push r17 - 7fe0: 18 2f mov r17, r24 + 7fec: 1f 93 push r17 + 7fee: 18 2f mov r17, r24 do getch(); while (--count); - 7fe2: df df rcall .-66 ; 0x7fa2 - 7fe4: 11 50 subi r17, 0x01 ; 1 - 7fe6: e9 f7 brne .-6 ; 0x7fe2 + 7ff0: df df rcall .-66 ; 0x7fb0 + 7ff2: 11 50 subi r17, 0x01 ; 1 + 7ff4: e9 f7 brne .-6 ; 0x7ff0 verifySpace(); - 7fe8: f4 df rcall .-24 ; 0x7fd2 + 7ff6: f4 df rcall .-24 ; 0x7fe0 } - 7fea: 1f 91 pop r17 - 7fec: 08 95 ret + 7ff8: 1f 91 pop r17 + 7ffa: 08 95 ret diff --git a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex index d6ac145..f4a1514 100644 --- a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex +++ b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex @@ -1,33 +1,34 @@ -:107E000085E08093810082E08093C00088E18093C8 -:107E1000C10086E08093C20088E08093C40084B7EC -:107E200014BE81FFD0D08DE0C8D0259A86E028E12D -:107E30003EEF91E0309385002093840096BBB09B89 -:107E4000FECF1D9AA8958150A9F7DD24D394A5E013 -:107E5000EA2EF1E1FF2EA4D0813421F481E0BED0DE -:107E600083E024C0823411F484E103C0853419F422 -:107E700085E0B4D08AC08535A1F492D0082F10E0F7 -:107E800010930102009300028BD090E0982F882776 -:107E9000802B912B880F991F9093010280930002F1 -:107EA00073C0863529F484E099D080E071D06DC02C -:107EB000843609F043C07CD0E0910002F0910102C9 -:107EC00083E080935700E895C0E0D1E069D08993C2 -:107ED000809102028150809302028823B9F778D002 -:107EE00007B600FCFDCF4091000250910102A0E0D6 -:107EF000B1E02C9130E011968C91119790E0982F81 -:107F00008827822B932B1296FA010C01D0925700EE -:107F1000E89511244E5F5F4FF1E0A038BF0749F7A5 -:107F2000E0910002F0910102E0925700E89507B657 -:107F300000FCFDCFF0925700E89527C08437B9F4D4 -:107F400037D046D0E0910002F09101023196F093D3 -:107F50000102E09300023197E4918E2F19D08091B5 -:107F60000202815080930202882361F70EC0853798 -:107F700039F42ED08EE10CD085E90AD08FE096CF6F -:107F8000813511F488E019D023D080E101D063CF8E -:107F9000982F8091C00085FFFCCF9093C600089574 -:107FA000A8958091C00087FFFCCF8091C6000895FE -:107FB000F7DFF6DF80930202F3CFE0E6F0E098E12E -:107FC00090838083089580E0F8DFEE27FF270994EF -:107FD000E7DF803209F0F7DF84E1DACF1F93182F53 -:0C7FE000DFDF1150E9F7F4DF1F91089576 +:107E0000112484B714BE81FFE6D085E08093810001 +:107E100082E08093C00088E18093C10086E0809377 +:107E2000C20088E08093C4008EE0CFD0259A86E01F +:107E300028E13EEF91E0309385002093840096BBCB +:107E4000B09BFECF1D9AA8958150A9F7DD24D3944D +:107E5000A5E0EA2EF1E1FF2EABD0813421F481E0E0 +:107E6000C5D083E020C0823411F484E103C085349E +:107E700019F485E0BBD091C0853581F499D0082FE5 +:107E800010E096D090E0982F8827802B912B880FB8 +:107E9000991F90930102809300027EC0863529F4D9 +:107EA00084E0A4D080E07CD078C0843609F04EC055 +:107EB00087D0E0910002F091010280E7E030F807FE +:107EC00018F483E087BFE895C0E0D1E071D08993D2 +:107ED000809102028150809302028823B9F7E091D9 +:107EE0000002F091010280E7E030F80718F083E02B +:107EF00087BFE89575D007B600FCFDCF4091000222 +:107F000050910102A0E0B1E02C9130E011968C91EB +:107F1000119790E0982F8827822B932B1296FA01C5 +:107F20000C01D7BEE89511244E5F5F4FF1E0A038F9 +:107F3000BF0751F7E0910002F0910102E7BEE8951A +:107F400007B600FCFDCFF7BEE89527C08437B9F42B +:107F500037D046D0E0910002F09101023196F093C3 +:107F60000102E09300023197E4918E2F19D08091A5 +:107F70000202815080930202882361F70EC0853788 +:107F800039F42ED08EE10CD085E90AD08FE08BCF6A +:107F9000813511F488E019D023D080E101D05CCF85 +:107FA000982F8091C00085FFFCCF9093C600089564 +:107FB000A8958091C00087FFFCCF8091C6000895EE +:107FC000F7DFF6DF80930202F3CFE0E6F0E098E11E +:107FD00090838083089580E0F8DFEE27FF270994DF +:107FE000E7DF803209F0F7DF84E1DACF1F93182F43 +:0C7FF000DFDF1150E9F7F4DF1F91089566 :0400000300007E007B :00000001FF diff --git a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst index 46eda68..4cbcf62 100644 --- a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst +++ b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst @@ -3,237 +3,257 @@ optiboot_atmega328_pro_8MHz.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001ec 00007e00 00007e00 00000054 2**1 + 0 .text 000001fc 00007e00 00007e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .debug_aranges 00000028 00000000 00000000 00000240 2**0 + 1 .debug_aranges 00000028 00000000 00000000 00000250 2**0 CONTENTS, READONLY, DEBUGGING - 2 .debug_pubnames 0000006a 00000000 00000000 00000268 2**0 + 2 .debug_pubnames 0000006a 00000000 00000000 00000278 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_info 00000269 00000000 00000000 000002d2 2**0 + 3 .debug_info 00000284 00000000 00000000 000002e2 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_abbrev 00000196 00000000 00000000 0000053b 2**0 + 4 .debug_abbrev 000001ae 00000000 00000000 00000566 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_line 000003d3 00000000 00000000 000006d1 2**0 + 5 .debug_line 00000450 00000000 00000000 00000714 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_frame 00000090 00000000 00000000 00000aa4 2**2 + 6 .debug_frame 00000090 00000000 00000000 00000b64 2**2 CONTENTS, READONLY, DEBUGGING - 7 .debug_str 00000135 00000000 00000000 00000b34 2**0 + 7 .debug_str 00000141 00000000 00000000 00000bf4 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_loc 000001d1 00000000 00000000 00000c69 2**0 + 8 .debug_loc 000001e1 00000000 00000000 00000d35 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_ranges 00000068 00000000 00000000 00000e3a 2**0 + 9 .debug_ranges 00000068 00000000 00000000 00000f16 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: 00007e00
: -#ifdef VIRTUAL_BOOT_PARTITION -#define rstVect (*(uint16_t*)(0x204)) -#define wdtVect (*(uint16_t*)(0x206)) +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif + /* main program starts here */ int main(void) { - 7e00: 85 e0 ldi r24, 0x05 ; 5 - 7e02: 80 93 81 00 sts 0x0081, r24 + 7e00: 11 24 eor r1, r1 +#ifdef __AVR_ATmega8__ + SP=RAMEND; // This is done by hardware reset +#endif + + // Adaboot no-wait mod + ch = MCUSR; + 7e02: 84 b7 in r24, 0x34 ; 52 + MCUSR = 0; + 7e04: 14 be out 0x34, r1 ; 52 + if (!(ch & _BV(EXTRF))) appStart(); + 7e06: 81 ff sbrs r24, 1 + 7e08: e6 d0 rcall .+460 ; 0x7fd6 + #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 -#endif -#ifndef SOFT_UART + 7e0a: 85 e0 ldi r24, 0x05 ; 5 + 7e0c: 80 93 81 00 sts 0x0081, r24 + UCSRA = _BV(U2X); //Double speed mode USART + UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx + UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 + UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); +#else UCSR0A = _BV(U2X0); //Double speed mode USART0 - 7e06: 82 e0 ldi r24, 0x02 ; 2 - 7e08: 80 93 c0 00 sts 0x00C0, r24 + 7e10: 82 e0 ldi r24, 0x02 ; 2 + 7e12: 80 93 c0 00 sts 0x00C0, r24 UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 7e0c: 88 e1 ldi r24, 0x18 ; 24 - 7e0e: 80 93 c1 00 sts 0x00C1, r24 + 7e16: 88 e1 ldi r24, 0x18 ; 24 + 7e18: 80 93 c1 00 sts 0x00C1, r24 UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 7e12: 86 e0 ldi r24, 0x06 ; 6 - 7e14: 80 93 c2 00 sts 0x00C2, r24 + 7e1c: 86 e0 ldi r24, 0x06 ; 6 + 7e1e: 80 93 c2 00 sts 0x00C2, r24 UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 7e18: 88 e0 ldi r24, 0x08 ; 8 - 7e1a: 80 93 c4 00 sts 0x00C4, r24 + 7e22: 88 e0 ldi r24, 0x08 ; 8 + 7e24: 80 93 c4 00 sts 0x00C4, r24 +#endif #endif - - // Adaboot no-wait mod - ch = MCUSR; - 7e1e: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 7e20: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 7e22: 81 ff sbrs r24, 1 - 7e24: d0 d0 rcall .+416 ; 0x7fc6 // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_500MS); - 7e26: 8d e0 ldi r24, 0x0D ; 13 - 7e28: c8 d0 rcall .+400 ; 0x7fba + watchdogConfig(WATCHDOG_1S); + 7e28: 8e e0 ldi r24, 0x0E ; 14 + 7e2a: cf d0 rcall .+414 ; 0x7fca /* Set LED pin as output */ LED_DDR |= _BV(LED); - 7e2a: 25 9a sbi 0x04, 5 ; 4 - 7e2c: 86 e0 ldi r24, 0x06 ; 6 + 7e2c: 25 9a sbi 0x04, 5 ; 4 + 7e2e: 86 e0 ldi r24, 0x06 ; 6 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 7e2e: 28 e1 ldi r18, 0x18 ; 24 - 7e30: 3e ef ldi r19, 0xFE ; 254 + 7e30: 28 e1 ldi r18, 0x18 ; 24 + 7e32: 3e ef ldi r19, 0xFE ; 254 TIFR1 = _BV(TOV1); - 7e32: 91 e0 ldi r25, 0x01 ; 1 + 7e34: 91 e0 ldi r25, 0x01 ; 1 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 7e34: 30 93 85 00 sts 0x0085, r19 - 7e38: 20 93 84 00 sts 0x0084, r18 + 7e36: 30 93 85 00 sts 0x0085, r19 + 7e3a: 20 93 84 00 sts 0x0084, r18 TIFR1 = _BV(TOV1); - 7e3c: 96 bb out 0x16, r25 ; 22 + 7e3e: 96 bb out 0x16, r25 ; 22 while(!(TIFR1 & _BV(TOV1))); - 7e3e: b0 9b sbis 0x16, 0 ; 22 - 7e40: fe cf rjmp .-4 ; 0x7e3e + 7e40: b0 9b sbis 0x16, 0 ; 22 + 7e42: fe cf rjmp .-4 ; 0x7e40 +#ifdef __AVR_ATmega8__ + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); - 7e42: 1d 9a sbi 0x03, 5 ; 3 + 7e44: 1d 9a sbi 0x03, 5 ; 3 return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 7e44: a8 95 wdr - TCNT1 = -(F_CPU/(1024*16)); - TIFR1 = _BV(TOV1); - while(!(TIFR1 & _BV(TOV1))); + 7e46: a8 95 wdr + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); +#endif watchdogReset(); } while (--count); - 7e46: 81 50 subi r24, 0x01 ; 1 - 7e48: a9 f7 brne .-22 ; 0x7e34 + 7e48: 81 50 subi r24, 0x01 ; 1 + 7e4a: a9 f7 brne .-22 ; 0x7e36 /* get character from UART */ ch = getch(); if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 7e4a: dd 24 eor r13, r13 - 7e4c: d3 94 inc r13 - boot_page_fill((uint16_t)(void*)addrPtr,a); + 7e4c: dd 24 eor r13, r13 + 7e4e: d3 94 inc r13 + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); // Write from programming buffer - boot_page_write((uint16_t)(void*)address); - 7e4e: a5 e0 ldi r26, 0x05 ; 5 - 7e50: ea 2e mov r14, r26 + __boot_page_write_short((uint16_t)(void*)address); + 7e50: a5 e0 ldi r26, 0x05 ; 5 + 7e52: ea 2e mov r14, r26 boot_spm_busy_wait(); #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 7e52: f1 e1 ldi r31, 0x11 ; 17 - 7e54: ff 2e mov r15, r31 + 7e54: f1 e1 ldi r31, 0x11 ; 17 + 7e56: ff 2e mov r15, r31 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 7e56: a4 d0 rcall .+328 ; 0x7fa0 + 7e58: ab d0 rcall .+342 ; 0x7fb0 if(ch == STK_GET_PARAMETER) { - 7e58: 81 34 cpi r24, 0x41 ; 65 - 7e5a: 21 f4 brne .+8 ; 0x7e64 + 7e5a: 81 34 cpi r24, 0x41 ; 65 + 7e5c: 21 f4 brne .+8 ; 0x7e66 // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 7e5c: 81 e0 ldi r24, 0x01 ; 1 - 7e5e: be d0 rcall .+380 ; 0x7fdc + 7e5e: 81 e0 ldi r24, 0x01 ; 1 + 7e60: c5 d0 rcall .+394 ; 0x7fec putch(0x03); - 7e60: 83 e0 ldi r24, 0x03 ; 3 - 7e62: 24 c0 rjmp .+72 ; 0x7eac + 7e62: 83 e0 ldi r24, 0x03 ; 3 + 7e64: 20 c0 rjmp .+64 ; 0x7ea6 } else if(ch == STK_SET_DEVICE) { - 7e64: 82 34 cpi r24, 0x42 ; 66 - 7e66: 11 f4 brne .+4 ; 0x7e6c + 7e66: 82 34 cpi r24, 0x42 ; 66 + 7e68: 11 f4 brne .+4 ; 0x7e6e // SET DEVICE is ignored getNch(20); - 7e68: 84 e1 ldi r24, 0x14 ; 20 - 7e6a: 03 c0 rjmp .+6 ; 0x7e72 + 7e6a: 84 e1 ldi r24, 0x14 ; 20 + 7e6c: 03 c0 rjmp .+6 ; 0x7e74 } else if(ch == STK_SET_DEVICE_EXT) { - 7e6c: 85 34 cpi r24, 0x45 ; 69 - 7e6e: 19 f4 brne .+6 ; 0x7e76 + 7e6e: 85 34 cpi r24, 0x45 ; 69 + 7e70: 19 f4 brne .+6 ; 0x7e78 // SET DEVICE EXT is ignored getNch(5); - 7e70: 85 e0 ldi r24, 0x05 ; 5 - 7e72: b4 d0 rcall .+360 ; 0x7fdc - 7e74: 8a c0 rjmp .+276 ; 0x7f8a + 7e72: 85 e0 ldi r24, 0x05 ; 5 + 7e74: bb d0 rcall .+374 ; 0x7fec + 7e76: 91 c0 rjmp .+290 ; 0x7f9a } else if(ch == STK_LOAD_ADDRESS) { - 7e76: 85 35 cpi r24, 0x55 ; 85 - 7e78: a1 f4 brne .+40 ; 0x7ea2 + 7e78: 85 35 cpi r24, 0x55 ; 85 + 7e7a: 81 f4 brne .+32 ; 0x7e9c // LOAD ADDRESS - address = getch(); - 7e7a: 92 d0 rcall .+292 ; 0x7fa0 - 7e7c: 08 2f mov r16, r24 - 7e7e: 10 e0 ldi r17, 0x00 ; 0 - 7e80: 10 93 01 02 sts 0x0201, r17 - 7e84: 00 93 00 02 sts 0x0200, r16 - address = (address & 0xff) | (getch() << 8); - 7e88: 8b d0 rcall .+278 ; 0x7fa0 - 7e8a: 90 e0 ldi r25, 0x00 ; 0 - 7e8c: 98 2f mov r25, r24 - 7e8e: 88 27 eor r24, r24 - 7e90: 80 2b or r24, r16 - 7e92: 91 2b or r25, r17 - address += address; // Convert from word address to byte address - 7e94: 88 0f add r24, r24 - 7e96: 99 1f adc r25, r25 - 7e98: 90 93 01 02 sts 0x0201, r25 - 7e9c: 80 93 00 02 sts 0x0200, r24 - 7ea0: 73 c0 rjmp .+230 ; 0x7f88 + uint16_t newAddress; + newAddress = getch(); + 7e7c: 99 d0 rcall .+306 ; 0x7fb0 + newAddress = (newAddress & 0xff) | (getch() << 8); + 7e7e: 08 2f mov r16, r24 + 7e80: 10 e0 ldi r17, 0x00 ; 0 + 7e82: 96 d0 rcall .+300 ; 0x7fb0 + 7e84: 90 e0 ldi r25, 0x00 ; 0 + 7e86: 98 2f mov r25, r24 + 7e88: 88 27 eor r24, r24 + 7e8a: 80 2b or r24, r16 + 7e8c: 91 2b or r25, r17 +#ifdef RAMPZ + // Transfer top bit to RAMPZ + RAMPZ = (newAddress & 0x8000) ? 1 : 0; +#endif + newAddress += newAddress; // Convert from word address to byte address + 7e8e: 88 0f add r24, r24 + 7e90: 99 1f adc r25, r25 + address = newAddress; + 7e92: 90 93 01 02 sts 0x0201, r25 + 7e96: 80 93 00 02 sts 0x0200, r24 + 7e9a: 7e c0 rjmp .+252 ; 0x7f98 verifySpace(); } else if(ch == STK_UNIVERSAL) { - 7ea2: 86 35 cpi r24, 0x56 ; 86 - 7ea4: 29 f4 brne .+10 ; 0x7eb0 + 7e9c: 86 35 cpi r24, 0x56 ; 86 + 7e9e: 29 f4 brne .+10 ; 0x7eaa // UNIVERSAL command is ignored getNch(4); - 7ea6: 84 e0 ldi r24, 0x04 ; 4 - 7ea8: 99 d0 rcall .+306 ; 0x7fdc + 7ea0: 84 e0 ldi r24, 0x04 ; 4 + 7ea2: a4 d0 rcall .+328 ; 0x7fec putch(0x00); - 7eaa: 80 e0 ldi r24, 0x00 ; 0 - 7eac: 71 d0 rcall .+226 ; 0x7f90 - 7eae: 6d c0 rjmp .+218 ; 0x7f8a + 7ea4: 80 e0 ldi r24, 0x00 ; 0 + 7ea6: 7c d0 rcall .+248 ; 0x7fa0 + 7ea8: 78 c0 rjmp .+240 ; 0x7f9a } - /* Write memory, length is big endian and is in bytes */ + /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 7eb0: 84 36 cpi r24, 0x64 ; 100 - 7eb2: 09 f0 breq .+2 ; 0x7eb6 - 7eb4: 43 c0 rjmp .+134 ; 0x7f3c + 7eaa: 84 36 cpi r24, 0x64 ; 100 + 7eac: 09 f0 breq .+2 ; 0x7eb0 + 7eae: 4e c0 rjmp .+156 ; 0x7f4c // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; getLen(); - 7eb6: 7c d0 rcall .+248 ; 0x7fb0 - - // Immediately start page erase - this will 4.5ms - boot_page_erase((uint16_t)(void*)address); - 7eb8: e0 91 00 02 lds r30, 0x0200 - 7ebc: f0 91 01 02 lds r31, 0x0201 - 7ec0: 83 e0 ldi r24, 0x03 ; 3 - 7ec2: 80 93 57 00 sts 0x0057, r24 + 7eb0: 87 d0 rcall .+270 ; 0x7fc0 + + // If we are in RWW section, immediately start page erase + if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 7eb2: e0 91 00 02 lds r30, 0x0200 + 7eb6: f0 91 01 02 lds r31, 0x0201 + 7eba: 80 e7 ldi r24, 0x70 ; 112 + 7ebc: e0 30 cpi r30, 0x00 ; 0 + 7ebe: f8 07 cpc r31, r24 + 7ec0: 18 f4 brcc .+6 ; 0x7ec8 + 7ec2: 83 e0 ldi r24, 0x03 ; 3 + 7ec4: 87 bf out 0x37, r24 ; 55 7ec6: e8 95 spm 7ec8: c0 e0 ldi r28, 0x00 ; 0 7eca: d1 e0 ldi r29, 0x01 ; 1 - + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 7ecc: 69 d0 rcall .+210 ; 0x7fa0 + 7ecc: 71 d0 rcall .+226 ; 0x7fb0 7ece: 89 93 st Y+, r24 while (--length); 7ed0: 80 91 02 02 lds r24, 0x0202 @@ -242,279 +262,293 @@ void watchdogReset() { 7eda: 88 23 and r24, r24 7edc: b9 f7 brne .-18 ; 0x7ecc + // If we are in NRWW section, page erase has to be delayed until now. + // Todo: Take RAMPZ into account + if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 7ede: e0 91 00 02 lds r30, 0x0200 + 7ee2: f0 91 01 02 lds r31, 0x0201 + 7ee6: 80 e7 ldi r24, 0x70 ; 112 + 7ee8: e0 30 cpi r30, 0x00 ; 0 + 7eea: f8 07 cpc r31, r24 + 7eec: 18 f0 brcs .+6 ; 0x7ef4 + 7eee: 83 e0 ldi r24, 0x03 ; 3 + 7ef0: 87 bf out 0x37, r24 ; 55 + 7ef2: e8 95 spm + // Read command terminator, start reply verifySpace(); - 7ede: 78 d0 rcall .+240 ; 0x7fd0 + 7ef4: 75 d0 rcall .+234 ; 0x7fe0 // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 7ee0: 07 b6 in r0, 0x37 ; 55 - 7ee2: 00 fc sbrc r0, 0 - 7ee4: fd cf rjmp .-6 ; 0x7ee0 + 7ef6: 07 b6 in r0, 0x37 ; 55 + 7ef8: 00 fc sbrc r0, 0 + 7efa: fd cf rjmp .-6 ; 0x7ef6 } #endif // Copy buffer into programming buffer bufPtr = buff; addrPtr = (uint16_t)(void*)address; - 7ee6: 40 91 00 02 lds r20, 0x0200 - 7eea: 50 91 01 02 lds r21, 0x0201 - 7eee: a0 e0 ldi r26, 0x00 ; 0 - 7ef0: b1 e0 ldi r27, 0x01 ; 1 + 7efc: 40 91 00 02 lds r20, 0x0200 + 7f00: 50 91 01 02 lds r21, 0x0201 + 7f04: a0 e0 ldi r26, 0x00 ; 0 + 7f06: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 7ef2: 2c 91 ld r18, X - 7ef4: 30 e0 ldi r19, 0x00 ; 0 + 7f08: 2c 91 ld r18, X + 7f0a: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 7ef6: 11 96 adiw r26, 0x01 ; 1 - 7ef8: 8c 91 ld r24, X - 7efa: 11 97 sbiw r26, 0x01 ; 1 - 7efc: 90 e0 ldi r25, 0x00 ; 0 - 7efe: 98 2f mov r25, r24 - 7f00: 88 27 eor r24, r24 - 7f02: 82 2b or r24, r18 - 7f04: 93 2b or r25, r19 -#ifdef VIRTUAL_BOOT_PARTITION -#define rstVect (*(uint16_t*)(0x204)) -#define wdtVect (*(uint16_t*)(0x206)) + 7f0c: 11 96 adiw r26, 0x01 ; 1 + 7f0e: 8c 91 ld r24, X + 7f10: 11 97 sbiw r26, 0x01 ; 1 + 7f12: 90 e0 ldi r25, 0x00 ; 0 + 7f14: 98 2f mov r25, r24 + 7f16: 88 27 eor r24, r24 + 7f18: 82 2b or r24, r18 + 7f1a: 93 2b or r25, r19 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif + /* main program starts here */ int main(void) { - 7f06: 12 96 adiw r26, 0x02 ; 2 + 7f1c: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; - boot_page_fill((uint16_t)(void*)addrPtr,a); - 7f08: fa 01 movw r30, r20 - 7f0a: 0c 01 movw r0, r24 - 7f0c: d0 92 57 00 sts 0x0057, r13 - 7f10: e8 95 spm - 7f12: 11 24 eor r1, r1 + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); + 7f1e: fa 01 movw r30, r20 + 7f20: 0c 01 movw r0, r24 + 7f22: d7 be out 0x37, r13 ; 55 + 7f24: e8 95 spm + 7f26: 11 24 eor r1, r1 addrPtr += 2; - 7f14: 4e 5f subi r20, 0xFE ; 254 - 7f16: 5f 4f sbci r21, 0xFF ; 255 + 7f28: 4e 5f subi r20, 0xFE ; 254 + 7f2a: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 7f18: f1 e0 ldi r31, 0x01 ; 1 - 7f1a: a0 38 cpi r26, 0x80 ; 128 - 7f1c: bf 07 cpc r27, r31 - 7f1e: 49 f7 brne .-46 ; 0x7ef2 + 7f2c: f1 e0 ldi r31, 0x01 ; 1 + 7f2e: a0 38 cpi r26, 0x80 ; 128 + 7f30: bf 07 cpc r27, r31 + 7f32: 51 f7 brne .-44 ; 0x7f08 // Write from programming buffer - boot_page_write((uint16_t)(void*)address); - 7f20: e0 91 00 02 lds r30, 0x0200 - 7f24: f0 91 01 02 lds r31, 0x0201 - 7f28: e0 92 57 00 sts 0x0057, r14 - 7f2c: e8 95 spm + __boot_page_write_short((uint16_t)(void*)address); + 7f34: e0 91 00 02 lds r30, 0x0200 + 7f38: f0 91 01 02 lds r31, 0x0201 + 7f3c: e7 be out 0x37, r14 ; 55 + 7f3e: e8 95 spm boot_spm_busy_wait(); - 7f2e: 07 b6 in r0, 0x37 ; 55 - 7f30: 00 fc sbrc r0, 0 - 7f32: fd cf rjmp .-6 ; 0x7f2e + 7f40: 07 b6 in r0, 0x37 ; 55 + 7f42: 00 fc sbrc r0, 0 + 7f44: fd cf rjmp .-6 ; 0x7f40 #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 7f34: f0 92 57 00 sts 0x0057, r15 - 7f38: e8 95 spm - 7f3a: 27 c0 rjmp .+78 ; 0x7f8a + 7f46: f7 be out 0x37, r15 ; 55 + 7f48: e8 95 spm + 7f4a: 27 c0 rjmp .+78 ; 0x7f9a #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 7f3c: 84 37 cpi r24, 0x74 ; 116 - 7f3e: b9 f4 brne .+46 ; 0x7f6e + 7f4c: 84 37 cpi r24, 0x74 ; 116 + 7f4e: b9 f4 brne .+46 ; 0x7f7e // READ PAGE - we only read flash getLen(); - 7f40: 37 d0 rcall .+110 ; 0x7fb0 + 7f50: 37 d0 rcall .+110 ; 0x7fc0 verifySpace(); - 7f42: 46 d0 rcall .+140 ; 0x7fd0 - else ch = pgm_read_byte_near(address); + 7f52: 46 d0 rcall .+140 ; 0x7fe0 + putch(result); address++; - putch(ch); - } while (--length); + } + while (--length); #else do putch(pgm_read_byte_near(address++)); - 7f44: e0 91 00 02 lds r30, 0x0200 - 7f48: f0 91 01 02 lds r31, 0x0201 - 7f4c: 31 96 adiw r30, 0x01 ; 1 - 7f4e: f0 93 01 02 sts 0x0201, r31 - 7f52: e0 93 00 02 sts 0x0200, r30 - 7f56: 31 97 sbiw r30, 0x01 ; 1 - 7f58: e4 91 lpm r30, Z+ - 7f5a: 8e 2f mov r24, r30 - 7f5c: 19 d0 rcall .+50 ; 0x7f90 + 7f54: e0 91 00 02 lds r30, 0x0200 + 7f58: f0 91 01 02 lds r31, 0x0201 + 7f5c: 31 96 adiw r30, 0x01 ; 1 + 7f5e: f0 93 01 02 sts 0x0201, r31 + 7f62: e0 93 00 02 sts 0x0200, r30 + 7f66: 31 97 sbiw r30, 0x01 ; 1 + 7f68: e4 91 lpm r30, Z+ + 7f6a: 8e 2f mov r24, r30 + 7f6c: 19 d0 rcall .+50 ; 0x7fa0 while (--length); - 7f5e: 80 91 02 02 lds r24, 0x0202 - 7f62: 81 50 subi r24, 0x01 ; 1 - 7f64: 80 93 02 02 sts 0x0202, r24 - 7f68: 88 23 and r24, r24 - 7f6a: 61 f7 brne .-40 ; 0x7f44 - 7f6c: 0e c0 rjmp .+28 ; 0x7f8a + 7f6e: 80 91 02 02 lds r24, 0x0202 + 7f72: 81 50 subi r24, 0x01 ; 1 + 7f74: 80 93 02 02 sts 0x0202, r24 + 7f78: 88 23 and r24, r24 + 7f7a: 61 f7 brne .-40 ; 0x7f54 + 7f7c: 0e c0 rjmp .+28 ; 0x7f9a +#endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 7f6e: 85 37 cpi r24, 0x75 ; 117 - 7f70: 39 f4 brne .+14 ; 0x7f80 + 7f7e: 85 37 cpi r24, 0x75 ; 117 + 7f80: 39 f4 brne .+14 ; 0x7f90 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 7f72: 2e d0 rcall .+92 ; 0x7fd0 + 7f82: 2e d0 rcall .+92 ; 0x7fe0 putch(SIGNATURE_0); - 7f74: 8e e1 ldi r24, 0x1E ; 30 - 7f76: 0c d0 rcall .+24 ; 0x7f90 + 7f84: 8e e1 ldi r24, 0x1E ; 30 + 7f86: 0c d0 rcall .+24 ; 0x7fa0 putch(SIGNATURE_1); - 7f78: 85 e9 ldi r24, 0x95 ; 149 - 7f7a: 0a d0 rcall .+20 ; 0x7f90 + 7f88: 85 e9 ldi r24, 0x95 ; 149 + 7f8a: 0a d0 rcall .+20 ; 0x7fa0 putch(SIGNATURE_2); - 7f7c: 8f e0 ldi r24, 0x0F ; 15 - 7f7e: 96 cf rjmp .-212 ; 0x7eac + 7f8c: 8f e0 ldi r24, 0x0F ; 15 + 7f8e: 8b cf rjmp .-234 ; 0x7ea6 } else if (ch == 'Q') { - 7f80: 81 35 cpi r24, 0x51 ; 81 - 7f82: 11 f4 brne .+4 ; 0x7f88 + 7f90: 81 35 cpi r24, 0x51 ; 81 + 7f92: 11 f4 brne .+4 ; 0x7f98 // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 7f84: 88 e0 ldi r24, 0x08 ; 8 - 7f86: 19 d0 rcall .+50 ; 0x7fba + 7f94: 88 e0 ldi r24, 0x08 ; 8 + 7f96: 19 d0 rcall .+50 ; 0x7fca verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 7f88: 23 d0 rcall .+70 ; 0x7fd0 + 7f98: 23 d0 rcall .+70 ; 0x7fe0 } putch(STK_OK); - 7f8a: 80 e1 ldi r24, 0x10 ; 16 - 7f8c: 01 d0 rcall .+2 ; 0x7f90 - 7f8e: 63 cf rjmp .-314 ; 0x7e56 + 7f9a: 80 e1 ldi r24, 0x10 ; 16 + 7f9c: 01 d0 rcall .+2 ; 0x7fa0 + 7f9e: 5c cf rjmp .-328 ; 0x7e58 -00007f90 : +00007fa0 : } } void putch(char ch) { - 7f90: 98 2f mov r25, r24 + 7fa0: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); - 7f92: 80 91 c0 00 lds r24, 0x00C0 - 7f96: 85 ff sbrs r24, 5 - 7f98: fc cf rjmp .-8 ; 0x7f92 + 7fa2: 80 91 c0 00 lds r24, 0x00C0 + 7fa6: 85 ff sbrs r24, 5 + 7fa8: fc cf rjmp .-8 ; 0x7fa2 UDR0 = ch; - 7f9a: 90 93 c6 00 sts 0x00C6, r25 + 7faa: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 7f9e: 08 95 ret + 7fae: 08 95 ret -00007fa0 : +00007fb0 : return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 7fa0: a8 95 wdr + 7fb0: a8 95 wdr [uartBit] "I" (UART_RX_BIT) : "r25" ); #else while(!(UCSR0A & _BV(RXC0))); - 7fa2: 80 91 c0 00 lds r24, 0x00C0 - 7fa6: 87 ff sbrs r24, 7 - 7fa8: fc cf rjmp .-8 ; 0x7fa2 + 7fb2: 80 91 c0 00 lds r24, 0x00C0 + 7fb6: 87 ff sbrs r24, 7 + 7fb8: fc cf rjmp .-8 ; 0x7fb2 ch = UDR0; - 7faa: 80 91 c6 00 lds r24, 0x00C6 -#ifdef LED_DATA_FLASH + 7fba: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); +#endif #endif return ch; } - 7fae: 08 95 ret + 7fbe: 08 95 ret -00007fb0 : +00007fc0 : } while (--count); } #endif uint8_t getLen() { getch(); - 7fb0: f7 df rcall .-18 ; 0x7fa0 + 7fc0: f7 df rcall .-18 ; 0x7fb0 length = getch(); - 7fb2: f6 df rcall .-20 ; 0x7fa0 - 7fb4: 80 93 02 02 sts 0x0202, r24 + 7fc2: f6 df rcall .-20 ; 0x7fb0 + 7fc4: 80 93 02 02 sts 0x0202, r24 return getch(); } - 7fb8: f3 cf rjmp .-26 ; 0x7fa0 + 7fc8: f3 cf rjmp .-26 ; 0x7fb0 -00007fba : +00007fca : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 7fba: e0 e6 ldi r30, 0x60 ; 96 - 7fbc: f0 e0 ldi r31, 0x00 ; 0 - 7fbe: 98 e1 ldi r25, 0x18 ; 24 - 7fc0: 90 83 st Z, r25 + 7fca: e0 e6 ldi r30, 0x60 ; 96 + 7fcc: f0 e0 ldi r31, 0x00 ; 0 + 7fce: 98 e1 ldi r25, 0x18 ; 24 + 7fd0: 90 83 st Z, r25 WDTCSR = x; - 7fc2: 80 83 st Z, r24 + 7fd2: 80 83 st Z, r24 } - 7fc4: 08 95 ret + 7fd4: 08 95 ret -00007fc6 : +00007fd6 : void appStart() { watchdogConfig(WATCHDOG_OFF); - 7fc6: 80 e0 ldi r24, 0x00 ; 0 - 7fc8: f8 df rcall .-16 ; 0x7fba + 7fd6: 80 e0 ldi r24, 0x00 ; 0 + 7fd8: f8 df rcall .-16 ; 0x7fca __asm__ __volatile__ ( - 7fca: ee 27 eor r30, r30 - 7fcc: ff 27 eor r31, r31 - 7fce: 09 94 ijmp + 7fda: ee 27 eor r30, r30 + 7fdc: ff 27 eor r31, r31 + 7fde: 09 94 ijmp -00007fd0 : +00007fe0 : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) appStart(); - 7fd0: e7 df rcall .-50 ; 0x7fa0 - 7fd2: 80 32 cpi r24, 0x20 ; 32 - 7fd4: 09 f0 breq .+2 ; 0x7fd8 - 7fd6: f7 df rcall .-18 ; 0x7fc6 + 7fe0: e7 df rcall .-50 ; 0x7fb0 + 7fe2: 80 32 cpi r24, 0x20 ; 32 + 7fe4: 09 f0 breq .+2 ; 0x7fe8 + 7fe6: f7 df rcall .-18 ; 0x7fd6 putch(STK_INSYNC); - 7fd8: 84 e1 ldi r24, 0x14 ; 20 + 7fe8: 84 e1 ldi r24, 0x14 ; 20 } - 7fda: da cf rjmp .-76 ; 0x7f90 + 7fea: da cf rjmp .-76 ; 0x7fa0 + +00007fec : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 7fdc: 1f 93 push r17 - 7fde: 18 2f mov r17, r24 - -00007fe0 : + 7fec: 1f 93 push r17 + 7fee: 18 2f mov r17, r24 do getch(); while (--count); - 7fe0: df df rcall .-66 ; 0x7fa0 - 7fe2: 11 50 subi r17, 0x01 ; 1 - 7fe4: e9 f7 brne .-6 ; 0x7fe0 + 7ff0: df df rcall .-66 ; 0x7fb0 + 7ff2: 11 50 subi r17, 0x01 ; 1 + 7ff4: e9 f7 brne .-6 ; 0x7ff0 verifySpace(); - 7fe6: f4 df rcall .-24 ; 0x7fd0 + 7ff6: f4 df rcall .-24 ; 0x7fe0 } - 7fe8: 1f 91 pop r17 - 7fea: 08 95 ret + 7ff8: 1f 91 pop r17 + 7ffa: 08 95 ret diff --git a/bootloaders/optiboot/optiboot_diecimila.hex b/bootloaders/optiboot/optiboot_diecimila.hex index 1e93414..2b4a582 100644 --- a/bootloaders/optiboot/optiboot_diecimila.hex +++ b/bootloaders/optiboot/optiboot_diecimila.hex @@ -1,33 +1,34 @@ -:103E000085E08093810082E08093C00088E1809308 -:103E1000C10086E08093C20080E18093C40084B733 -:103E200014BE81FFD0D08DE0C8D0259A86E020E373 -:103E30003CEF91E0309385002093840096BBB09BCB -:103E4000FECF1D9AA8958150A9F7DD24D394A5E053 -:103E5000EA2EF1E1FF2EA4D0813421F481E0BED01E -:103E600083E024C0823411F484E103C0853419F462 -:103E700085E0B4D08AC08535A1F492D0082F10E037 -:103E800010930102009300028BD090E0982F8827B6 -:103E9000802B912B880F991F909301028093000231 -:103EA00073C0863529F484E099D080E071D06DC06C -:103EB000843609F043C07CD0E0910002F091010209 -:103EC00083E080935700E895C0E0D1E069D0899302 -:103ED000809102028150809302028823B9F778D042 -:103EE00007B600FCFDCF4091000250910102A0E016 -:103EF000B1E02C9130E011968C91119790E0982FC1 -:103F00008827822B932B1296FA010C01D09257002E -:103F1000E89511244E5F5F4FF1E0A038BF0749F7E5 -:103F2000E0910002F0910102E0925700E89507B697 -:103F300000FCFDCFF0925700E89527C08437B9F414 -:103F400037D046D0E0910002F09101023196F09313 -:103F50000102E09300023197E4918E2F19D08091F5 -:103F60000202815080930202882361F70EC08537D8 -:103F700039F42ED08EE10CD084E90AD086E096CFB9 -:103F8000813511F488E019D023D080E101D063CFCE -:103F9000982F8091C00085FFFCCF9093C6000895B4 -:103FA000A8958091C00087FFFCCF8091C60008953E -:103FB000F7DFF6DF80930202F3CFE0E6F0E098E16E -:103FC00090838083089580E0F8DFEE27FF2709942F -:103FD000E7DF803209F0F7DF84E1DACF1F93182F93 -:0C3FE000DFDF1150E9F7F4DF1F910895B6 +:103E0000112484B714BE81FFE6D085E08093810041 +:103E100082E08093C00088E18093C10086E08093B7 +:103E2000C20080E18093C4008EE0CFD0259A86E066 +:103E300020E33CEF91E0309385002093840096BB13 +:103E4000B09BFECF1D9AA8958150A9F7DD24D3948D +:103E5000A5E0EA2EF1E1FF2EABD0813421F481E020 +:103E6000C5D083E020C0823411F484E103C08534DE +:103E700019F485E0BBD091C0853581F499D0082F25 +:103E800010E096D090E0982F8827802B912B880FF8 +:103E9000991F90930102809300027EC0863529F419 +:103EA00084E0A4D080E07CD078C0843609F04EC095 +:103EB00087D0E0910002F091010288E3E030F8073A +:103EC00018F483E087BFE895C0E0D1E071D0899312 +:103ED000809102028150809302028823B9F7E09119 +:103EE0000002F091010288E3E030F80718F083E067 +:103EF00087BFE89575D007B600FCFDCF4091000262 +:103F000050910102A0E0B1E02C9130E011968C912B +:103F1000119790E0982F8827822B932B1296FA0105 +:103F20000C01D7BEE89511244E5F5F4FF1E0A03839 +:103F3000BF0751F7E0910002F0910102E7BEE8955A +:103F400007B600FCFDCFF7BEE89527C08437B9F46B +:103F500037D046D0E0910002F09101023196F09303 +:103F60000102E09300023197E4918E2F19D08091E5 +:103F70000202815080930202882361F70EC08537C8 +:103F800039F42ED08EE10CD084E90AD086E08BCFB4 +:103F9000813511F488E019D023D080E101D05CCFC5 +:103FA000982F8091C00085FFFCCF9093C6000895A4 +:103FB000A8958091C00087FFFCCF8091C60008952E +:103FC000F7DFF6DF80930202F3CFE0E6F0E098E15E +:103FD00090838083089580E0F8DFEE27FF2709941F +:103FE000E7DF803209F0F7DF84E1DACF1F93182F83 +:0C3FF000DFDF1150E9F7F4DF1F910895A6 :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_diecimila.lst b/bootloaders/optiboot/optiboot_diecimila.lst index 1121893..e0a1ecf 100644 --- a/bootloaders/optiboot/optiboot_diecimila.lst +++ b/bootloaders/optiboot/optiboot_diecimila.lst @@ -3,237 +3,257 @@ optiboot_diecimila.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001ec 00003e00 00003e00 00000054 2**1 + 0 .text 000001fc 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .debug_aranges 00000028 00000000 00000000 00000240 2**0 + 1 .debug_aranges 00000028 00000000 00000000 00000250 2**0 CONTENTS, READONLY, DEBUGGING - 2 .debug_pubnames 0000006a 00000000 00000000 00000268 2**0 + 2 .debug_pubnames 0000006a 00000000 00000000 00000278 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_info 00000269 00000000 00000000 000002d2 2**0 + 3 .debug_info 00000284 00000000 00000000 000002e2 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_abbrev 00000196 00000000 00000000 0000053b 2**0 + 4 .debug_abbrev 000001ae 00000000 00000000 00000566 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_line 000003d3 00000000 00000000 000006d1 2**0 + 5 .debug_line 00000450 00000000 00000000 00000714 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_frame 00000090 00000000 00000000 00000aa4 2**2 + 6 .debug_frame 00000090 00000000 00000000 00000b64 2**2 CONTENTS, READONLY, DEBUGGING - 7 .debug_str 00000135 00000000 00000000 00000b34 2**0 + 7 .debug_str 00000141 00000000 00000000 00000bf4 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_loc 000001d1 00000000 00000000 00000c69 2**0 + 8 .debug_loc 000001e1 00000000 00000000 00000d35 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_ranges 00000068 00000000 00000000 00000e3a 2**0 + 9 .debug_ranges 00000068 00000000 00000000 00000f16 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: 00003e00
: -#ifdef VIRTUAL_BOOT_PARTITION -#define rstVect (*(uint16_t*)(0x204)) -#define wdtVect (*(uint16_t*)(0x206)) +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif + /* main program starts here */ int main(void) { - 3e00: 85 e0 ldi r24, 0x05 ; 5 - 3e02: 80 93 81 00 sts 0x0081, r24 + 3e00: 11 24 eor r1, r1 +#ifdef __AVR_ATmega8__ + SP=RAMEND; // This is done by hardware reset +#endif + + // Adaboot no-wait mod + ch = MCUSR; + 3e02: 84 b7 in r24, 0x34 ; 52 + MCUSR = 0; + 3e04: 14 be out 0x34, r1 ; 52 + if (!(ch & _BV(EXTRF))) appStart(); + 3e06: 81 ff sbrs r24, 1 + 3e08: e6 d0 rcall .+460 ; 0x3fd6 + #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 -#endif -#ifndef SOFT_UART + 3e0a: 85 e0 ldi r24, 0x05 ; 5 + 3e0c: 80 93 81 00 sts 0x0081, r24 + UCSRA = _BV(U2X); //Double speed mode USART + UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx + UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 + UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); +#else UCSR0A = _BV(U2X0); //Double speed mode USART0 - 3e06: 82 e0 ldi r24, 0x02 ; 2 - 3e08: 80 93 c0 00 sts 0x00C0, r24 + 3e10: 82 e0 ldi r24, 0x02 ; 2 + 3e12: 80 93 c0 00 sts 0x00C0, r24 UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 3e0c: 88 e1 ldi r24, 0x18 ; 24 - 3e0e: 80 93 c1 00 sts 0x00C1, r24 + 3e16: 88 e1 ldi r24, 0x18 ; 24 + 3e18: 80 93 c1 00 sts 0x00C1, r24 UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 3e12: 86 e0 ldi r24, 0x06 ; 6 - 3e14: 80 93 c2 00 sts 0x00C2, r24 + 3e1c: 86 e0 ldi r24, 0x06 ; 6 + 3e1e: 80 93 c2 00 sts 0x00C2, r24 UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e18: 80 e1 ldi r24, 0x10 ; 16 - 3e1a: 80 93 c4 00 sts 0x00C4, r24 + 3e22: 80 e1 ldi r24, 0x10 ; 16 + 3e24: 80 93 c4 00 sts 0x00C4, r24 +#endif #endif - - // Adaboot no-wait mod - ch = MCUSR; - 3e1e: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 3e20: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 3e22: 81 ff sbrs r24, 1 - 3e24: d0 d0 rcall .+416 ; 0x3fc6 // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_500MS); - 3e26: 8d e0 ldi r24, 0x0D ; 13 - 3e28: c8 d0 rcall .+400 ; 0x3fba + watchdogConfig(WATCHDOG_1S); + 3e28: 8e e0 ldi r24, 0x0E ; 14 + 3e2a: cf d0 rcall .+414 ; 0x3fca /* Set LED pin as output */ LED_DDR |= _BV(LED); - 3e2a: 25 9a sbi 0x04, 5 ; 4 - 3e2c: 86 e0 ldi r24, 0x06 ; 6 + 3e2c: 25 9a sbi 0x04, 5 ; 4 + 3e2e: 86 e0 ldi r24, 0x06 ; 6 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 3e2e: 20 e3 ldi r18, 0x30 ; 48 - 3e30: 3c ef ldi r19, 0xFC ; 252 + 3e30: 20 e3 ldi r18, 0x30 ; 48 + 3e32: 3c ef ldi r19, 0xFC ; 252 TIFR1 = _BV(TOV1); - 3e32: 91 e0 ldi r25, 0x01 ; 1 + 3e34: 91 e0 ldi r25, 0x01 ; 1 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 3e34: 30 93 85 00 sts 0x0085, r19 - 3e38: 20 93 84 00 sts 0x0084, r18 + 3e36: 30 93 85 00 sts 0x0085, r19 + 3e3a: 20 93 84 00 sts 0x0084, r18 TIFR1 = _BV(TOV1); - 3e3c: 96 bb out 0x16, r25 ; 22 + 3e3e: 96 bb out 0x16, r25 ; 22 while(!(TIFR1 & _BV(TOV1))); - 3e3e: b0 9b sbis 0x16, 0 ; 22 - 3e40: fe cf rjmp .-4 ; 0x3e3e + 3e40: b0 9b sbis 0x16, 0 ; 22 + 3e42: fe cf rjmp .-4 ; 0x3e40 +#ifdef __AVR_ATmega8__ + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); - 3e42: 1d 9a sbi 0x03, 5 ; 3 + 3e44: 1d 9a sbi 0x03, 5 ; 3 return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3e44: a8 95 wdr - TCNT1 = -(F_CPU/(1024*16)); - TIFR1 = _BV(TOV1); - while(!(TIFR1 & _BV(TOV1))); + 3e46: a8 95 wdr + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); +#endif watchdogReset(); } while (--count); - 3e46: 81 50 subi r24, 0x01 ; 1 - 3e48: a9 f7 brne .-22 ; 0x3e34 + 3e48: 81 50 subi r24, 0x01 ; 1 + 3e4a: a9 f7 brne .-22 ; 0x3e36 /* get character from UART */ ch = getch(); if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 3e4a: dd 24 eor r13, r13 - 3e4c: d3 94 inc r13 - boot_page_fill((uint16_t)(void*)addrPtr,a); + 3e4c: dd 24 eor r13, r13 + 3e4e: d3 94 inc r13 + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); // Write from programming buffer - boot_page_write((uint16_t)(void*)address); - 3e4e: a5 e0 ldi r26, 0x05 ; 5 - 3e50: ea 2e mov r14, r26 + __boot_page_write_short((uint16_t)(void*)address); + 3e50: a5 e0 ldi r26, 0x05 ; 5 + 3e52: ea 2e mov r14, r26 boot_spm_busy_wait(); #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 3e52: f1 e1 ldi r31, 0x11 ; 17 - 3e54: ff 2e mov r15, r31 + 3e54: f1 e1 ldi r31, 0x11 ; 17 + 3e56: ff 2e mov r15, r31 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 3e56: a4 d0 rcall .+328 ; 0x3fa0 + 3e58: ab d0 rcall .+342 ; 0x3fb0 if(ch == STK_GET_PARAMETER) { - 3e58: 81 34 cpi r24, 0x41 ; 65 - 3e5a: 21 f4 brne .+8 ; 0x3e64 + 3e5a: 81 34 cpi r24, 0x41 ; 65 + 3e5c: 21 f4 brne .+8 ; 0x3e66 // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 3e5c: 81 e0 ldi r24, 0x01 ; 1 - 3e5e: be d0 rcall .+380 ; 0x3fdc + 3e5e: 81 e0 ldi r24, 0x01 ; 1 + 3e60: c5 d0 rcall .+394 ; 0x3fec putch(0x03); - 3e60: 83 e0 ldi r24, 0x03 ; 3 - 3e62: 24 c0 rjmp .+72 ; 0x3eac + 3e62: 83 e0 ldi r24, 0x03 ; 3 + 3e64: 20 c0 rjmp .+64 ; 0x3ea6 } else if(ch == STK_SET_DEVICE) { - 3e64: 82 34 cpi r24, 0x42 ; 66 - 3e66: 11 f4 brne .+4 ; 0x3e6c + 3e66: 82 34 cpi r24, 0x42 ; 66 + 3e68: 11 f4 brne .+4 ; 0x3e6e // SET DEVICE is ignored getNch(20); - 3e68: 84 e1 ldi r24, 0x14 ; 20 - 3e6a: 03 c0 rjmp .+6 ; 0x3e72 + 3e6a: 84 e1 ldi r24, 0x14 ; 20 + 3e6c: 03 c0 rjmp .+6 ; 0x3e74 } else if(ch == STK_SET_DEVICE_EXT) { - 3e6c: 85 34 cpi r24, 0x45 ; 69 - 3e6e: 19 f4 brne .+6 ; 0x3e76 + 3e6e: 85 34 cpi r24, 0x45 ; 69 + 3e70: 19 f4 brne .+6 ; 0x3e78 // SET DEVICE EXT is ignored getNch(5); - 3e70: 85 e0 ldi r24, 0x05 ; 5 - 3e72: b4 d0 rcall .+360 ; 0x3fdc - 3e74: 8a c0 rjmp .+276 ; 0x3f8a + 3e72: 85 e0 ldi r24, 0x05 ; 5 + 3e74: bb d0 rcall .+374 ; 0x3fec + 3e76: 91 c0 rjmp .+290 ; 0x3f9a } else if(ch == STK_LOAD_ADDRESS) { - 3e76: 85 35 cpi r24, 0x55 ; 85 - 3e78: a1 f4 brne .+40 ; 0x3ea2 + 3e78: 85 35 cpi r24, 0x55 ; 85 + 3e7a: 81 f4 brne .+32 ; 0x3e9c // LOAD ADDRESS - address = getch(); - 3e7a: 92 d0 rcall .+292 ; 0x3fa0 - 3e7c: 08 2f mov r16, r24 - 3e7e: 10 e0 ldi r17, 0x00 ; 0 - 3e80: 10 93 01 02 sts 0x0201, r17 - 3e84: 00 93 00 02 sts 0x0200, r16 - address = (address & 0xff) | (getch() << 8); - 3e88: 8b d0 rcall .+278 ; 0x3fa0 - 3e8a: 90 e0 ldi r25, 0x00 ; 0 - 3e8c: 98 2f mov r25, r24 - 3e8e: 88 27 eor r24, r24 - 3e90: 80 2b or r24, r16 - 3e92: 91 2b or r25, r17 - address += address; // Convert from word address to byte address - 3e94: 88 0f add r24, r24 - 3e96: 99 1f adc r25, r25 - 3e98: 90 93 01 02 sts 0x0201, r25 - 3e9c: 80 93 00 02 sts 0x0200, r24 - 3ea0: 73 c0 rjmp .+230 ; 0x3f88 + uint16_t newAddress; + newAddress = getch(); + 3e7c: 99 d0 rcall .+306 ; 0x3fb0 + newAddress = (newAddress & 0xff) | (getch() << 8); + 3e7e: 08 2f mov r16, r24 + 3e80: 10 e0 ldi r17, 0x00 ; 0 + 3e82: 96 d0 rcall .+300 ; 0x3fb0 + 3e84: 90 e0 ldi r25, 0x00 ; 0 + 3e86: 98 2f mov r25, r24 + 3e88: 88 27 eor r24, r24 + 3e8a: 80 2b or r24, r16 + 3e8c: 91 2b or r25, r17 +#ifdef RAMPZ + // Transfer top bit to RAMPZ + RAMPZ = (newAddress & 0x8000) ? 1 : 0; +#endif + newAddress += newAddress; // Convert from word address to byte address + 3e8e: 88 0f add r24, r24 + 3e90: 99 1f adc r25, r25 + address = newAddress; + 3e92: 90 93 01 02 sts 0x0201, r25 + 3e96: 80 93 00 02 sts 0x0200, r24 + 3e9a: 7e c0 rjmp .+252 ; 0x3f98 verifySpace(); } else if(ch == STK_UNIVERSAL) { - 3ea2: 86 35 cpi r24, 0x56 ; 86 - 3ea4: 29 f4 brne .+10 ; 0x3eb0 + 3e9c: 86 35 cpi r24, 0x56 ; 86 + 3e9e: 29 f4 brne .+10 ; 0x3eaa // UNIVERSAL command is ignored getNch(4); - 3ea6: 84 e0 ldi r24, 0x04 ; 4 - 3ea8: 99 d0 rcall .+306 ; 0x3fdc + 3ea0: 84 e0 ldi r24, 0x04 ; 4 + 3ea2: a4 d0 rcall .+328 ; 0x3fec putch(0x00); - 3eaa: 80 e0 ldi r24, 0x00 ; 0 - 3eac: 71 d0 rcall .+226 ; 0x3f90 - 3eae: 6d c0 rjmp .+218 ; 0x3f8a + 3ea4: 80 e0 ldi r24, 0x00 ; 0 + 3ea6: 7c d0 rcall .+248 ; 0x3fa0 + 3ea8: 78 c0 rjmp .+240 ; 0x3f9a } - /* Write memory, length is big endian and is in bytes */ + /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 3eb0: 84 36 cpi r24, 0x64 ; 100 - 3eb2: 09 f0 breq .+2 ; 0x3eb6 - 3eb4: 43 c0 rjmp .+134 ; 0x3f3c + 3eaa: 84 36 cpi r24, 0x64 ; 100 + 3eac: 09 f0 breq .+2 ; 0x3eb0 + 3eae: 4e c0 rjmp .+156 ; 0x3f4c // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; getLen(); - 3eb6: 7c d0 rcall .+248 ; 0x3fb0 - - // Immediately start page erase - this will 4.5ms - boot_page_erase((uint16_t)(void*)address); - 3eb8: e0 91 00 02 lds r30, 0x0200 - 3ebc: f0 91 01 02 lds r31, 0x0201 - 3ec0: 83 e0 ldi r24, 0x03 ; 3 - 3ec2: 80 93 57 00 sts 0x0057, r24 + 3eb0: 87 d0 rcall .+270 ; 0x3fc0 + + // If we are in RWW section, immediately start page erase + if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 3eb2: e0 91 00 02 lds r30, 0x0200 + 3eb6: f0 91 01 02 lds r31, 0x0201 + 3eba: 88 e3 ldi r24, 0x38 ; 56 + 3ebc: e0 30 cpi r30, 0x00 ; 0 + 3ebe: f8 07 cpc r31, r24 + 3ec0: 18 f4 brcc .+6 ; 0x3ec8 + 3ec2: 83 e0 ldi r24, 0x03 ; 3 + 3ec4: 87 bf out 0x37, r24 ; 55 3ec6: e8 95 spm 3ec8: c0 e0 ldi r28, 0x00 ; 0 3eca: d1 e0 ldi r29, 0x01 ; 1 - + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 3ecc: 69 d0 rcall .+210 ; 0x3fa0 + 3ecc: 71 d0 rcall .+226 ; 0x3fb0 3ece: 89 93 st Y+, r24 while (--length); 3ed0: 80 91 02 02 lds r24, 0x0202 @@ -242,279 +262,293 @@ void watchdogReset() { 3eda: 88 23 and r24, r24 3edc: b9 f7 brne .-18 ; 0x3ecc + // If we are in NRWW section, page erase has to be delayed until now. + // Todo: Take RAMPZ into account + if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 3ede: e0 91 00 02 lds r30, 0x0200 + 3ee2: f0 91 01 02 lds r31, 0x0201 + 3ee6: 88 e3 ldi r24, 0x38 ; 56 + 3ee8: e0 30 cpi r30, 0x00 ; 0 + 3eea: f8 07 cpc r31, r24 + 3eec: 18 f0 brcs .+6 ; 0x3ef4 + 3eee: 83 e0 ldi r24, 0x03 ; 3 + 3ef0: 87 bf out 0x37, r24 ; 55 + 3ef2: e8 95 spm + // Read command terminator, start reply verifySpace(); - 3ede: 78 d0 rcall .+240 ; 0x3fd0 + 3ef4: 75 d0 rcall .+234 ; 0x3fe0 // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 3ee0: 07 b6 in r0, 0x37 ; 55 - 3ee2: 00 fc sbrc r0, 0 - 3ee4: fd cf rjmp .-6 ; 0x3ee0 + 3ef6: 07 b6 in r0, 0x37 ; 55 + 3ef8: 00 fc sbrc r0, 0 + 3efa: fd cf rjmp .-6 ; 0x3ef6 } #endif // Copy buffer into programming buffer bufPtr = buff; addrPtr = (uint16_t)(void*)address; - 3ee6: 40 91 00 02 lds r20, 0x0200 - 3eea: 50 91 01 02 lds r21, 0x0201 - 3eee: a0 e0 ldi r26, 0x00 ; 0 - 3ef0: b1 e0 ldi r27, 0x01 ; 1 + 3efc: 40 91 00 02 lds r20, 0x0200 + 3f00: 50 91 01 02 lds r21, 0x0201 + 3f04: a0 e0 ldi r26, 0x00 ; 0 + 3f06: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 3ef2: 2c 91 ld r18, X - 3ef4: 30 e0 ldi r19, 0x00 ; 0 + 3f08: 2c 91 ld r18, X + 3f0a: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 3ef6: 11 96 adiw r26, 0x01 ; 1 - 3ef8: 8c 91 ld r24, X - 3efa: 11 97 sbiw r26, 0x01 ; 1 - 3efc: 90 e0 ldi r25, 0x00 ; 0 - 3efe: 98 2f mov r25, r24 - 3f00: 88 27 eor r24, r24 - 3f02: 82 2b or r24, r18 - 3f04: 93 2b or r25, r19 -#ifdef VIRTUAL_BOOT_PARTITION -#define rstVect (*(uint16_t*)(0x204)) -#define wdtVect (*(uint16_t*)(0x206)) + 3f0c: 11 96 adiw r26, 0x01 ; 1 + 3f0e: 8c 91 ld r24, X + 3f10: 11 97 sbiw r26, 0x01 ; 1 + 3f12: 90 e0 ldi r25, 0x00 ; 0 + 3f14: 98 2f mov r25, r24 + 3f16: 88 27 eor r24, r24 + 3f18: 82 2b or r24, r18 + 3f1a: 93 2b or r25, r19 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif + /* main program starts here */ int main(void) { - 3f06: 12 96 adiw r26, 0x02 ; 2 + 3f1c: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; - boot_page_fill((uint16_t)(void*)addrPtr,a); - 3f08: fa 01 movw r30, r20 - 3f0a: 0c 01 movw r0, r24 - 3f0c: d0 92 57 00 sts 0x0057, r13 - 3f10: e8 95 spm - 3f12: 11 24 eor r1, r1 + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); + 3f1e: fa 01 movw r30, r20 + 3f20: 0c 01 movw r0, r24 + 3f22: d7 be out 0x37, r13 ; 55 + 3f24: e8 95 spm + 3f26: 11 24 eor r1, r1 addrPtr += 2; - 3f14: 4e 5f subi r20, 0xFE ; 254 - 3f16: 5f 4f sbci r21, 0xFF ; 255 + 3f28: 4e 5f subi r20, 0xFE ; 254 + 3f2a: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 3f18: f1 e0 ldi r31, 0x01 ; 1 - 3f1a: a0 38 cpi r26, 0x80 ; 128 - 3f1c: bf 07 cpc r27, r31 - 3f1e: 49 f7 brne .-46 ; 0x3ef2 + 3f2c: f1 e0 ldi r31, 0x01 ; 1 + 3f2e: a0 38 cpi r26, 0x80 ; 128 + 3f30: bf 07 cpc r27, r31 + 3f32: 51 f7 brne .-44 ; 0x3f08 // Write from programming buffer - boot_page_write((uint16_t)(void*)address); - 3f20: e0 91 00 02 lds r30, 0x0200 - 3f24: f0 91 01 02 lds r31, 0x0201 - 3f28: e0 92 57 00 sts 0x0057, r14 - 3f2c: e8 95 spm + __boot_page_write_short((uint16_t)(void*)address); + 3f34: e0 91 00 02 lds r30, 0x0200 + 3f38: f0 91 01 02 lds r31, 0x0201 + 3f3c: e7 be out 0x37, r14 ; 55 + 3f3e: e8 95 spm boot_spm_busy_wait(); - 3f2e: 07 b6 in r0, 0x37 ; 55 - 3f30: 00 fc sbrc r0, 0 - 3f32: fd cf rjmp .-6 ; 0x3f2e + 3f40: 07 b6 in r0, 0x37 ; 55 + 3f42: 00 fc sbrc r0, 0 + 3f44: fd cf rjmp .-6 ; 0x3f40 #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 3f34: f0 92 57 00 sts 0x0057, r15 - 3f38: e8 95 spm - 3f3a: 27 c0 rjmp .+78 ; 0x3f8a + 3f46: f7 be out 0x37, r15 ; 55 + 3f48: e8 95 spm + 3f4a: 27 c0 rjmp .+78 ; 0x3f9a #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 3f3c: 84 37 cpi r24, 0x74 ; 116 - 3f3e: b9 f4 brne .+46 ; 0x3f6e + 3f4c: 84 37 cpi r24, 0x74 ; 116 + 3f4e: b9 f4 brne .+46 ; 0x3f7e // READ PAGE - we only read flash getLen(); - 3f40: 37 d0 rcall .+110 ; 0x3fb0 + 3f50: 37 d0 rcall .+110 ; 0x3fc0 verifySpace(); - 3f42: 46 d0 rcall .+140 ; 0x3fd0 - else ch = pgm_read_byte_near(address); + 3f52: 46 d0 rcall .+140 ; 0x3fe0 + putch(result); address++; - putch(ch); - } while (--length); + } + while (--length); #else do putch(pgm_read_byte_near(address++)); - 3f44: e0 91 00 02 lds r30, 0x0200 - 3f48: f0 91 01 02 lds r31, 0x0201 - 3f4c: 31 96 adiw r30, 0x01 ; 1 - 3f4e: f0 93 01 02 sts 0x0201, r31 - 3f52: e0 93 00 02 sts 0x0200, r30 - 3f56: 31 97 sbiw r30, 0x01 ; 1 - 3f58: e4 91 lpm r30, Z+ - 3f5a: 8e 2f mov r24, r30 - 3f5c: 19 d0 rcall .+50 ; 0x3f90 + 3f54: e0 91 00 02 lds r30, 0x0200 + 3f58: f0 91 01 02 lds r31, 0x0201 + 3f5c: 31 96 adiw r30, 0x01 ; 1 + 3f5e: f0 93 01 02 sts 0x0201, r31 + 3f62: e0 93 00 02 sts 0x0200, r30 + 3f66: 31 97 sbiw r30, 0x01 ; 1 + 3f68: e4 91 lpm r30, Z+ + 3f6a: 8e 2f mov r24, r30 + 3f6c: 19 d0 rcall .+50 ; 0x3fa0 while (--length); - 3f5e: 80 91 02 02 lds r24, 0x0202 - 3f62: 81 50 subi r24, 0x01 ; 1 - 3f64: 80 93 02 02 sts 0x0202, r24 - 3f68: 88 23 and r24, r24 - 3f6a: 61 f7 brne .-40 ; 0x3f44 - 3f6c: 0e c0 rjmp .+28 ; 0x3f8a + 3f6e: 80 91 02 02 lds r24, 0x0202 + 3f72: 81 50 subi r24, 0x01 ; 1 + 3f74: 80 93 02 02 sts 0x0202, r24 + 3f78: 88 23 and r24, r24 + 3f7a: 61 f7 brne .-40 ; 0x3f54 + 3f7c: 0e c0 rjmp .+28 ; 0x3f9a +#endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 3f6e: 85 37 cpi r24, 0x75 ; 117 - 3f70: 39 f4 brne .+14 ; 0x3f80 + 3f7e: 85 37 cpi r24, 0x75 ; 117 + 3f80: 39 f4 brne .+14 ; 0x3f90 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 3f72: 2e d0 rcall .+92 ; 0x3fd0 + 3f82: 2e d0 rcall .+92 ; 0x3fe0 putch(SIGNATURE_0); - 3f74: 8e e1 ldi r24, 0x1E ; 30 - 3f76: 0c d0 rcall .+24 ; 0x3f90 + 3f84: 8e e1 ldi r24, 0x1E ; 30 + 3f86: 0c d0 rcall .+24 ; 0x3fa0 putch(SIGNATURE_1); - 3f78: 84 e9 ldi r24, 0x94 ; 148 - 3f7a: 0a d0 rcall .+20 ; 0x3f90 + 3f88: 84 e9 ldi r24, 0x94 ; 148 + 3f8a: 0a d0 rcall .+20 ; 0x3fa0 putch(SIGNATURE_2); - 3f7c: 86 e0 ldi r24, 0x06 ; 6 - 3f7e: 96 cf rjmp .-212 ; 0x3eac + 3f8c: 86 e0 ldi r24, 0x06 ; 6 + 3f8e: 8b cf rjmp .-234 ; 0x3ea6 } else if (ch == 'Q') { - 3f80: 81 35 cpi r24, 0x51 ; 81 - 3f82: 11 f4 brne .+4 ; 0x3f88 + 3f90: 81 35 cpi r24, 0x51 ; 81 + 3f92: 11 f4 brne .+4 ; 0x3f98 // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 3f84: 88 e0 ldi r24, 0x08 ; 8 - 3f86: 19 d0 rcall .+50 ; 0x3fba + 3f94: 88 e0 ldi r24, 0x08 ; 8 + 3f96: 19 d0 rcall .+50 ; 0x3fca verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 3f88: 23 d0 rcall .+70 ; 0x3fd0 + 3f98: 23 d0 rcall .+70 ; 0x3fe0 } putch(STK_OK); - 3f8a: 80 e1 ldi r24, 0x10 ; 16 - 3f8c: 01 d0 rcall .+2 ; 0x3f90 - 3f8e: 63 cf rjmp .-314 ; 0x3e56 + 3f9a: 80 e1 ldi r24, 0x10 ; 16 + 3f9c: 01 d0 rcall .+2 ; 0x3fa0 + 3f9e: 5c cf rjmp .-328 ; 0x3e58 -00003f90 : +00003fa0 : } } void putch(char ch) { - 3f90: 98 2f mov r25, r24 + 3fa0: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); - 3f92: 80 91 c0 00 lds r24, 0x00C0 - 3f96: 85 ff sbrs r24, 5 - 3f98: fc cf rjmp .-8 ; 0x3f92 + 3fa2: 80 91 c0 00 lds r24, 0x00C0 + 3fa6: 85 ff sbrs r24, 5 + 3fa8: fc cf rjmp .-8 ; 0x3fa2 UDR0 = ch; - 3f9a: 90 93 c6 00 sts 0x00C6, r25 + 3faa: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 3f9e: 08 95 ret + 3fae: 08 95 ret -00003fa0 : +00003fb0 : return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3fa0: a8 95 wdr + 3fb0: a8 95 wdr [uartBit] "I" (UART_RX_BIT) : "r25" ); #else while(!(UCSR0A & _BV(RXC0))); - 3fa2: 80 91 c0 00 lds r24, 0x00C0 - 3fa6: 87 ff sbrs r24, 7 - 3fa8: fc cf rjmp .-8 ; 0x3fa2 + 3fb2: 80 91 c0 00 lds r24, 0x00C0 + 3fb6: 87 ff sbrs r24, 7 + 3fb8: fc cf rjmp .-8 ; 0x3fb2 ch = UDR0; - 3faa: 80 91 c6 00 lds r24, 0x00C6 -#ifdef LED_DATA_FLASH + 3fba: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); +#endif #endif return ch; } - 3fae: 08 95 ret + 3fbe: 08 95 ret -00003fb0 : +00003fc0 : } while (--count); } #endif uint8_t getLen() { getch(); - 3fb0: f7 df rcall .-18 ; 0x3fa0 + 3fc0: f7 df rcall .-18 ; 0x3fb0 length = getch(); - 3fb2: f6 df rcall .-20 ; 0x3fa0 - 3fb4: 80 93 02 02 sts 0x0202, r24 + 3fc2: f6 df rcall .-20 ; 0x3fb0 + 3fc4: 80 93 02 02 sts 0x0202, r24 return getch(); } - 3fb8: f3 cf rjmp .-26 ; 0x3fa0 + 3fc8: f3 cf rjmp .-26 ; 0x3fb0 -00003fba : +00003fca : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 3fba: e0 e6 ldi r30, 0x60 ; 96 - 3fbc: f0 e0 ldi r31, 0x00 ; 0 - 3fbe: 98 e1 ldi r25, 0x18 ; 24 - 3fc0: 90 83 st Z, r25 + 3fca: e0 e6 ldi r30, 0x60 ; 96 + 3fcc: f0 e0 ldi r31, 0x00 ; 0 + 3fce: 98 e1 ldi r25, 0x18 ; 24 + 3fd0: 90 83 st Z, r25 WDTCSR = x; - 3fc2: 80 83 st Z, r24 + 3fd2: 80 83 st Z, r24 } - 3fc4: 08 95 ret + 3fd4: 08 95 ret -00003fc6 : +00003fd6 : void appStart() { watchdogConfig(WATCHDOG_OFF); - 3fc6: 80 e0 ldi r24, 0x00 ; 0 - 3fc8: f8 df rcall .-16 ; 0x3fba + 3fd6: 80 e0 ldi r24, 0x00 ; 0 + 3fd8: f8 df rcall .-16 ; 0x3fca __asm__ __volatile__ ( - 3fca: ee 27 eor r30, r30 - 3fcc: ff 27 eor r31, r31 - 3fce: 09 94 ijmp + 3fda: ee 27 eor r30, r30 + 3fdc: ff 27 eor r31, r31 + 3fde: 09 94 ijmp -00003fd0 : +00003fe0 : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) appStart(); - 3fd0: e7 df rcall .-50 ; 0x3fa0 - 3fd2: 80 32 cpi r24, 0x20 ; 32 - 3fd4: 09 f0 breq .+2 ; 0x3fd8 - 3fd6: f7 df rcall .-18 ; 0x3fc6 + 3fe0: e7 df rcall .-50 ; 0x3fb0 + 3fe2: 80 32 cpi r24, 0x20 ; 32 + 3fe4: 09 f0 breq .+2 ; 0x3fe8 + 3fe6: f7 df rcall .-18 ; 0x3fd6 putch(STK_INSYNC); - 3fd8: 84 e1 ldi r24, 0x14 ; 20 + 3fe8: 84 e1 ldi r24, 0x14 ; 20 } - 3fda: da cf rjmp .-76 ; 0x3f90 + 3fea: da cf rjmp .-76 ; 0x3fa0 + +00003fec : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 3fdc: 1f 93 push r17 - 3fde: 18 2f mov r17, r24 - -00003fe0 : + 3fec: 1f 93 push r17 + 3fee: 18 2f mov r17, r24 do getch(); while (--count); - 3fe0: df df rcall .-66 ; 0x3fa0 - 3fe2: 11 50 subi r17, 0x01 ; 1 - 3fe4: e9 f7 brne .-6 ; 0x3fe0 + 3ff0: df df rcall .-66 ; 0x3fb0 + 3ff2: 11 50 subi r17, 0x01 ; 1 + 3ff4: e9 f7 brne .-6 ; 0x3ff0 verifySpace(); - 3fe6: f4 df rcall .-24 ; 0x3fd0 + 3ff6: f4 df rcall .-24 ; 0x3fe0 } - 3fe8: 1f 91 pop r17 - 3fea: 08 95 ret + 3ff8: 1f 91 pop r17 + 3ffa: 08 95 ret diff --git a/bootloaders/optiboot/optiboot_lilypad.hex b/bootloaders/optiboot/optiboot_lilypad.hex index 9d31a7a..7579286 100644 --- a/bootloaders/optiboot/optiboot_lilypad.hex +++ b/bootloaders/optiboot/optiboot_lilypad.hex @@ -1,34 +1,34 @@ -:103E000085E08093810084B714BE81FFE4D08DE00B -:103E1000DCD0259A519A86E028E13EEF91E030937C -:103E200085002093840096BBB09BFECF1D9AA89579 -:103E30008150A9F7DD24D394A5E0EA2EF1E1FF2E0D -:103E4000ABD0813421F481E0D1D083E024C082342E -:103E500011F484E103C0853419F485E0C7D08AC029 -:103E60008535A1F499D0082F10E01093010200933A -:103E7000000292D090E0982F8827802B912B880FFA -:103E8000991F909301028093000273C0863529F434 -:103E900084E0ACD080E071D06DC0843609F043C0BE -:103EA0008FD0E0910002F091010283E080935700EF -:103EB000E895C0E0D1E070D08993809102028150F2 -:103EC000809302028823B9F78BD007B600FCFDCFA0 -:103ED0004091000250910102A0E0B1E02C9130E04D -:103EE00011968C91119790E0982F8827822B932B15 -:103EF0001296FA010C01D0925700E89511244E5FFA -:103F00005F4FF1E0A038BF0749F7E0910002F09160 -:103F10000102E0925700E89507B600FCFDCFF09251 -:103F20005700E89527C08437B9F44AD059D0E091BA -:103F30000002F09101023196F0930102E093000239 -:103F40003197E4918E2F19D0809102028150809395 -:103F50000202882361F70EC0853739F441D08EE123 -:103F60000CD084E90AD086E096CF813511F488E040 -:103F70002CD036D080E101D063CF2AE030E08095AC -:103F8000089410F4599802C0599A000015D014D022 -:103F900086952A95B1F70895A89529E030E04899CB -:103FA000FECF0AD009D008D08894489908942A9561 -:103FB00011F08795F7CF089598E09A95F1F7089555 -:103FC000EBDFEADF80930202E7CFE0E6F0E098E182 +:103E0000112484B714BE81FFE6D085E08093810041 +:103E100082E08093C00088E18093C10086E08093B7 +:103E2000C20088E08093C4008EE0CFD0259A86E05F +:103E300028E13EEF91E0309385002093840096BB0B +:103E4000B09BFECF1D9AA8958150A9F7DD24D3948D +:103E5000A5E0EA2EF1E1FF2EABD0813421F481E020 +:103E6000C5D083E020C0823411F484E103C08534DE +:103E700019F485E0BBD091C0853581F499D0082F25 +:103E800010E096D090E0982F8827802B912B880FF8 +:103E9000991F90930102809300027EC0863529F419 +:103EA00084E0A4D080E07CD078C0843609F04EC095 +:103EB00087D0E0910002F091010288E3E030F8073A +:103EC00018F483E087BFE895C0E0D1E071D0899312 +:103ED000809102028150809302028823B9F7E09119 +:103EE0000002F091010288E3E030F80718F083E067 +:103EF00087BFE89575D007B600FCFDCF4091000262 +:103F000050910102A0E0B1E02C9130E011968C912B +:103F1000119790E0982F8827822B932B1296FA0105 +:103F20000C01D7BEE89511244E5F5F4FF1E0A03839 +:103F3000BF0751F7E0910002F0910102E7BEE8955A +:103F400007B600FCFDCFF7BEE89527C08437B9F46B +:103F500037D046D0E0910002F09101023196F09303 +:103F60000102E09300023197E4918E2F19D08091E5 +:103F70000202815080930202882361F70EC08537C8 +:103F800039F42ED08EE10CD084E90AD086E08BCFB4 +:103F9000813511F488E019D023D080E101D05CCFC5 +:103FA000982F8091C00085FFFCCF9093C6000895A4 +:103FB000A8958091C00087FFFCCF8091C60008952E +:103FC000F7DFF6DF80930202F3CFE0E6F0E098E15E :103FD00090838083089580E0F8DFEE27FF2709941F -:103FE000DBDF803209F0F7DF84E1C7CF1F93182FA2 -:0C3FF000D3DF1150E9F7F4DF1F910895B2 +:103FE000E7DF803209F0F7DF84E1DACF1F93182F83 +:0C3FF000DFDF1150E9F7F4DF1F910895A6 :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_lilypad.lst b/bootloaders/optiboot/optiboot_lilypad.lst index 0e46bd1..cbae268 100644 --- a/bootloaders/optiboot/optiboot_lilypad.lst +++ b/bootloaders/optiboot/optiboot_lilypad.lst @@ -7,452 +7,473 @@ Idx Name Size VMA LMA File off Algn CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .debug_aranges 00000028 00000000 00000000 00000250 2**0 CONTENTS, READONLY, DEBUGGING - 2 .debug_pubnames 00000078 00000000 00000000 00000278 2**0 + 2 .debug_pubnames 0000006a 00000000 00000000 00000278 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_info 00000277 00000000 00000000 000002f0 2**0 + 3 .debug_info 00000284 00000000 00000000 000002e2 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_abbrev 00000194 00000000 00000000 00000567 2**0 + 4 .debug_abbrev 000001ae 00000000 00000000 00000566 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_line 000003bb 00000000 00000000 000006fb 2**0 + 5 .debug_line 00000450 00000000 00000000 00000714 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_frame 000000a0 00000000 00000000 00000ab8 2**2 + 6 .debug_frame 00000090 00000000 00000000 00000b64 2**2 CONTENTS, READONLY, DEBUGGING - 7 .debug_str 0000013f 00000000 00000000 00000b58 2**0 + 7 .debug_str 00000141 00000000 00000000 00000bf4 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_loc 000001a0 00000000 00000000 00000c97 2**0 + 8 .debug_loc 000001e1 00000000 00000000 00000d35 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_ranges 00000070 00000000 00000000 00000e37 2**0 + 9 .debug_ranges 00000068 00000000 00000000 00000f16 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: 00003e00
: -#ifdef VIRTUAL_BOOT_PARTITION -#define rstVect (*(uint16_t*)(0x204)) -#define wdtVect (*(uint16_t*)(0x206)) +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif + /* main program starts here */ int main(void) { - 3e00: 85 e0 ldi r24, 0x05 ; 5 - 3e02: 80 93 81 00 sts 0x0081, r24 - UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); + 3e00: 11 24 eor r1, r1 +#ifdef __AVR_ATmega8__ + SP=RAMEND; // This is done by hardware reset #endif // Adaboot no-wait mod ch = MCUSR; - 3e06: 84 b7 in r24, 0x34 ; 52 + 3e02: 84 b7 in r24, 0x34 ; 52 MCUSR = 0; - 3e08: 14 be out 0x34, r1 ; 52 + 3e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); - 3e0a: 81 ff sbrs r24, 1 - 3e0c: e4 d0 rcall .+456 ; 0x3fd6 + 3e06: 81 ff sbrs r24, 1 + 3e08: e6 d0 rcall .+460 ; 0x3fd6 + +#if LED_START_FLASHES > 0 + // Set up Timer 1 for timeout counter + TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 + 3e0a: 85 e0 ldi r24, 0x05 ; 5 + 3e0c: 80 93 81 00 sts 0x0081, r24 + UCSRA = _BV(U2X); //Double speed mode USART + UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx + UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 + UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); +#else + UCSR0A = _BV(U2X0); //Double speed mode USART0 + 3e10: 82 e0 ldi r24, 0x02 ; 2 + 3e12: 80 93 c0 00 sts 0x00C0, r24 + UCSR0B = _BV(RXEN0) | _BV(TXEN0); + 3e16: 88 e1 ldi r24, 0x18 ; 24 + 3e18: 80 93 c1 00 sts 0x00C1, r24 + UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); + 3e1c: 86 e0 ldi r24, 0x06 ; 6 + 3e1e: 80 93 c2 00 sts 0x00C2, r24 + UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); + 3e22: 88 e0 ldi r24, 0x08 ; 8 + 3e24: 80 93 c4 00 sts 0x00C4, r24 +#endif +#endif // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_500MS); - 3e0e: 8d e0 ldi r24, 0x0D ; 13 - 3e10: dc d0 rcall .+440 ; 0x3fca + watchdogConfig(WATCHDOG_1S); + 3e28: 8e e0 ldi r24, 0x0E ; 14 + 3e2a: cf d0 rcall .+414 ; 0x3fca /* Set LED pin as output */ LED_DDR |= _BV(LED); - 3e12: 25 9a sbi 0x04, 5 ; 4 - -#ifdef SOFT_UART - /* Set TX pin as output */ - UART_DDR |= _BV(UART_TX_BIT); - 3e14: 51 9a sbi 0x0a, 1 ; 10 - 3e16: 86 e0 ldi r24, 0x06 ; 6 + 3e2c: 25 9a sbi 0x04, 5 ; 4 + 3e2e: 86 e0 ldi r24, 0x06 ; 6 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 3e18: 28 e1 ldi r18, 0x18 ; 24 - 3e1a: 3e ef ldi r19, 0xFE ; 254 + 3e30: 28 e1 ldi r18, 0x18 ; 24 + 3e32: 3e ef ldi r19, 0xFE ; 254 TIFR1 = _BV(TOV1); - 3e1c: 91 e0 ldi r25, 0x01 ; 1 + 3e34: 91 e0 ldi r25, 0x01 ; 1 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 3e1e: 30 93 85 00 sts 0x0085, r19 - 3e22: 20 93 84 00 sts 0x0084, r18 + 3e36: 30 93 85 00 sts 0x0085, r19 + 3e3a: 20 93 84 00 sts 0x0084, r18 TIFR1 = _BV(TOV1); - 3e26: 96 bb out 0x16, r25 ; 22 + 3e3e: 96 bb out 0x16, r25 ; 22 while(!(TIFR1 & _BV(TOV1))); - 3e28: b0 9b sbis 0x16, 0 ; 22 - 3e2a: fe cf rjmp .-4 ; 0x3e28 + 3e40: b0 9b sbis 0x16, 0 ; 22 + 3e42: fe cf rjmp .-4 ; 0x3e40 +#ifdef __AVR_ATmega8__ + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); - 3e2c: 1d 9a sbi 0x03, 5 ; 3 + 3e44: 1d 9a sbi 0x03, 5 ; 3 return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3e2e: a8 95 wdr - TCNT1 = -(F_CPU/(1024*16)); - TIFR1 = _BV(TOV1); - while(!(TIFR1 & _BV(TOV1))); + 3e46: a8 95 wdr + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); +#endif watchdogReset(); } while (--count); - 3e30: 81 50 subi r24, 0x01 ; 1 - 3e32: a9 f7 brne .-22 ; 0x3e1e + 3e48: 81 50 subi r24, 0x01 ; 1 + 3e4a: a9 f7 brne .-22 ; 0x3e36 /* get character from UART */ ch = getch(); if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 3e34: dd 24 eor r13, r13 - 3e36: d3 94 inc r13 - boot_page_fill((uint16_t)(void*)addrPtr,a); + 3e4c: dd 24 eor r13, r13 + 3e4e: d3 94 inc r13 + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); // Write from programming buffer - boot_page_write((uint16_t)(void*)address); - 3e38: a5 e0 ldi r26, 0x05 ; 5 - 3e3a: ea 2e mov r14, r26 + __boot_page_write_short((uint16_t)(void*)address); + 3e50: a5 e0 ldi r26, 0x05 ; 5 + 3e52: ea 2e mov r14, r26 boot_spm_busy_wait(); #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 3e3c: f1 e1 ldi r31, 0x11 ; 17 - 3e3e: ff 2e mov r15, r31 + 3e54: f1 e1 ldi r31, 0x11 ; 17 + 3e56: ff 2e mov r15, r31 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 3e40: ab d0 rcall .+342 ; 0x3f98 + 3e58: ab d0 rcall .+342 ; 0x3fb0 if(ch == STK_GET_PARAMETER) { - 3e42: 81 34 cpi r24, 0x41 ; 65 - 3e44: 21 f4 brne .+8 ; 0x3e4e + 3e5a: 81 34 cpi r24, 0x41 ; 65 + 3e5c: 21 f4 brne .+8 ; 0x3e66 // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 3e46: 81 e0 ldi r24, 0x01 ; 1 - 3e48: d1 d0 rcall .+418 ; 0x3fec + 3e5e: 81 e0 ldi r24, 0x01 ; 1 + 3e60: c5 d0 rcall .+394 ; 0x3fec putch(0x03); - 3e4a: 83 e0 ldi r24, 0x03 ; 3 - 3e4c: 24 c0 rjmp .+72 ; 0x3e96 + 3e62: 83 e0 ldi r24, 0x03 ; 3 + 3e64: 20 c0 rjmp .+64 ; 0x3ea6 } else if(ch == STK_SET_DEVICE) { - 3e4e: 82 34 cpi r24, 0x42 ; 66 - 3e50: 11 f4 brne .+4 ; 0x3e56 + 3e66: 82 34 cpi r24, 0x42 ; 66 + 3e68: 11 f4 brne .+4 ; 0x3e6e // SET DEVICE is ignored getNch(20); - 3e52: 84 e1 ldi r24, 0x14 ; 20 - 3e54: 03 c0 rjmp .+6 ; 0x3e5c + 3e6a: 84 e1 ldi r24, 0x14 ; 20 + 3e6c: 03 c0 rjmp .+6 ; 0x3e74 } else if(ch == STK_SET_DEVICE_EXT) { - 3e56: 85 34 cpi r24, 0x45 ; 69 - 3e58: 19 f4 brne .+6 ; 0x3e60 + 3e6e: 85 34 cpi r24, 0x45 ; 69 + 3e70: 19 f4 brne .+6 ; 0x3e78 // SET DEVICE EXT is ignored getNch(5); - 3e5a: 85 e0 ldi r24, 0x05 ; 5 - 3e5c: c7 d0 rcall .+398 ; 0x3fec - 3e5e: 8a c0 rjmp .+276 ; 0x3f74 + 3e72: 85 e0 ldi r24, 0x05 ; 5 + 3e74: bb d0 rcall .+374 ; 0x3fec + 3e76: 91 c0 rjmp .+290 ; 0x3f9a } else if(ch == STK_LOAD_ADDRESS) { - 3e60: 85 35 cpi r24, 0x55 ; 85 - 3e62: a1 f4 brne .+40 ; 0x3e8c + 3e78: 85 35 cpi r24, 0x55 ; 85 + 3e7a: 81 f4 brne .+32 ; 0x3e9c // LOAD ADDRESS - address = getch(); - 3e64: 99 d0 rcall .+306 ; 0x3f98 - 3e66: 08 2f mov r16, r24 - 3e68: 10 e0 ldi r17, 0x00 ; 0 - 3e6a: 10 93 01 02 sts 0x0201, r17 - 3e6e: 00 93 00 02 sts 0x0200, r16 - address = (address & 0xff) | (getch() << 8); - 3e72: 92 d0 rcall .+292 ; 0x3f98 - 3e74: 90 e0 ldi r25, 0x00 ; 0 - 3e76: 98 2f mov r25, r24 - 3e78: 88 27 eor r24, r24 - 3e7a: 80 2b or r24, r16 - 3e7c: 91 2b or r25, r17 - address += address; // Convert from word address to byte address - 3e7e: 88 0f add r24, r24 - 3e80: 99 1f adc r25, r25 - 3e82: 90 93 01 02 sts 0x0201, r25 - 3e86: 80 93 00 02 sts 0x0200, r24 - 3e8a: 73 c0 rjmp .+230 ; 0x3f72 + uint16_t newAddress; + newAddress = getch(); + 3e7c: 99 d0 rcall .+306 ; 0x3fb0 + newAddress = (newAddress & 0xff) | (getch() << 8); + 3e7e: 08 2f mov r16, r24 + 3e80: 10 e0 ldi r17, 0x00 ; 0 + 3e82: 96 d0 rcall .+300 ; 0x3fb0 + 3e84: 90 e0 ldi r25, 0x00 ; 0 + 3e86: 98 2f mov r25, r24 + 3e88: 88 27 eor r24, r24 + 3e8a: 80 2b or r24, r16 + 3e8c: 91 2b or r25, r17 +#ifdef RAMPZ + // Transfer top bit to RAMPZ + RAMPZ = (newAddress & 0x8000) ? 1 : 0; +#endif + newAddress += newAddress; // Convert from word address to byte address + 3e8e: 88 0f add r24, r24 + 3e90: 99 1f adc r25, r25 + address = newAddress; + 3e92: 90 93 01 02 sts 0x0201, r25 + 3e96: 80 93 00 02 sts 0x0200, r24 + 3e9a: 7e c0 rjmp .+252 ; 0x3f98 verifySpace(); } else if(ch == STK_UNIVERSAL) { - 3e8c: 86 35 cpi r24, 0x56 ; 86 - 3e8e: 29 f4 brne .+10 ; 0x3e9a + 3e9c: 86 35 cpi r24, 0x56 ; 86 + 3e9e: 29 f4 brne .+10 ; 0x3eaa // UNIVERSAL command is ignored getNch(4); - 3e90: 84 e0 ldi r24, 0x04 ; 4 - 3e92: ac d0 rcall .+344 ; 0x3fec + 3ea0: 84 e0 ldi r24, 0x04 ; 4 + 3ea2: a4 d0 rcall .+328 ; 0x3fec putch(0x00); - 3e94: 80 e0 ldi r24, 0x00 ; 0 - 3e96: 71 d0 rcall .+226 ; 0x3f7a - 3e98: 6d c0 rjmp .+218 ; 0x3f74 + 3ea4: 80 e0 ldi r24, 0x00 ; 0 + 3ea6: 7c d0 rcall .+248 ; 0x3fa0 + 3ea8: 78 c0 rjmp .+240 ; 0x3f9a } - /* Write memory, length is big endian and is in bytes */ + /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 3e9a: 84 36 cpi r24, 0x64 ; 100 - 3e9c: 09 f0 breq .+2 ; 0x3ea0 - 3e9e: 43 c0 rjmp .+134 ; 0x3f26 + 3eaa: 84 36 cpi r24, 0x64 ; 100 + 3eac: 09 f0 breq .+2 ; 0x3eb0 + 3eae: 4e c0 rjmp .+156 ; 0x3f4c // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; getLen(); - 3ea0: 8f d0 rcall .+286 ; 0x3fc0 - - // Immediately start page erase - this will 4.5ms - boot_page_erase((uint16_t)(void*)address); - 3ea2: e0 91 00 02 lds r30, 0x0200 - 3ea6: f0 91 01 02 lds r31, 0x0201 - 3eaa: 83 e0 ldi r24, 0x03 ; 3 - 3eac: 80 93 57 00 sts 0x0057, r24 - 3eb0: e8 95 spm - 3eb2: c0 e0 ldi r28, 0x00 ; 0 - 3eb4: d1 e0 ldi r29, 0x01 ; 1 - + 3eb0: 87 d0 rcall .+270 ; 0x3fc0 + + // If we are in RWW section, immediately start page erase + if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 3eb2: e0 91 00 02 lds r30, 0x0200 + 3eb6: f0 91 01 02 lds r31, 0x0201 + 3eba: 88 e3 ldi r24, 0x38 ; 56 + 3ebc: e0 30 cpi r30, 0x00 ; 0 + 3ebe: f8 07 cpc r31, r24 + 3ec0: 18 f4 brcc .+6 ; 0x3ec8 + 3ec2: 83 e0 ldi r24, 0x03 ; 3 + 3ec4: 87 bf out 0x37, r24 ; 55 + 3ec6: e8 95 spm + 3ec8: c0 e0 ldi r28, 0x00 ; 0 + 3eca: d1 e0 ldi r29, 0x01 ; 1 + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 3eb6: 70 d0 rcall .+224 ; 0x3f98 - 3eb8: 89 93 st Y+, r24 + 3ecc: 71 d0 rcall .+226 ; 0x3fb0 + 3ece: 89 93 st Y+, r24 while (--length); - 3eba: 80 91 02 02 lds r24, 0x0202 - 3ebe: 81 50 subi r24, 0x01 ; 1 - 3ec0: 80 93 02 02 sts 0x0202, r24 - 3ec4: 88 23 and r24, r24 - 3ec6: b9 f7 brne .-18 ; 0x3eb6 + 3ed0: 80 91 02 02 lds r24, 0x0202 + 3ed4: 81 50 subi r24, 0x01 ; 1 + 3ed6: 80 93 02 02 sts 0x0202, r24 + 3eda: 88 23 and r24, r24 + 3edc: b9 f7 brne .-18 ; 0x3ecc + + // If we are in NRWW section, page erase has to be delayed until now. + // Todo: Take RAMPZ into account + if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 3ede: e0 91 00 02 lds r30, 0x0200 + 3ee2: f0 91 01 02 lds r31, 0x0201 + 3ee6: 88 e3 ldi r24, 0x38 ; 56 + 3ee8: e0 30 cpi r30, 0x00 ; 0 + 3eea: f8 07 cpc r31, r24 + 3eec: 18 f0 brcs .+6 ; 0x3ef4 + 3eee: 83 e0 ldi r24, 0x03 ; 3 + 3ef0: 87 bf out 0x37, r24 ; 55 + 3ef2: e8 95 spm // Read command terminator, start reply verifySpace(); - 3ec8: 8b d0 rcall .+278 ; 0x3fe0 + 3ef4: 75 d0 rcall .+234 ; 0x3fe0 // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 3eca: 07 b6 in r0, 0x37 ; 55 - 3ecc: 00 fc sbrc r0, 0 - 3ece: fd cf rjmp .-6 ; 0x3eca + 3ef6: 07 b6 in r0, 0x37 ; 55 + 3ef8: 00 fc sbrc r0, 0 + 3efa: fd cf rjmp .-6 ; 0x3ef6 } #endif // Copy buffer into programming buffer bufPtr = buff; addrPtr = (uint16_t)(void*)address; - 3ed0: 40 91 00 02 lds r20, 0x0200 - 3ed4: 50 91 01 02 lds r21, 0x0201 - 3ed8: a0 e0 ldi r26, 0x00 ; 0 - 3eda: b1 e0 ldi r27, 0x01 ; 1 + 3efc: 40 91 00 02 lds r20, 0x0200 + 3f00: 50 91 01 02 lds r21, 0x0201 + 3f04: a0 e0 ldi r26, 0x00 ; 0 + 3f06: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 3edc: 2c 91 ld r18, X - 3ede: 30 e0 ldi r19, 0x00 ; 0 + 3f08: 2c 91 ld r18, X + 3f0a: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 3ee0: 11 96 adiw r26, 0x01 ; 1 - 3ee2: 8c 91 ld r24, X - 3ee4: 11 97 sbiw r26, 0x01 ; 1 - 3ee6: 90 e0 ldi r25, 0x00 ; 0 - 3ee8: 98 2f mov r25, r24 - 3eea: 88 27 eor r24, r24 - 3eec: 82 2b or r24, r18 - 3eee: 93 2b or r25, r19 -#ifdef VIRTUAL_BOOT_PARTITION -#define rstVect (*(uint16_t*)(0x204)) -#define wdtVect (*(uint16_t*)(0x206)) + 3f0c: 11 96 adiw r26, 0x01 ; 1 + 3f0e: 8c 91 ld r24, X + 3f10: 11 97 sbiw r26, 0x01 ; 1 + 3f12: 90 e0 ldi r25, 0x00 ; 0 + 3f14: 98 2f mov r25, r24 + 3f16: 88 27 eor r24, r24 + 3f18: 82 2b or r24, r18 + 3f1a: 93 2b or r25, r19 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif + /* main program starts here */ int main(void) { - 3ef0: 12 96 adiw r26, 0x02 ; 2 + 3f1c: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; - boot_page_fill((uint16_t)(void*)addrPtr,a); - 3ef2: fa 01 movw r30, r20 - 3ef4: 0c 01 movw r0, r24 - 3ef6: d0 92 57 00 sts 0x0057, r13 - 3efa: e8 95 spm - 3efc: 11 24 eor r1, r1 + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); + 3f1e: fa 01 movw r30, r20 + 3f20: 0c 01 movw r0, r24 + 3f22: d7 be out 0x37, r13 ; 55 + 3f24: e8 95 spm + 3f26: 11 24 eor r1, r1 addrPtr += 2; - 3efe: 4e 5f subi r20, 0xFE ; 254 - 3f00: 5f 4f sbci r21, 0xFF ; 255 + 3f28: 4e 5f subi r20, 0xFE ; 254 + 3f2a: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 3f02: f1 e0 ldi r31, 0x01 ; 1 - 3f04: a0 38 cpi r26, 0x80 ; 128 - 3f06: bf 07 cpc r27, r31 - 3f08: 49 f7 brne .-46 ; 0x3edc + 3f2c: f1 e0 ldi r31, 0x01 ; 1 + 3f2e: a0 38 cpi r26, 0x80 ; 128 + 3f30: bf 07 cpc r27, r31 + 3f32: 51 f7 brne .-44 ; 0x3f08 // Write from programming buffer - boot_page_write((uint16_t)(void*)address); - 3f0a: e0 91 00 02 lds r30, 0x0200 - 3f0e: f0 91 01 02 lds r31, 0x0201 - 3f12: e0 92 57 00 sts 0x0057, r14 - 3f16: e8 95 spm + __boot_page_write_short((uint16_t)(void*)address); + 3f34: e0 91 00 02 lds r30, 0x0200 + 3f38: f0 91 01 02 lds r31, 0x0201 + 3f3c: e7 be out 0x37, r14 ; 55 + 3f3e: e8 95 spm boot_spm_busy_wait(); - 3f18: 07 b6 in r0, 0x37 ; 55 - 3f1a: 00 fc sbrc r0, 0 - 3f1c: fd cf rjmp .-6 ; 0x3f18 + 3f40: 07 b6 in r0, 0x37 ; 55 + 3f42: 00 fc sbrc r0, 0 + 3f44: fd cf rjmp .-6 ; 0x3f40 #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 3f1e: f0 92 57 00 sts 0x0057, r15 - 3f22: e8 95 spm - 3f24: 27 c0 rjmp .+78 ; 0x3f74 + 3f46: f7 be out 0x37, r15 ; 55 + 3f48: e8 95 spm + 3f4a: 27 c0 rjmp .+78 ; 0x3f9a #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 3f26: 84 37 cpi r24, 0x74 ; 116 - 3f28: b9 f4 brne .+46 ; 0x3f58 + 3f4c: 84 37 cpi r24, 0x74 ; 116 + 3f4e: b9 f4 brne .+46 ; 0x3f7e // READ PAGE - we only read flash getLen(); - 3f2a: 4a d0 rcall .+148 ; 0x3fc0 + 3f50: 37 d0 rcall .+110 ; 0x3fc0 verifySpace(); - 3f2c: 59 d0 rcall .+178 ; 0x3fe0 - else ch = pgm_read_byte_near(address); + 3f52: 46 d0 rcall .+140 ; 0x3fe0 + putch(result); address++; - putch(ch); - } while (--length); + } + while (--length); #else do putch(pgm_read_byte_near(address++)); - 3f2e: e0 91 00 02 lds r30, 0x0200 - 3f32: f0 91 01 02 lds r31, 0x0201 - 3f36: 31 96 adiw r30, 0x01 ; 1 - 3f38: f0 93 01 02 sts 0x0201, r31 - 3f3c: e0 93 00 02 sts 0x0200, r30 - 3f40: 31 97 sbiw r30, 0x01 ; 1 - 3f42: e4 91 lpm r30, Z+ - 3f44: 8e 2f mov r24, r30 - 3f46: 19 d0 rcall .+50 ; 0x3f7a + 3f54: e0 91 00 02 lds r30, 0x0200 + 3f58: f0 91 01 02 lds r31, 0x0201 + 3f5c: 31 96 adiw r30, 0x01 ; 1 + 3f5e: f0 93 01 02 sts 0x0201, r31 + 3f62: e0 93 00 02 sts 0x0200, r30 + 3f66: 31 97 sbiw r30, 0x01 ; 1 + 3f68: e4 91 lpm r30, Z+ + 3f6a: 8e 2f mov r24, r30 + 3f6c: 19 d0 rcall .+50 ; 0x3fa0 while (--length); - 3f48: 80 91 02 02 lds r24, 0x0202 - 3f4c: 81 50 subi r24, 0x01 ; 1 - 3f4e: 80 93 02 02 sts 0x0202, r24 - 3f52: 88 23 and r24, r24 - 3f54: 61 f7 brne .-40 ; 0x3f2e - 3f56: 0e c0 rjmp .+28 ; 0x3f74 + 3f6e: 80 91 02 02 lds r24, 0x0202 + 3f72: 81 50 subi r24, 0x01 ; 1 + 3f74: 80 93 02 02 sts 0x0202, r24 + 3f78: 88 23 and r24, r24 + 3f7a: 61 f7 brne .-40 ; 0x3f54 + 3f7c: 0e c0 rjmp .+28 ; 0x3f9a +#endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 3f58: 85 37 cpi r24, 0x75 ; 117 - 3f5a: 39 f4 brne .+14 ; 0x3f6a + 3f7e: 85 37 cpi r24, 0x75 ; 117 + 3f80: 39 f4 brne .+14 ; 0x3f90 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 3f5c: 41 d0 rcall .+130 ; 0x3fe0 + 3f82: 2e d0 rcall .+92 ; 0x3fe0 putch(SIGNATURE_0); - 3f5e: 8e e1 ldi r24, 0x1E ; 30 - 3f60: 0c d0 rcall .+24 ; 0x3f7a + 3f84: 8e e1 ldi r24, 0x1E ; 30 + 3f86: 0c d0 rcall .+24 ; 0x3fa0 putch(SIGNATURE_1); - 3f62: 84 e9 ldi r24, 0x94 ; 148 - 3f64: 0a d0 rcall .+20 ; 0x3f7a + 3f88: 84 e9 ldi r24, 0x94 ; 148 + 3f8a: 0a d0 rcall .+20 ; 0x3fa0 putch(SIGNATURE_2); - 3f66: 86 e0 ldi r24, 0x06 ; 6 - 3f68: 96 cf rjmp .-212 ; 0x3e96 + 3f8c: 86 e0 ldi r24, 0x06 ; 6 + 3f8e: 8b cf rjmp .-234 ; 0x3ea6 } else if (ch == 'Q') { - 3f6a: 81 35 cpi r24, 0x51 ; 81 - 3f6c: 11 f4 brne .+4 ; 0x3f72 + 3f90: 81 35 cpi r24, 0x51 ; 81 + 3f92: 11 f4 brne .+4 ; 0x3f98 // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 3f6e: 88 e0 ldi r24, 0x08 ; 8 - 3f70: 2c d0 rcall .+88 ; 0x3fca + 3f94: 88 e0 ldi r24, 0x08 ; 8 + 3f96: 19 d0 rcall .+50 ; 0x3fca verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 3f72: 36 d0 rcall .+108 ; 0x3fe0 + 3f98: 23 d0 rcall .+70 ; 0x3fe0 } putch(STK_OK); - 3f74: 80 e1 ldi r24, 0x10 ; 16 - 3f76: 01 d0 rcall .+2 ; 0x3f7a - 3f78: 63 cf rjmp .-314 ; 0x3e40 + 3f9a: 80 e1 ldi r24, 0x10 ; 16 + 3f9c: 01 d0 rcall .+2 ; 0x3fa0 + 3f9e: 5c cf rjmp .-328 ; 0x3e58 + +00003fa0 : + } +} -00003f7a : void putch(char ch) { + 3fa0: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); + 3fa2: 80 91 c0 00 lds r24, 0x00C0 + 3fa6: 85 ff sbrs r24, 5 + 3fa8: fc cf rjmp .-8 ; 0x3fa2 UDR0 = ch; -#else - __asm__ __volatile__ ( - 3f7a: 2a e0 ldi r18, 0x0A ; 10 - 3f7c: 30 e0 ldi r19, 0x00 ; 0 - 3f7e: 80 95 com r24 - 3f80: 08 94 sec - 3f82: 10 f4 brcc .+4 ; 0x3f88 - 3f84: 59 98 cbi 0x0b, 1 ; 11 - 3f86: 02 c0 rjmp .+4 ; 0x3f8c - 3f88: 59 9a sbi 0x0b, 1 ; 11 - 3f8a: 00 00 nop - 3f8c: 15 d0 rcall .+42 ; 0x3fb8 - 3f8e: 14 d0 rcall .+40 ; 0x3fb8 - 3f90: 86 95 lsr r24 - 3f92: 2a 95 dec r18 - 3f94: b1 f7 brne .-20 ; 0x3f82 + 3faa: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 3f96: 08 95 ret + 3fae: 08 95 ret -00003f98 : +00003fb0 : return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3f98: a8 95 wdr -#ifdef LED_DATA_FLASH + 3fb0: a8 95 wdr + [uartBit] "I" (UART_RX_BIT) + : + "r25" +); +#else + while(!(UCSR0A & _BV(RXC0))); + 3fb2: 80 91 c0 00 lds r24, 0x00C0 + 3fb6: 87 ff sbrs r24, 7 + 3fb8: fc cf rjmp .-8 ; 0x3fb2 + ch = UDR0; + 3fba: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); +#endif #endif return ch; } - 3f9a: 29 e0 ldi r18, 0x09 ; 9 - 3f9c: 30 e0 ldi r19, 0x00 ; 0 - 3f9e: 48 99 sbic 0x09, 0 ; 9 - 3fa0: fe cf rjmp .-4 ; 0x3f9e - 3fa2: 0a d0 rcall .+20 ; 0x3fb8 - 3fa4: 09 d0 rcall .+18 ; 0x3fb8 - 3fa6: 08 d0 rcall .+16 ; 0x3fb8 - 3fa8: 88 94 clc - 3faa: 48 99 sbic 0x09, 0 ; 9 - 3fac: 08 94 sec - 3fae: 2a 95 dec r18 - 3fb0: 11 f0 breq .+4 ; 0x3fb6 - 3fb2: 87 95 ror r24 - 3fb4: f7 cf rjmp .-18 ; 0x3fa4 - 3fb6: 08 95 ret - -00003fb8 : -#if UART_B_VALUE > 255 -#error Baud rate too slow for soft UART -#endif - -void uartDelay() { - __asm__ __volatile__ ( - 3fb8: 98 e0 ldi r25, 0x08 ; 8 - 3fba: 9a 95 dec r25 - 3fbc: f1 f7 brne .-4 ; 0x3fba 3fbe: 08 95 ret 00003fc0 : @@ -462,13 +483,13 @@ void uartDelay() { uint8_t getLen() { getch(); - 3fc0: eb df rcall .-42 ; 0x3f98 + 3fc0: f7 df rcall .-18 ; 0x3fb0 length = getch(); - 3fc2: ea df rcall .-44 ; 0x3f98 + 3fc2: f6 df rcall .-20 ; 0x3fb0 3fc4: 80 93 02 02 sts 0x0202, r24 return getch(); } - 3fc8: e7 cf rjmp .-50 ; 0x3f98 + 3fc8: f3 cf rjmp .-26 ; 0x3fb0 00003fca : "wdr\n" @@ -504,14 +525,16 @@ void appStart() { void verifySpace() { if (getch() != CRC_EOP) appStart(); - 3fe0: db df rcall .-74 ; 0x3f98 + 3fe0: e7 df rcall .-50 ; 0x3fb0 3fe2: 80 32 cpi r24, 0x20 ; 32 3fe4: 09 f0 breq .+2 ; 0x3fe8 3fe6: f7 df rcall .-18 ; 0x3fd6 putch(STK_INSYNC); 3fe8: 84 e1 ldi r24, 0x14 ; 20 } - 3fea: c7 cf rjmp .-114 ; 0x3f7a + 3fea: da cf rjmp .-76 ; 0x3fa0 + +00003fec : ::[count] "M" (UART_B_VALUE) ); } @@ -520,12 +543,10 @@ void verifySpace() { void getNch(uint8_t count) { 3fec: 1f 93 push r17 3fee: 18 2f mov r17, r24 - -00003ff0 : do getch(); while (--count); - 3ff0: d3 df rcall .-90 ; 0x3f98 + 3ff0: df df rcall .-66 ; 0x3fb0 3ff2: 11 50 subi r17, 0x01 ; 1 - 3ff4: e9 f7 brne .-6 ; 0x3ff0 + 3ff4: e9 f7 brne .-6 ; 0x3ff0 verifySpace(); 3ff6: f4 df rcall .-24 ; 0x3fe0 } diff --git a/bootloaders/optiboot/optiboot_lilypad_resonator.hex b/bootloaders/optiboot/optiboot_lilypad_resonator.hex index 9d31a7a..7579286 100644 --- a/bootloaders/optiboot/optiboot_lilypad_resonator.hex +++ b/bootloaders/optiboot/optiboot_lilypad_resonator.hex @@ -1,34 +1,34 @@ -:103E000085E08093810084B714BE81FFE4D08DE00B -:103E1000DCD0259A519A86E028E13EEF91E030937C -:103E200085002093840096BBB09BFECF1D9AA89579 -:103E30008150A9F7DD24D394A5E0EA2EF1E1FF2E0D -:103E4000ABD0813421F481E0D1D083E024C082342E -:103E500011F484E103C0853419F485E0C7D08AC029 -:103E60008535A1F499D0082F10E01093010200933A -:103E7000000292D090E0982F8827802B912B880FFA -:103E8000991F909301028093000273C0863529F434 -:103E900084E0ACD080E071D06DC0843609F043C0BE -:103EA0008FD0E0910002F091010283E080935700EF -:103EB000E895C0E0D1E070D08993809102028150F2 -:103EC000809302028823B9F78BD007B600FCFDCFA0 -:103ED0004091000250910102A0E0B1E02C9130E04D -:103EE00011968C91119790E0982F8827822B932B15 -:103EF0001296FA010C01D0925700E89511244E5FFA -:103F00005F4FF1E0A038BF0749F7E0910002F09160 -:103F10000102E0925700E89507B600FCFDCFF09251 -:103F20005700E89527C08437B9F44AD059D0E091BA -:103F30000002F09101023196F0930102E093000239 -:103F40003197E4918E2F19D0809102028150809395 -:103F50000202882361F70EC0853739F441D08EE123 -:103F60000CD084E90AD086E096CF813511F488E040 -:103F70002CD036D080E101D063CF2AE030E08095AC -:103F8000089410F4599802C0599A000015D014D022 -:103F900086952A95B1F70895A89529E030E04899CB -:103FA000FECF0AD009D008D08894489908942A9561 -:103FB00011F08795F7CF089598E09A95F1F7089555 -:103FC000EBDFEADF80930202E7CFE0E6F0E098E182 +:103E0000112484B714BE81FFE6D085E08093810041 +:103E100082E08093C00088E18093C10086E08093B7 +:103E2000C20088E08093C4008EE0CFD0259A86E05F +:103E300028E13EEF91E0309385002093840096BB0B +:103E4000B09BFECF1D9AA8958150A9F7DD24D3948D +:103E5000A5E0EA2EF1E1FF2EABD0813421F481E020 +:103E6000C5D083E020C0823411F484E103C08534DE +:103E700019F485E0BBD091C0853581F499D0082F25 +:103E800010E096D090E0982F8827802B912B880FF8 +:103E9000991F90930102809300027EC0863529F419 +:103EA00084E0A4D080E07CD078C0843609F04EC095 +:103EB00087D0E0910002F091010288E3E030F8073A +:103EC00018F483E087BFE895C0E0D1E071D0899312 +:103ED000809102028150809302028823B9F7E09119 +:103EE0000002F091010288E3E030F80718F083E067 +:103EF00087BFE89575D007B600FCFDCF4091000262 +:103F000050910102A0E0B1E02C9130E011968C912B +:103F1000119790E0982F8827822B932B1296FA0105 +:103F20000C01D7BEE89511244E5F5F4FF1E0A03839 +:103F3000BF0751F7E0910002F0910102E7BEE8955A +:103F400007B600FCFDCFF7BEE89527C08437B9F46B +:103F500037D046D0E0910002F09101023196F09303 +:103F60000102E09300023197E4918E2F19D08091E5 +:103F70000202815080930202882361F70EC08537C8 +:103F800039F42ED08EE10CD084E90AD086E08BCFB4 +:103F9000813511F488E019D023D080E101D05CCFC5 +:103FA000982F8091C00085FFFCCF9093C6000895A4 +:103FB000A8958091C00087FFFCCF8091C60008952E +:103FC000F7DFF6DF80930202F3CFE0E6F0E098E15E :103FD00090838083089580E0F8DFEE27FF2709941F -:103FE000DBDF803209F0F7DF84E1C7CF1F93182FA2 -:0C3FF000D3DF1150E9F7F4DF1F910895B2 +:103FE000E7DF803209F0F7DF84E1DACF1F93182F83 +:0C3FF000DFDF1150E9F7F4DF1F910895A6 :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_lilypad_resonator.lst b/bootloaders/optiboot/optiboot_lilypad_resonator.lst index 80ecb83..c5d7710 100644 --- a/bootloaders/optiboot/optiboot_lilypad_resonator.lst +++ b/bootloaders/optiboot/optiboot_lilypad_resonator.lst @@ -7,452 +7,473 @@ Idx Name Size VMA LMA File off Algn CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .debug_aranges 00000028 00000000 00000000 00000250 2**0 CONTENTS, READONLY, DEBUGGING - 2 .debug_pubnames 00000078 00000000 00000000 00000278 2**0 + 2 .debug_pubnames 0000006a 00000000 00000000 00000278 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_info 00000277 00000000 00000000 000002f0 2**0 + 3 .debug_info 00000284 00000000 00000000 000002e2 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_abbrev 00000194 00000000 00000000 00000567 2**0 + 4 .debug_abbrev 000001ae 00000000 00000000 00000566 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_line 000003bb 00000000 00000000 000006fb 2**0 + 5 .debug_line 00000450 00000000 00000000 00000714 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_frame 000000a0 00000000 00000000 00000ab8 2**2 + 6 .debug_frame 00000090 00000000 00000000 00000b64 2**2 CONTENTS, READONLY, DEBUGGING - 7 .debug_str 0000013f 00000000 00000000 00000b58 2**0 + 7 .debug_str 00000141 00000000 00000000 00000bf4 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_loc 000001a0 00000000 00000000 00000c97 2**0 + 8 .debug_loc 000001e1 00000000 00000000 00000d35 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_ranges 00000070 00000000 00000000 00000e37 2**0 + 9 .debug_ranges 00000068 00000000 00000000 00000f16 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: 00003e00
: -#ifdef VIRTUAL_BOOT_PARTITION -#define rstVect (*(uint16_t*)(0x204)) -#define wdtVect (*(uint16_t*)(0x206)) +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif + /* main program starts here */ int main(void) { - 3e00: 85 e0 ldi r24, 0x05 ; 5 - 3e02: 80 93 81 00 sts 0x0081, r24 - UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); + 3e00: 11 24 eor r1, r1 +#ifdef __AVR_ATmega8__ + SP=RAMEND; // This is done by hardware reset #endif // Adaboot no-wait mod ch = MCUSR; - 3e06: 84 b7 in r24, 0x34 ; 52 + 3e02: 84 b7 in r24, 0x34 ; 52 MCUSR = 0; - 3e08: 14 be out 0x34, r1 ; 52 + 3e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); - 3e0a: 81 ff sbrs r24, 1 - 3e0c: e4 d0 rcall .+456 ; 0x3fd6 + 3e06: 81 ff sbrs r24, 1 + 3e08: e6 d0 rcall .+460 ; 0x3fd6 + +#if LED_START_FLASHES > 0 + // Set up Timer 1 for timeout counter + TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 + 3e0a: 85 e0 ldi r24, 0x05 ; 5 + 3e0c: 80 93 81 00 sts 0x0081, r24 + UCSRA = _BV(U2X); //Double speed mode USART + UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx + UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 + UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); +#else + UCSR0A = _BV(U2X0); //Double speed mode USART0 + 3e10: 82 e0 ldi r24, 0x02 ; 2 + 3e12: 80 93 c0 00 sts 0x00C0, r24 + UCSR0B = _BV(RXEN0) | _BV(TXEN0); + 3e16: 88 e1 ldi r24, 0x18 ; 24 + 3e18: 80 93 c1 00 sts 0x00C1, r24 + UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); + 3e1c: 86 e0 ldi r24, 0x06 ; 6 + 3e1e: 80 93 c2 00 sts 0x00C2, r24 + UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); + 3e22: 88 e0 ldi r24, 0x08 ; 8 + 3e24: 80 93 c4 00 sts 0x00C4, r24 +#endif +#endif // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_500MS); - 3e0e: 8d e0 ldi r24, 0x0D ; 13 - 3e10: dc d0 rcall .+440 ; 0x3fca + watchdogConfig(WATCHDOG_1S); + 3e28: 8e e0 ldi r24, 0x0E ; 14 + 3e2a: cf d0 rcall .+414 ; 0x3fca /* Set LED pin as output */ LED_DDR |= _BV(LED); - 3e12: 25 9a sbi 0x04, 5 ; 4 - -#ifdef SOFT_UART - /* Set TX pin as output */ - UART_DDR |= _BV(UART_TX_BIT); - 3e14: 51 9a sbi 0x0a, 1 ; 10 - 3e16: 86 e0 ldi r24, 0x06 ; 6 + 3e2c: 25 9a sbi 0x04, 5 ; 4 + 3e2e: 86 e0 ldi r24, 0x06 ; 6 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 3e18: 28 e1 ldi r18, 0x18 ; 24 - 3e1a: 3e ef ldi r19, 0xFE ; 254 + 3e30: 28 e1 ldi r18, 0x18 ; 24 + 3e32: 3e ef ldi r19, 0xFE ; 254 TIFR1 = _BV(TOV1); - 3e1c: 91 e0 ldi r25, 0x01 ; 1 + 3e34: 91 e0 ldi r25, 0x01 ; 1 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 3e1e: 30 93 85 00 sts 0x0085, r19 - 3e22: 20 93 84 00 sts 0x0084, r18 + 3e36: 30 93 85 00 sts 0x0085, r19 + 3e3a: 20 93 84 00 sts 0x0084, r18 TIFR1 = _BV(TOV1); - 3e26: 96 bb out 0x16, r25 ; 22 + 3e3e: 96 bb out 0x16, r25 ; 22 while(!(TIFR1 & _BV(TOV1))); - 3e28: b0 9b sbis 0x16, 0 ; 22 - 3e2a: fe cf rjmp .-4 ; 0x3e28 + 3e40: b0 9b sbis 0x16, 0 ; 22 + 3e42: fe cf rjmp .-4 ; 0x3e40 +#ifdef __AVR_ATmega8__ + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); - 3e2c: 1d 9a sbi 0x03, 5 ; 3 + 3e44: 1d 9a sbi 0x03, 5 ; 3 return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3e2e: a8 95 wdr - TCNT1 = -(F_CPU/(1024*16)); - TIFR1 = _BV(TOV1); - while(!(TIFR1 & _BV(TOV1))); + 3e46: a8 95 wdr + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); +#endif watchdogReset(); } while (--count); - 3e30: 81 50 subi r24, 0x01 ; 1 - 3e32: a9 f7 brne .-22 ; 0x3e1e + 3e48: 81 50 subi r24, 0x01 ; 1 + 3e4a: a9 f7 brne .-22 ; 0x3e36 /* get character from UART */ ch = getch(); if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 3e34: dd 24 eor r13, r13 - 3e36: d3 94 inc r13 - boot_page_fill((uint16_t)(void*)addrPtr,a); + 3e4c: dd 24 eor r13, r13 + 3e4e: d3 94 inc r13 + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); // Write from programming buffer - boot_page_write((uint16_t)(void*)address); - 3e38: a5 e0 ldi r26, 0x05 ; 5 - 3e3a: ea 2e mov r14, r26 + __boot_page_write_short((uint16_t)(void*)address); + 3e50: a5 e0 ldi r26, 0x05 ; 5 + 3e52: ea 2e mov r14, r26 boot_spm_busy_wait(); #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 3e3c: f1 e1 ldi r31, 0x11 ; 17 - 3e3e: ff 2e mov r15, r31 + 3e54: f1 e1 ldi r31, 0x11 ; 17 + 3e56: ff 2e mov r15, r31 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 3e40: ab d0 rcall .+342 ; 0x3f98 + 3e58: ab d0 rcall .+342 ; 0x3fb0 if(ch == STK_GET_PARAMETER) { - 3e42: 81 34 cpi r24, 0x41 ; 65 - 3e44: 21 f4 brne .+8 ; 0x3e4e + 3e5a: 81 34 cpi r24, 0x41 ; 65 + 3e5c: 21 f4 brne .+8 ; 0x3e66 // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 3e46: 81 e0 ldi r24, 0x01 ; 1 - 3e48: d1 d0 rcall .+418 ; 0x3fec + 3e5e: 81 e0 ldi r24, 0x01 ; 1 + 3e60: c5 d0 rcall .+394 ; 0x3fec putch(0x03); - 3e4a: 83 e0 ldi r24, 0x03 ; 3 - 3e4c: 24 c0 rjmp .+72 ; 0x3e96 + 3e62: 83 e0 ldi r24, 0x03 ; 3 + 3e64: 20 c0 rjmp .+64 ; 0x3ea6 } else if(ch == STK_SET_DEVICE) { - 3e4e: 82 34 cpi r24, 0x42 ; 66 - 3e50: 11 f4 brne .+4 ; 0x3e56 + 3e66: 82 34 cpi r24, 0x42 ; 66 + 3e68: 11 f4 brne .+4 ; 0x3e6e // SET DEVICE is ignored getNch(20); - 3e52: 84 e1 ldi r24, 0x14 ; 20 - 3e54: 03 c0 rjmp .+6 ; 0x3e5c + 3e6a: 84 e1 ldi r24, 0x14 ; 20 + 3e6c: 03 c0 rjmp .+6 ; 0x3e74 } else if(ch == STK_SET_DEVICE_EXT) { - 3e56: 85 34 cpi r24, 0x45 ; 69 - 3e58: 19 f4 brne .+6 ; 0x3e60 + 3e6e: 85 34 cpi r24, 0x45 ; 69 + 3e70: 19 f4 brne .+6 ; 0x3e78 // SET DEVICE EXT is ignored getNch(5); - 3e5a: 85 e0 ldi r24, 0x05 ; 5 - 3e5c: c7 d0 rcall .+398 ; 0x3fec - 3e5e: 8a c0 rjmp .+276 ; 0x3f74 + 3e72: 85 e0 ldi r24, 0x05 ; 5 + 3e74: bb d0 rcall .+374 ; 0x3fec + 3e76: 91 c0 rjmp .+290 ; 0x3f9a } else if(ch == STK_LOAD_ADDRESS) { - 3e60: 85 35 cpi r24, 0x55 ; 85 - 3e62: a1 f4 brne .+40 ; 0x3e8c + 3e78: 85 35 cpi r24, 0x55 ; 85 + 3e7a: 81 f4 brne .+32 ; 0x3e9c // LOAD ADDRESS - address = getch(); - 3e64: 99 d0 rcall .+306 ; 0x3f98 - 3e66: 08 2f mov r16, r24 - 3e68: 10 e0 ldi r17, 0x00 ; 0 - 3e6a: 10 93 01 02 sts 0x0201, r17 - 3e6e: 00 93 00 02 sts 0x0200, r16 - address = (address & 0xff) | (getch() << 8); - 3e72: 92 d0 rcall .+292 ; 0x3f98 - 3e74: 90 e0 ldi r25, 0x00 ; 0 - 3e76: 98 2f mov r25, r24 - 3e78: 88 27 eor r24, r24 - 3e7a: 80 2b or r24, r16 - 3e7c: 91 2b or r25, r17 - address += address; // Convert from word address to byte address - 3e7e: 88 0f add r24, r24 - 3e80: 99 1f adc r25, r25 - 3e82: 90 93 01 02 sts 0x0201, r25 - 3e86: 80 93 00 02 sts 0x0200, r24 - 3e8a: 73 c0 rjmp .+230 ; 0x3f72 + uint16_t newAddress; + newAddress = getch(); + 3e7c: 99 d0 rcall .+306 ; 0x3fb0 + newAddress = (newAddress & 0xff) | (getch() << 8); + 3e7e: 08 2f mov r16, r24 + 3e80: 10 e0 ldi r17, 0x00 ; 0 + 3e82: 96 d0 rcall .+300 ; 0x3fb0 + 3e84: 90 e0 ldi r25, 0x00 ; 0 + 3e86: 98 2f mov r25, r24 + 3e88: 88 27 eor r24, r24 + 3e8a: 80 2b or r24, r16 + 3e8c: 91 2b or r25, r17 +#ifdef RAMPZ + // Transfer top bit to RAMPZ + RAMPZ = (newAddress & 0x8000) ? 1 : 0; +#endif + newAddress += newAddress; // Convert from word address to byte address + 3e8e: 88 0f add r24, r24 + 3e90: 99 1f adc r25, r25 + address = newAddress; + 3e92: 90 93 01 02 sts 0x0201, r25 + 3e96: 80 93 00 02 sts 0x0200, r24 + 3e9a: 7e c0 rjmp .+252 ; 0x3f98 verifySpace(); } else if(ch == STK_UNIVERSAL) { - 3e8c: 86 35 cpi r24, 0x56 ; 86 - 3e8e: 29 f4 brne .+10 ; 0x3e9a + 3e9c: 86 35 cpi r24, 0x56 ; 86 + 3e9e: 29 f4 brne .+10 ; 0x3eaa // UNIVERSAL command is ignored getNch(4); - 3e90: 84 e0 ldi r24, 0x04 ; 4 - 3e92: ac d0 rcall .+344 ; 0x3fec + 3ea0: 84 e0 ldi r24, 0x04 ; 4 + 3ea2: a4 d0 rcall .+328 ; 0x3fec putch(0x00); - 3e94: 80 e0 ldi r24, 0x00 ; 0 - 3e96: 71 d0 rcall .+226 ; 0x3f7a - 3e98: 6d c0 rjmp .+218 ; 0x3f74 + 3ea4: 80 e0 ldi r24, 0x00 ; 0 + 3ea6: 7c d0 rcall .+248 ; 0x3fa0 + 3ea8: 78 c0 rjmp .+240 ; 0x3f9a } - /* Write memory, length is big endian and is in bytes */ + /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 3e9a: 84 36 cpi r24, 0x64 ; 100 - 3e9c: 09 f0 breq .+2 ; 0x3ea0 - 3e9e: 43 c0 rjmp .+134 ; 0x3f26 + 3eaa: 84 36 cpi r24, 0x64 ; 100 + 3eac: 09 f0 breq .+2 ; 0x3eb0 + 3eae: 4e c0 rjmp .+156 ; 0x3f4c // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; getLen(); - 3ea0: 8f d0 rcall .+286 ; 0x3fc0 - - // Immediately start page erase - this will 4.5ms - boot_page_erase((uint16_t)(void*)address); - 3ea2: e0 91 00 02 lds r30, 0x0200 - 3ea6: f0 91 01 02 lds r31, 0x0201 - 3eaa: 83 e0 ldi r24, 0x03 ; 3 - 3eac: 80 93 57 00 sts 0x0057, r24 - 3eb0: e8 95 spm - 3eb2: c0 e0 ldi r28, 0x00 ; 0 - 3eb4: d1 e0 ldi r29, 0x01 ; 1 - + 3eb0: 87 d0 rcall .+270 ; 0x3fc0 + + // If we are in RWW section, immediately start page erase + if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 3eb2: e0 91 00 02 lds r30, 0x0200 + 3eb6: f0 91 01 02 lds r31, 0x0201 + 3eba: 88 e3 ldi r24, 0x38 ; 56 + 3ebc: e0 30 cpi r30, 0x00 ; 0 + 3ebe: f8 07 cpc r31, r24 + 3ec0: 18 f4 brcc .+6 ; 0x3ec8 + 3ec2: 83 e0 ldi r24, 0x03 ; 3 + 3ec4: 87 bf out 0x37, r24 ; 55 + 3ec6: e8 95 spm + 3ec8: c0 e0 ldi r28, 0x00 ; 0 + 3eca: d1 e0 ldi r29, 0x01 ; 1 + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 3eb6: 70 d0 rcall .+224 ; 0x3f98 - 3eb8: 89 93 st Y+, r24 + 3ecc: 71 d0 rcall .+226 ; 0x3fb0 + 3ece: 89 93 st Y+, r24 while (--length); - 3eba: 80 91 02 02 lds r24, 0x0202 - 3ebe: 81 50 subi r24, 0x01 ; 1 - 3ec0: 80 93 02 02 sts 0x0202, r24 - 3ec4: 88 23 and r24, r24 - 3ec6: b9 f7 brne .-18 ; 0x3eb6 + 3ed0: 80 91 02 02 lds r24, 0x0202 + 3ed4: 81 50 subi r24, 0x01 ; 1 + 3ed6: 80 93 02 02 sts 0x0202, r24 + 3eda: 88 23 and r24, r24 + 3edc: b9 f7 brne .-18 ; 0x3ecc + + // If we are in NRWW section, page erase has to be delayed until now. + // Todo: Take RAMPZ into account + if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 3ede: e0 91 00 02 lds r30, 0x0200 + 3ee2: f0 91 01 02 lds r31, 0x0201 + 3ee6: 88 e3 ldi r24, 0x38 ; 56 + 3ee8: e0 30 cpi r30, 0x00 ; 0 + 3eea: f8 07 cpc r31, r24 + 3eec: 18 f0 brcs .+6 ; 0x3ef4 + 3eee: 83 e0 ldi r24, 0x03 ; 3 + 3ef0: 87 bf out 0x37, r24 ; 55 + 3ef2: e8 95 spm // Read command terminator, start reply verifySpace(); - 3ec8: 8b d0 rcall .+278 ; 0x3fe0 + 3ef4: 75 d0 rcall .+234 ; 0x3fe0 // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 3eca: 07 b6 in r0, 0x37 ; 55 - 3ecc: 00 fc sbrc r0, 0 - 3ece: fd cf rjmp .-6 ; 0x3eca + 3ef6: 07 b6 in r0, 0x37 ; 55 + 3ef8: 00 fc sbrc r0, 0 + 3efa: fd cf rjmp .-6 ; 0x3ef6 } #endif // Copy buffer into programming buffer bufPtr = buff; addrPtr = (uint16_t)(void*)address; - 3ed0: 40 91 00 02 lds r20, 0x0200 - 3ed4: 50 91 01 02 lds r21, 0x0201 - 3ed8: a0 e0 ldi r26, 0x00 ; 0 - 3eda: b1 e0 ldi r27, 0x01 ; 1 + 3efc: 40 91 00 02 lds r20, 0x0200 + 3f00: 50 91 01 02 lds r21, 0x0201 + 3f04: a0 e0 ldi r26, 0x00 ; 0 + 3f06: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 3edc: 2c 91 ld r18, X - 3ede: 30 e0 ldi r19, 0x00 ; 0 + 3f08: 2c 91 ld r18, X + 3f0a: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 3ee0: 11 96 adiw r26, 0x01 ; 1 - 3ee2: 8c 91 ld r24, X - 3ee4: 11 97 sbiw r26, 0x01 ; 1 - 3ee6: 90 e0 ldi r25, 0x00 ; 0 - 3ee8: 98 2f mov r25, r24 - 3eea: 88 27 eor r24, r24 - 3eec: 82 2b or r24, r18 - 3eee: 93 2b or r25, r19 -#ifdef VIRTUAL_BOOT_PARTITION -#define rstVect (*(uint16_t*)(0x204)) -#define wdtVect (*(uint16_t*)(0x206)) + 3f0c: 11 96 adiw r26, 0x01 ; 1 + 3f0e: 8c 91 ld r24, X + 3f10: 11 97 sbiw r26, 0x01 ; 1 + 3f12: 90 e0 ldi r25, 0x00 ; 0 + 3f14: 98 2f mov r25, r24 + 3f16: 88 27 eor r24, r24 + 3f18: 82 2b or r24, r18 + 3f1a: 93 2b or r25, r19 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif + /* main program starts here */ int main(void) { - 3ef0: 12 96 adiw r26, 0x02 ; 2 + 3f1c: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; - boot_page_fill((uint16_t)(void*)addrPtr,a); - 3ef2: fa 01 movw r30, r20 - 3ef4: 0c 01 movw r0, r24 - 3ef6: d0 92 57 00 sts 0x0057, r13 - 3efa: e8 95 spm - 3efc: 11 24 eor r1, r1 + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); + 3f1e: fa 01 movw r30, r20 + 3f20: 0c 01 movw r0, r24 + 3f22: d7 be out 0x37, r13 ; 55 + 3f24: e8 95 spm + 3f26: 11 24 eor r1, r1 addrPtr += 2; - 3efe: 4e 5f subi r20, 0xFE ; 254 - 3f00: 5f 4f sbci r21, 0xFF ; 255 + 3f28: 4e 5f subi r20, 0xFE ; 254 + 3f2a: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 3f02: f1 e0 ldi r31, 0x01 ; 1 - 3f04: a0 38 cpi r26, 0x80 ; 128 - 3f06: bf 07 cpc r27, r31 - 3f08: 49 f7 brne .-46 ; 0x3edc + 3f2c: f1 e0 ldi r31, 0x01 ; 1 + 3f2e: a0 38 cpi r26, 0x80 ; 128 + 3f30: bf 07 cpc r27, r31 + 3f32: 51 f7 brne .-44 ; 0x3f08 // Write from programming buffer - boot_page_write((uint16_t)(void*)address); - 3f0a: e0 91 00 02 lds r30, 0x0200 - 3f0e: f0 91 01 02 lds r31, 0x0201 - 3f12: e0 92 57 00 sts 0x0057, r14 - 3f16: e8 95 spm + __boot_page_write_short((uint16_t)(void*)address); + 3f34: e0 91 00 02 lds r30, 0x0200 + 3f38: f0 91 01 02 lds r31, 0x0201 + 3f3c: e7 be out 0x37, r14 ; 55 + 3f3e: e8 95 spm boot_spm_busy_wait(); - 3f18: 07 b6 in r0, 0x37 ; 55 - 3f1a: 00 fc sbrc r0, 0 - 3f1c: fd cf rjmp .-6 ; 0x3f18 + 3f40: 07 b6 in r0, 0x37 ; 55 + 3f42: 00 fc sbrc r0, 0 + 3f44: fd cf rjmp .-6 ; 0x3f40 #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 3f1e: f0 92 57 00 sts 0x0057, r15 - 3f22: e8 95 spm - 3f24: 27 c0 rjmp .+78 ; 0x3f74 + 3f46: f7 be out 0x37, r15 ; 55 + 3f48: e8 95 spm + 3f4a: 27 c0 rjmp .+78 ; 0x3f9a #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 3f26: 84 37 cpi r24, 0x74 ; 116 - 3f28: b9 f4 brne .+46 ; 0x3f58 + 3f4c: 84 37 cpi r24, 0x74 ; 116 + 3f4e: b9 f4 brne .+46 ; 0x3f7e // READ PAGE - we only read flash getLen(); - 3f2a: 4a d0 rcall .+148 ; 0x3fc0 + 3f50: 37 d0 rcall .+110 ; 0x3fc0 verifySpace(); - 3f2c: 59 d0 rcall .+178 ; 0x3fe0 - else ch = pgm_read_byte_near(address); + 3f52: 46 d0 rcall .+140 ; 0x3fe0 + putch(result); address++; - putch(ch); - } while (--length); + } + while (--length); #else do putch(pgm_read_byte_near(address++)); - 3f2e: e0 91 00 02 lds r30, 0x0200 - 3f32: f0 91 01 02 lds r31, 0x0201 - 3f36: 31 96 adiw r30, 0x01 ; 1 - 3f38: f0 93 01 02 sts 0x0201, r31 - 3f3c: e0 93 00 02 sts 0x0200, r30 - 3f40: 31 97 sbiw r30, 0x01 ; 1 - 3f42: e4 91 lpm r30, Z+ - 3f44: 8e 2f mov r24, r30 - 3f46: 19 d0 rcall .+50 ; 0x3f7a + 3f54: e0 91 00 02 lds r30, 0x0200 + 3f58: f0 91 01 02 lds r31, 0x0201 + 3f5c: 31 96 adiw r30, 0x01 ; 1 + 3f5e: f0 93 01 02 sts 0x0201, r31 + 3f62: e0 93 00 02 sts 0x0200, r30 + 3f66: 31 97 sbiw r30, 0x01 ; 1 + 3f68: e4 91 lpm r30, Z+ + 3f6a: 8e 2f mov r24, r30 + 3f6c: 19 d0 rcall .+50 ; 0x3fa0 while (--length); - 3f48: 80 91 02 02 lds r24, 0x0202 - 3f4c: 81 50 subi r24, 0x01 ; 1 - 3f4e: 80 93 02 02 sts 0x0202, r24 - 3f52: 88 23 and r24, r24 - 3f54: 61 f7 brne .-40 ; 0x3f2e - 3f56: 0e c0 rjmp .+28 ; 0x3f74 + 3f6e: 80 91 02 02 lds r24, 0x0202 + 3f72: 81 50 subi r24, 0x01 ; 1 + 3f74: 80 93 02 02 sts 0x0202, r24 + 3f78: 88 23 and r24, r24 + 3f7a: 61 f7 brne .-40 ; 0x3f54 + 3f7c: 0e c0 rjmp .+28 ; 0x3f9a +#endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 3f58: 85 37 cpi r24, 0x75 ; 117 - 3f5a: 39 f4 brne .+14 ; 0x3f6a + 3f7e: 85 37 cpi r24, 0x75 ; 117 + 3f80: 39 f4 brne .+14 ; 0x3f90 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 3f5c: 41 d0 rcall .+130 ; 0x3fe0 + 3f82: 2e d0 rcall .+92 ; 0x3fe0 putch(SIGNATURE_0); - 3f5e: 8e e1 ldi r24, 0x1E ; 30 - 3f60: 0c d0 rcall .+24 ; 0x3f7a + 3f84: 8e e1 ldi r24, 0x1E ; 30 + 3f86: 0c d0 rcall .+24 ; 0x3fa0 putch(SIGNATURE_1); - 3f62: 84 e9 ldi r24, 0x94 ; 148 - 3f64: 0a d0 rcall .+20 ; 0x3f7a + 3f88: 84 e9 ldi r24, 0x94 ; 148 + 3f8a: 0a d0 rcall .+20 ; 0x3fa0 putch(SIGNATURE_2); - 3f66: 86 e0 ldi r24, 0x06 ; 6 - 3f68: 96 cf rjmp .-212 ; 0x3e96 + 3f8c: 86 e0 ldi r24, 0x06 ; 6 + 3f8e: 8b cf rjmp .-234 ; 0x3ea6 } else if (ch == 'Q') { - 3f6a: 81 35 cpi r24, 0x51 ; 81 - 3f6c: 11 f4 brne .+4 ; 0x3f72 + 3f90: 81 35 cpi r24, 0x51 ; 81 + 3f92: 11 f4 brne .+4 ; 0x3f98 // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 3f6e: 88 e0 ldi r24, 0x08 ; 8 - 3f70: 2c d0 rcall .+88 ; 0x3fca + 3f94: 88 e0 ldi r24, 0x08 ; 8 + 3f96: 19 d0 rcall .+50 ; 0x3fca verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 3f72: 36 d0 rcall .+108 ; 0x3fe0 + 3f98: 23 d0 rcall .+70 ; 0x3fe0 } putch(STK_OK); - 3f74: 80 e1 ldi r24, 0x10 ; 16 - 3f76: 01 d0 rcall .+2 ; 0x3f7a - 3f78: 63 cf rjmp .-314 ; 0x3e40 + 3f9a: 80 e1 ldi r24, 0x10 ; 16 + 3f9c: 01 d0 rcall .+2 ; 0x3fa0 + 3f9e: 5c cf rjmp .-328 ; 0x3e58 + +00003fa0 : + } +} -00003f7a : void putch(char ch) { + 3fa0: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); + 3fa2: 80 91 c0 00 lds r24, 0x00C0 + 3fa6: 85 ff sbrs r24, 5 + 3fa8: fc cf rjmp .-8 ; 0x3fa2 UDR0 = ch; -#else - __asm__ __volatile__ ( - 3f7a: 2a e0 ldi r18, 0x0A ; 10 - 3f7c: 30 e0 ldi r19, 0x00 ; 0 - 3f7e: 80 95 com r24 - 3f80: 08 94 sec - 3f82: 10 f4 brcc .+4 ; 0x3f88 - 3f84: 59 98 cbi 0x0b, 1 ; 11 - 3f86: 02 c0 rjmp .+4 ; 0x3f8c - 3f88: 59 9a sbi 0x0b, 1 ; 11 - 3f8a: 00 00 nop - 3f8c: 15 d0 rcall .+42 ; 0x3fb8 - 3f8e: 14 d0 rcall .+40 ; 0x3fb8 - 3f90: 86 95 lsr r24 - 3f92: 2a 95 dec r18 - 3f94: b1 f7 brne .-20 ; 0x3f82 + 3faa: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 3f96: 08 95 ret + 3fae: 08 95 ret -00003f98 : +00003fb0 : return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3f98: a8 95 wdr -#ifdef LED_DATA_FLASH + 3fb0: a8 95 wdr + [uartBit] "I" (UART_RX_BIT) + : + "r25" +); +#else + while(!(UCSR0A & _BV(RXC0))); + 3fb2: 80 91 c0 00 lds r24, 0x00C0 + 3fb6: 87 ff sbrs r24, 7 + 3fb8: fc cf rjmp .-8 ; 0x3fb2 + ch = UDR0; + 3fba: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); +#endif #endif return ch; } - 3f9a: 29 e0 ldi r18, 0x09 ; 9 - 3f9c: 30 e0 ldi r19, 0x00 ; 0 - 3f9e: 48 99 sbic 0x09, 0 ; 9 - 3fa0: fe cf rjmp .-4 ; 0x3f9e - 3fa2: 0a d0 rcall .+20 ; 0x3fb8 - 3fa4: 09 d0 rcall .+18 ; 0x3fb8 - 3fa6: 08 d0 rcall .+16 ; 0x3fb8 - 3fa8: 88 94 clc - 3faa: 48 99 sbic 0x09, 0 ; 9 - 3fac: 08 94 sec - 3fae: 2a 95 dec r18 - 3fb0: 11 f0 breq .+4 ; 0x3fb6 - 3fb2: 87 95 ror r24 - 3fb4: f7 cf rjmp .-18 ; 0x3fa4 - 3fb6: 08 95 ret - -00003fb8 : -#if UART_B_VALUE > 255 -#error Baud rate too slow for soft UART -#endif - -void uartDelay() { - __asm__ __volatile__ ( - 3fb8: 98 e0 ldi r25, 0x08 ; 8 - 3fba: 9a 95 dec r25 - 3fbc: f1 f7 brne .-4 ; 0x3fba 3fbe: 08 95 ret 00003fc0 : @@ -462,13 +483,13 @@ void uartDelay() { uint8_t getLen() { getch(); - 3fc0: eb df rcall .-42 ; 0x3f98 + 3fc0: f7 df rcall .-18 ; 0x3fb0 length = getch(); - 3fc2: ea df rcall .-44 ; 0x3f98 + 3fc2: f6 df rcall .-20 ; 0x3fb0 3fc4: 80 93 02 02 sts 0x0202, r24 return getch(); } - 3fc8: e7 cf rjmp .-50 ; 0x3f98 + 3fc8: f3 cf rjmp .-26 ; 0x3fb0 00003fca : "wdr\n" @@ -504,14 +525,16 @@ void appStart() { void verifySpace() { if (getch() != CRC_EOP) appStart(); - 3fe0: db df rcall .-74 ; 0x3f98 + 3fe0: e7 df rcall .-50 ; 0x3fb0 3fe2: 80 32 cpi r24, 0x20 ; 32 3fe4: 09 f0 breq .+2 ; 0x3fe8 3fe6: f7 df rcall .-18 ; 0x3fd6 putch(STK_INSYNC); 3fe8: 84 e1 ldi r24, 0x14 ; 20 } - 3fea: c7 cf rjmp .-114 ; 0x3f7a + 3fea: da cf rjmp .-76 ; 0x3fa0 + +00003fec : ::[count] "M" (UART_B_VALUE) ); } @@ -520,12 +543,10 @@ void verifySpace() { void getNch(uint8_t count) { 3fec: 1f 93 push r17 3fee: 18 2f mov r17, r24 - -00003ff0 : do getch(); while (--count); - 3ff0: d3 df rcall .-90 ; 0x3f98 + 3ff0: df df rcall .-66 ; 0x3fb0 3ff2: 11 50 subi r17, 0x01 ; 1 - 3ff4: e9 f7 brne .-6 ; 0x3ff0 + 3ff4: e9 f7 brne .-6 ; 0x3ff0 verifySpace(); 3ff6: f4 df rcall .-24 ; 0x3fe0 } diff --git a/bootloaders/optiboot/optiboot_luminet.hex b/bootloaders/optiboot/optiboot_luminet.hex index 0e51124..3ad3c0a 100644 --- a/bootloaders/optiboot/optiboot_luminet.hex +++ b/bootloaders/optiboot/optiboot_luminet.hex @@ -1,42 +1,42 @@ -:101D000085E08EBD84B714BE81FF27D18DE021D13F -:101D1000D49AD29A86E023EC3FEF91E03DBD2CBDF2 -:101D20009BB9589BFECFCC9AA8958150B9F7CC248B -:101D3000C39485E0E82E0FE7D02E1EECF12EF0D0F4 -:101D4000813421F481E014D183E024C0823411F481 -:101D500084E103C0853419F485E00AD1CFC085350C -:101D6000A1F4DED0082F10E01093010200930002CE -:101D7000D7D090E0982F8827802B912B880F991F20 -:101D80009093010280930002B8C0863529F484E064 -:101D9000EFD080E0B6D0B2C0843609F06EC0D4D0A7 -:101DA000E0910002F091010283E080935700E895F2 -:101DB000C0E0D1E0B5D08993809102028150809338 -:101DC00002028823B9F7CED007B600FCFDCF809180 -:101DD000000290910102892B41F580910001209130 -:101DE000010130E0322F222790E0282B392B30934D -:101DF00005022093040240910A0180910B0190E0BA -:101E0000982F882750E0842B952B9093070280937E -:101E100006022450304020930A01232F33272093B9 -:101E20000B01D0920001F09201014091000250910B -:101E30000102A0E0B1E02C9130E011968C91119755 -:101E400090E0982F8827822B932B1296FA010C0191 -:101E5000C0925700E89511244E5F5F4FF1E0A03427 -:101E6000BF0749F7E0910002F0910102E0925700AC -:101E7000E89507B600FCFDCF41C0843789F564D0F2 -:101E800071D0E0910002F0910102309719F4209195 -:101E9000040213C0E130F10519F4209105020DC0D0 -:101EA000EA30F10519F42091060207C0EB30F10584 -:101EB00019F42091070201C02491809100029091B1 -:101EC000010201969093010280930002822F19D0A3 -:101ED00080910202815080930202882391F60EC005 -:101EE000853739F43FD08EE10CD083E90AD08CE0FD -:101EF00051CF813511F488E02CD034D080E101D06D -:101F00001ECF2AE030E08095089410F4DA9802C0E1 -:101F1000DA9A000015D014D086952A95B1F7089565 -:101F2000A89529E030E0CB99FECF0AD009D008D09F -:101F30008894CB9908942A9511F08795F7CF089546 -:101F40009EE09A95F1F70895EBDFEADF80930202B5 -:101F5000E7CF98E191BD81BD089580E0FADFE5E02B -:101F6000FF270994DDDF803209F0F7DF84E1C9CF74 -:101F70001F93182FD5DF1150E9F7F4DF1F91089553 +:101D0000112484B714BE81FF22D185E08EBD8EE000 +:101D10001AD1D49AD29A86E023EC3FEF91E03DBDF0 +:101D20002CBD9BB9589BFECFCC9AA8958150B9F792 +:101D3000DD24D39485E0C82E0FE7F02E1EECE12EB3 +:101D4000E9D0813421F481E00DD183E020C08234D8 +:101D500011F484E103C0853419F485E003D1C8C0CF +:101D6000853581F4D7D0082F10E0D4D090E0982F9B +:101D70008827802B912B880F991F90938101809346 +:101D80008001B5C0863529F484E0ECD080E0B3D082 +:101D9000AFC0843609F06BC0D1D0C0E0D1E0BAD07A +:101DA0008993809182018150809382018823B9F7C1 +:101DB000E0918001F091810183E087BFE895CCD06C +:101DC00007B600FCFDCF8091800190918101892BA5 +:101DD00041F5809100012091010130E0322F22274E +:101DE00090E0282B392B309385012093840140917A +:101DF00008018091090190E0982F882750E0842BFA +:101E0000952B909387018093860124503040209336 +:101E10000801232F332720930901F0920001E0925B +:101E200001014091800150918101A0E0B1E02C912D +:101E300030E011968C91119790E0982F8827822B93 +:101E4000932B1296FA010C01D7BEE89511244E5F30 +:101E50005F4FF1E0A034BF0751F7E0918001F091AE +:101E60008101C7BEE89507B600FCFDCF41C08437AD +:101E700089F564D071D0E0918001F09181013097B3 +:101E800019F42091840113C0E130F10519F4209177 +:101E900085010DC0E830F10519F42091860107C0D5 +:101EA000E930F10519F42091870101C02491809156 +:101EB000800190918101019690938101809380012E +:101EC000822F19D0809182018150809382018823D2 +:101ED00091F60EC0853739F43FD08EE10CD083E9FE +:101EE0000AD08CE054CF813511F488E02CD034D066 +:101EF00080E101D025CF2AE030E08095089410F4ED +:101F0000DA9802C0DA9A000015D014D086952A9586 +:101F1000B1F70895A89529E030E0CB99FECF0AD01B +:101F200009D008D08894CB9908942A9511F0879508 +:101F3000F7CF08959EE09A95F1F70895EBDFEADF79 +:101F400080938201E7CF98E191BD81BD089580E043 +:101F5000FADFE4E0FF270994DDDF803209F0F7DFE4 +:101F600084E1C9CF1F93182FD5DF1150E9F7F4DFB3 +:041F70001F91089520 :0400000300001D00DC :00000001FF diff --git a/bootloaders/optiboot/optiboot_luminet.lst b/bootloaders/optiboot/optiboot_luminet.lst index 59468cb..737d2c5 100644 --- a/bootloaders/optiboot/optiboot_luminet.lst +++ b/bootloaders/optiboot/optiboot_luminet.lst @@ -3,602 +3,620 @@ optiboot_luminet.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 00000280 00001d00 00001d00 00000054 2**1 + 0 .text 00000274 00001d00 00001d00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .debug_aranges 00000028 00000000 00000000 000002d4 2**0 + 1 .debug_aranges 00000028 00000000 00000000 000002c8 2**0 CONTENTS, READONLY, DEBUGGING - 2 .debug_pubnames 00000078 00000000 00000000 000002fc 2**0 + 2 .debug_pubnames 00000078 00000000 00000000 000002f0 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_info 00000289 00000000 00000000 00000374 2**0 + 3 .debug_info 000002a4 00000000 00000000 00000368 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_abbrev 000001a1 00000000 00000000 000005fd 2**0 + 4 .debug_abbrev 000001ac 00000000 00000000 0000060c 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_line 00000435 00000000 00000000 0000079e 2**0 + 5 .debug_line 000004a9 00000000 00000000 000007b8 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_frame 000000a0 00000000 00000000 00000bd4 2**2 + 6 .debug_frame 000000a0 00000000 00000000 00000c64 2**2 CONTENTS, READONLY, DEBUGGING - 7 .debug_str 00000144 00000000 00000000 00000c74 2**0 + 7 .debug_str 00000150 00000000 00000000 00000d04 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_loc 00000194 00000000 00000000 00000db8 2**0 + 8 .debug_loc 00000194 00000000 00000000 00000e54 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_ranges 00000088 00000000 00000000 00000f4c 2**0 + 9 .debug_ranges 00000088 00000000 00000000 00000fe8 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: 00001d00
: -#ifdef VIRTUAL_BOOT_PARTITION -#define rstVect (*(uint16_t*)(0x204)) -#define wdtVect (*(uint16_t*)(0x206)) +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif + /* main program starts here */ int main(void) { - 1d00: 85 e0 ldi r24, 0x05 ; 5 - 1d02: 8e bd out 0x2e, r24 ; 46 - UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); + 1d00: 11 24 eor r1, r1 +#ifdef __AVR_ATmega8__ + SP=RAMEND; // This is done by hardware reset #endif // Adaboot no-wait mod ch = MCUSR; - 1d04: 84 b7 in r24, 0x34 ; 52 + 1d02: 84 b7 in r24, 0x34 ; 52 MCUSR = 0; - 1d06: 14 be out 0x34, r1 ; 52 + 1d04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); - 1d08: 81 ff sbrs r24, 1 - 1d0a: 27 d1 rcall .+590 ; 0x1f5a + 1d06: 81 ff sbrs r24, 1 + 1d08: 22 d1 rcall .+580 ; 0x1f4e + +#if LED_START_FLASHES > 0 + // Set up Timer 1 for timeout counter + TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 + 1d0a: 85 e0 ldi r24, 0x05 ; 5 + 1d0c: 8e bd out 0x2e, r24 ; 46 + UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); +#endif +#endif // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_500MS); - 1d0c: 8d e0 ldi r24, 0x0D ; 13 - 1d0e: 21 d1 rcall .+578 ; 0x1f52 + watchdogConfig(WATCHDOG_1S); + 1d0e: 8e e0 ldi r24, 0x0E ; 14 + 1d10: 1a d1 rcall .+564 ; 0x1f46 /* Set LED pin as output */ LED_DDR |= _BV(LED); - 1d10: d4 9a sbi 0x1a, 4 ; 26 + 1d12: d4 9a sbi 0x1a, 4 ; 26 #ifdef SOFT_UART /* Set TX pin as output */ UART_DDR |= _BV(UART_TX_BIT); - 1d12: d2 9a sbi 0x1a, 2 ; 26 - 1d14: 86 e0 ldi r24, 0x06 ; 6 + 1d14: d2 9a sbi 0x1a, 2 ; 26 + 1d16: 86 e0 ldi r24, 0x06 ; 6 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 1d16: 23 ec ldi r18, 0xC3 ; 195 - 1d18: 3f ef ldi r19, 0xFF ; 255 + 1d18: 23 ec ldi r18, 0xC3 ; 195 + 1d1a: 3f ef ldi r19, 0xFF ; 255 TIFR1 = _BV(TOV1); - 1d1a: 91 e0 ldi r25, 0x01 ; 1 + 1d1c: 91 e0 ldi r25, 0x01 ; 1 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 1d1c: 3d bd out 0x2d, r19 ; 45 - 1d1e: 2c bd out 0x2c, r18 ; 44 + 1d1e: 3d bd out 0x2d, r19 ; 45 + 1d20: 2c bd out 0x2c, r18 ; 44 TIFR1 = _BV(TOV1); - 1d20: 9b b9 out 0x0b, r25 ; 11 + 1d22: 9b b9 out 0x0b, r25 ; 11 while(!(TIFR1 & _BV(TOV1))); - 1d22: 58 9b sbis 0x0b, 0 ; 11 - 1d24: fe cf rjmp .-4 ; 0x1d22 + 1d24: 58 9b sbis 0x0b, 0 ; 11 + 1d26: fe cf rjmp .-4 ; 0x1d24 +#ifdef __AVR_ATmega8__ + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); - 1d26: cc 9a sbi 0x19, 4 ; 25 + 1d28: cc 9a sbi 0x19, 4 ; 25 return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 1d28: a8 95 wdr - TCNT1 = -(F_CPU/(1024*16)); - TIFR1 = _BV(TOV1); - while(!(TIFR1 & _BV(TOV1))); + 1d2a: a8 95 wdr + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); +#endif watchdogReset(); } while (--count); - 1d2a: 81 50 subi r24, 0x01 ; 1 - 1d2c: b9 f7 brne .-18 ; 0x1d1c + 1d2c: 81 50 subi r24, 0x01 ; 1 + 1d2e: b9 f7 brne .-18 ; 0x1d1e /* get character from UART */ ch = getch(); if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 1d2e: cc 24 eor r12, r12 - 1d30: c3 94 inc r12 - boot_page_fill((uint16_t)(void*)addrPtr,a); + 1d30: dd 24 eor r13, r13 + 1d32: d3 94 inc r13 + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); // Write from programming buffer - boot_page_write((uint16_t)(void*)address); - 1d32: 85 e0 ldi r24, 0x05 ; 5 - 1d34: e8 2e mov r14, r24 + __boot_page_write_short((uint16_t)(void*)address); + 1d34: 85 e0 ldi r24, 0x05 ; 5 + 1d36: c8 2e mov r12, r24 vect -= 4; // Instruction is a relative jump (rjmp), so recalculate. - buff[10] = vect & 0xff; - buff[11] = vect >> 8; + buff[8] = vect & 0xff; + buff[9] = vect >> 8; // Add jump to bootloader at RESET vector buff[0] = 0x7f; - 1d36: 0f e7 ldi r16, 0x7F ; 127 - 1d38: d0 2e mov r13, r16 + 1d38: 0f e7 ldi r16, 0x7F ; 127 + 1d3a: f0 2e mov r15, r16 buff[1] = 0xce; // rjmp 0x1d00 instruction - 1d3a: 1e ec ldi r17, 0xCE ; 206 - 1d3c: f1 2e mov r15, r17 + 1d3c: 1e ec ldi r17, 0xCE ; 206 + 1d3e: e1 2e mov r14, r17 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 1d3e: f0 d0 rcall .+480 ; 0x1f20 + 1d40: e9 d0 rcall .+466 ; 0x1f14 if(ch == STK_GET_PARAMETER) { - 1d40: 81 34 cpi r24, 0x41 ; 65 - 1d42: 21 f4 brne .+8 ; 0x1d4c + 1d42: 81 34 cpi r24, 0x41 ; 65 + 1d44: 21 f4 brne .+8 ; 0x1d4e // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 1d44: 81 e0 ldi r24, 0x01 ; 1 - 1d46: 14 d1 rcall .+552 ; 0x1f70 + 1d46: 81 e0 ldi r24, 0x01 ; 1 + 1d48: 0d d1 rcall .+538 ; 0x1f64 putch(0x03); - 1d48: 83 e0 ldi r24, 0x03 ; 3 - 1d4a: 24 c0 rjmp .+72 ; 0x1d94 + 1d4a: 83 e0 ldi r24, 0x03 ; 3 + 1d4c: 20 c0 rjmp .+64 ; 0x1d8e } else if(ch == STK_SET_DEVICE) { - 1d4c: 82 34 cpi r24, 0x42 ; 66 - 1d4e: 11 f4 brne .+4 ; 0x1d54 + 1d4e: 82 34 cpi r24, 0x42 ; 66 + 1d50: 11 f4 brne .+4 ; 0x1d56 // SET DEVICE is ignored getNch(20); - 1d50: 84 e1 ldi r24, 0x14 ; 20 - 1d52: 03 c0 rjmp .+6 ; 0x1d5a + 1d52: 84 e1 ldi r24, 0x14 ; 20 + 1d54: 03 c0 rjmp .+6 ; 0x1d5c } else if(ch == STK_SET_DEVICE_EXT) { - 1d54: 85 34 cpi r24, 0x45 ; 69 - 1d56: 19 f4 brne .+6 ; 0x1d5e + 1d56: 85 34 cpi r24, 0x45 ; 69 + 1d58: 19 f4 brne .+6 ; 0x1d60 // SET DEVICE EXT is ignored getNch(5); - 1d58: 85 e0 ldi r24, 0x05 ; 5 - 1d5a: 0a d1 rcall .+532 ; 0x1f70 - 1d5c: cf c0 rjmp .+414 ; 0x1efc + 1d5a: 85 e0 ldi r24, 0x05 ; 5 + 1d5c: 03 d1 rcall .+518 ; 0x1f64 + 1d5e: c8 c0 rjmp .+400 ; 0x1ef0 } else if(ch == STK_LOAD_ADDRESS) { - 1d5e: 85 35 cpi r24, 0x55 ; 85 - 1d60: a1 f4 brne .+40 ; 0x1d8a + 1d60: 85 35 cpi r24, 0x55 ; 85 + 1d62: 81 f4 brne .+32 ; 0x1d84 // LOAD ADDRESS - address = getch(); - 1d62: de d0 rcall .+444 ; 0x1f20 - 1d64: 08 2f mov r16, r24 - 1d66: 10 e0 ldi r17, 0x00 ; 0 - 1d68: 10 93 01 02 sts 0x0201, r17 - 1d6c: 00 93 00 02 sts 0x0200, r16 - address = (address & 0xff) | (getch() << 8); - 1d70: d7 d0 rcall .+430 ; 0x1f20 - 1d72: 90 e0 ldi r25, 0x00 ; 0 - 1d74: 98 2f mov r25, r24 - 1d76: 88 27 eor r24, r24 - 1d78: 80 2b or r24, r16 - 1d7a: 91 2b or r25, r17 - address += address; // Convert from word address to byte address - 1d7c: 88 0f add r24, r24 - 1d7e: 99 1f adc r25, r25 - 1d80: 90 93 01 02 sts 0x0201, r25 - 1d84: 80 93 00 02 sts 0x0200, r24 - 1d88: b8 c0 rjmp .+368 ; 0x1efa + uint16_t newAddress; + newAddress = getch(); + 1d64: d7 d0 rcall .+430 ; 0x1f14 + newAddress = (newAddress & 0xff) | (getch() << 8); + 1d66: 08 2f mov r16, r24 + 1d68: 10 e0 ldi r17, 0x00 ; 0 + 1d6a: d4 d0 rcall .+424 ; 0x1f14 + 1d6c: 90 e0 ldi r25, 0x00 ; 0 + 1d6e: 98 2f mov r25, r24 + 1d70: 88 27 eor r24, r24 + 1d72: 80 2b or r24, r16 + 1d74: 91 2b or r25, r17 +#ifdef RAMPZ + // Transfer top bit to RAMPZ + RAMPZ = (newAddress & 0x8000) ? 1 : 0; +#endif + newAddress += newAddress; // Convert from word address to byte address + 1d76: 88 0f add r24, r24 + 1d78: 99 1f adc r25, r25 + address = newAddress; + 1d7a: 90 93 81 01 sts 0x0181, r25 + 1d7e: 80 93 80 01 sts 0x0180, r24 + 1d82: b5 c0 rjmp .+362 ; 0x1eee verifySpace(); } else if(ch == STK_UNIVERSAL) { - 1d8a: 86 35 cpi r24, 0x56 ; 86 - 1d8c: 29 f4 brne .+10 ; 0x1d98 + 1d84: 86 35 cpi r24, 0x56 ; 86 + 1d86: 29 f4 brne .+10 ; 0x1d92 // UNIVERSAL command is ignored getNch(4); - 1d8e: 84 e0 ldi r24, 0x04 ; 4 - 1d90: ef d0 rcall .+478 ; 0x1f70 + 1d88: 84 e0 ldi r24, 0x04 ; 4 + 1d8a: ec d0 rcall .+472 ; 0x1f64 putch(0x00); - 1d92: 80 e0 ldi r24, 0x00 ; 0 - 1d94: b6 d0 rcall .+364 ; 0x1f02 - 1d96: b2 c0 rjmp .+356 ; 0x1efc + 1d8c: 80 e0 ldi r24, 0x00 ; 0 + 1d8e: b3 d0 rcall .+358 ; 0x1ef6 + 1d90: af c0 rjmp .+350 ; 0x1ef0 } - /* Write memory, length is big endian and is in bytes */ + /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 1d98: 84 36 cpi r24, 0x64 ; 100 - 1d9a: 09 f0 breq .+2 ; 0x1d9e - 1d9c: 6e c0 rjmp .+220 ; 0x1e7a + 1d92: 84 36 cpi r24, 0x64 ; 100 + 1d94: 09 f0 breq .+2 ; 0x1d98 + 1d96: 6b c0 rjmp .+214 ; 0x1e6e // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; getLen(); - 1d9e: d4 d0 rcall .+424 ; 0x1f48 - - // Immediately start page erase - this will 4.5ms - boot_page_erase((uint16_t)(void*)address); - 1da0: e0 91 00 02 lds r30, 0x0200 - 1da4: f0 91 01 02 lds r31, 0x0201 - 1da8: 83 e0 ldi r24, 0x03 ; 3 - 1daa: 80 93 57 00 sts 0x0057, r24 - 1dae: e8 95 spm - 1db0: c0 e0 ldi r28, 0x00 ; 0 - 1db2: d1 e0 ldi r29, 0x01 ; 1 - + 1d98: d1 d0 rcall .+418 ; 0x1f3c + 1d9a: c0 e0 ldi r28, 0x00 ; 0 + 1d9c: d1 e0 ldi r29, 0x01 ; 1 + // If we are in RWW section, immediately start page erase + if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 1db4: b5 d0 rcall .+362 ; 0x1f20 - 1db6: 89 93 st Y+, r24 + 1d9e: ba d0 rcall .+372 ; 0x1f14 + 1da0: 89 93 st Y+, r24 while (--length); - 1db8: 80 91 02 02 lds r24, 0x0202 - 1dbc: 81 50 subi r24, 0x01 ; 1 - 1dbe: 80 93 02 02 sts 0x0202, r24 - 1dc2: 88 23 and r24, r24 - 1dc4: b9 f7 brne .-18 ; 0x1db4 + 1da2: 80 91 82 01 lds r24, 0x0182 + 1da6: 81 50 subi r24, 0x01 ; 1 + 1da8: 80 93 82 01 sts 0x0182, r24 + 1dac: 88 23 and r24, r24 + 1dae: b9 f7 brne .-18 ; 0x1d9e + + // If we are in NRWW section, page erase has to be delayed until now. + // Todo: Take RAMPZ into account + if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 1db0: e0 91 80 01 lds r30, 0x0180 + 1db4: f0 91 81 01 lds r31, 0x0181 + 1db8: 83 e0 ldi r24, 0x03 ; 3 + 1dba: 87 bf out 0x37, r24 ; 55 + 1dbc: e8 95 spm // Read command terminator, start reply verifySpace(); - 1dc6: ce d0 rcall .+412 ; 0x1f64 + 1dbe: cc d0 rcall .+408 ; 0x1f58 // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 1dc8: 07 b6 in r0, 0x37 ; 55 - 1dca: 00 fc sbrc r0, 0 - 1dcc: fd cf rjmp .-6 ; 0x1dc8 + 1dc0: 07 b6 in r0, 0x37 ; 55 + 1dc2: 00 fc sbrc r0, 0 + 1dc4: fd cf rjmp .-6 ; 0x1dc0 #ifdef VIRTUAL_BOOT_PARTITION if ((uint16_t)(void*)address == 0) { - 1dce: 80 91 00 02 lds r24, 0x0200 - 1dd2: 90 91 01 02 lds r25, 0x0201 - 1dd6: 89 2b or r24, r25 - 1dd8: 41 f5 brne .+80 ; 0x1e2a + 1dc6: 80 91 80 01 lds r24, 0x0180 + 1dca: 90 91 81 01 lds r25, 0x0181 + 1dce: 89 2b or r24, r25 + 1dd0: 41 f5 brne .+80 ; 0x1e22 // This is the reset vector page. We need to live-patch the code so the // bootloader runs. // // Move RESET vector to WDT vector uint16_t vect = buff[0] | (buff[1]<<8); - 1dda: 80 91 00 01 lds r24, 0x0100 - 1dde: 20 91 01 01 lds r18, 0x0101 - 1de2: 30 e0 ldi r19, 0x00 ; 0 - 1de4: 32 2f mov r19, r18 - 1de6: 22 27 eor r18, r18 - 1de8: 90 e0 ldi r25, 0x00 ; 0 - 1dea: 28 2b or r18, r24 - 1dec: 39 2b or r19, r25 + 1dd2: 80 91 00 01 lds r24, 0x0100 + 1dd6: 20 91 01 01 lds r18, 0x0101 + 1dda: 30 e0 ldi r19, 0x00 ; 0 + 1ddc: 32 2f mov r19, r18 + 1dde: 22 27 eor r18, r18 + 1de0: 90 e0 ldi r25, 0x00 ; 0 + 1de2: 28 2b or r18, r24 + 1de4: 39 2b or r19, r25 rstVect = vect; - 1dee: 30 93 05 02 sts 0x0205, r19 - 1df2: 20 93 04 02 sts 0x0204, r18 - wdtVect = buff[10] | (buff[11]<<8); - 1df6: 40 91 0a 01 lds r20, 0x010A - 1dfa: 80 91 0b 01 lds r24, 0x010B - 1dfe: 90 e0 ldi r25, 0x00 ; 0 - 1e00: 98 2f mov r25, r24 - 1e02: 88 27 eor r24, r24 - 1e04: 50 e0 ldi r21, 0x00 ; 0 - 1e06: 84 2b or r24, r20 - 1e08: 95 2b or r25, r21 - 1e0a: 90 93 07 02 sts 0x0207, r25 - 1e0e: 80 93 06 02 sts 0x0206, r24 + 1de6: 30 93 85 01 sts 0x0185, r19 + 1dea: 20 93 84 01 sts 0x0184, r18 + wdtVect = buff[8] | (buff[9]<<8); + 1dee: 40 91 08 01 lds r20, 0x0108 + 1df2: 80 91 09 01 lds r24, 0x0109 + 1df6: 90 e0 ldi r25, 0x00 ; 0 + 1df8: 98 2f mov r25, r24 + 1dfa: 88 27 eor r24, r24 + 1dfc: 50 e0 ldi r21, 0x00 ; 0 + 1dfe: 84 2b or r24, r20 + 1e00: 95 2b or r25, r21 + 1e02: 90 93 87 01 sts 0x0187, r25 + 1e06: 80 93 86 01 sts 0x0186, r24 vect -= 4; // Instruction is a relative jump (rjmp), so recalculate. - 1e12: 24 50 subi r18, 0x04 ; 4 - 1e14: 30 40 sbci r19, 0x00 ; 0 - buff[10] = vect & 0xff; - 1e16: 20 93 0a 01 sts 0x010A, r18 - buff[11] = vect >> 8; - 1e1a: 23 2f mov r18, r19 - 1e1c: 33 27 eor r19, r19 - 1e1e: 20 93 0b 01 sts 0x010B, r18 + 1e0a: 24 50 subi r18, 0x04 ; 4 + 1e0c: 30 40 sbci r19, 0x00 ; 0 + buff[8] = vect & 0xff; + 1e0e: 20 93 08 01 sts 0x0108, r18 + buff[9] = vect >> 8; + 1e12: 23 2f mov r18, r19 + 1e14: 33 27 eor r19, r19 + 1e16: 20 93 09 01 sts 0x0109, r18 // Add jump to bootloader at RESET vector buff[0] = 0x7f; - 1e22: d0 92 00 01 sts 0x0100, r13 + 1e1a: f0 92 00 01 sts 0x0100, r15 buff[1] = 0xce; // rjmp 0x1d00 instruction - 1e26: f0 92 01 01 sts 0x0101, r15 + 1e1e: e0 92 01 01 sts 0x0101, r14 } #endif // Copy buffer into programming buffer bufPtr = buff; addrPtr = (uint16_t)(void*)address; - 1e2a: 40 91 00 02 lds r20, 0x0200 - 1e2e: 50 91 01 02 lds r21, 0x0201 - 1e32: a0 e0 ldi r26, 0x00 ; 0 - 1e34: b1 e0 ldi r27, 0x01 ; 1 + 1e22: 40 91 80 01 lds r20, 0x0180 + 1e26: 50 91 81 01 lds r21, 0x0181 + 1e2a: a0 e0 ldi r26, 0x00 ; 0 + 1e2c: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 1e36: 2c 91 ld r18, X - 1e38: 30 e0 ldi r19, 0x00 ; 0 + 1e2e: 2c 91 ld r18, X + 1e30: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 1e3a: 11 96 adiw r26, 0x01 ; 1 - 1e3c: 8c 91 ld r24, X - 1e3e: 11 97 sbiw r26, 0x01 ; 1 - 1e40: 90 e0 ldi r25, 0x00 ; 0 - 1e42: 98 2f mov r25, r24 - 1e44: 88 27 eor r24, r24 - 1e46: 82 2b or r24, r18 - 1e48: 93 2b or r25, r19 -#ifdef VIRTUAL_BOOT_PARTITION -#define rstVect (*(uint16_t*)(0x204)) -#define wdtVect (*(uint16_t*)(0x206)) + 1e32: 11 96 adiw r26, 0x01 ; 1 + 1e34: 8c 91 ld r24, X + 1e36: 11 97 sbiw r26, 0x01 ; 1 + 1e38: 90 e0 ldi r25, 0x00 ; 0 + 1e3a: 98 2f mov r25, r24 + 1e3c: 88 27 eor r24, r24 + 1e3e: 82 2b or r24, r18 + 1e40: 93 2b or r25, r19 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif + /* main program starts here */ int main(void) { - 1e4a: 12 96 adiw r26, 0x02 ; 2 + 1e42: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; - boot_page_fill((uint16_t)(void*)addrPtr,a); - 1e4c: fa 01 movw r30, r20 - 1e4e: 0c 01 movw r0, r24 - 1e50: c0 92 57 00 sts 0x0057, r12 - 1e54: e8 95 spm - 1e56: 11 24 eor r1, r1 + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); + 1e44: fa 01 movw r30, r20 + 1e46: 0c 01 movw r0, r24 + 1e48: d7 be out 0x37, r13 ; 55 + 1e4a: e8 95 spm + 1e4c: 11 24 eor r1, r1 addrPtr += 2; - 1e58: 4e 5f subi r20, 0xFE ; 254 - 1e5a: 5f 4f sbci r21, 0xFF ; 255 + 1e4e: 4e 5f subi r20, 0xFE ; 254 + 1e50: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 1e5c: f1 e0 ldi r31, 0x01 ; 1 - 1e5e: a0 34 cpi r26, 0x40 ; 64 - 1e60: bf 07 cpc r27, r31 - 1e62: 49 f7 brne .-46 ; 0x1e36 + 1e52: f1 e0 ldi r31, 0x01 ; 1 + 1e54: a0 34 cpi r26, 0x40 ; 64 + 1e56: bf 07 cpc r27, r31 + 1e58: 51 f7 brne .-44 ; 0x1e2e // Write from programming buffer - boot_page_write((uint16_t)(void*)address); - 1e64: e0 91 00 02 lds r30, 0x0200 - 1e68: f0 91 01 02 lds r31, 0x0201 - 1e6c: e0 92 57 00 sts 0x0057, r14 - 1e70: e8 95 spm + __boot_page_write_short((uint16_t)(void*)address); + 1e5a: e0 91 80 01 lds r30, 0x0180 + 1e5e: f0 91 81 01 lds r31, 0x0181 + 1e62: c7 be out 0x37, r12 ; 55 + 1e64: e8 95 spm boot_spm_busy_wait(); - 1e72: 07 b6 in r0, 0x37 ; 55 - 1e74: 00 fc sbrc r0, 0 - 1e76: fd cf rjmp .-6 ; 0x1e72 - 1e78: 41 c0 rjmp .+130 ; 0x1efc + 1e66: 07 b6 in r0, 0x37 ; 55 + 1e68: 00 fc sbrc r0, 0 + 1e6a: fd cf rjmp .-6 ; 0x1e66 + 1e6c: 41 c0 rjmp .+130 ; 0x1ef0 boot_rww_enable(); #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 1e7a: 84 37 cpi r24, 0x74 ; 116 - 1e7c: 89 f5 brne .+98 ; 0x1ee0 + 1e6e: 84 37 cpi r24, 0x74 ; 116 + 1e70: 89 f5 brne .+98 ; 0x1ed4 // READ PAGE - we only read flash getLen(); - 1e7e: 64 d0 rcall .+200 ; 0x1f48 + 1e72: 64 d0 rcall .+200 ; 0x1f3c verifySpace(); - 1e80: 71 d0 rcall .+226 ; 0x1f64 + 1e74: 71 d0 rcall .+226 ; 0x1f58 #ifdef VIRTUAL_BOOT_PARTITION do { // Undo vector patch in bottom page so verify passes if (address == 0) ch=rstVect & 0xff; - 1e82: e0 91 00 02 lds r30, 0x0200 - 1e86: f0 91 01 02 lds r31, 0x0201 - 1e8a: 30 97 sbiw r30, 0x00 ; 0 - 1e8c: 19 f4 brne .+6 ; 0x1e94 - 1e8e: 20 91 04 02 lds r18, 0x0204 - 1e92: 13 c0 rjmp .+38 ; 0x1eba + 1e76: e0 91 80 01 lds r30, 0x0180 + 1e7a: f0 91 81 01 lds r31, 0x0181 + 1e7e: 30 97 sbiw r30, 0x00 ; 0 + 1e80: 19 f4 brne .+6 ; 0x1e88 + 1e82: 20 91 84 01 lds r18, 0x0184 + 1e86: 13 c0 rjmp .+38 ; 0x1eae else if (address == 1) ch=rstVect >> 8; - 1e94: e1 30 cpi r30, 0x01 ; 1 + 1e88: e1 30 cpi r30, 0x01 ; 1 + 1e8a: f1 05 cpc r31, r1 + 1e8c: 19 f4 brne .+6 ; 0x1e94 + 1e8e: 20 91 85 01 lds r18, 0x0185 + 1e92: 0d c0 rjmp .+26 ; 0x1eae + else if (address == 8) ch=wdtVect & 0xff; + 1e94: e8 30 cpi r30, 0x08 ; 8 1e96: f1 05 cpc r31, r1 1e98: 19 f4 brne .+6 ; 0x1ea0 - 1e9a: 20 91 05 02 lds r18, 0x0205 - 1e9e: 0d c0 rjmp .+26 ; 0x1eba - else if (address == 10) ch=wdtVect & 0xff; - 1ea0: ea 30 cpi r30, 0x0A ; 10 + 1e9a: 20 91 86 01 lds r18, 0x0186 + 1e9e: 07 c0 rjmp .+14 ; 0x1eae + else if (address == 9) ch=wdtVect >> 8; + 1ea0: e9 30 cpi r30, 0x09 ; 9 1ea2: f1 05 cpc r31, r1 1ea4: 19 f4 brne .+6 ; 0x1eac - 1ea6: 20 91 06 02 lds r18, 0x0206 - 1eaa: 07 c0 rjmp .+14 ; 0x1eba - else if (address == 11) ch=wdtVect >> 8; - 1eac: eb 30 cpi r30, 0x0B ; 11 - 1eae: f1 05 cpc r31, r1 - 1eb0: 19 f4 brne .+6 ; 0x1eb8 - 1eb2: 20 91 07 02 lds r18, 0x0207 - 1eb6: 01 c0 rjmp .+2 ; 0x1eba + 1ea6: 20 91 87 01 lds r18, 0x0187 + 1eaa: 01 c0 rjmp .+2 ; 0x1eae else ch = pgm_read_byte_near(address); - 1eb8: 24 91 lpm r18, Z+ + 1eac: 24 91 lpm r18, Z+ address++; - 1eba: 80 91 00 02 lds r24, 0x0200 - 1ebe: 90 91 01 02 lds r25, 0x0201 - 1ec2: 01 96 adiw r24, 0x01 ; 1 - 1ec4: 90 93 01 02 sts 0x0201, r25 - 1ec8: 80 93 00 02 sts 0x0200, r24 + 1eae: 80 91 80 01 lds r24, 0x0180 + 1eb2: 90 91 81 01 lds r25, 0x0181 + 1eb6: 01 96 adiw r24, 0x01 ; 1 + 1eb8: 90 93 81 01 sts 0x0181, r25 + 1ebc: 80 93 80 01 sts 0x0180, r24 putch(ch); - 1ecc: 82 2f mov r24, r18 - 1ece: 19 d0 rcall .+50 ; 0x1f02 + 1ec0: 82 2f mov r24, r18 + 1ec2: 19 d0 rcall .+50 ; 0x1ef6 } while (--length); - 1ed0: 80 91 02 02 lds r24, 0x0202 - 1ed4: 81 50 subi r24, 0x01 ; 1 - 1ed6: 80 93 02 02 sts 0x0202, r24 - 1eda: 88 23 and r24, r24 - 1edc: 91 f6 brne .-92 ; 0x1e82 - 1ede: 0e c0 rjmp .+28 ; 0x1efc - while (--length); + 1ec4: 80 91 82 01 lds r24, 0x0182 + 1ec8: 81 50 subi r24, 0x01 ; 1 + 1eca: 80 93 82 01 sts 0x0182, r24 + 1ece: 88 23 and r24, r24 + 1ed0: 91 f6 brne .-92 ; 0x1e76 + 1ed2: 0e c0 rjmp .+28 ; 0x1ef0 +#endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 1ee0: 85 37 cpi r24, 0x75 ; 117 - 1ee2: 39 f4 brne .+14 ; 0x1ef2 + 1ed4: 85 37 cpi r24, 0x75 ; 117 + 1ed6: 39 f4 brne .+14 ; 0x1ee6 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 1ee4: 3f d0 rcall .+126 ; 0x1f64 + 1ed8: 3f d0 rcall .+126 ; 0x1f58 putch(SIGNATURE_0); - 1ee6: 8e e1 ldi r24, 0x1E ; 30 - 1ee8: 0c d0 rcall .+24 ; 0x1f02 + 1eda: 8e e1 ldi r24, 0x1E ; 30 + 1edc: 0c d0 rcall .+24 ; 0x1ef6 putch(SIGNATURE_1); - 1eea: 83 e9 ldi r24, 0x93 ; 147 - 1eec: 0a d0 rcall .+20 ; 0x1f02 + 1ede: 83 e9 ldi r24, 0x93 ; 147 + 1ee0: 0a d0 rcall .+20 ; 0x1ef6 putch(SIGNATURE_2); - 1eee: 8c e0 ldi r24, 0x0C ; 12 - 1ef0: 51 cf rjmp .-350 ; 0x1d94 + 1ee2: 8c e0 ldi r24, 0x0C ; 12 + 1ee4: 54 cf rjmp .-344 ; 0x1d8e } else if (ch == 'Q') { - 1ef2: 81 35 cpi r24, 0x51 ; 81 - 1ef4: 11 f4 brne .+4 ; 0x1efa + 1ee6: 81 35 cpi r24, 0x51 ; 81 + 1ee8: 11 f4 brne .+4 ; 0x1eee // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 1ef6: 88 e0 ldi r24, 0x08 ; 8 - 1ef8: 2c d0 rcall .+88 ; 0x1f52 + 1eea: 88 e0 ldi r24, 0x08 ; 8 + 1eec: 2c d0 rcall .+88 ; 0x1f46 verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 1efa: 34 d0 rcall .+104 ; 0x1f64 + 1eee: 34 d0 rcall .+104 ; 0x1f58 } putch(STK_OK); - 1efc: 80 e1 ldi r24, 0x10 ; 16 - 1efe: 01 d0 rcall .+2 ; 0x1f02 - 1f00: 1e cf rjmp .-452 ; 0x1d3e + 1ef0: 80 e1 ldi r24, 0x10 ; 16 + 1ef2: 01 d0 rcall .+2 ; 0x1ef6 + 1ef4: 25 cf rjmp .-438 ; 0x1d40 -00001f02 : +00001ef6 : void putch(char ch) { #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); UDR0 = ch; #else __asm__ __volatile__ ( - 1f02: 2a e0 ldi r18, 0x0A ; 10 - 1f04: 30 e0 ldi r19, 0x00 ; 0 - 1f06: 80 95 com r24 - 1f08: 08 94 sec - 1f0a: 10 f4 brcc .+4 ; 0x1f10 - 1f0c: da 98 cbi 0x1b, 2 ; 27 - 1f0e: 02 c0 rjmp .+4 ; 0x1f14 - 1f10: da 9a sbi 0x1b, 2 ; 27 - 1f12: 00 00 nop - 1f14: 15 d0 rcall .+42 ; 0x1f40 - 1f16: 14 d0 rcall .+40 ; 0x1f40 - 1f18: 86 95 lsr r24 - 1f1a: 2a 95 dec r18 - 1f1c: b1 f7 brne .-20 ; 0x1f0a + 1ef6: 2a e0 ldi r18, 0x0A ; 10 + 1ef8: 30 e0 ldi r19, 0x00 ; 0 + 1efa: 80 95 com r24 + 1efc: 08 94 sec + 1efe: 10 f4 brcc .+4 ; 0x1f04 + 1f00: da 98 cbi 0x1b, 2 ; 27 + 1f02: 02 c0 rjmp .+4 ; 0x1f08 + 1f04: da 9a sbi 0x1b, 2 ; 27 + 1f06: 00 00 nop + 1f08: 15 d0 rcall .+42 ; 0x1f34 + 1f0a: 14 d0 rcall .+40 ; 0x1f34 + 1f0c: 86 95 lsr r24 + 1f0e: 2a 95 dec r18 + 1f10: b1 f7 brne .-20 ; 0x1efe [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 1f1e: 08 95 ret + 1f12: 08 95 ret -00001f20 : +00001f14 : return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 1f20: a8 95 wdr -#ifdef LED_DATA_FLASH + 1f14: a8 95 wdr LED_PIN |= _BV(LED); +#endif #endif return ch; } - 1f22: 29 e0 ldi r18, 0x09 ; 9 - 1f24: 30 e0 ldi r19, 0x00 ; 0 + 1f16: 29 e0 ldi r18, 0x09 ; 9 + 1f18: 30 e0 ldi r19, 0x00 ; 0 + 1f1a: cb 99 sbic 0x19, 3 ; 25 + 1f1c: fe cf rjmp .-4 ; 0x1f1a + 1f1e: 0a d0 rcall .+20 ; 0x1f34 + 1f20: 09 d0 rcall .+18 ; 0x1f34 + 1f22: 08 d0 rcall .+16 ; 0x1f34 + 1f24: 88 94 clc 1f26: cb 99 sbic 0x19, 3 ; 25 - 1f28: fe cf rjmp .-4 ; 0x1f26 - 1f2a: 0a d0 rcall .+20 ; 0x1f40 - 1f2c: 09 d0 rcall .+18 ; 0x1f40 - 1f2e: 08 d0 rcall .+16 ; 0x1f40 - 1f30: 88 94 clc - 1f32: cb 99 sbic 0x19, 3 ; 25 - 1f34: 08 94 sec - 1f36: 2a 95 dec r18 - 1f38: 11 f0 breq .+4 ; 0x1f3e - 1f3a: 87 95 ror r24 - 1f3c: f7 cf rjmp .-18 ; 0x1f2c - 1f3e: 08 95 ret - -00001f40 : + 1f28: 08 94 sec + 1f2a: 2a 95 dec r18 + 1f2c: 11 f0 breq .+4 ; 0x1f32 + 1f2e: 87 95 ror r24 + 1f30: f7 cf rjmp .-18 ; 0x1f20 + 1f32: 08 95 ret + +00001f34 : #if UART_B_VALUE > 255 #error Baud rate too slow for soft UART #endif void uartDelay() { __asm__ __volatile__ ( - 1f40: 9e e0 ldi r25, 0x0E ; 14 - 1f42: 9a 95 dec r25 - 1f44: f1 f7 brne .-4 ; 0x1f42 - 1f46: 08 95 ret + 1f34: 9e e0 ldi r25, 0x0E ; 14 + 1f36: 9a 95 dec r25 + 1f38: f1 f7 brne .-4 ; 0x1f36 + 1f3a: 08 95 ret -00001f48 : +00001f3c : } while (--count); } #endif uint8_t getLen() { getch(); - 1f48: eb df rcall .-42 ; 0x1f20 + 1f3c: eb df rcall .-42 ; 0x1f14 length = getch(); - 1f4a: ea df rcall .-44 ; 0x1f20 - 1f4c: 80 93 02 02 sts 0x0202, r24 + 1f3e: ea df rcall .-44 ; 0x1f14 + 1f40: 80 93 82 01 sts 0x0182, r24 return getch(); } - 1f50: e7 cf rjmp .-50 ; 0x1f20 + 1f44: e7 cf rjmp .-50 ; 0x1f14 -00001f52 : +00001f46 : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 1f52: 98 e1 ldi r25, 0x18 ; 24 - 1f54: 91 bd out 0x21, r25 ; 33 + 1f46: 98 e1 ldi r25, 0x18 ; 24 + 1f48: 91 bd out 0x21, r25 ; 33 WDTCSR = x; - 1f56: 81 bd out 0x21, r24 ; 33 + 1f4a: 81 bd out 0x21, r24 ; 33 } - 1f58: 08 95 ret + 1f4c: 08 95 ret -00001f5a : +00001f4e : void appStart() { watchdogConfig(WATCHDOG_OFF); - 1f5a: 80 e0 ldi r24, 0x00 ; 0 - 1f5c: fa df rcall .-12 ; 0x1f52 + 1f4e: 80 e0 ldi r24, 0x00 ; 0 + 1f50: fa df rcall .-12 ; 0x1f46 __asm__ __volatile__ ( - 1f5e: e5 e0 ldi r30, 0x05 ; 5 - 1f60: ff 27 eor r31, r31 - 1f62: 09 94 ijmp + 1f52: e4 e0 ldi r30, 0x04 ; 4 + 1f54: ff 27 eor r31, r31 + 1f56: 09 94 ijmp -00001f64 : +00001f58 : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) appStart(); - 1f64: dd df rcall .-70 ; 0x1f20 - 1f66: 80 32 cpi r24, 0x20 ; 32 - 1f68: 09 f0 breq .+2 ; 0x1f6c - 1f6a: f7 df rcall .-18 ; 0x1f5a + 1f58: dd df rcall .-70 ; 0x1f14 + 1f5a: 80 32 cpi r24, 0x20 ; 32 + 1f5c: 09 f0 breq .+2 ; 0x1f60 + 1f5e: f7 df rcall .-18 ; 0x1f4e putch(STK_INSYNC); - 1f6c: 84 e1 ldi r24, 0x14 ; 20 + 1f60: 84 e1 ldi r24, 0x14 ; 20 } - 1f6e: c9 cf rjmp .-110 ; 0x1f02 + 1f62: c9 cf rjmp .-110 ; 0x1ef6 + +00001f64 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 1f70: 1f 93 push r17 - 1f72: 18 2f mov r17, r24 - -00001f74 : + 1f64: 1f 93 push r17 + 1f66: 18 2f mov r17, r24 do getch(); while (--count); - 1f74: d5 df rcall .-86 ; 0x1f20 - 1f76: 11 50 subi r17, 0x01 ; 1 - 1f78: e9 f7 brne .-6 ; 0x1f74 + 1f68: d5 df rcall .-86 ; 0x1f14 + 1f6a: 11 50 subi r17, 0x01 ; 1 + 1f6c: e9 f7 brne .-6 ; 0x1f68 verifySpace(); - 1f7a: f4 df rcall .-24 ; 0x1f64 + 1f6e: f4 df rcall .-24 ; 0x1f58 } - 1f7c: 1f 91 pop r17 - 1f7e: 08 95 ret + 1f70: 1f 91 pop r17 + 1f72: 08 95 ret diff --git a/bootloaders/optiboot/optiboot_pro_16MHz.hex b/bootloaders/optiboot/optiboot_pro_16MHz.hex index 1e93414..2b4a582 100644 --- a/bootloaders/optiboot/optiboot_pro_16MHz.hex +++ b/bootloaders/optiboot/optiboot_pro_16MHz.hex @@ -1,33 +1,34 @@ -:103E000085E08093810082E08093C00088E1809308 -:103E1000C10086E08093C20080E18093C40084B733 -:103E200014BE81FFD0D08DE0C8D0259A86E020E373 -:103E30003CEF91E0309385002093840096BBB09BCB -:103E4000FECF1D9AA8958150A9F7DD24D394A5E053 -:103E5000EA2EF1E1FF2EA4D0813421F481E0BED01E -:103E600083E024C0823411F484E103C0853419F462 -:103E700085E0B4D08AC08535A1F492D0082F10E037 -:103E800010930102009300028BD090E0982F8827B6 -:103E9000802B912B880F991F909301028093000231 -:103EA00073C0863529F484E099D080E071D06DC06C -:103EB000843609F043C07CD0E0910002F091010209 -:103EC00083E080935700E895C0E0D1E069D0899302 -:103ED000809102028150809302028823B9F778D042 -:103EE00007B600FCFDCF4091000250910102A0E016 -:103EF000B1E02C9130E011968C91119790E0982FC1 -:103F00008827822B932B1296FA010C01D09257002E -:103F1000E89511244E5F5F4FF1E0A038BF0749F7E5 -:103F2000E0910002F0910102E0925700E89507B697 -:103F300000FCFDCFF0925700E89527C08437B9F414 -:103F400037D046D0E0910002F09101023196F09313 -:103F50000102E09300023197E4918E2F19D08091F5 -:103F60000202815080930202882361F70EC08537D8 -:103F700039F42ED08EE10CD084E90AD086E096CFB9 -:103F8000813511F488E019D023D080E101D063CFCE -:103F9000982F8091C00085FFFCCF9093C6000895B4 -:103FA000A8958091C00087FFFCCF8091C60008953E -:103FB000F7DFF6DF80930202F3CFE0E6F0E098E16E -:103FC00090838083089580E0F8DFEE27FF2709942F -:103FD000E7DF803209F0F7DF84E1DACF1F93182F93 -:0C3FE000DFDF1150E9F7F4DF1F910895B6 +:103E0000112484B714BE81FFE6D085E08093810041 +:103E100082E08093C00088E18093C10086E08093B7 +:103E2000C20080E18093C4008EE0CFD0259A86E066 +:103E300020E33CEF91E0309385002093840096BB13 +:103E4000B09BFECF1D9AA8958150A9F7DD24D3948D +:103E5000A5E0EA2EF1E1FF2EABD0813421F481E020 +:103E6000C5D083E020C0823411F484E103C08534DE +:103E700019F485E0BBD091C0853581F499D0082F25 +:103E800010E096D090E0982F8827802B912B880FF8 +:103E9000991F90930102809300027EC0863529F419 +:103EA00084E0A4D080E07CD078C0843609F04EC095 +:103EB00087D0E0910002F091010288E3E030F8073A +:103EC00018F483E087BFE895C0E0D1E071D0899312 +:103ED000809102028150809302028823B9F7E09119 +:103EE0000002F091010288E3E030F80718F083E067 +:103EF00087BFE89575D007B600FCFDCF4091000262 +:103F000050910102A0E0B1E02C9130E011968C912B +:103F1000119790E0982F8827822B932B1296FA0105 +:103F20000C01D7BEE89511244E5F5F4FF1E0A03839 +:103F3000BF0751F7E0910002F0910102E7BEE8955A +:103F400007B600FCFDCFF7BEE89527C08437B9F46B +:103F500037D046D0E0910002F09101023196F09303 +:103F60000102E09300023197E4918E2F19D08091E5 +:103F70000202815080930202882361F70EC08537C8 +:103F800039F42ED08EE10CD084E90AD086E08BCFB4 +:103F9000813511F488E019D023D080E101D05CCFC5 +:103FA000982F8091C00085FFFCCF9093C6000895A4 +:103FB000A8958091C00087FFFCCF8091C60008952E +:103FC000F7DFF6DF80930202F3CFE0E6F0E098E15E +:103FD00090838083089580E0F8DFEE27FF2709941F +:103FE000E7DF803209F0F7DF84E1DACF1F93182F83 +:0C3FF000DFDF1150E9F7F4DF1F910895A6 :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_16MHz.lst b/bootloaders/optiboot/optiboot_pro_16MHz.lst index 9920a76..25dc46b 100644 --- a/bootloaders/optiboot/optiboot_pro_16MHz.lst +++ b/bootloaders/optiboot/optiboot_pro_16MHz.lst @@ -3,237 +3,257 @@ optiboot_pro_16MHz.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001ec 00003e00 00003e00 00000054 2**1 + 0 .text 000001fc 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .debug_aranges 00000028 00000000 00000000 00000240 2**0 + 1 .debug_aranges 00000028 00000000 00000000 00000250 2**0 CONTENTS, READONLY, DEBUGGING - 2 .debug_pubnames 0000006a 00000000 00000000 00000268 2**0 + 2 .debug_pubnames 0000006a 00000000 00000000 00000278 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_info 00000269 00000000 00000000 000002d2 2**0 + 3 .debug_info 00000284 00000000 00000000 000002e2 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_abbrev 00000196 00000000 00000000 0000053b 2**0 + 4 .debug_abbrev 000001ae 00000000 00000000 00000566 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_line 000003d3 00000000 00000000 000006d1 2**0 + 5 .debug_line 00000450 00000000 00000000 00000714 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_frame 00000090 00000000 00000000 00000aa4 2**2 + 6 .debug_frame 00000090 00000000 00000000 00000b64 2**2 CONTENTS, READONLY, DEBUGGING - 7 .debug_str 00000135 00000000 00000000 00000b34 2**0 + 7 .debug_str 00000141 00000000 00000000 00000bf4 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_loc 000001d1 00000000 00000000 00000c69 2**0 + 8 .debug_loc 000001e1 00000000 00000000 00000d35 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_ranges 00000068 00000000 00000000 00000e3a 2**0 + 9 .debug_ranges 00000068 00000000 00000000 00000f16 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: 00003e00
: -#ifdef VIRTUAL_BOOT_PARTITION -#define rstVect (*(uint16_t*)(0x204)) -#define wdtVect (*(uint16_t*)(0x206)) +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif + /* main program starts here */ int main(void) { - 3e00: 85 e0 ldi r24, 0x05 ; 5 - 3e02: 80 93 81 00 sts 0x0081, r24 + 3e00: 11 24 eor r1, r1 +#ifdef __AVR_ATmega8__ + SP=RAMEND; // This is done by hardware reset +#endif + + // Adaboot no-wait mod + ch = MCUSR; + 3e02: 84 b7 in r24, 0x34 ; 52 + MCUSR = 0; + 3e04: 14 be out 0x34, r1 ; 52 + if (!(ch & _BV(EXTRF))) appStart(); + 3e06: 81 ff sbrs r24, 1 + 3e08: e6 d0 rcall .+460 ; 0x3fd6 + #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 -#endif -#ifndef SOFT_UART + 3e0a: 85 e0 ldi r24, 0x05 ; 5 + 3e0c: 80 93 81 00 sts 0x0081, r24 + UCSRA = _BV(U2X); //Double speed mode USART + UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx + UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 + UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); +#else UCSR0A = _BV(U2X0); //Double speed mode USART0 - 3e06: 82 e0 ldi r24, 0x02 ; 2 - 3e08: 80 93 c0 00 sts 0x00C0, r24 + 3e10: 82 e0 ldi r24, 0x02 ; 2 + 3e12: 80 93 c0 00 sts 0x00C0, r24 UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 3e0c: 88 e1 ldi r24, 0x18 ; 24 - 3e0e: 80 93 c1 00 sts 0x00C1, r24 + 3e16: 88 e1 ldi r24, 0x18 ; 24 + 3e18: 80 93 c1 00 sts 0x00C1, r24 UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 3e12: 86 e0 ldi r24, 0x06 ; 6 - 3e14: 80 93 c2 00 sts 0x00C2, r24 + 3e1c: 86 e0 ldi r24, 0x06 ; 6 + 3e1e: 80 93 c2 00 sts 0x00C2, r24 UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e18: 80 e1 ldi r24, 0x10 ; 16 - 3e1a: 80 93 c4 00 sts 0x00C4, r24 + 3e22: 80 e1 ldi r24, 0x10 ; 16 + 3e24: 80 93 c4 00 sts 0x00C4, r24 +#endif #endif - - // Adaboot no-wait mod - ch = MCUSR; - 3e1e: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 3e20: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 3e22: 81 ff sbrs r24, 1 - 3e24: d0 d0 rcall .+416 ; 0x3fc6 // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_500MS); - 3e26: 8d e0 ldi r24, 0x0D ; 13 - 3e28: c8 d0 rcall .+400 ; 0x3fba + watchdogConfig(WATCHDOG_1S); + 3e28: 8e e0 ldi r24, 0x0E ; 14 + 3e2a: cf d0 rcall .+414 ; 0x3fca /* Set LED pin as output */ LED_DDR |= _BV(LED); - 3e2a: 25 9a sbi 0x04, 5 ; 4 - 3e2c: 86 e0 ldi r24, 0x06 ; 6 + 3e2c: 25 9a sbi 0x04, 5 ; 4 + 3e2e: 86 e0 ldi r24, 0x06 ; 6 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 3e2e: 20 e3 ldi r18, 0x30 ; 48 - 3e30: 3c ef ldi r19, 0xFC ; 252 + 3e30: 20 e3 ldi r18, 0x30 ; 48 + 3e32: 3c ef ldi r19, 0xFC ; 252 TIFR1 = _BV(TOV1); - 3e32: 91 e0 ldi r25, 0x01 ; 1 + 3e34: 91 e0 ldi r25, 0x01 ; 1 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 3e34: 30 93 85 00 sts 0x0085, r19 - 3e38: 20 93 84 00 sts 0x0084, r18 + 3e36: 30 93 85 00 sts 0x0085, r19 + 3e3a: 20 93 84 00 sts 0x0084, r18 TIFR1 = _BV(TOV1); - 3e3c: 96 bb out 0x16, r25 ; 22 + 3e3e: 96 bb out 0x16, r25 ; 22 while(!(TIFR1 & _BV(TOV1))); - 3e3e: b0 9b sbis 0x16, 0 ; 22 - 3e40: fe cf rjmp .-4 ; 0x3e3e + 3e40: b0 9b sbis 0x16, 0 ; 22 + 3e42: fe cf rjmp .-4 ; 0x3e40 +#ifdef __AVR_ATmega8__ + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); - 3e42: 1d 9a sbi 0x03, 5 ; 3 + 3e44: 1d 9a sbi 0x03, 5 ; 3 return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3e44: a8 95 wdr - TCNT1 = -(F_CPU/(1024*16)); - TIFR1 = _BV(TOV1); - while(!(TIFR1 & _BV(TOV1))); + 3e46: a8 95 wdr + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); +#endif watchdogReset(); } while (--count); - 3e46: 81 50 subi r24, 0x01 ; 1 - 3e48: a9 f7 brne .-22 ; 0x3e34 + 3e48: 81 50 subi r24, 0x01 ; 1 + 3e4a: a9 f7 brne .-22 ; 0x3e36 /* get character from UART */ ch = getch(); if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 3e4a: dd 24 eor r13, r13 - 3e4c: d3 94 inc r13 - boot_page_fill((uint16_t)(void*)addrPtr,a); + 3e4c: dd 24 eor r13, r13 + 3e4e: d3 94 inc r13 + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); // Write from programming buffer - boot_page_write((uint16_t)(void*)address); - 3e4e: a5 e0 ldi r26, 0x05 ; 5 - 3e50: ea 2e mov r14, r26 + __boot_page_write_short((uint16_t)(void*)address); + 3e50: a5 e0 ldi r26, 0x05 ; 5 + 3e52: ea 2e mov r14, r26 boot_spm_busy_wait(); #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 3e52: f1 e1 ldi r31, 0x11 ; 17 - 3e54: ff 2e mov r15, r31 + 3e54: f1 e1 ldi r31, 0x11 ; 17 + 3e56: ff 2e mov r15, r31 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 3e56: a4 d0 rcall .+328 ; 0x3fa0 + 3e58: ab d0 rcall .+342 ; 0x3fb0 if(ch == STK_GET_PARAMETER) { - 3e58: 81 34 cpi r24, 0x41 ; 65 - 3e5a: 21 f4 brne .+8 ; 0x3e64 + 3e5a: 81 34 cpi r24, 0x41 ; 65 + 3e5c: 21 f4 brne .+8 ; 0x3e66 // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 3e5c: 81 e0 ldi r24, 0x01 ; 1 - 3e5e: be d0 rcall .+380 ; 0x3fdc + 3e5e: 81 e0 ldi r24, 0x01 ; 1 + 3e60: c5 d0 rcall .+394 ; 0x3fec putch(0x03); - 3e60: 83 e0 ldi r24, 0x03 ; 3 - 3e62: 24 c0 rjmp .+72 ; 0x3eac + 3e62: 83 e0 ldi r24, 0x03 ; 3 + 3e64: 20 c0 rjmp .+64 ; 0x3ea6 } else if(ch == STK_SET_DEVICE) { - 3e64: 82 34 cpi r24, 0x42 ; 66 - 3e66: 11 f4 brne .+4 ; 0x3e6c + 3e66: 82 34 cpi r24, 0x42 ; 66 + 3e68: 11 f4 brne .+4 ; 0x3e6e // SET DEVICE is ignored getNch(20); - 3e68: 84 e1 ldi r24, 0x14 ; 20 - 3e6a: 03 c0 rjmp .+6 ; 0x3e72 + 3e6a: 84 e1 ldi r24, 0x14 ; 20 + 3e6c: 03 c0 rjmp .+6 ; 0x3e74 } else if(ch == STK_SET_DEVICE_EXT) { - 3e6c: 85 34 cpi r24, 0x45 ; 69 - 3e6e: 19 f4 brne .+6 ; 0x3e76 + 3e6e: 85 34 cpi r24, 0x45 ; 69 + 3e70: 19 f4 brne .+6 ; 0x3e78 // SET DEVICE EXT is ignored getNch(5); - 3e70: 85 e0 ldi r24, 0x05 ; 5 - 3e72: b4 d0 rcall .+360 ; 0x3fdc - 3e74: 8a c0 rjmp .+276 ; 0x3f8a + 3e72: 85 e0 ldi r24, 0x05 ; 5 + 3e74: bb d0 rcall .+374 ; 0x3fec + 3e76: 91 c0 rjmp .+290 ; 0x3f9a } else if(ch == STK_LOAD_ADDRESS) { - 3e76: 85 35 cpi r24, 0x55 ; 85 - 3e78: a1 f4 brne .+40 ; 0x3ea2 + 3e78: 85 35 cpi r24, 0x55 ; 85 + 3e7a: 81 f4 brne .+32 ; 0x3e9c // LOAD ADDRESS - address = getch(); - 3e7a: 92 d0 rcall .+292 ; 0x3fa0 - 3e7c: 08 2f mov r16, r24 - 3e7e: 10 e0 ldi r17, 0x00 ; 0 - 3e80: 10 93 01 02 sts 0x0201, r17 - 3e84: 00 93 00 02 sts 0x0200, r16 - address = (address & 0xff) | (getch() << 8); - 3e88: 8b d0 rcall .+278 ; 0x3fa0 - 3e8a: 90 e0 ldi r25, 0x00 ; 0 - 3e8c: 98 2f mov r25, r24 - 3e8e: 88 27 eor r24, r24 - 3e90: 80 2b or r24, r16 - 3e92: 91 2b or r25, r17 - address += address; // Convert from word address to byte address - 3e94: 88 0f add r24, r24 - 3e96: 99 1f adc r25, r25 - 3e98: 90 93 01 02 sts 0x0201, r25 - 3e9c: 80 93 00 02 sts 0x0200, r24 - 3ea0: 73 c0 rjmp .+230 ; 0x3f88 + uint16_t newAddress; + newAddress = getch(); + 3e7c: 99 d0 rcall .+306 ; 0x3fb0 + newAddress = (newAddress & 0xff) | (getch() << 8); + 3e7e: 08 2f mov r16, r24 + 3e80: 10 e0 ldi r17, 0x00 ; 0 + 3e82: 96 d0 rcall .+300 ; 0x3fb0 + 3e84: 90 e0 ldi r25, 0x00 ; 0 + 3e86: 98 2f mov r25, r24 + 3e88: 88 27 eor r24, r24 + 3e8a: 80 2b or r24, r16 + 3e8c: 91 2b or r25, r17 +#ifdef RAMPZ + // Transfer top bit to RAMPZ + RAMPZ = (newAddress & 0x8000) ? 1 : 0; +#endif + newAddress += newAddress; // Convert from word address to byte address + 3e8e: 88 0f add r24, r24 + 3e90: 99 1f adc r25, r25 + address = newAddress; + 3e92: 90 93 01 02 sts 0x0201, r25 + 3e96: 80 93 00 02 sts 0x0200, r24 + 3e9a: 7e c0 rjmp .+252 ; 0x3f98 verifySpace(); } else if(ch == STK_UNIVERSAL) { - 3ea2: 86 35 cpi r24, 0x56 ; 86 - 3ea4: 29 f4 brne .+10 ; 0x3eb0 + 3e9c: 86 35 cpi r24, 0x56 ; 86 + 3e9e: 29 f4 brne .+10 ; 0x3eaa // UNIVERSAL command is ignored getNch(4); - 3ea6: 84 e0 ldi r24, 0x04 ; 4 - 3ea8: 99 d0 rcall .+306 ; 0x3fdc + 3ea0: 84 e0 ldi r24, 0x04 ; 4 + 3ea2: a4 d0 rcall .+328 ; 0x3fec putch(0x00); - 3eaa: 80 e0 ldi r24, 0x00 ; 0 - 3eac: 71 d0 rcall .+226 ; 0x3f90 - 3eae: 6d c0 rjmp .+218 ; 0x3f8a + 3ea4: 80 e0 ldi r24, 0x00 ; 0 + 3ea6: 7c d0 rcall .+248 ; 0x3fa0 + 3ea8: 78 c0 rjmp .+240 ; 0x3f9a } - /* Write memory, length is big endian and is in bytes */ + /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 3eb0: 84 36 cpi r24, 0x64 ; 100 - 3eb2: 09 f0 breq .+2 ; 0x3eb6 - 3eb4: 43 c0 rjmp .+134 ; 0x3f3c + 3eaa: 84 36 cpi r24, 0x64 ; 100 + 3eac: 09 f0 breq .+2 ; 0x3eb0 + 3eae: 4e c0 rjmp .+156 ; 0x3f4c // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; getLen(); - 3eb6: 7c d0 rcall .+248 ; 0x3fb0 - - // Immediately start page erase - this will 4.5ms - boot_page_erase((uint16_t)(void*)address); - 3eb8: e0 91 00 02 lds r30, 0x0200 - 3ebc: f0 91 01 02 lds r31, 0x0201 - 3ec0: 83 e0 ldi r24, 0x03 ; 3 - 3ec2: 80 93 57 00 sts 0x0057, r24 + 3eb0: 87 d0 rcall .+270 ; 0x3fc0 + + // If we are in RWW section, immediately start page erase + if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 3eb2: e0 91 00 02 lds r30, 0x0200 + 3eb6: f0 91 01 02 lds r31, 0x0201 + 3eba: 88 e3 ldi r24, 0x38 ; 56 + 3ebc: e0 30 cpi r30, 0x00 ; 0 + 3ebe: f8 07 cpc r31, r24 + 3ec0: 18 f4 brcc .+6 ; 0x3ec8 + 3ec2: 83 e0 ldi r24, 0x03 ; 3 + 3ec4: 87 bf out 0x37, r24 ; 55 3ec6: e8 95 spm 3ec8: c0 e0 ldi r28, 0x00 ; 0 3eca: d1 e0 ldi r29, 0x01 ; 1 - + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 3ecc: 69 d0 rcall .+210 ; 0x3fa0 + 3ecc: 71 d0 rcall .+226 ; 0x3fb0 3ece: 89 93 st Y+, r24 while (--length); 3ed0: 80 91 02 02 lds r24, 0x0202 @@ -242,279 +262,293 @@ void watchdogReset() { 3eda: 88 23 and r24, r24 3edc: b9 f7 brne .-18 ; 0x3ecc + // If we are in NRWW section, page erase has to be delayed until now. + // Todo: Take RAMPZ into account + if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 3ede: e0 91 00 02 lds r30, 0x0200 + 3ee2: f0 91 01 02 lds r31, 0x0201 + 3ee6: 88 e3 ldi r24, 0x38 ; 56 + 3ee8: e0 30 cpi r30, 0x00 ; 0 + 3eea: f8 07 cpc r31, r24 + 3eec: 18 f0 brcs .+6 ; 0x3ef4 + 3eee: 83 e0 ldi r24, 0x03 ; 3 + 3ef0: 87 bf out 0x37, r24 ; 55 + 3ef2: e8 95 spm + // Read command terminator, start reply verifySpace(); - 3ede: 78 d0 rcall .+240 ; 0x3fd0 + 3ef4: 75 d0 rcall .+234 ; 0x3fe0 // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 3ee0: 07 b6 in r0, 0x37 ; 55 - 3ee2: 00 fc sbrc r0, 0 - 3ee4: fd cf rjmp .-6 ; 0x3ee0 + 3ef6: 07 b6 in r0, 0x37 ; 55 + 3ef8: 00 fc sbrc r0, 0 + 3efa: fd cf rjmp .-6 ; 0x3ef6 } #endif // Copy buffer into programming buffer bufPtr = buff; addrPtr = (uint16_t)(void*)address; - 3ee6: 40 91 00 02 lds r20, 0x0200 - 3eea: 50 91 01 02 lds r21, 0x0201 - 3eee: a0 e0 ldi r26, 0x00 ; 0 - 3ef0: b1 e0 ldi r27, 0x01 ; 1 + 3efc: 40 91 00 02 lds r20, 0x0200 + 3f00: 50 91 01 02 lds r21, 0x0201 + 3f04: a0 e0 ldi r26, 0x00 ; 0 + 3f06: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 3ef2: 2c 91 ld r18, X - 3ef4: 30 e0 ldi r19, 0x00 ; 0 + 3f08: 2c 91 ld r18, X + 3f0a: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 3ef6: 11 96 adiw r26, 0x01 ; 1 - 3ef8: 8c 91 ld r24, X - 3efa: 11 97 sbiw r26, 0x01 ; 1 - 3efc: 90 e0 ldi r25, 0x00 ; 0 - 3efe: 98 2f mov r25, r24 - 3f00: 88 27 eor r24, r24 - 3f02: 82 2b or r24, r18 - 3f04: 93 2b or r25, r19 -#ifdef VIRTUAL_BOOT_PARTITION -#define rstVect (*(uint16_t*)(0x204)) -#define wdtVect (*(uint16_t*)(0x206)) + 3f0c: 11 96 adiw r26, 0x01 ; 1 + 3f0e: 8c 91 ld r24, X + 3f10: 11 97 sbiw r26, 0x01 ; 1 + 3f12: 90 e0 ldi r25, 0x00 ; 0 + 3f14: 98 2f mov r25, r24 + 3f16: 88 27 eor r24, r24 + 3f18: 82 2b or r24, r18 + 3f1a: 93 2b or r25, r19 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif + /* main program starts here */ int main(void) { - 3f06: 12 96 adiw r26, 0x02 ; 2 + 3f1c: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; - boot_page_fill((uint16_t)(void*)addrPtr,a); - 3f08: fa 01 movw r30, r20 - 3f0a: 0c 01 movw r0, r24 - 3f0c: d0 92 57 00 sts 0x0057, r13 - 3f10: e8 95 spm - 3f12: 11 24 eor r1, r1 + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); + 3f1e: fa 01 movw r30, r20 + 3f20: 0c 01 movw r0, r24 + 3f22: d7 be out 0x37, r13 ; 55 + 3f24: e8 95 spm + 3f26: 11 24 eor r1, r1 addrPtr += 2; - 3f14: 4e 5f subi r20, 0xFE ; 254 - 3f16: 5f 4f sbci r21, 0xFF ; 255 + 3f28: 4e 5f subi r20, 0xFE ; 254 + 3f2a: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 3f18: f1 e0 ldi r31, 0x01 ; 1 - 3f1a: a0 38 cpi r26, 0x80 ; 128 - 3f1c: bf 07 cpc r27, r31 - 3f1e: 49 f7 brne .-46 ; 0x3ef2 + 3f2c: f1 e0 ldi r31, 0x01 ; 1 + 3f2e: a0 38 cpi r26, 0x80 ; 128 + 3f30: bf 07 cpc r27, r31 + 3f32: 51 f7 brne .-44 ; 0x3f08 // Write from programming buffer - boot_page_write((uint16_t)(void*)address); - 3f20: e0 91 00 02 lds r30, 0x0200 - 3f24: f0 91 01 02 lds r31, 0x0201 - 3f28: e0 92 57 00 sts 0x0057, r14 - 3f2c: e8 95 spm + __boot_page_write_short((uint16_t)(void*)address); + 3f34: e0 91 00 02 lds r30, 0x0200 + 3f38: f0 91 01 02 lds r31, 0x0201 + 3f3c: e7 be out 0x37, r14 ; 55 + 3f3e: e8 95 spm boot_spm_busy_wait(); - 3f2e: 07 b6 in r0, 0x37 ; 55 - 3f30: 00 fc sbrc r0, 0 - 3f32: fd cf rjmp .-6 ; 0x3f2e + 3f40: 07 b6 in r0, 0x37 ; 55 + 3f42: 00 fc sbrc r0, 0 + 3f44: fd cf rjmp .-6 ; 0x3f40 #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 3f34: f0 92 57 00 sts 0x0057, r15 - 3f38: e8 95 spm - 3f3a: 27 c0 rjmp .+78 ; 0x3f8a + 3f46: f7 be out 0x37, r15 ; 55 + 3f48: e8 95 spm + 3f4a: 27 c0 rjmp .+78 ; 0x3f9a #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 3f3c: 84 37 cpi r24, 0x74 ; 116 - 3f3e: b9 f4 brne .+46 ; 0x3f6e + 3f4c: 84 37 cpi r24, 0x74 ; 116 + 3f4e: b9 f4 brne .+46 ; 0x3f7e // READ PAGE - we only read flash getLen(); - 3f40: 37 d0 rcall .+110 ; 0x3fb0 + 3f50: 37 d0 rcall .+110 ; 0x3fc0 verifySpace(); - 3f42: 46 d0 rcall .+140 ; 0x3fd0 - else ch = pgm_read_byte_near(address); + 3f52: 46 d0 rcall .+140 ; 0x3fe0 + putch(result); address++; - putch(ch); - } while (--length); + } + while (--length); #else do putch(pgm_read_byte_near(address++)); - 3f44: e0 91 00 02 lds r30, 0x0200 - 3f48: f0 91 01 02 lds r31, 0x0201 - 3f4c: 31 96 adiw r30, 0x01 ; 1 - 3f4e: f0 93 01 02 sts 0x0201, r31 - 3f52: e0 93 00 02 sts 0x0200, r30 - 3f56: 31 97 sbiw r30, 0x01 ; 1 - 3f58: e4 91 lpm r30, Z+ - 3f5a: 8e 2f mov r24, r30 - 3f5c: 19 d0 rcall .+50 ; 0x3f90 + 3f54: e0 91 00 02 lds r30, 0x0200 + 3f58: f0 91 01 02 lds r31, 0x0201 + 3f5c: 31 96 adiw r30, 0x01 ; 1 + 3f5e: f0 93 01 02 sts 0x0201, r31 + 3f62: e0 93 00 02 sts 0x0200, r30 + 3f66: 31 97 sbiw r30, 0x01 ; 1 + 3f68: e4 91 lpm r30, Z+ + 3f6a: 8e 2f mov r24, r30 + 3f6c: 19 d0 rcall .+50 ; 0x3fa0 while (--length); - 3f5e: 80 91 02 02 lds r24, 0x0202 - 3f62: 81 50 subi r24, 0x01 ; 1 - 3f64: 80 93 02 02 sts 0x0202, r24 - 3f68: 88 23 and r24, r24 - 3f6a: 61 f7 brne .-40 ; 0x3f44 - 3f6c: 0e c0 rjmp .+28 ; 0x3f8a + 3f6e: 80 91 02 02 lds r24, 0x0202 + 3f72: 81 50 subi r24, 0x01 ; 1 + 3f74: 80 93 02 02 sts 0x0202, r24 + 3f78: 88 23 and r24, r24 + 3f7a: 61 f7 brne .-40 ; 0x3f54 + 3f7c: 0e c0 rjmp .+28 ; 0x3f9a +#endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 3f6e: 85 37 cpi r24, 0x75 ; 117 - 3f70: 39 f4 brne .+14 ; 0x3f80 + 3f7e: 85 37 cpi r24, 0x75 ; 117 + 3f80: 39 f4 brne .+14 ; 0x3f90 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 3f72: 2e d0 rcall .+92 ; 0x3fd0 + 3f82: 2e d0 rcall .+92 ; 0x3fe0 putch(SIGNATURE_0); - 3f74: 8e e1 ldi r24, 0x1E ; 30 - 3f76: 0c d0 rcall .+24 ; 0x3f90 + 3f84: 8e e1 ldi r24, 0x1E ; 30 + 3f86: 0c d0 rcall .+24 ; 0x3fa0 putch(SIGNATURE_1); - 3f78: 84 e9 ldi r24, 0x94 ; 148 - 3f7a: 0a d0 rcall .+20 ; 0x3f90 + 3f88: 84 e9 ldi r24, 0x94 ; 148 + 3f8a: 0a d0 rcall .+20 ; 0x3fa0 putch(SIGNATURE_2); - 3f7c: 86 e0 ldi r24, 0x06 ; 6 - 3f7e: 96 cf rjmp .-212 ; 0x3eac + 3f8c: 86 e0 ldi r24, 0x06 ; 6 + 3f8e: 8b cf rjmp .-234 ; 0x3ea6 } else if (ch == 'Q') { - 3f80: 81 35 cpi r24, 0x51 ; 81 - 3f82: 11 f4 brne .+4 ; 0x3f88 + 3f90: 81 35 cpi r24, 0x51 ; 81 + 3f92: 11 f4 brne .+4 ; 0x3f98 // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 3f84: 88 e0 ldi r24, 0x08 ; 8 - 3f86: 19 d0 rcall .+50 ; 0x3fba + 3f94: 88 e0 ldi r24, 0x08 ; 8 + 3f96: 19 d0 rcall .+50 ; 0x3fca verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 3f88: 23 d0 rcall .+70 ; 0x3fd0 + 3f98: 23 d0 rcall .+70 ; 0x3fe0 } putch(STK_OK); - 3f8a: 80 e1 ldi r24, 0x10 ; 16 - 3f8c: 01 d0 rcall .+2 ; 0x3f90 - 3f8e: 63 cf rjmp .-314 ; 0x3e56 + 3f9a: 80 e1 ldi r24, 0x10 ; 16 + 3f9c: 01 d0 rcall .+2 ; 0x3fa0 + 3f9e: 5c cf rjmp .-328 ; 0x3e58 -00003f90 : +00003fa0 : } } void putch(char ch) { - 3f90: 98 2f mov r25, r24 + 3fa0: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); - 3f92: 80 91 c0 00 lds r24, 0x00C0 - 3f96: 85 ff sbrs r24, 5 - 3f98: fc cf rjmp .-8 ; 0x3f92 + 3fa2: 80 91 c0 00 lds r24, 0x00C0 + 3fa6: 85 ff sbrs r24, 5 + 3fa8: fc cf rjmp .-8 ; 0x3fa2 UDR0 = ch; - 3f9a: 90 93 c6 00 sts 0x00C6, r25 + 3faa: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 3f9e: 08 95 ret + 3fae: 08 95 ret -00003fa0 : +00003fb0 : return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3fa0: a8 95 wdr + 3fb0: a8 95 wdr [uartBit] "I" (UART_RX_BIT) : "r25" ); #else while(!(UCSR0A & _BV(RXC0))); - 3fa2: 80 91 c0 00 lds r24, 0x00C0 - 3fa6: 87 ff sbrs r24, 7 - 3fa8: fc cf rjmp .-8 ; 0x3fa2 + 3fb2: 80 91 c0 00 lds r24, 0x00C0 + 3fb6: 87 ff sbrs r24, 7 + 3fb8: fc cf rjmp .-8 ; 0x3fb2 ch = UDR0; - 3faa: 80 91 c6 00 lds r24, 0x00C6 -#ifdef LED_DATA_FLASH + 3fba: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); +#endif #endif return ch; } - 3fae: 08 95 ret + 3fbe: 08 95 ret -00003fb0 : +00003fc0 : } while (--count); } #endif uint8_t getLen() { getch(); - 3fb0: f7 df rcall .-18 ; 0x3fa0 + 3fc0: f7 df rcall .-18 ; 0x3fb0 length = getch(); - 3fb2: f6 df rcall .-20 ; 0x3fa0 - 3fb4: 80 93 02 02 sts 0x0202, r24 + 3fc2: f6 df rcall .-20 ; 0x3fb0 + 3fc4: 80 93 02 02 sts 0x0202, r24 return getch(); } - 3fb8: f3 cf rjmp .-26 ; 0x3fa0 + 3fc8: f3 cf rjmp .-26 ; 0x3fb0 -00003fba : +00003fca : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 3fba: e0 e6 ldi r30, 0x60 ; 96 - 3fbc: f0 e0 ldi r31, 0x00 ; 0 - 3fbe: 98 e1 ldi r25, 0x18 ; 24 - 3fc0: 90 83 st Z, r25 + 3fca: e0 e6 ldi r30, 0x60 ; 96 + 3fcc: f0 e0 ldi r31, 0x00 ; 0 + 3fce: 98 e1 ldi r25, 0x18 ; 24 + 3fd0: 90 83 st Z, r25 WDTCSR = x; - 3fc2: 80 83 st Z, r24 + 3fd2: 80 83 st Z, r24 } - 3fc4: 08 95 ret + 3fd4: 08 95 ret -00003fc6 : +00003fd6 : void appStart() { watchdogConfig(WATCHDOG_OFF); - 3fc6: 80 e0 ldi r24, 0x00 ; 0 - 3fc8: f8 df rcall .-16 ; 0x3fba + 3fd6: 80 e0 ldi r24, 0x00 ; 0 + 3fd8: f8 df rcall .-16 ; 0x3fca __asm__ __volatile__ ( - 3fca: ee 27 eor r30, r30 - 3fcc: ff 27 eor r31, r31 - 3fce: 09 94 ijmp + 3fda: ee 27 eor r30, r30 + 3fdc: ff 27 eor r31, r31 + 3fde: 09 94 ijmp -00003fd0 : +00003fe0 : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) appStart(); - 3fd0: e7 df rcall .-50 ; 0x3fa0 - 3fd2: 80 32 cpi r24, 0x20 ; 32 - 3fd4: 09 f0 breq .+2 ; 0x3fd8 - 3fd6: f7 df rcall .-18 ; 0x3fc6 + 3fe0: e7 df rcall .-50 ; 0x3fb0 + 3fe2: 80 32 cpi r24, 0x20 ; 32 + 3fe4: 09 f0 breq .+2 ; 0x3fe8 + 3fe6: f7 df rcall .-18 ; 0x3fd6 putch(STK_INSYNC); - 3fd8: 84 e1 ldi r24, 0x14 ; 20 + 3fe8: 84 e1 ldi r24, 0x14 ; 20 } - 3fda: da cf rjmp .-76 ; 0x3f90 + 3fea: da cf rjmp .-76 ; 0x3fa0 + +00003fec : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 3fdc: 1f 93 push r17 - 3fde: 18 2f mov r17, r24 - -00003fe0 : + 3fec: 1f 93 push r17 + 3fee: 18 2f mov r17, r24 do getch(); while (--count); - 3fe0: df df rcall .-66 ; 0x3fa0 - 3fe2: 11 50 subi r17, 0x01 ; 1 - 3fe4: e9 f7 brne .-6 ; 0x3fe0 + 3ff0: df df rcall .-66 ; 0x3fb0 + 3ff2: 11 50 subi r17, 0x01 ; 1 + 3ff4: e9 f7 brne .-6 ; 0x3ff0 verifySpace(); - 3fe6: f4 df rcall .-24 ; 0x3fd0 + 3ff6: f4 df rcall .-24 ; 0x3fe0 } - 3fe8: 1f 91 pop r17 - 3fea: 08 95 ret + 3ff8: 1f 91 pop r17 + 3ffa: 08 95 ret diff --git a/bootloaders/optiboot/optiboot_pro_20mhz.hex b/bootloaders/optiboot/optiboot_pro_20mhz.hex index 19c9ae4..d147f8f 100644 --- a/bootloaders/optiboot/optiboot_pro_20mhz.hex +++ b/bootloaders/optiboot/optiboot_pro_20mhz.hex @@ -1,33 +1,34 @@ -:103E000085E08093810082E08093C00088E1809308 -:103E1000C10086E08093C20085E18093C40084B72E -:103E200014BE81FFD0D08DE0C8D0259A86E02CE367 -:103E30003BEF91E0309385002093840096BBB09BCC -:103E4000FECF1D9AA8958150A9F7DD24D394A5E053 -:103E5000EA2EF1E1FF2EA4D0813421F481E0BED01E -:103E600083E024C0823411F484E103C0853419F462 -:103E700085E0B4D08AC08535A1F492D0082F10E037 -:103E800010930102009300028BD090E0982F8827B6 -:103E9000802B912B880F991F909301028093000231 -:103EA00073C0863529F484E099D080E071D06DC06C -:103EB000843609F043C07CD0E0910002F091010209 -:103EC00083E080935700E895C0E0D1E069D0899302 -:103ED000809102028150809302028823B9F778D042 -:103EE00007B600FCFDCF4091000250910102A0E016 -:103EF000B1E02C9130E011968C91119790E0982FC1 -:103F00008827822B932B1296FA010C01D09257002E -:103F1000E89511244E5F5F4FF1E0A038BF0749F7E5 -:103F2000E0910002F0910102E0925700E89507B697 -:103F300000FCFDCFF0925700E89527C08437B9F414 -:103F400037D046D0E0910002F09101023196F09313 -:103F50000102E09300023197E4918E2F19D08091F5 -:103F60000202815080930202882361F70EC08537D8 -:103F700039F42ED08EE10CD084E90AD086E096CFB9 -:103F8000813511F488E019D023D080E101D063CFCE -:103F9000982F8091C00085FFFCCF9093C6000895B4 -:103FA000A8958091C00087FFFCCF8091C60008953E -:103FB000F7DFF6DF80930202F3CFE0E6F0E098E16E -:103FC00090838083089580E0F8DFEE27FF2709942F -:103FD000E7DF803209F0F7DF84E1DACF1F93182F93 -:0C3FE000DFDF1150E9F7F4DF1F910895B6 +:103E0000112484B714BE81FFE6D085E08093810041 +:103E100082E08093C00088E18093C10086E08093B7 +:103E2000C20085E18093C4008EE0CFD0259A86E061 +:103E30002CE33BEF91E0309385002093840096BB08 +:103E4000B09BFECF1D9AA8958150A9F7DD24D3948D +:103E5000A5E0EA2EF1E1FF2EABD0813421F481E020 +:103E6000C5D083E020C0823411F484E103C08534DE +:103E700019F485E0BBD091C0853581F499D0082F25 +:103E800010E096D090E0982F8827802B912B880FF8 +:103E9000991F90930102809300027EC0863529F419 +:103EA00084E0A4D080E07CD078C0843609F04EC095 +:103EB00087D0E0910002F091010288E3E030F8073A +:103EC00018F483E087BFE895C0E0D1E071D0899312 +:103ED000809102028150809302028823B9F7E09119 +:103EE0000002F091010288E3E030F80718F083E067 +:103EF00087BFE89575D007B600FCFDCF4091000262 +:103F000050910102A0E0B1E02C9130E011968C912B +:103F1000119790E0982F8827822B932B1296FA0105 +:103F20000C01D7BEE89511244E5F5F4FF1E0A03839 +:103F3000BF0751F7E0910002F0910102E7BEE8955A +:103F400007B600FCFDCFF7BEE89527C08437B9F46B +:103F500037D046D0E0910002F09101023196F09303 +:103F60000102E09300023197E4918E2F19D08091E5 +:103F70000202815080930202882361F70EC08537C8 +:103F800039F42ED08EE10CD084E90AD086E08BCFB4 +:103F9000813511F488E019D023D080E101D05CCFC5 +:103FA000982F8091C00085FFFCCF9093C6000895A4 +:103FB000A8958091C00087FFFCCF8091C60008952E +:103FC000F7DFF6DF80930202F3CFE0E6F0E098E15E +:103FD00090838083089580E0F8DFEE27FF2709941F +:103FE000E7DF803209F0F7DF84E1DACF1F93182F83 +:0C3FF000DFDF1150E9F7F4DF1F910895A6 :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_20mhz.lst b/bootloaders/optiboot/optiboot_pro_20mhz.lst index 62178d3..1868d16 100644 --- a/bootloaders/optiboot/optiboot_pro_20mhz.lst +++ b/bootloaders/optiboot/optiboot_pro_20mhz.lst @@ -3,237 +3,257 @@ optiboot_pro_20mhz.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001ec 00003e00 00003e00 00000054 2**1 + 0 .text 000001fc 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .debug_aranges 00000028 00000000 00000000 00000240 2**0 + 1 .debug_aranges 00000028 00000000 00000000 00000250 2**0 CONTENTS, READONLY, DEBUGGING - 2 .debug_pubnames 0000006a 00000000 00000000 00000268 2**0 + 2 .debug_pubnames 0000006a 00000000 00000000 00000278 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_info 00000269 00000000 00000000 000002d2 2**0 + 3 .debug_info 00000284 00000000 00000000 000002e2 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_abbrev 00000196 00000000 00000000 0000053b 2**0 + 4 .debug_abbrev 000001ae 00000000 00000000 00000566 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_line 000003d3 00000000 00000000 000006d1 2**0 + 5 .debug_line 00000450 00000000 00000000 00000714 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_frame 00000090 00000000 00000000 00000aa4 2**2 + 6 .debug_frame 00000090 00000000 00000000 00000b64 2**2 CONTENTS, READONLY, DEBUGGING - 7 .debug_str 00000135 00000000 00000000 00000b34 2**0 + 7 .debug_str 00000141 00000000 00000000 00000bf4 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_loc 000001d1 00000000 00000000 00000c69 2**0 + 8 .debug_loc 000001e1 00000000 00000000 00000d35 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_ranges 00000068 00000000 00000000 00000e3a 2**0 + 9 .debug_ranges 00000068 00000000 00000000 00000f16 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: 00003e00
: -#ifdef VIRTUAL_BOOT_PARTITION -#define rstVect (*(uint16_t*)(0x204)) -#define wdtVect (*(uint16_t*)(0x206)) +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif + /* main program starts here */ int main(void) { - 3e00: 85 e0 ldi r24, 0x05 ; 5 - 3e02: 80 93 81 00 sts 0x0081, r24 + 3e00: 11 24 eor r1, r1 +#ifdef __AVR_ATmega8__ + SP=RAMEND; // This is done by hardware reset +#endif + + // Adaboot no-wait mod + ch = MCUSR; + 3e02: 84 b7 in r24, 0x34 ; 52 + MCUSR = 0; + 3e04: 14 be out 0x34, r1 ; 52 + if (!(ch & _BV(EXTRF))) appStart(); + 3e06: 81 ff sbrs r24, 1 + 3e08: e6 d0 rcall .+460 ; 0x3fd6 + #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 -#endif -#ifndef SOFT_UART + 3e0a: 85 e0 ldi r24, 0x05 ; 5 + 3e0c: 80 93 81 00 sts 0x0081, r24 + UCSRA = _BV(U2X); //Double speed mode USART + UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx + UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 + UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); +#else UCSR0A = _BV(U2X0); //Double speed mode USART0 - 3e06: 82 e0 ldi r24, 0x02 ; 2 - 3e08: 80 93 c0 00 sts 0x00C0, r24 + 3e10: 82 e0 ldi r24, 0x02 ; 2 + 3e12: 80 93 c0 00 sts 0x00C0, r24 UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 3e0c: 88 e1 ldi r24, 0x18 ; 24 - 3e0e: 80 93 c1 00 sts 0x00C1, r24 + 3e16: 88 e1 ldi r24, 0x18 ; 24 + 3e18: 80 93 c1 00 sts 0x00C1, r24 UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 3e12: 86 e0 ldi r24, 0x06 ; 6 - 3e14: 80 93 c2 00 sts 0x00C2, r24 + 3e1c: 86 e0 ldi r24, 0x06 ; 6 + 3e1e: 80 93 c2 00 sts 0x00C2, r24 UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e18: 85 e1 ldi r24, 0x15 ; 21 - 3e1a: 80 93 c4 00 sts 0x00C4, r24 + 3e22: 85 e1 ldi r24, 0x15 ; 21 + 3e24: 80 93 c4 00 sts 0x00C4, r24 +#endif #endif - - // Adaboot no-wait mod - ch = MCUSR; - 3e1e: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 3e20: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 3e22: 81 ff sbrs r24, 1 - 3e24: d0 d0 rcall .+416 ; 0x3fc6 // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_500MS); - 3e26: 8d e0 ldi r24, 0x0D ; 13 - 3e28: c8 d0 rcall .+400 ; 0x3fba + watchdogConfig(WATCHDOG_1S); + 3e28: 8e e0 ldi r24, 0x0E ; 14 + 3e2a: cf d0 rcall .+414 ; 0x3fca /* Set LED pin as output */ LED_DDR |= _BV(LED); - 3e2a: 25 9a sbi 0x04, 5 ; 4 - 3e2c: 86 e0 ldi r24, 0x06 ; 6 + 3e2c: 25 9a sbi 0x04, 5 ; 4 + 3e2e: 86 e0 ldi r24, 0x06 ; 6 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 3e2e: 2c e3 ldi r18, 0x3C ; 60 - 3e30: 3b ef ldi r19, 0xFB ; 251 + 3e30: 2c e3 ldi r18, 0x3C ; 60 + 3e32: 3b ef ldi r19, 0xFB ; 251 TIFR1 = _BV(TOV1); - 3e32: 91 e0 ldi r25, 0x01 ; 1 + 3e34: 91 e0 ldi r25, 0x01 ; 1 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 3e34: 30 93 85 00 sts 0x0085, r19 - 3e38: 20 93 84 00 sts 0x0084, r18 + 3e36: 30 93 85 00 sts 0x0085, r19 + 3e3a: 20 93 84 00 sts 0x0084, r18 TIFR1 = _BV(TOV1); - 3e3c: 96 bb out 0x16, r25 ; 22 + 3e3e: 96 bb out 0x16, r25 ; 22 while(!(TIFR1 & _BV(TOV1))); - 3e3e: b0 9b sbis 0x16, 0 ; 22 - 3e40: fe cf rjmp .-4 ; 0x3e3e + 3e40: b0 9b sbis 0x16, 0 ; 22 + 3e42: fe cf rjmp .-4 ; 0x3e40 +#ifdef __AVR_ATmega8__ + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); - 3e42: 1d 9a sbi 0x03, 5 ; 3 + 3e44: 1d 9a sbi 0x03, 5 ; 3 return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3e44: a8 95 wdr - TCNT1 = -(F_CPU/(1024*16)); - TIFR1 = _BV(TOV1); - while(!(TIFR1 & _BV(TOV1))); + 3e46: a8 95 wdr + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); +#endif watchdogReset(); } while (--count); - 3e46: 81 50 subi r24, 0x01 ; 1 - 3e48: a9 f7 brne .-22 ; 0x3e34 + 3e48: 81 50 subi r24, 0x01 ; 1 + 3e4a: a9 f7 brne .-22 ; 0x3e36 /* get character from UART */ ch = getch(); if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 3e4a: dd 24 eor r13, r13 - 3e4c: d3 94 inc r13 - boot_page_fill((uint16_t)(void*)addrPtr,a); + 3e4c: dd 24 eor r13, r13 + 3e4e: d3 94 inc r13 + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); // Write from programming buffer - boot_page_write((uint16_t)(void*)address); - 3e4e: a5 e0 ldi r26, 0x05 ; 5 - 3e50: ea 2e mov r14, r26 + __boot_page_write_short((uint16_t)(void*)address); + 3e50: a5 e0 ldi r26, 0x05 ; 5 + 3e52: ea 2e mov r14, r26 boot_spm_busy_wait(); #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 3e52: f1 e1 ldi r31, 0x11 ; 17 - 3e54: ff 2e mov r15, r31 + 3e54: f1 e1 ldi r31, 0x11 ; 17 + 3e56: ff 2e mov r15, r31 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 3e56: a4 d0 rcall .+328 ; 0x3fa0 + 3e58: ab d0 rcall .+342 ; 0x3fb0 if(ch == STK_GET_PARAMETER) { - 3e58: 81 34 cpi r24, 0x41 ; 65 - 3e5a: 21 f4 brne .+8 ; 0x3e64 + 3e5a: 81 34 cpi r24, 0x41 ; 65 + 3e5c: 21 f4 brne .+8 ; 0x3e66 // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 3e5c: 81 e0 ldi r24, 0x01 ; 1 - 3e5e: be d0 rcall .+380 ; 0x3fdc + 3e5e: 81 e0 ldi r24, 0x01 ; 1 + 3e60: c5 d0 rcall .+394 ; 0x3fec putch(0x03); - 3e60: 83 e0 ldi r24, 0x03 ; 3 - 3e62: 24 c0 rjmp .+72 ; 0x3eac + 3e62: 83 e0 ldi r24, 0x03 ; 3 + 3e64: 20 c0 rjmp .+64 ; 0x3ea6 } else if(ch == STK_SET_DEVICE) { - 3e64: 82 34 cpi r24, 0x42 ; 66 - 3e66: 11 f4 brne .+4 ; 0x3e6c + 3e66: 82 34 cpi r24, 0x42 ; 66 + 3e68: 11 f4 brne .+4 ; 0x3e6e // SET DEVICE is ignored getNch(20); - 3e68: 84 e1 ldi r24, 0x14 ; 20 - 3e6a: 03 c0 rjmp .+6 ; 0x3e72 + 3e6a: 84 e1 ldi r24, 0x14 ; 20 + 3e6c: 03 c0 rjmp .+6 ; 0x3e74 } else if(ch == STK_SET_DEVICE_EXT) { - 3e6c: 85 34 cpi r24, 0x45 ; 69 - 3e6e: 19 f4 brne .+6 ; 0x3e76 + 3e6e: 85 34 cpi r24, 0x45 ; 69 + 3e70: 19 f4 brne .+6 ; 0x3e78 // SET DEVICE EXT is ignored getNch(5); - 3e70: 85 e0 ldi r24, 0x05 ; 5 - 3e72: b4 d0 rcall .+360 ; 0x3fdc - 3e74: 8a c0 rjmp .+276 ; 0x3f8a + 3e72: 85 e0 ldi r24, 0x05 ; 5 + 3e74: bb d0 rcall .+374 ; 0x3fec + 3e76: 91 c0 rjmp .+290 ; 0x3f9a } else if(ch == STK_LOAD_ADDRESS) { - 3e76: 85 35 cpi r24, 0x55 ; 85 - 3e78: a1 f4 brne .+40 ; 0x3ea2 + 3e78: 85 35 cpi r24, 0x55 ; 85 + 3e7a: 81 f4 brne .+32 ; 0x3e9c // LOAD ADDRESS - address = getch(); - 3e7a: 92 d0 rcall .+292 ; 0x3fa0 - 3e7c: 08 2f mov r16, r24 - 3e7e: 10 e0 ldi r17, 0x00 ; 0 - 3e80: 10 93 01 02 sts 0x0201, r17 - 3e84: 00 93 00 02 sts 0x0200, r16 - address = (address & 0xff) | (getch() << 8); - 3e88: 8b d0 rcall .+278 ; 0x3fa0 - 3e8a: 90 e0 ldi r25, 0x00 ; 0 - 3e8c: 98 2f mov r25, r24 - 3e8e: 88 27 eor r24, r24 - 3e90: 80 2b or r24, r16 - 3e92: 91 2b or r25, r17 - address += address; // Convert from word address to byte address - 3e94: 88 0f add r24, r24 - 3e96: 99 1f adc r25, r25 - 3e98: 90 93 01 02 sts 0x0201, r25 - 3e9c: 80 93 00 02 sts 0x0200, r24 - 3ea0: 73 c0 rjmp .+230 ; 0x3f88 + uint16_t newAddress; + newAddress = getch(); + 3e7c: 99 d0 rcall .+306 ; 0x3fb0 + newAddress = (newAddress & 0xff) | (getch() << 8); + 3e7e: 08 2f mov r16, r24 + 3e80: 10 e0 ldi r17, 0x00 ; 0 + 3e82: 96 d0 rcall .+300 ; 0x3fb0 + 3e84: 90 e0 ldi r25, 0x00 ; 0 + 3e86: 98 2f mov r25, r24 + 3e88: 88 27 eor r24, r24 + 3e8a: 80 2b or r24, r16 + 3e8c: 91 2b or r25, r17 +#ifdef RAMPZ + // Transfer top bit to RAMPZ + RAMPZ = (newAddress & 0x8000) ? 1 : 0; +#endif + newAddress += newAddress; // Convert from word address to byte address + 3e8e: 88 0f add r24, r24 + 3e90: 99 1f adc r25, r25 + address = newAddress; + 3e92: 90 93 01 02 sts 0x0201, r25 + 3e96: 80 93 00 02 sts 0x0200, r24 + 3e9a: 7e c0 rjmp .+252 ; 0x3f98 verifySpace(); } else if(ch == STK_UNIVERSAL) { - 3ea2: 86 35 cpi r24, 0x56 ; 86 - 3ea4: 29 f4 brne .+10 ; 0x3eb0 + 3e9c: 86 35 cpi r24, 0x56 ; 86 + 3e9e: 29 f4 brne .+10 ; 0x3eaa // UNIVERSAL command is ignored getNch(4); - 3ea6: 84 e0 ldi r24, 0x04 ; 4 - 3ea8: 99 d0 rcall .+306 ; 0x3fdc + 3ea0: 84 e0 ldi r24, 0x04 ; 4 + 3ea2: a4 d0 rcall .+328 ; 0x3fec putch(0x00); - 3eaa: 80 e0 ldi r24, 0x00 ; 0 - 3eac: 71 d0 rcall .+226 ; 0x3f90 - 3eae: 6d c0 rjmp .+218 ; 0x3f8a + 3ea4: 80 e0 ldi r24, 0x00 ; 0 + 3ea6: 7c d0 rcall .+248 ; 0x3fa0 + 3ea8: 78 c0 rjmp .+240 ; 0x3f9a } - /* Write memory, length is big endian and is in bytes */ + /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 3eb0: 84 36 cpi r24, 0x64 ; 100 - 3eb2: 09 f0 breq .+2 ; 0x3eb6 - 3eb4: 43 c0 rjmp .+134 ; 0x3f3c + 3eaa: 84 36 cpi r24, 0x64 ; 100 + 3eac: 09 f0 breq .+2 ; 0x3eb0 + 3eae: 4e c0 rjmp .+156 ; 0x3f4c // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; getLen(); - 3eb6: 7c d0 rcall .+248 ; 0x3fb0 - - // Immediately start page erase - this will 4.5ms - boot_page_erase((uint16_t)(void*)address); - 3eb8: e0 91 00 02 lds r30, 0x0200 - 3ebc: f0 91 01 02 lds r31, 0x0201 - 3ec0: 83 e0 ldi r24, 0x03 ; 3 - 3ec2: 80 93 57 00 sts 0x0057, r24 + 3eb0: 87 d0 rcall .+270 ; 0x3fc0 + + // If we are in RWW section, immediately start page erase + if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 3eb2: e0 91 00 02 lds r30, 0x0200 + 3eb6: f0 91 01 02 lds r31, 0x0201 + 3eba: 88 e3 ldi r24, 0x38 ; 56 + 3ebc: e0 30 cpi r30, 0x00 ; 0 + 3ebe: f8 07 cpc r31, r24 + 3ec0: 18 f4 brcc .+6 ; 0x3ec8 + 3ec2: 83 e0 ldi r24, 0x03 ; 3 + 3ec4: 87 bf out 0x37, r24 ; 55 3ec6: e8 95 spm 3ec8: c0 e0 ldi r28, 0x00 ; 0 3eca: d1 e0 ldi r29, 0x01 ; 1 - + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 3ecc: 69 d0 rcall .+210 ; 0x3fa0 + 3ecc: 71 d0 rcall .+226 ; 0x3fb0 3ece: 89 93 st Y+, r24 while (--length); 3ed0: 80 91 02 02 lds r24, 0x0202 @@ -242,279 +262,293 @@ void watchdogReset() { 3eda: 88 23 and r24, r24 3edc: b9 f7 brne .-18 ; 0x3ecc + // If we are in NRWW section, page erase has to be delayed until now. + // Todo: Take RAMPZ into account + if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 3ede: e0 91 00 02 lds r30, 0x0200 + 3ee2: f0 91 01 02 lds r31, 0x0201 + 3ee6: 88 e3 ldi r24, 0x38 ; 56 + 3ee8: e0 30 cpi r30, 0x00 ; 0 + 3eea: f8 07 cpc r31, r24 + 3eec: 18 f0 brcs .+6 ; 0x3ef4 + 3eee: 83 e0 ldi r24, 0x03 ; 3 + 3ef0: 87 bf out 0x37, r24 ; 55 + 3ef2: e8 95 spm + // Read command terminator, start reply verifySpace(); - 3ede: 78 d0 rcall .+240 ; 0x3fd0 + 3ef4: 75 d0 rcall .+234 ; 0x3fe0 // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 3ee0: 07 b6 in r0, 0x37 ; 55 - 3ee2: 00 fc sbrc r0, 0 - 3ee4: fd cf rjmp .-6 ; 0x3ee0 + 3ef6: 07 b6 in r0, 0x37 ; 55 + 3ef8: 00 fc sbrc r0, 0 + 3efa: fd cf rjmp .-6 ; 0x3ef6 } #endif // Copy buffer into programming buffer bufPtr = buff; addrPtr = (uint16_t)(void*)address; - 3ee6: 40 91 00 02 lds r20, 0x0200 - 3eea: 50 91 01 02 lds r21, 0x0201 - 3eee: a0 e0 ldi r26, 0x00 ; 0 - 3ef0: b1 e0 ldi r27, 0x01 ; 1 + 3efc: 40 91 00 02 lds r20, 0x0200 + 3f00: 50 91 01 02 lds r21, 0x0201 + 3f04: a0 e0 ldi r26, 0x00 ; 0 + 3f06: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 3ef2: 2c 91 ld r18, X - 3ef4: 30 e0 ldi r19, 0x00 ; 0 + 3f08: 2c 91 ld r18, X + 3f0a: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 3ef6: 11 96 adiw r26, 0x01 ; 1 - 3ef8: 8c 91 ld r24, X - 3efa: 11 97 sbiw r26, 0x01 ; 1 - 3efc: 90 e0 ldi r25, 0x00 ; 0 - 3efe: 98 2f mov r25, r24 - 3f00: 88 27 eor r24, r24 - 3f02: 82 2b or r24, r18 - 3f04: 93 2b or r25, r19 -#ifdef VIRTUAL_BOOT_PARTITION -#define rstVect (*(uint16_t*)(0x204)) -#define wdtVect (*(uint16_t*)(0x206)) + 3f0c: 11 96 adiw r26, 0x01 ; 1 + 3f0e: 8c 91 ld r24, X + 3f10: 11 97 sbiw r26, 0x01 ; 1 + 3f12: 90 e0 ldi r25, 0x00 ; 0 + 3f14: 98 2f mov r25, r24 + 3f16: 88 27 eor r24, r24 + 3f18: 82 2b or r24, r18 + 3f1a: 93 2b or r25, r19 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif + /* main program starts here */ int main(void) { - 3f06: 12 96 adiw r26, 0x02 ; 2 + 3f1c: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; - boot_page_fill((uint16_t)(void*)addrPtr,a); - 3f08: fa 01 movw r30, r20 - 3f0a: 0c 01 movw r0, r24 - 3f0c: d0 92 57 00 sts 0x0057, r13 - 3f10: e8 95 spm - 3f12: 11 24 eor r1, r1 + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); + 3f1e: fa 01 movw r30, r20 + 3f20: 0c 01 movw r0, r24 + 3f22: d7 be out 0x37, r13 ; 55 + 3f24: e8 95 spm + 3f26: 11 24 eor r1, r1 addrPtr += 2; - 3f14: 4e 5f subi r20, 0xFE ; 254 - 3f16: 5f 4f sbci r21, 0xFF ; 255 + 3f28: 4e 5f subi r20, 0xFE ; 254 + 3f2a: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 3f18: f1 e0 ldi r31, 0x01 ; 1 - 3f1a: a0 38 cpi r26, 0x80 ; 128 - 3f1c: bf 07 cpc r27, r31 - 3f1e: 49 f7 brne .-46 ; 0x3ef2 + 3f2c: f1 e0 ldi r31, 0x01 ; 1 + 3f2e: a0 38 cpi r26, 0x80 ; 128 + 3f30: bf 07 cpc r27, r31 + 3f32: 51 f7 brne .-44 ; 0x3f08 // Write from programming buffer - boot_page_write((uint16_t)(void*)address); - 3f20: e0 91 00 02 lds r30, 0x0200 - 3f24: f0 91 01 02 lds r31, 0x0201 - 3f28: e0 92 57 00 sts 0x0057, r14 - 3f2c: e8 95 spm + __boot_page_write_short((uint16_t)(void*)address); + 3f34: e0 91 00 02 lds r30, 0x0200 + 3f38: f0 91 01 02 lds r31, 0x0201 + 3f3c: e7 be out 0x37, r14 ; 55 + 3f3e: e8 95 spm boot_spm_busy_wait(); - 3f2e: 07 b6 in r0, 0x37 ; 55 - 3f30: 00 fc sbrc r0, 0 - 3f32: fd cf rjmp .-6 ; 0x3f2e + 3f40: 07 b6 in r0, 0x37 ; 55 + 3f42: 00 fc sbrc r0, 0 + 3f44: fd cf rjmp .-6 ; 0x3f40 #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 3f34: f0 92 57 00 sts 0x0057, r15 - 3f38: e8 95 spm - 3f3a: 27 c0 rjmp .+78 ; 0x3f8a + 3f46: f7 be out 0x37, r15 ; 55 + 3f48: e8 95 spm + 3f4a: 27 c0 rjmp .+78 ; 0x3f9a #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 3f3c: 84 37 cpi r24, 0x74 ; 116 - 3f3e: b9 f4 brne .+46 ; 0x3f6e + 3f4c: 84 37 cpi r24, 0x74 ; 116 + 3f4e: b9 f4 brne .+46 ; 0x3f7e // READ PAGE - we only read flash getLen(); - 3f40: 37 d0 rcall .+110 ; 0x3fb0 + 3f50: 37 d0 rcall .+110 ; 0x3fc0 verifySpace(); - 3f42: 46 d0 rcall .+140 ; 0x3fd0 - else ch = pgm_read_byte_near(address); + 3f52: 46 d0 rcall .+140 ; 0x3fe0 + putch(result); address++; - putch(ch); - } while (--length); + } + while (--length); #else do putch(pgm_read_byte_near(address++)); - 3f44: e0 91 00 02 lds r30, 0x0200 - 3f48: f0 91 01 02 lds r31, 0x0201 - 3f4c: 31 96 adiw r30, 0x01 ; 1 - 3f4e: f0 93 01 02 sts 0x0201, r31 - 3f52: e0 93 00 02 sts 0x0200, r30 - 3f56: 31 97 sbiw r30, 0x01 ; 1 - 3f58: e4 91 lpm r30, Z+ - 3f5a: 8e 2f mov r24, r30 - 3f5c: 19 d0 rcall .+50 ; 0x3f90 + 3f54: e0 91 00 02 lds r30, 0x0200 + 3f58: f0 91 01 02 lds r31, 0x0201 + 3f5c: 31 96 adiw r30, 0x01 ; 1 + 3f5e: f0 93 01 02 sts 0x0201, r31 + 3f62: e0 93 00 02 sts 0x0200, r30 + 3f66: 31 97 sbiw r30, 0x01 ; 1 + 3f68: e4 91 lpm r30, Z+ + 3f6a: 8e 2f mov r24, r30 + 3f6c: 19 d0 rcall .+50 ; 0x3fa0 while (--length); - 3f5e: 80 91 02 02 lds r24, 0x0202 - 3f62: 81 50 subi r24, 0x01 ; 1 - 3f64: 80 93 02 02 sts 0x0202, r24 - 3f68: 88 23 and r24, r24 - 3f6a: 61 f7 brne .-40 ; 0x3f44 - 3f6c: 0e c0 rjmp .+28 ; 0x3f8a + 3f6e: 80 91 02 02 lds r24, 0x0202 + 3f72: 81 50 subi r24, 0x01 ; 1 + 3f74: 80 93 02 02 sts 0x0202, r24 + 3f78: 88 23 and r24, r24 + 3f7a: 61 f7 brne .-40 ; 0x3f54 + 3f7c: 0e c0 rjmp .+28 ; 0x3f9a +#endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 3f6e: 85 37 cpi r24, 0x75 ; 117 - 3f70: 39 f4 brne .+14 ; 0x3f80 + 3f7e: 85 37 cpi r24, 0x75 ; 117 + 3f80: 39 f4 brne .+14 ; 0x3f90 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 3f72: 2e d0 rcall .+92 ; 0x3fd0 + 3f82: 2e d0 rcall .+92 ; 0x3fe0 putch(SIGNATURE_0); - 3f74: 8e e1 ldi r24, 0x1E ; 30 - 3f76: 0c d0 rcall .+24 ; 0x3f90 + 3f84: 8e e1 ldi r24, 0x1E ; 30 + 3f86: 0c d0 rcall .+24 ; 0x3fa0 putch(SIGNATURE_1); - 3f78: 84 e9 ldi r24, 0x94 ; 148 - 3f7a: 0a d0 rcall .+20 ; 0x3f90 + 3f88: 84 e9 ldi r24, 0x94 ; 148 + 3f8a: 0a d0 rcall .+20 ; 0x3fa0 putch(SIGNATURE_2); - 3f7c: 86 e0 ldi r24, 0x06 ; 6 - 3f7e: 96 cf rjmp .-212 ; 0x3eac + 3f8c: 86 e0 ldi r24, 0x06 ; 6 + 3f8e: 8b cf rjmp .-234 ; 0x3ea6 } else if (ch == 'Q') { - 3f80: 81 35 cpi r24, 0x51 ; 81 - 3f82: 11 f4 brne .+4 ; 0x3f88 + 3f90: 81 35 cpi r24, 0x51 ; 81 + 3f92: 11 f4 brne .+4 ; 0x3f98 // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 3f84: 88 e0 ldi r24, 0x08 ; 8 - 3f86: 19 d0 rcall .+50 ; 0x3fba + 3f94: 88 e0 ldi r24, 0x08 ; 8 + 3f96: 19 d0 rcall .+50 ; 0x3fca verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 3f88: 23 d0 rcall .+70 ; 0x3fd0 + 3f98: 23 d0 rcall .+70 ; 0x3fe0 } putch(STK_OK); - 3f8a: 80 e1 ldi r24, 0x10 ; 16 - 3f8c: 01 d0 rcall .+2 ; 0x3f90 - 3f8e: 63 cf rjmp .-314 ; 0x3e56 + 3f9a: 80 e1 ldi r24, 0x10 ; 16 + 3f9c: 01 d0 rcall .+2 ; 0x3fa0 + 3f9e: 5c cf rjmp .-328 ; 0x3e58 -00003f90 : +00003fa0 : } } void putch(char ch) { - 3f90: 98 2f mov r25, r24 + 3fa0: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); - 3f92: 80 91 c0 00 lds r24, 0x00C0 - 3f96: 85 ff sbrs r24, 5 - 3f98: fc cf rjmp .-8 ; 0x3f92 + 3fa2: 80 91 c0 00 lds r24, 0x00C0 + 3fa6: 85 ff sbrs r24, 5 + 3fa8: fc cf rjmp .-8 ; 0x3fa2 UDR0 = ch; - 3f9a: 90 93 c6 00 sts 0x00C6, r25 + 3faa: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 3f9e: 08 95 ret + 3fae: 08 95 ret -00003fa0 : +00003fb0 : return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3fa0: a8 95 wdr + 3fb0: a8 95 wdr [uartBit] "I" (UART_RX_BIT) : "r25" ); #else while(!(UCSR0A & _BV(RXC0))); - 3fa2: 80 91 c0 00 lds r24, 0x00C0 - 3fa6: 87 ff sbrs r24, 7 - 3fa8: fc cf rjmp .-8 ; 0x3fa2 + 3fb2: 80 91 c0 00 lds r24, 0x00C0 + 3fb6: 87 ff sbrs r24, 7 + 3fb8: fc cf rjmp .-8 ; 0x3fb2 ch = UDR0; - 3faa: 80 91 c6 00 lds r24, 0x00C6 -#ifdef LED_DATA_FLASH + 3fba: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); +#endif #endif return ch; } - 3fae: 08 95 ret + 3fbe: 08 95 ret -00003fb0 : +00003fc0 : } while (--count); } #endif uint8_t getLen() { getch(); - 3fb0: f7 df rcall .-18 ; 0x3fa0 + 3fc0: f7 df rcall .-18 ; 0x3fb0 length = getch(); - 3fb2: f6 df rcall .-20 ; 0x3fa0 - 3fb4: 80 93 02 02 sts 0x0202, r24 + 3fc2: f6 df rcall .-20 ; 0x3fb0 + 3fc4: 80 93 02 02 sts 0x0202, r24 return getch(); } - 3fb8: f3 cf rjmp .-26 ; 0x3fa0 + 3fc8: f3 cf rjmp .-26 ; 0x3fb0 -00003fba : +00003fca : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 3fba: e0 e6 ldi r30, 0x60 ; 96 - 3fbc: f0 e0 ldi r31, 0x00 ; 0 - 3fbe: 98 e1 ldi r25, 0x18 ; 24 - 3fc0: 90 83 st Z, r25 + 3fca: e0 e6 ldi r30, 0x60 ; 96 + 3fcc: f0 e0 ldi r31, 0x00 ; 0 + 3fce: 98 e1 ldi r25, 0x18 ; 24 + 3fd0: 90 83 st Z, r25 WDTCSR = x; - 3fc2: 80 83 st Z, r24 + 3fd2: 80 83 st Z, r24 } - 3fc4: 08 95 ret + 3fd4: 08 95 ret -00003fc6 : +00003fd6 : void appStart() { watchdogConfig(WATCHDOG_OFF); - 3fc6: 80 e0 ldi r24, 0x00 ; 0 - 3fc8: f8 df rcall .-16 ; 0x3fba + 3fd6: 80 e0 ldi r24, 0x00 ; 0 + 3fd8: f8 df rcall .-16 ; 0x3fca __asm__ __volatile__ ( - 3fca: ee 27 eor r30, r30 - 3fcc: ff 27 eor r31, r31 - 3fce: 09 94 ijmp + 3fda: ee 27 eor r30, r30 + 3fdc: ff 27 eor r31, r31 + 3fde: 09 94 ijmp -00003fd0 : +00003fe0 : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) appStart(); - 3fd0: e7 df rcall .-50 ; 0x3fa0 - 3fd2: 80 32 cpi r24, 0x20 ; 32 - 3fd4: 09 f0 breq .+2 ; 0x3fd8 - 3fd6: f7 df rcall .-18 ; 0x3fc6 + 3fe0: e7 df rcall .-50 ; 0x3fb0 + 3fe2: 80 32 cpi r24, 0x20 ; 32 + 3fe4: 09 f0 breq .+2 ; 0x3fe8 + 3fe6: f7 df rcall .-18 ; 0x3fd6 putch(STK_INSYNC); - 3fd8: 84 e1 ldi r24, 0x14 ; 20 + 3fe8: 84 e1 ldi r24, 0x14 ; 20 } - 3fda: da cf rjmp .-76 ; 0x3f90 + 3fea: da cf rjmp .-76 ; 0x3fa0 + +00003fec : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 3fdc: 1f 93 push r17 - 3fde: 18 2f mov r17, r24 - -00003fe0 : + 3fec: 1f 93 push r17 + 3fee: 18 2f mov r17, r24 do getch(); while (--count); - 3fe0: df df rcall .-66 ; 0x3fa0 - 3fe2: 11 50 subi r17, 0x01 ; 1 - 3fe4: e9 f7 brne .-6 ; 0x3fe0 + 3ff0: df df rcall .-66 ; 0x3fb0 + 3ff2: 11 50 subi r17, 0x01 ; 1 + 3ff4: e9 f7 brne .-6 ; 0x3ff0 verifySpace(); - 3fe6: f4 df rcall .-24 ; 0x3fd0 + 3ff6: f4 df rcall .-24 ; 0x3fe0 } - 3fe8: 1f 91 pop r17 - 3fea: 08 95 ret + 3ff8: 1f 91 pop r17 + 3ffa: 08 95 ret diff --git a/bootloaders/optiboot/optiboot_pro_8MHz.hex b/bootloaders/optiboot/optiboot_pro_8MHz.hex index 9d31a7a..7579286 100644 --- a/bootloaders/optiboot/optiboot_pro_8MHz.hex +++ b/bootloaders/optiboot/optiboot_pro_8MHz.hex @@ -1,34 +1,34 @@ -:103E000085E08093810084B714BE81FFE4D08DE00B -:103E1000DCD0259A519A86E028E13EEF91E030937C -:103E200085002093840096BBB09BFECF1D9AA89579 -:103E30008150A9F7DD24D394A5E0EA2EF1E1FF2E0D -:103E4000ABD0813421F481E0D1D083E024C082342E -:103E500011F484E103C0853419F485E0C7D08AC029 -:103E60008535A1F499D0082F10E01093010200933A -:103E7000000292D090E0982F8827802B912B880FFA -:103E8000991F909301028093000273C0863529F434 -:103E900084E0ACD080E071D06DC0843609F043C0BE -:103EA0008FD0E0910002F091010283E080935700EF -:103EB000E895C0E0D1E070D08993809102028150F2 -:103EC000809302028823B9F78BD007B600FCFDCFA0 -:103ED0004091000250910102A0E0B1E02C9130E04D -:103EE00011968C91119790E0982F8827822B932B15 -:103EF0001296FA010C01D0925700E89511244E5FFA -:103F00005F4FF1E0A038BF0749F7E0910002F09160 -:103F10000102E0925700E89507B600FCFDCFF09251 -:103F20005700E89527C08437B9F44AD059D0E091BA -:103F30000002F09101023196F0930102E093000239 -:103F40003197E4918E2F19D0809102028150809395 -:103F50000202882361F70EC0853739F441D08EE123 -:103F60000CD084E90AD086E096CF813511F488E040 -:103F70002CD036D080E101D063CF2AE030E08095AC -:103F8000089410F4599802C0599A000015D014D022 -:103F900086952A95B1F70895A89529E030E04899CB -:103FA000FECF0AD009D008D08894489908942A9561 -:103FB00011F08795F7CF089598E09A95F1F7089555 -:103FC000EBDFEADF80930202E7CFE0E6F0E098E182 +:103E0000112484B714BE81FFE6D085E08093810041 +:103E100082E08093C00088E18093C10086E08093B7 +:103E2000C20088E08093C4008EE0CFD0259A86E05F +:103E300028E13EEF91E0309385002093840096BB0B +:103E4000B09BFECF1D9AA8958150A9F7DD24D3948D +:103E5000A5E0EA2EF1E1FF2EABD0813421F481E020 +:103E6000C5D083E020C0823411F484E103C08534DE +:103E700019F485E0BBD091C0853581F499D0082F25 +:103E800010E096D090E0982F8827802B912B880FF8 +:103E9000991F90930102809300027EC0863529F419 +:103EA00084E0A4D080E07CD078C0843609F04EC095 +:103EB00087D0E0910002F091010288E3E030F8073A +:103EC00018F483E087BFE895C0E0D1E071D0899312 +:103ED000809102028150809302028823B9F7E09119 +:103EE0000002F091010288E3E030F80718F083E067 +:103EF00087BFE89575D007B600FCFDCF4091000262 +:103F000050910102A0E0B1E02C9130E011968C912B +:103F1000119790E0982F8827822B932B1296FA0105 +:103F20000C01D7BEE89511244E5F5F4FF1E0A03839 +:103F3000BF0751F7E0910002F0910102E7BEE8955A +:103F400007B600FCFDCFF7BEE89527C08437B9F46B +:103F500037D046D0E0910002F09101023196F09303 +:103F60000102E09300023197E4918E2F19D08091E5 +:103F70000202815080930202882361F70EC08537C8 +:103F800039F42ED08EE10CD084E90AD086E08BCFB4 +:103F9000813511F488E019D023D080E101D05CCFC5 +:103FA000982F8091C00085FFFCCF9093C6000895A4 +:103FB000A8958091C00087FFFCCF8091C60008952E +:103FC000F7DFF6DF80930202F3CFE0E6F0E098E15E :103FD00090838083089580E0F8DFEE27FF2709941F -:103FE000DBDF803209F0F7DF84E1C7CF1F93182FA2 -:0C3FF000D3DF1150E9F7F4DF1F910895B2 +:103FE000E7DF803209F0F7DF84E1DACF1F93182F83 +:0C3FF000DFDF1150E9F7F4DF1F910895A6 :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_8MHz.lst b/bootloaders/optiboot/optiboot_pro_8MHz.lst index 94603e2..25a4bd2 100644 --- a/bootloaders/optiboot/optiboot_pro_8MHz.lst +++ b/bootloaders/optiboot/optiboot_pro_8MHz.lst @@ -7,452 +7,473 @@ Idx Name Size VMA LMA File off Algn CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .debug_aranges 00000028 00000000 00000000 00000250 2**0 CONTENTS, READONLY, DEBUGGING - 2 .debug_pubnames 00000078 00000000 00000000 00000278 2**0 + 2 .debug_pubnames 0000006a 00000000 00000000 00000278 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_info 00000277 00000000 00000000 000002f0 2**0 + 3 .debug_info 00000284 00000000 00000000 000002e2 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_abbrev 00000194 00000000 00000000 00000567 2**0 + 4 .debug_abbrev 000001ae 00000000 00000000 00000566 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_line 000003bb 00000000 00000000 000006fb 2**0 + 5 .debug_line 00000450 00000000 00000000 00000714 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_frame 000000a0 00000000 00000000 00000ab8 2**2 + 6 .debug_frame 00000090 00000000 00000000 00000b64 2**2 CONTENTS, READONLY, DEBUGGING - 7 .debug_str 0000013f 00000000 00000000 00000b58 2**0 + 7 .debug_str 00000141 00000000 00000000 00000bf4 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_loc 000001a0 00000000 00000000 00000c97 2**0 + 8 .debug_loc 000001e1 00000000 00000000 00000d35 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_ranges 00000070 00000000 00000000 00000e37 2**0 + 9 .debug_ranges 00000068 00000000 00000000 00000f16 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: 00003e00
: -#ifdef VIRTUAL_BOOT_PARTITION -#define rstVect (*(uint16_t*)(0x204)) -#define wdtVect (*(uint16_t*)(0x206)) +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif + /* main program starts here */ int main(void) { - 3e00: 85 e0 ldi r24, 0x05 ; 5 - 3e02: 80 93 81 00 sts 0x0081, r24 - UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); + 3e00: 11 24 eor r1, r1 +#ifdef __AVR_ATmega8__ + SP=RAMEND; // This is done by hardware reset #endif // Adaboot no-wait mod ch = MCUSR; - 3e06: 84 b7 in r24, 0x34 ; 52 + 3e02: 84 b7 in r24, 0x34 ; 52 MCUSR = 0; - 3e08: 14 be out 0x34, r1 ; 52 + 3e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); - 3e0a: 81 ff sbrs r24, 1 - 3e0c: e4 d0 rcall .+456 ; 0x3fd6 + 3e06: 81 ff sbrs r24, 1 + 3e08: e6 d0 rcall .+460 ; 0x3fd6 + +#if LED_START_FLASHES > 0 + // Set up Timer 1 for timeout counter + TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 + 3e0a: 85 e0 ldi r24, 0x05 ; 5 + 3e0c: 80 93 81 00 sts 0x0081, r24 + UCSRA = _BV(U2X); //Double speed mode USART + UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx + UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 + UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); +#else + UCSR0A = _BV(U2X0); //Double speed mode USART0 + 3e10: 82 e0 ldi r24, 0x02 ; 2 + 3e12: 80 93 c0 00 sts 0x00C0, r24 + UCSR0B = _BV(RXEN0) | _BV(TXEN0); + 3e16: 88 e1 ldi r24, 0x18 ; 24 + 3e18: 80 93 c1 00 sts 0x00C1, r24 + UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); + 3e1c: 86 e0 ldi r24, 0x06 ; 6 + 3e1e: 80 93 c2 00 sts 0x00C2, r24 + UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); + 3e22: 88 e0 ldi r24, 0x08 ; 8 + 3e24: 80 93 c4 00 sts 0x00C4, r24 +#endif +#endif // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_500MS); - 3e0e: 8d e0 ldi r24, 0x0D ; 13 - 3e10: dc d0 rcall .+440 ; 0x3fca + watchdogConfig(WATCHDOG_1S); + 3e28: 8e e0 ldi r24, 0x0E ; 14 + 3e2a: cf d0 rcall .+414 ; 0x3fca /* Set LED pin as output */ LED_DDR |= _BV(LED); - 3e12: 25 9a sbi 0x04, 5 ; 4 - -#ifdef SOFT_UART - /* Set TX pin as output */ - UART_DDR |= _BV(UART_TX_BIT); - 3e14: 51 9a sbi 0x0a, 1 ; 10 - 3e16: 86 e0 ldi r24, 0x06 ; 6 + 3e2c: 25 9a sbi 0x04, 5 ; 4 + 3e2e: 86 e0 ldi r24, 0x06 ; 6 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 3e18: 28 e1 ldi r18, 0x18 ; 24 - 3e1a: 3e ef ldi r19, 0xFE ; 254 + 3e30: 28 e1 ldi r18, 0x18 ; 24 + 3e32: 3e ef ldi r19, 0xFE ; 254 TIFR1 = _BV(TOV1); - 3e1c: 91 e0 ldi r25, 0x01 ; 1 + 3e34: 91 e0 ldi r25, 0x01 ; 1 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 3e1e: 30 93 85 00 sts 0x0085, r19 - 3e22: 20 93 84 00 sts 0x0084, r18 + 3e36: 30 93 85 00 sts 0x0085, r19 + 3e3a: 20 93 84 00 sts 0x0084, r18 TIFR1 = _BV(TOV1); - 3e26: 96 bb out 0x16, r25 ; 22 + 3e3e: 96 bb out 0x16, r25 ; 22 while(!(TIFR1 & _BV(TOV1))); - 3e28: b0 9b sbis 0x16, 0 ; 22 - 3e2a: fe cf rjmp .-4 ; 0x3e28 + 3e40: b0 9b sbis 0x16, 0 ; 22 + 3e42: fe cf rjmp .-4 ; 0x3e40 +#ifdef __AVR_ATmega8__ + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); - 3e2c: 1d 9a sbi 0x03, 5 ; 3 + 3e44: 1d 9a sbi 0x03, 5 ; 3 return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3e2e: a8 95 wdr - TCNT1 = -(F_CPU/(1024*16)); - TIFR1 = _BV(TOV1); - while(!(TIFR1 & _BV(TOV1))); + 3e46: a8 95 wdr + LED_PORT ^= _BV(LED); +#else LED_PIN |= _BV(LED); +#endif watchdogReset(); } while (--count); - 3e30: 81 50 subi r24, 0x01 ; 1 - 3e32: a9 f7 brne .-22 ; 0x3e1e + 3e48: 81 50 subi r24, 0x01 ; 1 + 3e4a: a9 f7 brne .-22 ; 0x3e36 /* get character from UART */ ch = getch(); if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 3e34: dd 24 eor r13, r13 - 3e36: d3 94 inc r13 - boot_page_fill((uint16_t)(void*)addrPtr,a); + 3e4c: dd 24 eor r13, r13 + 3e4e: d3 94 inc r13 + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); // Write from programming buffer - boot_page_write((uint16_t)(void*)address); - 3e38: a5 e0 ldi r26, 0x05 ; 5 - 3e3a: ea 2e mov r14, r26 + __boot_page_write_short((uint16_t)(void*)address); + 3e50: a5 e0 ldi r26, 0x05 ; 5 + 3e52: ea 2e mov r14, r26 boot_spm_busy_wait(); #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 3e3c: f1 e1 ldi r31, 0x11 ; 17 - 3e3e: ff 2e mov r15, r31 + 3e54: f1 e1 ldi r31, 0x11 ; 17 + 3e56: ff 2e mov r15, r31 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 3e40: ab d0 rcall .+342 ; 0x3f98 + 3e58: ab d0 rcall .+342 ; 0x3fb0 if(ch == STK_GET_PARAMETER) { - 3e42: 81 34 cpi r24, 0x41 ; 65 - 3e44: 21 f4 brne .+8 ; 0x3e4e + 3e5a: 81 34 cpi r24, 0x41 ; 65 + 3e5c: 21 f4 brne .+8 ; 0x3e66 // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 3e46: 81 e0 ldi r24, 0x01 ; 1 - 3e48: d1 d0 rcall .+418 ; 0x3fec + 3e5e: 81 e0 ldi r24, 0x01 ; 1 + 3e60: c5 d0 rcall .+394 ; 0x3fec putch(0x03); - 3e4a: 83 e0 ldi r24, 0x03 ; 3 - 3e4c: 24 c0 rjmp .+72 ; 0x3e96 + 3e62: 83 e0 ldi r24, 0x03 ; 3 + 3e64: 20 c0 rjmp .+64 ; 0x3ea6 } else if(ch == STK_SET_DEVICE) { - 3e4e: 82 34 cpi r24, 0x42 ; 66 - 3e50: 11 f4 brne .+4 ; 0x3e56 + 3e66: 82 34 cpi r24, 0x42 ; 66 + 3e68: 11 f4 brne .+4 ; 0x3e6e // SET DEVICE is ignored getNch(20); - 3e52: 84 e1 ldi r24, 0x14 ; 20 - 3e54: 03 c0 rjmp .+6 ; 0x3e5c + 3e6a: 84 e1 ldi r24, 0x14 ; 20 + 3e6c: 03 c0 rjmp .+6 ; 0x3e74 } else if(ch == STK_SET_DEVICE_EXT) { - 3e56: 85 34 cpi r24, 0x45 ; 69 - 3e58: 19 f4 brne .+6 ; 0x3e60 + 3e6e: 85 34 cpi r24, 0x45 ; 69 + 3e70: 19 f4 brne .+6 ; 0x3e78 // SET DEVICE EXT is ignored getNch(5); - 3e5a: 85 e0 ldi r24, 0x05 ; 5 - 3e5c: c7 d0 rcall .+398 ; 0x3fec - 3e5e: 8a c0 rjmp .+276 ; 0x3f74 + 3e72: 85 e0 ldi r24, 0x05 ; 5 + 3e74: bb d0 rcall .+374 ; 0x3fec + 3e76: 91 c0 rjmp .+290 ; 0x3f9a } else if(ch == STK_LOAD_ADDRESS) { - 3e60: 85 35 cpi r24, 0x55 ; 85 - 3e62: a1 f4 brne .+40 ; 0x3e8c + 3e78: 85 35 cpi r24, 0x55 ; 85 + 3e7a: 81 f4 brne .+32 ; 0x3e9c // LOAD ADDRESS - address = getch(); - 3e64: 99 d0 rcall .+306 ; 0x3f98 - 3e66: 08 2f mov r16, r24 - 3e68: 10 e0 ldi r17, 0x00 ; 0 - 3e6a: 10 93 01 02 sts 0x0201, r17 - 3e6e: 00 93 00 02 sts 0x0200, r16 - address = (address & 0xff) | (getch() << 8); - 3e72: 92 d0 rcall .+292 ; 0x3f98 - 3e74: 90 e0 ldi r25, 0x00 ; 0 - 3e76: 98 2f mov r25, r24 - 3e78: 88 27 eor r24, r24 - 3e7a: 80 2b or r24, r16 - 3e7c: 91 2b or r25, r17 - address += address; // Convert from word address to byte address - 3e7e: 88 0f add r24, r24 - 3e80: 99 1f adc r25, r25 - 3e82: 90 93 01 02 sts 0x0201, r25 - 3e86: 80 93 00 02 sts 0x0200, r24 - 3e8a: 73 c0 rjmp .+230 ; 0x3f72 + uint16_t newAddress; + newAddress = getch(); + 3e7c: 99 d0 rcall .+306 ; 0x3fb0 + newAddress = (newAddress & 0xff) | (getch() << 8); + 3e7e: 08 2f mov r16, r24 + 3e80: 10 e0 ldi r17, 0x00 ; 0 + 3e82: 96 d0 rcall .+300 ; 0x3fb0 + 3e84: 90 e0 ldi r25, 0x00 ; 0 + 3e86: 98 2f mov r25, r24 + 3e88: 88 27 eor r24, r24 + 3e8a: 80 2b or r24, r16 + 3e8c: 91 2b or r25, r17 +#ifdef RAMPZ + // Transfer top bit to RAMPZ + RAMPZ = (newAddress & 0x8000) ? 1 : 0; +#endif + newAddress += newAddress; // Convert from word address to byte address + 3e8e: 88 0f add r24, r24 + 3e90: 99 1f adc r25, r25 + address = newAddress; + 3e92: 90 93 01 02 sts 0x0201, r25 + 3e96: 80 93 00 02 sts 0x0200, r24 + 3e9a: 7e c0 rjmp .+252 ; 0x3f98 verifySpace(); } else if(ch == STK_UNIVERSAL) { - 3e8c: 86 35 cpi r24, 0x56 ; 86 - 3e8e: 29 f4 brne .+10 ; 0x3e9a + 3e9c: 86 35 cpi r24, 0x56 ; 86 + 3e9e: 29 f4 brne .+10 ; 0x3eaa // UNIVERSAL command is ignored getNch(4); - 3e90: 84 e0 ldi r24, 0x04 ; 4 - 3e92: ac d0 rcall .+344 ; 0x3fec + 3ea0: 84 e0 ldi r24, 0x04 ; 4 + 3ea2: a4 d0 rcall .+328 ; 0x3fec putch(0x00); - 3e94: 80 e0 ldi r24, 0x00 ; 0 - 3e96: 71 d0 rcall .+226 ; 0x3f7a - 3e98: 6d c0 rjmp .+218 ; 0x3f74 + 3ea4: 80 e0 ldi r24, 0x00 ; 0 + 3ea6: 7c d0 rcall .+248 ; 0x3fa0 + 3ea8: 78 c0 rjmp .+240 ; 0x3f9a } - /* Write memory, length is big endian and is in bytes */ + /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 3e9a: 84 36 cpi r24, 0x64 ; 100 - 3e9c: 09 f0 breq .+2 ; 0x3ea0 - 3e9e: 43 c0 rjmp .+134 ; 0x3f26 + 3eaa: 84 36 cpi r24, 0x64 ; 100 + 3eac: 09 f0 breq .+2 ; 0x3eb0 + 3eae: 4e c0 rjmp .+156 ; 0x3f4c // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; getLen(); - 3ea0: 8f d0 rcall .+286 ; 0x3fc0 - - // Immediately start page erase - this will 4.5ms - boot_page_erase((uint16_t)(void*)address); - 3ea2: e0 91 00 02 lds r30, 0x0200 - 3ea6: f0 91 01 02 lds r31, 0x0201 - 3eaa: 83 e0 ldi r24, 0x03 ; 3 - 3eac: 80 93 57 00 sts 0x0057, r24 - 3eb0: e8 95 spm - 3eb2: c0 e0 ldi r28, 0x00 ; 0 - 3eb4: d1 e0 ldi r29, 0x01 ; 1 - + 3eb0: 87 d0 rcall .+270 ; 0x3fc0 + + // If we are in RWW section, immediately start page erase + if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 3eb2: e0 91 00 02 lds r30, 0x0200 + 3eb6: f0 91 01 02 lds r31, 0x0201 + 3eba: 88 e3 ldi r24, 0x38 ; 56 + 3ebc: e0 30 cpi r30, 0x00 ; 0 + 3ebe: f8 07 cpc r31, r24 + 3ec0: 18 f4 brcc .+6 ; 0x3ec8 + 3ec2: 83 e0 ldi r24, 0x03 ; 3 + 3ec4: 87 bf out 0x37, r24 ; 55 + 3ec6: e8 95 spm + 3ec8: c0 e0 ldi r28, 0x00 ; 0 + 3eca: d1 e0 ldi r29, 0x01 ; 1 + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 3eb6: 70 d0 rcall .+224 ; 0x3f98 - 3eb8: 89 93 st Y+, r24 + 3ecc: 71 d0 rcall .+226 ; 0x3fb0 + 3ece: 89 93 st Y+, r24 while (--length); - 3eba: 80 91 02 02 lds r24, 0x0202 - 3ebe: 81 50 subi r24, 0x01 ; 1 - 3ec0: 80 93 02 02 sts 0x0202, r24 - 3ec4: 88 23 and r24, r24 - 3ec6: b9 f7 brne .-18 ; 0x3eb6 + 3ed0: 80 91 02 02 lds r24, 0x0202 + 3ed4: 81 50 subi r24, 0x01 ; 1 + 3ed6: 80 93 02 02 sts 0x0202, r24 + 3eda: 88 23 and r24, r24 + 3edc: b9 f7 brne .-18 ; 0x3ecc + + // If we are in NRWW section, page erase has to be delayed until now. + // Todo: Take RAMPZ into account + if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 3ede: e0 91 00 02 lds r30, 0x0200 + 3ee2: f0 91 01 02 lds r31, 0x0201 + 3ee6: 88 e3 ldi r24, 0x38 ; 56 + 3ee8: e0 30 cpi r30, 0x00 ; 0 + 3eea: f8 07 cpc r31, r24 + 3eec: 18 f0 brcs .+6 ; 0x3ef4 + 3eee: 83 e0 ldi r24, 0x03 ; 3 + 3ef0: 87 bf out 0x37, r24 ; 55 + 3ef2: e8 95 spm // Read command terminator, start reply verifySpace(); - 3ec8: 8b d0 rcall .+278 ; 0x3fe0 + 3ef4: 75 d0 rcall .+234 ; 0x3fe0 // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 3eca: 07 b6 in r0, 0x37 ; 55 - 3ecc: 00 fc sbrc r0, 0 - 3ece: fd cf rjmp .-6 ; 0x3eca + 3ef6: 07 b6 in r0, 0x37 ; 55 + 3ef8: 00 fc sbrc r0, 0 + 3efa: fd cf rjmp .-6 ; 0x3ef6 } #endif // Copy buffer into programming buffer bufPtr = buff; addrPtr = (uint16_t)(void*)address; - 3ed0: 40 91 00 02 lds r20, 0x0200 - 3ed4: 50 91 01 02 lds r21, 0x0201 - 3ed8: a0 e0 ldi r26, 0x00 ; 0 - 3eda: b1 e0 ldi r27, 0x01 ; 1 + 3efc: 40 91 00 02 lds r20, 0x0200 + 3f00: 50 91 01 02 lds r21, 0x0201 + 3f04: a0 e0 ldi r26, 0x00 ; 0 + 3f06: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 3edc: 2c 91 ld r18, X - 3ede: 30 e0 ldi r19, 0x00 ; 0 + 3f08: 2c 91 ld r18, X + 3f0a: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 3ee0: 11 96 adiw r26, 0x01 ; 1 - 3ee2: 8c 91 ld r24, X - 3ee4: 11 97 sbiw r26, 0x01 ; 1 - 3ee6: 90 e0 ldi r25, 0x00 ; 0 - 3ee8: 98 2f mov r25, r24 - 3eea: 88 27 eor r24, r24 - 3eec: 82 2b or r24, r18 - 3eee: 93 2b or r25, r19 -#ifdef VIRTUAL_BOOT_PARTITION -#define rstVect (*(uint16_t*)(0x204)) -#define wdtVect (*(uint16_t*)(0x206)) + 3f0c: 11 96 adiw r26, 0x01 ; 1 + 3f0e: 8c 91 ld r24, X + 3f10: 11 97 sbiw r26, 0x01 ; 1 + 3f12: 90 e0 ldi r25, 0x00 ; 0 + 3f14: 98 2f mov r25, r24 + 3f16: 88 27 eor r24, r24 + 3f18: 82 2b or r24, r18 + 3f1a: 93 2b or r25, r19 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif + /* main program starts here */ int main(void) { - 3ef0: 12 96 adiw r26, 0x02 ; 2 + 3f1c: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; - boot_page_fill((uint16_t)(void*)addrPtr,a); - 3ef2: fa 01 movw r30, r20 - 3ef4: 0c 01 movw r0, r24 - 3ef6: d0 92 57 00 sts 0x0057, r13 - 3efa: e8 95 spm - 3efc: 11 24 eor r1, r1 + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); + 3f1e: fa 01 movw r30, r20 + 3f20: 0c 01 movw r0, r24 + 3f22: d7 be out 0x37, r13 ; 55 + 3f24: e8 95 spm + 3f26: 11 24 eor r1, r1 addrPtr += 2; - 3efe: 4e 5f subi r20, 0xFE ; 254 - 3f00: 5f 4f sbci r21, 0xFF ; 255 + 3f28: 4e 5f subi r20, 0xFE ; 254 + 3f2a: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 3f02: f1 e0 ldi r31, 0x01 ; 1 - 3f04: a0 38 cpi r26, 0x80 ; 128 - 3f06: bf 07 cpc r27, r31 - 3f08: 49 f7 brne .-46 ; 0x3edc + 3f2c: f1 e0 ldi r31, 0x01 ; 1 + 3f2e: a0 38 cpi r26, 0x80 ; 128 + 3f30: bf 07 cpc r27, r31 + 3f32: 51 f7 brne .-44 ; 0x3f08 // Write from programming buffer - boot_page_write((uint16_t)(void*)address); - 3f0a: e0 91 00 02 lds r30, 0x0200 - 3f0e: f0 91 01 02 lds r31, 0x0201 - 3f12: e0 92 57 00 sts 0x0057, r14 - 3f16: e8 95 spm + __boot_page_write_short((uint16_t)(void*)address); + 3f34: e0 91 00 02 lds r30, 0x0200 + 3f38: f0 91 01 02 lds r31, 0x0201 + 3f3c: e7 be out 0x37, r14 ; 55 + 3f3e: e8 95 spm boot_spm_busy_wait(); - 3f18: 07 b6 in r0, 0x37 ; 55 - 3f1a: 00 fc sbrc r0, 0 - 3f1c: fd cf rjmp .-6 ; 0x3f18 + 3f40: 07 b6 in r0, 0x37 ; 55 + 3f42: 00 fc sbrc r0, 0 + 3f44: fd cf rjmp .-6 ; 0x3f40 #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 3f1e: f0 92 57 00 sts 0x0057, r15 - 3f22: e8 95 spm - 3f24: 27 c0 rjmp .+78 ; 0x3f74 + 3f46: f7 be out 0x37, r15 ; 55 + 3f48: e8 95 spm + 3f4a: 27 c0 rjmp .+78 ; 0x3f9a #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 3f26: 84 37 cpi r24, 0x74 ; 116 - 3f28: b9 f4 brne .+46 ; 0x3f58 + 3f4c: 84 37 cpi r24, 0x74 ; 116 + 3f4e: b9 f4 brne .+46 ; 0x3f7e // READ PAGE - we only read flash getLen(); - 3f2a: 4a d0 rcall .+148 ; 0x3fc0 + 3f50: 37 d0 rcall .+110 ; 0x3fc0 verifySpace(); - 3f2c: 59 d0 rcall .+178 ; 0x3fe0 - else ch = pgm_read_byte_near(address); + 3f52: 46 d0 rcall .+140 ; 0x3fe0 + putch(result); address++; - putch(ch); - } while (--length); + } + while (--length); #else do putch(pgm_read_byte_near(address++)); - 3f2e: e0 91 00 02 lds r30, 0x0200 - 3f32: f0 91 01 02 lds r31, 0x0201 - 3f36: 31 96 adiw r30, 0x01 ; 1 - 3f38: f0 93 01 02 sts 0x0201, r31 - 3f3c: e0 93 00 02 sts 0x0200, r30 - 3f40: 31 97 sbiw r30, 0x01 ; 1 - 3f42: e4 91 lpm r30, Z+ - 3f44: 8e 2f mov r24, r30 - 3f46: 19 d0 rcall .+50 ; 0x3f7a + 3f54: e0 91 00 02 lds r30, 0x0200 + 3f58: f0 91 01 02 lds r31, 0x0201 + 3f5c: 31 96 adiw r30, 0x01 ; 1 + 3f5e: f0 93 01 02 sts 0x0201, r31 + 3f62: e0 93 00 02 sts 0x0200, r30 + 3f66: 31 97 sbiw r30, 0x01 ; 1 + 3f68: e4 91 lpm r30, Z+ + 3f6a: 8e 2f mov r24, r30 + 3f6c: 19 d0 rcall .+50 ; 0x3fa0 while (--length); - 3f48: 80 91 02 02 lds r24, 0x0202 - 3f4c: 81 50 subi r24, 0x01 ; 1 - 3f4e: 80 93 02 02 sts 0x0202, r24 - 3f52: 88 23 and r24, r24 - 3f54: 61 f7 brne .-40 ; 0x3f2e - 3f56: 0e c0 rjmp .+28 ; 0x3f74 + 3f6e: 80 91 02 02 lds r24, 0x0202 + 3f72: 81 50 subi r24, 0x01 ; 1 + 3f74: 80 93 02 02 sts 0x0202, r24 + 3f78: 88 23 and r24, r24 + 3f7a: 61 f7 brne .-40 ; 0x3f54 + 3f7c: 0e c0 rjmp .+28 ; 0x3f9a +#endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 3f58: 85 37 cpi r24, 0x75 ; 117 - 3f5a: 39 f4 brne .+14 ; 0x3f6a + 3f7e: 85 37 cpi r24, 0x75 ; 117 + 3f80: 39 f4 brne .+14 ; 0x3f90 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 3f5c: 41 d0 rcall .+130 ; 0x3fe0 + 3f82: 2e d0 rcall .+92 ; 0x3fe0 putch(SIGNATURE_0); - 3f5e: 8e e1 ldi r24, 0x1E ; 30 - 3f60: 0c d0 rcall .+24 ; 0x3f7a + 3f84: 8e e1 ldi r24, 0x1E ; 30 + 3f86: 0c d0 rcall .+24 ; 0x3fa0 putch(SIGNATURE_1); - 3f62: 84 e9 ldi r24, 0x94 ; 148 - 3f64: 0a d0 rcall .+20 ; 0x3f7a + 3f88: 84 e9 ldi r24, 0x94 ; 148 + 3f8a: 0a d0 rcall .+20 ; 0x3fa0 putch(SIGNATURE_2); - 3f66: 86 e0 ldi r24, 0x06 ; 6 - 3f68: 96 cf rjmp .-212 ; 0x3e96 + 3f8c: 86 e0 ldi r24, 0x06 ; 6 + 3f8e: 8b cf rjmp .-234 ; 0x3ea6 } else if (ch == 'Q') { - 3f6a: 81 35 cpi r24, 0x51 ; 81 - 3f6c: 11 f4 brne .+4 ; 0x3f72 + 3f90: 81 35 cpi r24, 0x51 ; 81 + 3f92: 11 f4 brne .+4 ; 0x3f98 // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 3f6e: 88 e0 ldi r24, 0x08 ; 8 - 3f70: 2c d0 rcall .+88 ; 0x3fca + 3f94: 88 e0 ldi r24, 0x08 ; 8 + 3f96: 19 d0 rcall .+50 ; 0x3fca verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 3f72: 36 d0 rcall .+108 ; 0x3fe0 + 3f98: 23 d0 rcall .+70 ; 0x3fe0 } putch(STK_OK); - 3f74: 80 e1 ldi r24, 0x10 ; 16 - 3f76: 01 d0 rcall .+2 ; 0x3f7a - 3f78: 63 cf rjmp .-314 ; 0x3e40 + 3f9a: 80 e1 ldi r24, 0x10 ; 16 + 3f9c: 01 d0 rcall .+2 ; 0x3fa0 + 3f9e: 5c cf rjmp .-328 ; 0x3e58 + +00003fa0 : + } +} -00003f7a : void putch(char ch) { + 3fa0: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); + 3fa2: 80 91 c0 00 lds r24, 0x00C0 + 3fa6: 85 ff sbrs r24, 5 + 3fa8: fc cf rjmp .-8 ; 0x3fa2 UDR0 = ch; -#else - __asm__ __volatile__ ( - 3f7a: 2a e0 ldi r18, 0x0A ; 10 - 3f7c: 30 e0 ldi r19, 0x00 ; 0 - 3f7e: 80 95 com r24 - 3f80: 08 94 sec - 3f82: 10 f4 brcc .+4 ; 0x3f88 - 3f84: 59 98 cbi 0x0b, 1 ; 11 - 3f86: 02 c0 rjmp .+4 ; 0x3f8c - 3f88: 59 9a sbi 0x0b, 1 ; 11 - 3f8a: 00 00 nop - 3f8c: 15 d0 rcall .+42 ; 0x3fb8 - 3f8e: 14 d0 rcall .+40 ; 0x3fb8 - 3f90: 86 95 lsr r24 - 3f92: 2a 95 dec r18 - 3f94: b1 f7 brne .-20 ; 0x3f82 + 3faa: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 3f96: 08 95 ret + 3fae: 08 95 ret -00003f98 : +00003fb0 : return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3f98: a8 95 wdr -#ifdef LED_DATA_FLASH + 3fb0: a8 95 wdr + [uartBit] "I" (UART_RX_BIT) + : + "r25" +); +#else + while(!(UCSR0A & _BV(RXC0))); + 3fb2: 80 91 c0 00 lds r24, 0x00C0 + 3fb6: 87 ff sbrs r24, 7 + 3fb8: fc cf rjmp .-8 ; 0x3fb2 + ch = UDR0; + 3fba: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); +#endif #endif return ch; } - 3f9a: 29 e0 ldi r18, 0x09 ; 9 - 3f9c: 30 e0 ldi r19, 0x00 ; 0 - 3f9e: 48 99 sbic 0x09, 0 ; 9 - 3fa0: fe cf rjmp .-4 ; 0x3f9e - 3fa2: 0a d0 rcall .+20 ; 0x3fb8 - 3fa4: 09 d0 rcall .+18 ; 0x3fb8 - 3fa6: 08 d0 rcall .+16 ; 0x3fb8 - 3fa8: 88 94 clc - 3faa: 48 99 sbic 0x09, 0 ; 9 - 3fac: 08 94 sec - 3fae: 2a 95 dec r18 - 3fb0: 11 f0 breq .+4 ; 0x3fb6 - 3fb2: 87 95 ror r24 - 3fb4: f7 cf rjmp .-18 ; 0x3fa4 - 3fb6: 08 95 ret - -00003fb8 : -#if UART_B_VALUE > 255 -#error Baud rate too slow for soft UART -#endif - -void uartDelay() { - __asm__ __volatile__ ( - 3fb8: 98 e0 ldi r25, 0x08 ; 8 - 3fba: 9a 95 dec r25 - 3fbc: f1 f7 brne .-4 ; 0x3fba 3fbe: 08 95 ret 00003fc0 : @@ -462,13 +483,13 @@ void uartDelay() { uint8_t getLen() { getch(); - 3fc0: eb df rcall .-42 ; 0x3f98 + 3fc0: f7 df rcall .-18 ; 0x3fb0 length = getch(); - 3fc2: ea df rcall .-44 ; 0x3f98 + 3fc2: f6 df rcall .-20 ; 0x3fb0 3fc4: 80 93 02 02 sts 0x0202, r24 return getch(); } - 3fc8: e7 cf rjmp .-50 ; 0x3f98 + 3fc8: f3 cf rjmp .-26 ; 0x3fb0 00003fca : "wdr\n" @@ -504,14 +525,16 @@ void appStart() { void verifySpace() { if (getch() != CRC_EOP) appStart(); - 3fe0: db df rcall .-74 ; 0x3f98 + 3fe0: e7 df rcall .-50 ; 0x3fb0 3fe2: 80 32 cpi r24, 0x20 ; 32 3fe4: 09 f0 breq .+2 ; 0x3fe8 3fe6: f7 df rcall .-18 ; 0x3fd6 putch(STK_INSYNC); 3fe8: 84 e1 ldi r24, 0x14 ; 20 } - 3fea: c7 cf rjmp .-114 ; 0x3f7a + 3fea: da cf rjmp .-76 ; 0x3fa0 + +00003fec : ::[count] "M" (UART_B_VALUE) ); } @@ -520,12 +543,10 @@ void verifySpace() { void getNch(uint8_t count) { 3fec: 1f 93 push r17 3fee: 18 2f mov r17, r24 - -00003ff0 : do getch(); while (--count); - 3ff0: d3 df rcall .-90 ; 0x3f98 + 3ff0: df df rcall .-66 ; 0x3fb0 3ff2: 11 50 subi r17, 0x01 ; 1 - 3ff4: e9 f7 brne .-6 ; 0x3ff0 + 3ff4: e9 f7 brne .-6 ; 0x3ff0 verifySpace(); 3ff6: f4 df rcall .-24 ; 0x3fe0 } diff --git a/bootloaders/optiboot/pin_defs.h b/bootloaders/optiboot/pin_defs.h new file mode 100644 index 0000000..313e453 --- /dev/null +++ b/bootloaders/optiboot/pin_defs.h @@ -0,0 +1,79 @@ +#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega88) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega88__) +/* Onboard LED is connected to pin PB5 in Arduino NG, Diecimila, and Duemilanove */ +#define LED_DDR DDRB +#define LED_PORT PORTB +#define LED_PIN PINB +#define LED PINB5 + +/* Ports for soft UART */ +#ifdef SOFT_UART +#define UART_PORT PORTD +#define UART_PIN PIND +#define UART_DDR DDRD +#define UART_TX_BIT 1 +#define UART_RX_BIT 0 +#endif +#endif + +#if defined(__AVR_ATmega8__) + //Name conversion R.Wiersma + #define UCSR0A UCSRA + #define UDR0 UDR + #define UDRE0 UDRE + #define RXC0 RXC + #define TIFR1 TIFR + #define WDTCSR WDTCR +#endif + +/* Luminet support */ +#if defined(__AVR_ATtiny84__) +/* Red LED is connected to pin PA4 */ +#define LED_DDR DDRA +#define LED_PORT PORTA +#define LED_PIN PINA +#define LED PINA4 +/* Ports for soft UART - left port only for now. TX/RX on PA2/PA3 */ +#ifdef SOFT_UART +#define UART_PORT PORTA +#define UART_PIN PINA +#define UART_DDR DDRA +#define UART_TX_BIT 2 +#define UART_RX_BIT 3 +#endif +#endif + +/* Sanguino support */ +#if defined(__AVR_ATmega644P__) +/* Onboard LED is connected to pin PB0 on Sanguino */ +#define LED_DDR DDRB +#define LED_PORT PORTB +#define LED_PIN PINB +#define LED PINB0 + +/* Ports for soft UART */ +#ifdef SOFT_UART +#define UART_PORT PORTD +#define UART_PIN PIND +#define UART_DDR DDRD +#define UART_TX_BIT 1 +#define UART_RX_BIT 0 +#endif +#endif + +/* Mega support */ +#if defined(__AVR_ATmega1280__) +/* Onboard LED is connected to pin PB7 on Arduino Mega */ +#define LED_DDR DDRB +#define LED_PORT PORTB +#define LED_PIN PINB +#define LED PINB7 + +/* Ports for soft UART */ +#ifdef SOFT_UART +#define UART_PORT PORTE +#define UART_PIN PINE +#define UART_DDR DDRE +#define UART_TX_BIT 1 +#define UART_RX_BIT 0 +#endif +#endif diff --git a/bootloaders/optiboot/stk500.h b/bootloaders/optiboot/stk500.h new file mode 100644 index 0000000..ca0dd91 --- /dev/null +++ b/bootloaders/optiboot/stk500.h @@ -0,0 +1,39 @@ +/* STK500 constants list, from AVRDUDE */ +#define STK_OK 0x10 +#define STK_FAILED 0x11 // Not used +#define STK_UNKNOWN 0x12 // Not used +#define STK_NODEVICE 0x13 // Not used +#define STK_INSYNC 0x14 // ' ' +#define STK_NOSYNC 0x15 // Not used +#define ADC_CHANNEL_ERROR 0x16 // Not used +#define ADC_MEASURE_OK 0x17 // Not used +#define PWM_CHANNEL_ERROR 0x18 // Not used +#define PWM_ADJUST_OK 0x19 // Not used +#define CRC_EOP 0x20 // 'SPACE' +#define STK_GET_SYNC 0x30 // '0' +#define STK_GET_SIGN_ON 0x31 // '1' +#define STK_SET_PARAMETER 0x40 // '@' +#define STK_GET_PARAMETER 0x41 // 'A' +#define STK_SET_DEVICE 0x42 // 'B' +#define STK_SET_DEVICE_EXT 0x45 // 'E' +#define STK_ENTER_PROGMODE 0x50 // 'P' +#define STK_LEAVE_PROGMODE 0x51 // 'Q' +#define STK_CHIP_ERASE 0x52 // 'R' +#define STK_CHECK_AUTOINC 0x53 // 'S' +#define STK_LOAD_ADDRESS 0x55 // 'U' +#define STK_UNIVERSAL 0x56 // 'V' +#define STK_PROG_FLASH 0x60 // '`' +#define STK_PROG_DATA 0x61 // 'a' +#define STK_PROG_FUSE 0x62 // 'b' +#define STK_PROG_LOCK 0x63 // 'c' +#define STK_PROG_PAGE 0x64 // 'd' +#define STK_PROG_FUSE_EXT 0x65 // 'e' +#define STK_READ_FLASH 0x70 // 'p' +#define STK_READ_DATA 0x71 // 'q' +#define STK_READ_FUSE 0x72 // 'r' +#define STK_READ_LOCK 0x73 // 's' +#define STK_READ_PAGE 0x74 // 't' +#define STK_READ_SIGN 0x75 // 'u' +#define STK_READ_OSCCAL 0x76 // 'v' +#define STK_READ_FUSE_EXT 0x77 // 'w' +#define STK_READ_OSCCAL_EXT 0x78 // 'x' -- cgit v1.2.3-18-g5258 From 64be388f3eb3ce662000d7c14e44047458f55875 Mon Sep 17 00:00:00 2001 From: WestfW Date: Fri, 10 Jun 2011 16:29:34 -0700 Subject: Update shell script makeall --- bootloaders/optiboot/makeall | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bootloaders/optiboot/makeall b/bootloaders/optiboot/makeall index 7a0b82d..b92c56e 100755 --- a/bootloaders/optiboot/makeall +++ b/bootloaders/optiboot/makeall @@ -6,8 +6,10 @@ make pro8 make pro16 make pro20 make diecimila -make ng make atmega328 make atmega328_pro8 +make sanguino +make mega +make atmega8 +make atmega88 make luminet - -- cgit v1.2.3-18-g5258 From 2a83ee55b38c81df04d7d3b83d6bf68ed72936e4 Mon Sep 17 00:00:00 2001 From: WestfW Date: Fri, 10 Jun 2011 17:47:47 -0700 Subject: Add a version number to the optiboot source and binary. http://code.google.com/p/arduino/issues/detail?id=554 end of flash memory where they can be read (at least in theory) by device programmers, hex-file examination, or application programs. This is done by putting the version number in a separate section (".version"), and using linker/objcopy magic to locate that section as appropriate for the target chip. (See http://lists.gnu.org/archive/html/avr-gcc-list/2011-02/msg00016.html for some discussion on the details.) Start the version at 4.1 (the last "packaged" version of optiboot was called version 3, so the "top of source" would be 4.0, and adding the version number makes 4.1) Refactor LDSECTION in the Makefile to LDSECTIONS so that multiple section start addresses can be defined. Change the _isp makefile definitions to make the bootloader section readable (but not writable) by the application section. (This would need to be done elsewhere as well to handle all bootloader programming techniques. Notably Arduino's boards.txt Note that this change does not change the "code" portion of optiboot at all. The only diffs in the .hex files are the added version word at the end of flash memory. --- bootloaders/optiboot/Makefile | 26 +- bootloaders/optiboot/optiboot.c | 38 +- bootloaders/optiboot/optiboot_atmega328.hex | 1 + bootloaders/optiboot/optiboot_atmega328.lst | 28 +- .../optiboot/optiboot_atmega328_pro_8MHz.hex | 66 +-- .../optiboot/optiboot_atmega328_pro_8MHz.lst | 494 ++++++++--------- bootloaders/optiboot/optiboot_diecimila.hex | 1 + bootloaders/optiboot/optiboot_diecimila.lst | 28 +- bootloaders/optiboot/optiboot_lilypad.hex | 1 + bootloaders/optiboot/optiboot_lilypad.lst | 28 +- .../optiboot/optiboot_lilypad_resonator.hex | 1 + .../optiboot/optiboot_lilypad_resonator.lst | 28 +- bootloaders/optiboot/optiboot_luminet.hex | 82 +-- bootloaders/optiboot/optiboot_luminet.lst | 604 +++++++++++---------- bootloaders/optiboot/optiboot_pro_16MHz.hex | 1 + bootloaders/optiboot/optiboot_pro_16MHz.lst | 28 +- bootloaders/optiboot/optiboot_pro_20mhz.hex | 1 + bootloaders/optiboot/optiboot_pro_20mhz.lst | 28 +- bootloaders/optiboot/optiboot_pro_8MHz.hex | 1 + bootloaders/optiboot/optiboot_pro_8MHz.lst | 28 +- 20 files changed, 784 insertions(+), 729 deletions(-) diff --git a/bootloaders/optiboot/Makefile b/bootloaders/optiboot/Makefile index 88cb9a2..ce25ac3 100644 --- a/bootloaders/optiboot/Makefile +++ b/bootloaders/optiboot/Makefile @@ -36,7 +36,7 @@ ISPPORT = usb ISPSPEED = -b 115200 MCU_TARGET = atmega168 -LDSECTION = --section-start=.text=0x3e00 +LDSECTIONS = -Wl,--section-start=.text=0x3e00 -Wl,--section-start=.version=0x3ffe # Build environments # Start of some ugly makefile-isms to allow optiboot to be built @@ -88,7 +88,7 @@ endif # http://tinker.it/now/2007/02/24/the-tale-of-avrdude-atmega168-and-extended-bits-fuses/ # # similarly, the lock bits should be 0xff instead of 0x3f (to -# unlock the bootloader section) and 0xcf instead of 0x0f (to +# unlock the bootloader section) and 0xcf instead of 0x2f (to # lock it), but since the high two bits of the lock byte are # unused, avrdude would get confused. @@ -98,7 +98,7 @@ ISPFUSES = $(GCCROOT)avrdude $(AVRDUDE_CONF) -c $(ISPTOOL) \ -U hfuse:w:0x$(HFUSE):m -U lfuse:w:0x$(LFUSE):m ISPFLASH = $(GCCROOT)avrdude $(AVRDUDE_CONF) -c $(ISPTOOL) \ -p $(MCU_TARGET) -P $(ISPPORT) $(ISPSPEED) \ - -U flash:w:$(PROGRAM)_$(TARGET).hex -U lock:w:0x0f:m + -U flash:w:$(PROGRAM)_$(TARGET).hex -U lock:w:0x2f:m STK500 = "C:\Program Files\Atmel\AVR Tools\STK500\Stk500.exe" STK500-1 = $(STK500) -e -d$(MCU_TARGET) -pf -vf -if$(PROGRAM)_$(TARGET).hex \ @@ -116,7 +116,7 @@ CC = $(GCCROOT)avr-gcc # Override is only needed by avr-lib build system. override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -DF_CPU=$(AVR_FREQ) $(DEFS) -override LDFLAGS = -Wl,$(LDSECTION) -Wl,--relax -Wl,--gc-sections -nostartfiles -nostdlib +override LDFLAGS = $(LDSECTIONS) -Wl,--relax -Wl,--gc-sections -nostartfiles -nostdlib OBJCOPY = $(GCCROOT)avr-objcopy OBJDUMP = $(call fixpath,$(GCCROOT)avr-objdump) @@ -129,7 +129,7 @@ virboot328: TARGET = atmega328 virboot328: MCU_TARGET = atmega328p virboot328: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' '-DVIRTUAL_BOOT' virboot328: AVR_FREQ = 16000000L -virboot328: LDSECTION = --section-start=.text=0x7e00 +virboot328: LDSECTIONS = --section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe virboot328: $(PROGRAM)_atmega328.hex virboot328: $(PROGRAM)_atmega328.lst @@ -200,7 +200,7 @@ atmega328: TARGET = atmega328 atmega328: MCU_TARGET = atmega328p atmega328: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' atmega328: AVR_FREQ = 16000000L -atmega328: LDSECTION = --section-start=.text=0x7e00 +atmega328: LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe atmega328: $(PROGRAM)_atmega328.hex atmega328: $(PROGRAM)_atmega328.lst @@ -262,7 +262,7 @@ atmega8: TARGET = atmega8 atmega8: MCU_TARGET = atmega8 atmega8: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' atmega8: AVR_FREQ = 16000000L -atmega8: LDSECTION = --section-start=.text=0x1e00 +atmega8: LDSECTIONS = --section-start=.text=0x1e00 -Wl,--section-start=.version=0x1ffe atmega8: $(PROGRAM)_atmega8.hex atmega8: $(PROGRAM)_atmega8.lst @@ -281,7 +281,7 @@ atmega88: TARGET = atmega88 atmega88: MCU_TARGET = atmega88 atmega88: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' atmega88: AVR_FREQ = 16000000L -atmega88: LDSECTION = --section-start=.text=0x1e00 +atmega88: LDSECTIONS = --section-start=.text=0x1e00 -Wl,--section-start=.version=0x1ffe atmega88: $(PROGRAM)_atmega88.hex atmega88: $(PROGRAM)_atmega88.lst @@ -357,7 +357,7 @@ atmega328_pro8: TARGET = atmega328_pro_8MHz atmega328_pro8: MCU_TARGET = atmega328p atmega328_pro8: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' atmega328_pro8: AVR_FREQ = 8000000L -atmega328_pro8: LDSECTION = --section-start=.text=0x7e00 +atmega328_pro8: LDSECTIONS = --section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe atmega328_pro8: $(PROGRAM)_atmega328_pro_8MHz.hex atmega328_pro8: $(PROGRAM)_atmega328_pro_8MHz.lst @@ -382,7 +382,7 @@ luminet: MCU_TARGET = attiny84 luminet: CFLAGS += '-DLED_START_FLASHES=3' '-DSOFT_UART' '-DBAUD_RATE=9600' luminet: CFLAGS += '-DVIRTUAL_BOOT_PARTITION' luminet: AVR_FREQ = 1000000L -luminet: LDSECTION = --section-start=.text=0x1d00 +luminet: LDSECTIONS = --section-start=.text=0x1d00 -Wl,--section-start=.version=0x1efe luminet: $(PROGRAM)_luminet.hex luminet: $(PROGRAM)_luminet.lst @@ -421,10 +421,10 @@ clean: $(OBJDUMP) -h -S $< > $@ %.hex: %.elf - $(OBJCOPY) -j .text -j .data -O ihex $< $@ + $(OBJCOPY) -j .text -j .data -j .version --set-section-flags .version=alloc,load -O ihex $< $@ %.srec: %.elf - $(OBJCOPY) -j .text -j .data -O srec $< $@ + $(OBJCOPY) -j .text -j .data -j .version --set-section-flags .version=alloc,load -O srec $< $@ %.bin: %.elf - $(OBJCOPY) -j .text -j .data -O binary $< $@ + $(OBJCOPY) -j .text -j .data -j .version --set-section-flags .version=alloc,load -O binary $< $@ diff --git a/bootloaders/optiboot/optiboot.c b/bootloaders/optiboot/optiboot.c index 4b4a10a..ece8b43 100644 --- a/bootloaders/optiboot/optiboot.c +++ b/bootloaders/optiboot/optiboot.c @@ -114,7 +114,37 @@ /* 500,1000,2000,4000,8000 supported. */ /* */ /**********************************************************/ + +/**********************************************************/ +/* Version Numbers! */ +/* */ +/* Arduino Optiboot now includes this Version number in */ +/* the source and object code. */ +/* */ +/* Version 3 was released as zip from the optiboot */ +/* repository and was distributed with Arduino 0022. */ +/* Version 4 starts with the arduino repository commit */ +/* that brought the arduino repository up-to-date with */ +/* the optiboot source tree changes since v3. */ +/* */ +/**********************************************************/ + +/**********************************************************/ +/* Edit History: */ +/* */ +/* 4.1 WestfW: put version number in binary. */ +/**********************************************************/ + +#define OPTIBOOT_MAJVER 4 +#define OPTIBOOT_MINVER 1 +#define MAKESTR(a) #a +#define MAKEVER(a, b) MAKESTR(a*256+b) + +asm(" .section .version\n" + "optiboot_version: .word " MAKEVER(OPTIBOOT_MAJVER, OPTIBOOT_MINVER) "\n" + " .section .text\n"); + #include #include #include @@ -324,7 +354,7 @@ int main(void) { // If we are in RWW section, immediately start page erase if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); @@ -336,7 +366,7 @@ int main(void) { // Read command terminator, start reply verifySpace(); - + // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); @@ -371,7 +401,7 @@ int main(void) { __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); - + // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); boot_spm_busy_wait(); @@ -489,7 +519,7 @@ uint8_t getch(void) { " rcall uartDelay\n" // Wait 1 bit period " clc\n" " sbic %[uartPin],%[uartBit]\n" - " sec\n" + " sec\n" " dec %[bitCnt]\n" " breq 3f\n" " ror %[ch]\n" diff --git a/bootloaders/optiboot/optiboot_atmega328.hex b/bootloaders/optiboot/optiboot_atmega328.hex index 72108ee..7286e0d 100644 --- a/bootloaders/optiboot/optiboot_atmega328.hex +++ b/bootloaders/optiboot/optiboot_atmega328.hex @@ -30,5 +30,6 @@ :107FD00090838083089580E0F8DFEE27FF270994DF :107FE000E7DF803209F0F7DF84E1DACF1F93182F43 :0C7FF000DFDF1150E9F7F4DF1F91089566 +:027FFE0001047C :0400000300007E007B :00000001FF diff --git a/bootloaders/optiboot/optiboot_atmega328.lst b/bootloaders/optiboot/optiboot_atmega328.lst index 1af4a3c..0da8aaf 100644 --- a/bootloaders/optiboot/optiboot_atmega328.lst +++ b/bootloaders/optiboot/optiboot_atmega328.lst @@ -5,23 +5,25 @@ Sections: Idx Name Size VMA LMA File off Algn 0 .text 000001fc 00007e00 00007e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .debug_aranges 00000028 00000000 00000000 00000250 2**0 + 1 .version 00000002 00007ffe 00007ffe 00000250 2**0 + CONTENTS, READONLY + 2 .debug_aranges 00000028 00000000 00000000 00000252 2**0 CONTENTS, READONLY, DEBUGGING - 2 .debug_pubnames 0000006a 00000000 00000000 00000278 2**0 + 3 .debug_pubnames 0000006a 00000000 00000000 0000027a 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_info 00000284 00000000 00000000 000002e2 2**0 + 4 .debug_info 00000285 00000000 00000000 000002e4 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_abbrev 000001ae 00000000 00000000 00000566 2**0 + 5 .debug_abbrev 0000019f 00000000 00000000 00000569 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_line 00000450 00000000 00000000 00000714 2**0 + 6 .debug_line 00000453 00000000 00000000 00000708 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_frame 00000090 00000000 00000000 00000b64 2**2 + 7 .debug_frame 00000090 00000000 00000000 00000b5c 2**2 CONTENTS, READONLY, DEBUGGING - 7 .debug_str 00000141 00000000 00000000 00000bf4 2**0 + 8 .debug_str 00000141 00000000 00000000 00000bec 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_loc 000001e1 00000000 00000000 00000d35 2**0 + 9 .debug_loc 000001e1 00000000 00000000 00000d2d 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_ranges 00000068 00000000 00000000 00000f16 2**0 + 10 .debug_ranges 00000068 00000000 00000000 00000f0e 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -135,7 +137,7 @@ void watchdogReset() { __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); - + // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 7e50: a5 e0 ldi r26, 0x05 ; 5 @@ -249,7 +251,7 @@ void watchdogReset() { 7ec6: e8 95 spm 7ec8: c0 e0 ldi r28, 0x00 ; 0 7eca: d1 e0 ldi r29, 0x01 ; 1 - + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); @@ -278,7 +280,7 @@ void watchdogReset() { // Read command terminator, start reply verifySpace(); 7ef4: 75 d0 rcall .+234 ; 0x7fe0 - + // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); @@ -336,7 +338,7 @@ int main(void) { 7f2e: a0 38 cpi r26, 0x80 ; 128 7f30: bf 07 cpc r27, r31 7f32: 51 f7 brne .-44 ; 0x7f08 - + // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 7f34: e0 91 00 02 lds r30, 0x0200 diff --git a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex index f4a1514..1e56839 100644 --- a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex +++ b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex @@ -1,34 +1,34 @@ -:107E0000112484B714BE81FFE6D085E08093810001 -:107E100082E08093C00088E18093C10086E0809377 -:107E2000C20088E08093C4008EE0CFD0259A86E01F -:107E300028E13EEF91E0309385002093840096BBCB -:107E4000B09BFECF1D9AA8958150A9F7DD24D3944D -:107E5000A5E0EA2EF1E1FF2EABD0813421F481E0E0 -:107E6000C5D083E020C0823411F484E103C085349E -:107E700019F485E0BBD091C0853581F499D0082FE5 -:107E800010E096D090E0982F8827802B912B880FB8 -:107E9000991F90930102809300027EC0863529F4D9 -:107EA00084E0A4D080E07CD078C0843609F04EC055 -:107EB00087D0E0910002F091010280E7E030F807FE -:107EC00018F483E087BFE895C0E0D1E071D08993D2 -:107ED000809102028150809302028823B9F7E091D9 -:107EE0000002F091010280E7E030F80718F083E02B -:107EF00087BFE89575D007B600FCFDCF4091000222 -:107F000050910102A0E0B1E02C9130E011968C91EB -:107F1000119790E0982F8827822B932B1296FA01C5 -:107F20000C01D7BEE89511244E5F5F4FF1E0A038F9 -:107F3000BF0751F7E0910002F0910102E7BEE8951A -:107F400007B600FCFDCFF7BEE89527C08437B9F42B -:107F500037D046D0E0910002F09101023196F093C3 -:107F60000102E09300023197E4918E2F19D08091A5 -:107F70000202815080930202882361F70EC0853788 -:107F800039F42ED08EE10CD085E90AD08FE08BCF6A -:107F9000813511F488E019D023D080E101D05CCF85 -:107FA000982F8091C00085FFFCCF9093C600089564 -:107FB000A8958091C00087FFFCCF8091C6000895EE -:107FC000F7DFF6DF80930202F3CFE0E6F0E098E11E -:107FD00090838083089580E0F8DFEE27FF270994DF -:107FE000E7DF803209F0F7DF84E1DACF1F93182F43 -:0C7FF000DFDF1150E9F7F4DF1F91089566 -:0400000300007E007B +:10000000112484B714BE81FFE6D085E0809381007F +:1000100082E08093C00088E18093C10086E08093F5 +:10002000C20088E08093C4008EE0CFD0259A86E09D +:1000300028E13EEF91E0309385002093840096BB49 +:10004000B09BFECF1D9AA8958150A9F7DD24D394CB +:10005000A5E0EA2EF1E1FF2EABD0813421F481E05E +:10006000C5D083E020C0823411F484E103C085341C +:1000700019F485E0BBD091C0853581F499D0082F63 +:1000800010E096D090E0982F8827802B912B880F36 +:10009000991F90930102809300027EC0863529F457 +:1000A00084E0A4D080E07CD078C0843609F04EC0D3 +:1000B00087D0E0910002F091010280E7E030F8077C +:1000C00018F483E087BFE895C0E0D1E071D0899350 +:1000D000809102028150809302028823B9F7E09157 +:1000E0000002F091010280E7E030F80718F083E0A9 +:1000F00087BFE89575D007B600FCFDCF40910002A0 +:1001000050910102A0E0B1E02C9130E011968C9169 +:10011000119790E0982F8827822B932B1296FA0143 +:100120000C01D7BEE89511244E5F5F4FF1E0A03877 +:10013000BF0751F7E0910002F0910102E7BEE89598 +:1001400007B600FCFDCFF7BEE89527C08437B9F4A9 +:1001500037D046D0E0910002F09101023196F09341 +:100160000102E09300023197E4918E2F19D0809123 +:100170000202815080930202882361F70EC0853706 +:1001800039F42ED08EE10CD085E90AD08FE08BCFE8 +:10019000813511F488E019D023D080E101D05CCF03 +:1001A000982F8091C00085FFFCCF9093C6000895E2 +:1001B000A8958091C00087FFFCCF8091C60008956C +:1001C000F7DFF6DF80930202F3CFE0E6F0E098E19C +:1001D00090838083089580E0F8DFEE27FF2709945D +:1001E000E7DF803209F0F7DF84E1DACF1F93182FC1 +:0C01F000DFDF1150E9F7F4DF1F910895E4 +:027FFE0001047C :00000001FF diff --git a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst index 4cbcf62..d7ce991 100644 --- a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst +++ b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst @@ -3,552 +3,554 @@ optiboot_atmega328_pro_8MHz.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001fc 00007e00 00007e00 00000054 2**1 + 0 .text 000001fc 00000000 00000000 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .debug_aranges 00000028 00000000 00000000 00000250 2**0 + 1 .version 00000002 00007ffe 00007ffe 00000250 2**0 + CONTENTS, READONLY + 2 .debug_aranges 00000028 00000000 00000000 00000252 2**0 CONTENTS, READONLY, DEBUGGING - 2 .debug_pubnames 0000006a 00000000 00000000 00000278 2**0 + 3 .debug_pubnames 0000006a 00000000 00000000 0000027a 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_info 00000284 00000000 00000000 000002e2 2**0 + 4 .debug_info 00000285 00000000 00000000 000002e4 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_abbrev 000001ae 00000000 00000000 00000566 2**0 + 5 .debug_abbrev 0000019f 00000000 00000000 00000569 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_line 00000450 00000000 00000000 00000714 2**0 + 6 .debug_line 00000453 00000000 00000000 00000708 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_frame 00000090 00000000 00000000 00000b64 2**2 + 7 .debug_frame 00000090 00000000 00000000 00000b5c 2**2 CONTENTS, READONLY, DEBUGGING - 7 .debug_str 00000141 00000000 00000000 00000bf4 2**0 + 8 .debug_str 00000141 00000000 00000000 00000bec 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_loc 000001e1 00000000 00000000 00000d35 2**0 + 9 .debug_loc 000001e1 00000000 00000000 00000d2d 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_ranges 00000068 00000000 00000000 00000f16 2**0 + 10 .debug_ranges 00000068 00000000 00000000 00000f0e 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: -00007e00
: +00000000
: #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 7e00: 11 24 eor r1, r1 + 0: 11 24 eor r1, r1 #ifdef __AVR_ATmega8__ SP=RAMEND; // This is done by hardware reset #endif // Adaboot no-wait mod ch = MCUSR; - 7e02: 84 b7 in r24, 0x34 ; 52 + 2: 84 b7 in r24, 0x34 ; 52 MCUSR = 0; - 7e04: 14 be out 0x34, r1 ; 52 + 4: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); - 7e06: 81 ff sbrs r24, 1 - 7e08: e6 d0 rcall .+460 ; 0x7fd6 + 6: 81 ff sbrs r24, 1 + 8: e6 d0 rcall .+460 ; 0x1d6 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 7e0a: 85 e0 ldi r24, 0x05 ; 5 - 7e0c: 80 93 81 00 sts 0x0081, r24 + a: 85 e0 ldi r24, 0x05 ; 5 + c: 80 93 81 00 sts 0x0081, r24 UCSRA = _BV(U2X); //Double speed mode USART UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); #else UCSR0A = _BV(U2X0); //Double speed mode USART0 - 7e10: 82 e0 ldi r24, 0x02 ; 2 - 7e12: 80 93 c0 00 sts 0x00C0, r24 + 10: 82 e0 ldi r24, 0x02 ; 2 + 12: 80 93 c0 00 sts 0x00C0, r24 UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 7e16: 88 e1 ldi r24, 0x18 ; 24 - 7e18: 80 93 c1 00 sts 0x00C1, r24 + 16: 88 e1 ldi r24, 0x18 ; 24 + 18: 80 93 c1 00 sts 0x00C1, r24 UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 7e1c: 86 e0 ldi r24, 0x06 ; 6 - 7e1e: 80 93 c2 00 sts 0x00C2, r24 + 1c: 86 e0 ldi r24, 0x06 ; 6 + 1e: 80 93 c2 00 sts 0x00C2, r24 UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 7e22: 88 e0 ldi r24, 0x08 ; 8 - 7e24: 80 93 c4 00 sts 0x00C4, r24 + 22: 88 e0 ldi r24, 0x08 ; 8 + 24: 80 93 c4 00 sts 0x00C4, r24 #endif #endif // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); - 7e28: 8e e0 ldi r24, 0x0E ; 14 - 7e2a: cf d0 rcall .+414 ; 0x7fca + 28: 8e e0 ldi r24, 0x0E ; 14 + 2a: cf d0 rcall .+414 ; 0x1ca /* Set LED pin as output */ LED_DDR |= _BV(LED); - 7e2c: 25 9a sbi 0x04, 5 ; 4 - 7e2e: 86 e0 ldi r24, 0x06 ; 6 + 2c: 25 9a sbi 0x04, 5 ; 4 + 2e: 86 e0 ldi r24, 0x06 ; 6 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 7e30: 28 e1 ldi r18, 0x18 ; 24 - 7e32: 3e ef ldi r19, 0xFE ; 254 + 30: 28 e1 ldi r18, 0x18 ; 24 + 32: 3e ef ldi r19, 0xFE ; 254 TIFR1 = _BV(TOV1); - 7e34: 91 e0 ldi r25, 0x01 ; 1 + 34: 91 e0 ldi r25, 0x01 ; 1 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 7e36: 30 93 85 00 sts 0x0085, r19 - 7e3a: 20 93 84 00 sts 0x0084, r18 + 36: 30 93 85 00 sts 0x0085, r19 + 3a: 20 93 84 00 sts 0x0084, r18 TIFR1 = _BV(TOV1); - 7e3e: 96 bb out 0x16, r25 ; 22 + 3e: 96 bb out 0x16, r25 ; 22 while(!(TIFR1 & _BV(TOV1))); - 7e40: b0 9b sbis 0x16, 0 ; 22 - 7e42: fe cf rjmp .-4 ; 0x7e40 + 40: b0 9b sbis 0x16, 0 ; 22 + 42: fe cf rjmp .-4 ; 0x40 <__SREG__+0x1> #ifdef __AVR_ATmega8__ LED_PORT ^= _BV(LED); #else LED_PIN |= _BV(LED); - 7e44: 1d 9a sbi 0x03, 5 ; 3 + 44: 1d 9a sbi 0x03, 5 ; 3 return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 7e46: a8 95 wdr + 46: a8 95 wdr LED_PORT ^= _BV(LED); #else LED_PIN |= _BV(LED); #endif watchdogReset(); } while (--count); - 7e48: 81 50 subi r24, 0x01 ; 1 - 7e4a: a9 f7 brne .-22 ; 0x7e36 + 48: 81 50 subi r24, 0x01 ; 1 + 4a: a9 f7 brne .-22 ; 0x36 <__CCP__+0x2> /* get character from UART */ ch = getch(); if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 7e4c: dd 24 eor r13, r13 - 7e4e: d3 94 inc r13 + 4c: dd 24 eor r13, r13 + 4e: d3 94 inc r13 __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); - + // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 7e50: a5 e0 ldi r26, 0x05 ; 5 - 7e52: ea 2e mov r14, r26 + 50: a5 e0 ldi r26, 0x05 ; 5 + 52: ea 2e mov r14, r26 boot_spm_busy_wait(); #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 7e54: f1 e1 ldi r31, 0x11 ; 17 - 7e56: ff 2e mov r15, r31 + 54: f1 e1 ldi r31, 0x11 ; 17 + 56: ff 2e mov r15, r31 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 7e58: ab d0 rcall .+342 ; 0x7fb0 + 58: ab d0 rcall .+342 ; 0x1b0 if(ch == STK_GET_PARAMETER) { - 7e5a: 81 34 cpi r24, 0x41 ; 65 - 7e5c: 21 f4 brne .+8 ; 0x7e66 + 5a: 81 34 cpi r24, 0x41 ; 65 + 5c: 21 f4 brne .+8 ; 0x66 <__SREG__+0x27> // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 7e5e: 81 e0 ldi r24, 0x01 ; 1 - 7e60: c5 d0 rcall .+394 ; 0x7fec + 5e: 81 e0 ldi r24, 0x01 ; 1 + 60: c5 d0 rcall .+394 ; 0x1ec putch(0x03); - 7e62: 83 e0 ldi r24, 0x03 ; 3 - 7e64: 20 c0 rjmp .+64 ; 0x7ea6 + 62: 83 e0 ldi r24, 0x03 ; 3 + 64: 20 c0 rjmp .+64 ; 0xa6 <__SREG__+0x67> } else if(ch == STK_SET_DEVICE) { - 7e66: 82 34 cpi r24, 0x42 ; 66 - 7e68: 11 f4 brne .+4 ; 0x7e6e + 66: 82 34 cpi r24, 0x42 ; 66 + 68: 11 f4 brne .+4 ; 0x6e <__SREG__+0x2f> // SET DEVICE is ignored getNch(20); - 7e6a: 84 e1 ldi r24, 0x14 ; 20 - 7e6c: 03 c0 rjmp .+6 ; 0x7e74 + 6a: 84 e1 ldi r24, 0x14 ; 20 + 6c: 03 c0 rjmp .+6 ; 0x74 <__SREG__+0x35> } else if(ch == STK_SET_DEVICE_EXT) { - 7e6e: 85 34 cpi r24, 0x45 ; 69 - 7e70: 19 f4 brne .+6 ; 0x7e78 + 6e: 85 34 cpi r24, 0x45 ; 69 + 70: 19 f4 brne .+6 ; 0x78 <__SREG__+0x39> // SET DEVICE EXT is ignored getNch(5); - 7e72: 85 e0 ldi r24, 0x05 ; 5 - 7e74: bb d0 rcall .+374 ; 0x7fec - 7e76: 91 c0 rjmp .+290 ; 0x7f9a + 72: 85 e0 ldi r24, 0x05 ; 5 + 74: bb d0 rcall .+374 ; 0x1ec + 76: 91 c0 rjmp .+290 ; 0x19a <__SREG__+0x15b> } else if(ch == STK_LOAD_ADDRESS) { - 7e78: 85 35 cpi r24, 0x55 ; 85 - 7e7a: 81 f4 brne .+32 ; 0x7e9c + 78: 85 35 cpi r24, 0x55 ; 85 + 7a: 81 f4 brne .+32 ; 0x9c <__SREG__+0x5d> // LOAD ADDRESS uint16_t newAddress; newAddress = getch(); - 7e7c: 99 d0 rcall .+306 ; 0x7fb0 + 7c: 99 d0 rcall .+306 ; 0x1b0 newAddress = (newAddress & 0xff) | (getch() << 8); - 7e7e: 08 2f mov r16, r24 - 7e80: 10 e0 ldi r17, 0x00 ; 0 - 7e82: 96 d0 rcall .+300 ; 0x7fb0 - 7e84: 90 e0 ldi r25, 0x00 ; 0 - 7e86: 98 2f mov r25, r24 - 7e88: 88 27 eor r24, r24 - 7e8a: 80 2b or r24, r16 - 7e8c: 91 2b or r25, r17 + 7e: 08 2f mov r16, r24 + 80: 10 e0 ldi r17, 0x00 ; 0 + 82: 96 d0 rcall .+300 ; 0x1b0 + 84: 90 e0 ldi r25, 0x00 ; 0 + 86: 98 2f mov r25, r24 + 88: 88 27 eor r24, r24 + 8a: 80 2b or r24, r16 + 8c: 91 2b or r25, r17 #ifdef RAMPZ // Transfer top bit to RAMPZ RAMPZ = (newAddress & 0x8000) ? 1 : 0; #endif newAddress += newAddress; // Convert from word address to byte address - 7e8e: 88 0f add r24, r24 - 7e90: 99 1f adc r25, r25 + 8e: 88 0f add r24, r24 + 90: 99 1f adc r25, r25 address = newAddress; - 7e92: 90 93 01 02 sts 0x0201, r25 - 7e96: 80 93 00 02 sts 0x0200, r24 - 7e9a: 7e c0 rjmp .+252 ; 0x7f98 + 92: 90 93 01 02 sts 0x0201, r25 + 96: 80 93 00 02 sts 0x0200, r24 + 9a: 7e c0 rjmp .+252 ; 0x198 <__SREG__+0x159> verifySpace(); } else if(ch == STK_UNIVERSAL) { - 7e9c: 86 35 cpi r24, 0x56 ; 86 - 7e9e: 29 f4 brne .+10 ; 0x7eaa + 9c: 86 35 cpi r24, 0x56 ; 86 + 9e: 29 f4 brne .+10 ; 0xaa <__SREG__+0x6b> // UNIVERSAL command is ignored getNch(4); - 7ea0: 84 e0 ldi r24, 0x04 ; 4 - 7ea2: a4 d0 rcall .+328 ; 0x7fec + a0: 84 e0 ldi r24, 0x04 ; 4 + a2: a4 d0 rcall .+328 ; 0x1ec putch(0x00); - 7ea4: 80 e0 ldi r24, 0x00 ; 0 - 7ea6: 7c d0 rcall .+248 ; 0x7fa0 - 7ea8: 78 c0 rjmp .+240 ; 0x7f9a + a4: 80 e0 ldi r24, 0x00 ; 0 + a6: 7c d0 rcall .+248 ; 0x1a0 + a8: 78 c0 rjmp .+240 ; 0x19a <__SREG__+0x15b> } /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 7eaa: 84 36 cpi r24, 0x64 ; 100 - 7eac: 09 f0 breq .+2 ; 0x7eb0 - 7eae: 4e c0 rjmp .+156 ; 0x7f4c + aa: 84 36 cpi r24, 0x64 ; 100 + ac: 09 f0 breq .+2 ; 0xb0 <__SREG__+0x71> + ae: 4e c0 rjmp .+156 ; 0x14c <__SREG__+0x10d> // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; getLen(); - 7eb0: 87 d0 rcall .+270 ; 0x7fc0 + b0: 87 d0 rcall .+270 ; 0x1c0 // If we are in RWW section, immediately start page erase if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 7eb2: e0 91 00 02 lds r30, 0x0200 - 7eb6: f0 91 01 02 lds r31, 0x0201 - 7eba: 80 e7 ldi r24, 0x70 ; 112 - 7ebc: e0 30 cpi r30, 0x00 ; 0 - 7ebe: f8 07 cpc r31, r24 - 7ec0: 18 f4 brcc .+6 ; 0x7ec8 - 7ec2: 83 e0 ldi r24, 0x03 ; 3 - 7ec4: 87 bf out 0x37, r24 ; 55 - 7ec6: e8 95 spm - 7ec8: c0 e0 ldi r28, 0x00 ; 0 - 7eca: d1 e0 ldi r29, 0x01 ; 1 - + b2: e0 91 00 02 lds r30, 0x0200 + b6: f0 91 01 02 lds r31, 0x0201 + ba: 80 e7 ldi r24, 0x70 ; 112 + bc: e0 30 cpi r30, 0x00 ; 0 + be: f8 07 cpc r31, r24 + c0: 18 f4 brcc .+6 ; 0xc8 <__SREG__+0x89> + c2: 83 e0 ldi r24, 0x03 ; 3 + c4: 87 bf out 0x37, r24 ; 55 + c6: e8 95 spm + c8: c0 e0 ldi r28, 0x00 ; 0 + ca: d1 e0 ldi r29, 0x01 ; 1 + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 7ecc: 71 d0 rcall .+226 ; 0x7fb0 - 7ece: 89 93 st Y+, r24 + cc: 71 d0 rcall .+226 ; 0x1b0 + ce: 89 93 st Y+, r24 while (--length); - 7ed0: 80 91 02 02 lds r24, 0x0202 - 7ed4: 81 50 subi r24, 0x01 ; 1 - 7ed6: 80 93 02 02 sts 0x0202, r24 - 7eda: 88 23 and r24, r24 - 7edc: b9 f7 brne .-18 ; 0x7ecc + d0: 80 91 02 02 lds r24, 0x0202 + d4: 81 50 subi r24, 0x01 ; 1 + d6: 80 93 02 02 sts 0x0202, r24 + da: 88 23 and r24, r24 + dc: b9 f7 brne .-18 ; 0xcc <__SREG__+0x8d> // If we are in NRWW section, page erase has to be delayed until now. // Todo: Take RAMPZ into account if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 7ede: e0 91 00 02 lds r30, 0x0200 - 7ee2: f0 91 01 02 lds r31, 0x0201 - 7ee6: 80 e7 ldi r24, 0x70 ; 112 - 7ee8: e0 30 cpi r30, 0x00 ; 0 - 7eea: f8 07 cpc r31, r24 - 7eec: 18 f0 brcs .+6 ; 0x7ef4 - 7eee: 83 e0 ldi r24, 0x03 ; 3 - 7ef0: 87 bf out 0x37, r24 ; 55 - 7ef2: e8 95 spm + de: e0 91 00 02 lds r30, 0x0200 + e2: f0 91 01 02 lds r31, 0x0201 + e6: 80 e7 ldi r24, 0x70 ; 112 + e8: e0 30 cpi r30, 0x00 ; 0 + ea: f8 07 cpc r31, r24 + ec: 18 f0 brcs .+6 ; 0xf4 <__SREG__+0xb5> + ee: 83 e0 ldi r24, 0x03 ; 3 + f0: 87 bf out 0x37, r24 ; 55 + f2: e8 95 spm // Read command terminator, start reply verifySpace(); - 7ef4: 75 d0 rcall .+234 ; 0x7fe0 - + f4: 75 d0 rcall .+234 ; 0x1e0 + // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 7ef6: 07 b6 in r0, 0x37 ; 55 - 7ef8: 00 fc sbrc r0, 0 - 7efa: fd cf rjmp .-6 ; 0x7ef6 + f6: 07 b6 in r0, 0x37 ; 55 + f8: 00 fc sbrc r0, 0 + fa: fd cf rjmp .-6 ; 0xf6 <__SREG__+0xb7> } #endif // Copy buffer into programming buffer bufPtr = buff; addrPtr = (uint16_t)(void*)address; - 7efc: 40 91 00 02 lds r20, 0x0200 - 7f00: 50 91 01 02 lds r21, 0x0201 - 7f04: a0 e0 ldi r26, 0x00 ; 0 - 7f06: b1 e0 ldi r27, 0x01 ; 1 + fc: 40 91 00 02 lds r20, 0x0200 + 100: 50 91 01 02 lds r21, 0x0201 + 104: a0 e0 ldi r26, 0x00 ; 0 + 106: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 7f08: 2c 91 ld r18, X - 7f0a: 30 e0 ldi r19, 0x00 ; 0 + 108: 2c 91 ld r18, X + 10a: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 7f0c: 11 96 adiw r26, 0x01 ; 1 - 7f0e: 8c 91 ld r24, X - 7f10: 11 97 sbiw r26, 0x01 ; 1 - 7f12: 90 e0 ldi r25, 0x00 ; 0 - 7f14: 98 2f mov r25, r24 - 7f16: 88 27 eor r24, r24 - 7f18: 82 2b or r24, r18 - 7f1a: 93 2b or r25, r19 + 10c: 11 96 adiw r26, 0x01 ; 1 + 10e: 8c 91 ld r24, X + 110: 11 97 sbiw r26, 0x01 ; 1 + 112: 90 e0 ldi r25, 0x00 ; 0 + 114: 98 2f mov r25, r24 + 116: 88 27 eor r24, r24 + 118: 82 2b or r24, r18 + 11a: 93 2b or r25, r19 #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 7f1c: 12 96 adiw r26, 0x02 ; 2 + 11c: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 7f1e: fa 01 movw r30, r20 - 7f20: 0c 01 movw r0, r24 - 7f22: d7 be out 0x37, r13 ; 55 - 7f24: e8 95 spm - 7f26: 11 24 eor r1, r1 + 11e: fa 01 movw r30, r20 + 120: 0c 01 movw r0, r24 + 122: d7 be out 0x37, r13 ; 55 + 124: e8 95 spm + 126: 11 24 eor r1, r1 addrPtr += 2; - 7f28: 4e 5f subi r20, 0xFE ; 254 - 7f2a: 5f 4f sbci r21, 0xFF ; 255 + 128: 4e 5f subi r20, 0xFE ; 254 + 12a: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 7f2c: f1 e0 ldi r31, 0x01 ; 1 - 7f2e: a0 38 cpi r26, 0x80 ; 128 - 7f30: bf 07 cpc r27, r31 - 7f32: 51 f7 brne .-44 ; 0x7f08 - + 12c: f1 e0 ldi r31, 0x01 ; 1 + 12e: a0 38 cpi r26, 0x80 ; 128 + 130: bf 07 cpc r27, r31 + 132: 51 f7 brne .-44 ; 0x108 <__SREG__+0xc9> + // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 7f34: e0 91 00 02 lds r30, 0x0200 - 7f38: f0 91 01 02 lds r31, 0x0201 - 7f3c: e7 be out 0x37, r14 ; 55 - 7f3e: e8 95 spm + 134: e0 91 00 02 lds r30, 0x0200 + 138: f0 91 01 02 lds r31, 0x0201 + 13c: e7 be out 0x37, r14 ; 55 + 13e: e8 95 spm boot_spm_busy_wait(); - 7f40: 07 b6 in r0, 0x37 ; 55 - 7f42: 00 fc sbrc r0, 0 - 7f44: fd cf rjmp .-6 ; 0x7f40 + 140: 07 b6 in r0, 0x37 ; 55 + 142: 00 fc sbrc r0, 0 + 144: fd cf rjmp .-6 ; 0x140 <__SREG__+0x101> #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 7f46: f7 be out 0x37, r15 ; 55 - 7f48: e8 95 spm - 7f4a: 27 c0 rjmp .+78 ; 0x7f9a + 146: f7 be out 0x37, r15 ; 55 + 148: e8 95 spm + 14a: 27 c0 rjmp .+78 ; 0x19a <__SREG__+0x15b> #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 7f4c: 84 37 cpi r24, 0x74 ; 116 - 7f4e: b9 f4 brne .+46 ; 0x7f7e + 14c: 84 37 cpi r24, 0x74 ; 116 + 14e: b9 f4 brne .+46 ; 0x17e <__SREG__+0x13f> // READ PAGE - we only read flash getLen(); - 7f50: 37 d0 rcall .+110 ; 0x7fc0 + 150: 37 d0 rcall .+110 ; 0x1c0 verifySpace(); - 7f52: 46 d0 rcall .+140 ; 0x7fe0 + 152: 46 d0 rcall .+140 ; 0x1e0 putch(result); address++; } while (--length); #else do putch(pgm_read_byte_near(address++)); - 7f54: e0 91 00 02 lds r30, 0x0200 - 7f58: f0 91 01 02 lds r31, 0x0201 - 7f5c: 31 96 adiw r30, 0x01 ; 1 - 7f5e: f0 93 01 02 sts 0x0201, r31 - 7f62: e0 93 00 02 sts 0x0200, r30 - 7f66: 31 97 sbiw r30, 0x01 ; 1 - 7f68: e4 91 lpm r30, Z+ - 7f6a: 8e 2f mov r24, r30 - 7f6c: 19 d0 rcall .+50 ; 0x7fa0 + 154: e0 91 00 02 lds r30, 0x0200 + 158: f0 91 01 02 lds r31, 0x0201 + 15c: 31 96 adiw r30, 0x01 ; 1 + 15e: f0 93 01 02 sts 0x0201, r31 + 162: e0 93 00 02 sts 0x0200, r30 + 166: 31 97 sbiw r30, 0x01 ; 1 + 168: e4 91 lpm r30, Z+ + 16a: 8e 2f mov r24, r30 + 16c: 19 d0 rcall .+50 ; 0x1a0 while (--length); - 7f6e: 80 91 02 02 lds r24, 0x0202 - 7f72: 81 50 subi r24, 0x01 ; 1 - 7f74: 80 93 02 02 sts 0x0202, r24 - 7f78: 88 23 and r24, r24 - 7f7a: 61 f7 brne .-40 ; 0x7f54 - 7f7c: 0e c0 rjmp .+28 ; 0x7f9a + 16e: 80 91 02 02 lds r24, 0x0202 + 172: 81 50 subi r24, 0x01 ; 1 + 174: 80 93 02 02 sts 0x0202, r24 + 178: 88 23 and r24, r24 + 17a: 61 f7 brne .-40 ; 0x154 <__SREG__+0x115> + 17c: 0e c0 rjmp .+28 ; 0x19a <__SREG__+0x15b> #endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 7f7e: 85 37 cpi r24, 0x75 ; 117 - 7f80: 39 f4 brne .+14 ; 0x7f90 + 17e: 85 37 cpi r24, 0x75 ; 117 + 180: 39 f4 brne .+14 ; 0x190 <__SREG__+0x151> // READ SIGN - return what Avrdude wants to hear verifySpace(); - 7f82: 2e d0 rcall .+92 ; 0x7fe0 + 182: 2e d0 rcall .+92 ; 0x1e0 putch(SIGNATURE_0); - 7f84: 8e e1 ldi r24, 0x1E ; 30 - 7f86: 0c d0 rcall .+24 ; 0x7fa0 + 184: 8e e1 ldi r24, 0x1E ; 30 + 186: 0c d0 rcall .+24 ; 0x1a0 putch(SIGNATURE_1); - 7f88: 85 e9 ldi r24, 0x95 ; 149 - 7f8a: 0a d0 rcall .+20 ; 0x7fa0 + 188: 85 e9 ldi r24, 0x95 ; 149 + 18a: 0a d0 rcall .+20 ; 0x1a0 putch(SIGNATURE_2); - 7f8c: 8f e0 ldi r24, 0x0F ; 15 - 7f8e: 8b cf rjmp .-234 ; 0x7ea6 + 18c: 8f e0 ldi r24, 0x0F ; 15 + 18e: 8b cf rjmp .-234 ; 0xa6 <__SREG__+0x67> } else if (ch == 'Q') { - 7f90: 81 35 cpi r24, 0x51 ; 81 - 7f92: 11 f4 brne .+4 ; 0x7f98 + 190: 81 35 cpi r24, 0x51 ; 81 + 192: 11 f4 brne .+4 ; 0x198 <__SREG__+0x159> // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 7f94: 88 e0 ldi r24, 0x08 ; 8 - 7f96: 19 d0 rcall .+50 ; 0x7fca + 194: 88 e0 ldi r24, 0x08 ; 8 + 196: 19 d0 rcall .+50 ; 0x1ca verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 7f98: 23 d0 rcall .+70 ; 0x7fe0 + 198: 23 d0 rcall .+70 ; 0x1e0 } putch(STK_OK); - 7f9a: 80 e1 ldi r24, 0x10 ; 16 - 7f9c: 01 d0 rcall .+2 ; 0x7fa0 - 7f9e: 5c cf rjmp .-328 ; 0x7e58 + 19a: 80 e1 ldi r24, 0x10 ; 16 + 19c: 01 d0 rcall .+2 ; 0x1a0 + 19e: 5c cf rjmp .-328 ; 0x58 <__SREG__+0x19> -00007fa0 : +000001a0 : } } void putch(char ch) { - 7fa0: 98 2f mov r25, r24 + 1a0: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); - 7fa2: 80 91 c0 00 lds r24, 0x00C0 - 7fa6: 85 ff sbrs r24, 5 - 7fa8: fc cf rjmp .-8 ; 0x7fa2 + 1a2: 80 91 c0 00 lds r24, 0x00C0 + 1a6: 85 ff sbrs r24, 5 + 1a8: fc cf rjmp .-8 ; 0x1a2 UDR0 = ch; - 7faa: 90 93 c6 00 sts 0x00C6, r25 + 1aa: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 7fae: 08 95 ret + 1ae: 08 95 ret -00007fb0 : +000001b0 : return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 7fb0: a8 95 wdr + 1b0: a8 95 wdr [uartBit] "I" (UART_RX_BIT) : "r25" ); #else while(!(UCSR0A & _BV(RXC0))); - 7fb2: 80 91 c0 00 lds r24, 0x00C0 - 7fb6: 87 ff sbrs r24, 7 - 7fb8: fc cf rjmp .-8 ; 0x7fb2 + 1b2: 80 91 c0 00 lds r24, 0x00C0 + 1b6: 87 ff sbrs r24, 7 + 1b8: fc cf rjmp .-8 ; 0x1b2 ch = UDR0; - 7fba: 80 91 c6 00 lds r24, 0x00C6 + 1ba: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 7fbe: 08 95 ret + 1be: 08 95 ret -00007fc0 : +000001c0 : } while (--count); } #endif uint8_t getLen() { getch(); - 7fc0: f7 df rcall .-18 ; 0x7fb0 + 1c0: f7 df rcall .-18 ; 0x1b0 length = getch(); - 7fc2: f6 df rcall .-20 ; 0x7fb0 - 7fc4: 80 93 02 02 sts 0x0202, r24 + 1c2: f6 df rcall .-20 ; 0x1b0 + 1c4: 80 93 02 02 sts 0x0202, r24 return getch(); } - 7fc8: f3 cf rjmp .-26 ; 0x7fb0 + 1c8: f3 cf rjmp .-26 ; 0x1b0 -00007fca : +000001ca : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 7fca: e0 e6 ldi r30, 0x60 ; 96 - 7fcc: f0 e0 ldi r31, 0x00 ; 0 - 7fce: 98 e1 ldi r25, 0x18 ; 24 - 7fd0: 90 83 st Z, r25 + 1ca: e0 e6 ldi r30, 0x60 ; 96 + 1cc: f0 e0 ldi r31, 0x00 ; 0 + 1ce: 98 e1 ldi r25, 0x18 ; 24 + 1d0: 90 83 st Z, r25 WDTCSR = x; - 7fd2: 80 83 st Z, r24 + 1d2: 80 83 st Z, r24 } - 7fd4: 08 95 ret + 1d4: 08 95 ret -00007fd6 : +000001d6 : void appStart() { watchdogConfig(WATCHDOG_OFF); - 7fd6: 80 e0 ldi r24, 0x00 ; 0 - 7fd8: f8 df rcall .-16 ; 0x7fca + 1d6: 80 e0 ldi r24, 0x00 ; 0 + 1d8: f8 df rcall .-16 ; 0x1ca __asm__ __volatile__ ( - 7fda: ee 27 eor r30, r30 - 7fdc: ff 27 eor r31, r31 - 7fde: 09 94 ijmp + 1da: ee 27 eor r30, r30 + 1dc: ff 27 eor r31, r31 + 1de: 09 94 ijmp -00007fe0 : +000001e0 : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) appStart(); - 7fe0: e7 df rcall .-50 ; 0x7fb0 - 7fe2: 80 32 cpi r24, 0x20 ; 32 - 7fe4: 09 f0 breq .+2 ; 0x7fe8 - 7fe6: f7 df rcall .-18 ; 0x7fd6 + 1e0: e7 df rcall .-50 ; 0x1b0 + 1e2: 80 32 cpi r24, 0x20 ; 32 + 1e4: 09 f0 breq .+2 ; 0x1e8 + 1e6: f7 df rcall .-18 ; 0x1d6 putch(STK_INSYNC); - 7fe8: 84 e1 ldi r24, 0x14 ; 20 + 1e8: 84 e1 ldi r24, 0x14 ; 20 } - 7fea: da cf rjmp .-76 ; 0x7fa0 + 1ea: da cf rjmp .-76 ; 0x1a0 -00007fec : +000001ec : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 7fec: 1f 93 push r17 - 7fee: 18 2f mov r17, r24 + 1ec: 1f 93 push r17 + 1ee: 18 2f mov r17, r24 do getch(); while (--count); - 7ff0: df df rcall .-66 ; 0x7fb0 - 7ff2: 11 50 subi r17, 0x01 ; 1 - 7ff4: e9 f7 brne .-6 ; 0x7ff0 + 1f0: df df rcall .-66 ; 0x1b0 + 1f2: 11 50 subi r17, 0x01 ; 1 + 1f4: e9 f7 brne .-6 ; 0x1f0 verifySpace(); - 7ff6: f4 df rcall .-24 ; 0x7fe0 + 1f6: f4 df rcall .-24 ; 0x1e0 } - 7ff8: 1f 91 pop r17 - 7ffa: 08 95 ret + 1f8: 1f 91 pop r17 + 1fa: 08 95 ret diff --git a/bootloaders/optiboot/optiboot_diecimila.hex b/bootloaders/optiboot/optiboot_diecimila.hex index 2b4a582..3ac0de2 100644 --- a/bootloaders/optiboot/optiboot_diecimila.hex +++ b/bootloaders/optiboot/optiboot_diecimila.hex @@ -30,5 +30,6 @@ :103FD00090838083089580E0F8DFEE27FF2709941F :103FE000E7DF803209F0F7DF84E1DACF1F93182F83 :0C3FF000DFDF1150E9F7F4DF1F910895A6 +:023FFE000104BC :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_diecimila.lst b/bootloaders/optiboot/optiboot_diecimila.lst index e0a1ecf..8b17368 100644 --- a/bootloaders/optiboot/optiboot_diecimila.lst +++ b/bootloaders/optiboot/optiboot_diecimila.lst @@ -5,23 +5,25 @@ Sections: Idx Name Size VMA LMA File off Algn 0 .text 000001fc 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .debug_aranges 00000028 00000000 00000000 00000250 2**0 + 1 .version 00000002 00003ffe 00003ffe 00000250 2**0 + CONTENTS, READONLY + 2 .debug_aranges 00000028 00000000 00000000 00000252 2**0 CONTENTS, READONLY, DEBUGGING - 2 .debug_pubnames 0000006a 00000000 00000000 00000278 2**0 + 3 .debug_pubnames 0000006a 00000000 00000000 0000027a 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_info 00000284 00000000 00000000 000002e2 2**0 + 4 .debug_info 00000285 00000000 00000000 000002e4 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_abbrev 000001ae 00000000 00000000 00000566 2**0 + 5 .debug_abbrev 0000019f 00000000 00000000 00000569 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_line 00000450 00000000 00000000 00000714 2**0 + 6 .debug_line 00000453 00000000 00000000 00000708 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_frame 00000090 00000000 00000000 00000b64 2**2 + 7 .debug_frame 00000090 00000000 00000000 00000b5c 2**2 CONTENTS, READONLY, DEBUGGING - 7 .debug_str 00000141 00000000 00000000 00000bf4 2**0 + 8 .debug_str 00000141 00000000 00000000 00000bec 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_loc 000001e1 00000000 00000000 00000d35 2**0 + 9 .debug_loc 000001e1 00000000 00000000 00000d2d 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_ranges 00000068 00000000 00000000 00000f16 2**0 + 10 .debug_ranges 00000068 00000000 00000000 00000f0e 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -135,7 +137,7 @@ void watchdogReset() { __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); - + // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 3e50: a5 e0 ldi r26, 0x05 ; 5 @@ -249,7 +251,7 @@ void watchdogReset() { 3ec6: e8 95 spm 3ec8: c0 e0 ldi r28, 0x00 ; 0 3eca: d1 e0 ldi r29, 0x01 ; 1 - + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); @@ -278,7 +280,7 @@ void watchdogReset() { // Read command terminator, start reply verifySpace(); 3ef4: 75 d0 rcall .+234 ; 0x3fe0 - + // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); @@ -336,7 +338,7 @@ int main(void) { 3f2e: a0 38 cpi r26, 0x80 ; 128 3f30: bf 07 cpc r27, r31 3f32: 51 f7 brne .-44 ; 0x3f08 - + // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 3f34: e0 91 00 02 lds r30, 0x0200 diff --git a/bootloaders/optiboot/optiboot_lilypad.hex b/bootloaders/optiboot/optiboot_lilypad.hex index 7579286..77897e7 100644 --- a/bootloaders/optiboot/optiboot_lilypad.hex +++ b/bootloaders/optiboot/optiboot_lilypad.hex @@ -30,5 +30,6 @@ :103FD00090838083089580E0F8DFEE27FF2709941F :103FE000E7DF803209F0F7DF84E1DACF1F93182F83 :0C3FF000DFDF1150E9F7F4DF1F910895A6 +:023FFE000104BC :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_lilypad.lst b/bootloaders/optiboot/optiboot_lilypad.lst index cbae268..75180bc 100644 --- a/bootloaders/optiboot/optiboot_lilypad.lst +++ b/bootloaders/optiboot/optiboot_lilypad.lst @@ -5,23 +5,25 @@ Sections: Idx Name Size VMA LMA File off Algn 0 .text 000001fc 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .debug_aranges 00000028 00000000 00000000 00000250 2**0 + 1 .version 00000002 00003ffe 00003ffe 00000250 2**0 + CONTENTS, READONLY + 2 .debug_aranges 00000028 00000000 00000000 00000252 2**0 CONTENTS, READONLY, DEBUGGING - 2 .debug_pubnames 0000006a 00000000 00000000 00000278 2**0 + 3 .debug_pubnames 0000006a 00000000 00000000 0000027a 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_info 00000284 00000000 00000000 000002e2 2**0 + 4 .debug_info 00000285 00000000 00000000 000002e4 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_abbrev 000001ae 00000000 00000000 00000566 2**0 + 5 .debug_abbrev 0000019f 00000000 00000000 00000569 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_line 00000450 00000000 00000000 00000714 2**0 + 6 .debug_line 00000453 00000000 00000000 00000708 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_frame 00000090 00000000 00000000 00000b64 2**2 + 7 .debug_frame 00000090 00000000 00000000 00000b5c 2**2 CONTENTS, READONLY, DEBUGGING - 7 .debug_str 00000141 00000000 00000000 00000bf4 2**0 + 8 .debug_str 00000141 00000000 00000000 00000bec 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_loc 000001e1 00000000 00000000 00000d35 2**0 + 9 .debug_loc 000001e1 00000000 00000000 00000d2d 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_ranges 00000068 00000000 00000000 00000f16 2**0 + 10 .debug_ranges 00000068 00000000 00000000 00000f0e 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -135,7 +137,7 @@ void watchdogReset() { __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); - + // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 3e50: a5 e0 ldi r26, 0x05 ; 5 @@ -249,7 +251,7 @@ void watchdogReset() { 3ec6: e8 95 spm 3ec8: c0 e0 ldi r28, 0x00 ; 0 3eca: d1 e0 ldi r29, 0x01 ; 1 - + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); @@ -278,7 +280,7 @@ void watchdogReset() { // Read command terminator, start reply verifySpace(); 3ef4: 75 d0 rcall .+234 ; 0x3fe0 - + // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); @@ -336,7 +338,7 @@ int main(void) { 3f2e: a0 38 cpi r26, 0x80 ; 128 3f30: bf 07 cpc r27, r31 3f32: 51 f7 brne .-44 ; 0x3f08 - + // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 3f34: e0 91 00 02 lds r30, 0x0200 diff --git a/bootloaders/optiboot/optiboot_lilypad_resonator.hex b/bootloaders/optiboot/optiboot_lilypad_resonator.hex index 7579286..77897e7 100644 --- a/bootloaders/optiboot/optiboot_lilypad_resonator.hex +++ b/bootloaders/optiboot/optiboot_lilypad_resonator.hex @@ -30,5 +30,6 @@ :103FD00090838083089580E0F8DFEE27FF2709941F :103FE000E7DF803209F0F7DF84E1DACF1F93182F83 :0C3FF000DFDF1150E9F7F4DF1F910895A6 +:023FFE000104BC :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_lilypad_resonator.lst b/bootloaders/optiboot/optiboot_lilypad_resonator.lst index c5d7710..48c2778 100644 --- a/bootloaders/optiboot/optiboot_lilypad_resonator.lst +++ b/bootloaders/optiboot/optiboot_lilypad_resonator.lst @@ -5,23 +5,25 @@ Sections: Idx Name Size VMA LMA File off Algn 0 .text 000001fc 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .debug_aranges 00000028 00000000 00000000 00000250 2**0 + 1 .version 00000002 00003ffe 00003ffe 00000250 2**0 + CONTENTS, READONLY + 2 .debug_aranges 00000028 00000000 00000000 00000252 2**0 CONTENTS, READONLY, DEBUGGING - 2 .debug_pubnames 0000006a 00000000 00000000 00000278 2**0 + 3 .debug_pubnames 0000006a 00000000 00000000 0000027a 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_info 00000284 00000000 00000000 000002e2 2**0 + 4 .debug_info 00000285 00000000 00000000 000002e4 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_abbrev 000001ae 00000000 00000000 00000566 2**0 + 5 .debug_abbrev 0000019f 00000000 00000000 00000569 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_line 00000450 00000000 00000000 00000714 2**0 + 6 .debug_line 00000453 00000000 00000000 00000708 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_frame 00000090 00000000 00000000 00000b64 2**2 + 7 .debug_frame 00000090 00000000 00000000 00000b5c 2**2 CONTENTS, READONLY, DEBUGGING - 7 .debug_str 00000141 00000000 00000000 00000bf4 2**0 + 8 .debug_str 00000141 00000000 00000000 00000bec 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_loc 000001e1 00000000 00000000 00000d35 2**0 + 9 .debug_loc 000001e1 00000000 00000000 00000d2d 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_ranges 00000068 00000000 00000000 00000f16 2**0 + 10 .debug_ranges 00000068 00000000 00000000 00000f0e 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -135,7 +137,7 @@ void watchdogReset() { __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); - + // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 3e50: a5 e0 ldi r26, 0x05 ; 5 @@ -249,7 +251,7 @@ void watchdogReset() { 3ec6: e8 95 spm 3ec8: c0 e0 ldi r28, 0x00 ; 0 3eca: d1 e0 ldi r29, 0x01 ; 1 - + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); @@ -278,7 +280,7 @@ void watchdogReset() { // Read command terminator, start reply verifySpace(); 3ef4: 75 d0 rcall .+234 ; 0x3fe0 - + // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); @@ -336,7 +338,7 @@ int main(void) { 3f2e: a0 38 cpi r26, 0x80 ; 128 3f30: bf 07 cpc r27, r31 3f32: 51 f7 brne .-44 ; 0x3f08 - + // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 3f34: e0 91 00 02 lds r30, 0x0200 diff --git a/bootloaders/optiboot/optiboot_luminet.hex b/bootloaders/optiboot/optiboot_luminet.hex index 3ad3c0a..0f901f4 100644 --- a/bootloaders/optiboot/optiboot_luminet.hex +++ b/bootloaders/optiboot/optiboot_luminet.hex @@ -1,42 +1,42 @@ -:101D0000112484B714BE81FF22D185E08EBD8EE000 -:101D10001AD1D49AD29A86E023EC3FEF91E03DBDF0 -:101D20002CBD9BB9589BFECFCC9AA8958150B9F792 -:101D3000DD24D39485E0C82E0FE7F02E1EECE12EB3 -:101D4000E9D0813421F481E00DD183E020C08234D8 -:101D500011F484E103C0853419F485E003D1C8C0CF -:101D6000853581F4D7D0082F10E0D4D090E0982F9B -:101D70008827802B912B880F991F90938101809346 -:101D80008001B5C0863529F484E0ECD080E0B3D082 -:101D9000AFC0843609F06BC0D1D0C0E0D1E0BAD07A -:101DA0008993809182018150809382018823B9F7C1 -:101DB000E0918001F091810183E087BFE895CCD06C -:101DC00007B600FCFDCF8091800190918101892BA5 -:101DD00041F5809100012091010130E0322F22274E -:101DE00090E0282B392B309385012093840140917A -:101DF00008018091090190E0982F882750E0842BFA -:101E0000952B909387018093860124503040209336 -:101E10000801232F332720930901F0920001E0925B -:101E200001014091800150918101A0E0B1E02C912D -:101E300030E011968C91119790E0982F8827822B93 -:101E4000932B1296FA010C01D7BEE89511244E5F30 -:101E50005F4FF1E0A034BF0751F7E0918001F091AE -:101E60008101C7BEE89507B600FCFDCF41C08437AD -:101E700089F564D071D0E0918001F09181013097B3 -:101E800019F42091840113C0E130F10519F4209177 -:101E900085010DC0E830F10519F42091860107C0D5 -:101EA000E930F10519F42091870101C02491809156 -:101EB000800190918101019690938101809380012E -:101EC000822F19D0809182018150809382018823D2 -:101ED00091F60EC0853739F43FD08EE10CD083E9FE -:101EE0000AD08CE054CF813511F488E02CD034D066 -:101EF00080E101D025CF2AE030E08095089410F4ED -:101F0000DA9802C0DA9A000015D014D086952A9586 -:101F1000B1F70895A89529E030E0CB99FECF0AD01B -:101F200009D008D08894CB9908942A9511F0879508 -:101F3000F7CF08959EE09A95F1F70895EBDFEADF79 -:101F400080938201E7CF98E191BD81BD089580E043 -:101F5000FADFE4E0FF270994DDDF803209F0F7DFE4 -:101F600084E1C9CF1F93182FD5DF1150E9F7F4DFB3 -:041F70001F91089520 -:0400000300001D00DC +:10000000112484B714BE81FF22D185E08EBD8EE01D +:100010001AD1D49AD29A86E023EC3FEF91E03DBD0D +:100020002CBD9BB9589BFECFCC9AA8958150B9F7AF +:10003000DD24D39485E0C82E0FE7F02E1EECE12ED0 +:10004000E9D0813421F481E00DD183E020C08234F5 +:1000500011F484E103C0853419F485E003D1C8C0EC +:10006000853581F4D7D0082F10E0D4D090E0982FB8 +:100070008827802B912B880F991F90938101809363 +:100080008001B5C0863529F484E0ECD080E0B3D09F +:10009000AFC0843609F06BC0D1D0C0E0D1E0BAD097 +:1000A0008993809182018150809382018823B9F7DE +:1000B000E0918001F091810183E087BFE895CCD089 +:1000C00007B600FCFDCF8091800190918101892BC2 +:1000D00041F5809100012091010130E0322F22276B +:1000E00090E0282B392B3093850120938401409197 +:1000F00008018091090190E0982F882750E0842B17 +:10010000952B909387018093860124503040209353 +:100110000801232F332720930901F0920001E09278 +:1001200001014091800150918101A0E0B1E02C914A +:1001300030E011968C91119790E0982F8827822BB0 +:10014000932B1296FA010C01D7BEE89511244E5F4D +:100150005F4FF1E0A034BF0751F7E0918001F091CB +:100160008101C7BEE89507B600FCFDCF41C08437CA +:1001700089F564D071D0E0918001F09181013097D0 +:1001800019F42091840113C0E130F10519F4209194 +:1001900085010DC0E830F10519F42091860107C0F2 +:1001A000E930F10519F42091870101C02491809173 +:1001B000800190918101019690938101809380014B +:1001C000822F19D0809182018150809382018823EF +:1001D00091F60EC0853739F43FD08EE10CD083E91B +:1001E0000AD08CE054CF813511F488E02CD034D083 +:1001F00080E101D025CF2AE030E08095089410F40A +:10020000DA9802C0DA9A000015D014D086952A95A3 +:10021000B1F70895A89529E030E0CB99FECF0AD038 +:1002200009D008D08894CB9908942A9511F0879525 +:10023000F7CF08959EE09A95F1F70895EBDFEADF96 +:1002400080938201E7CF98E191BD81BD089580E060 +:10025000FADFE4E0FF270994DDDF803209F0F7DF01 +:1002600084E1C9CF1F93182FD5DF1150E9F7F4DFD0 +:040270001F9108953D +:021EFE000104DD :00000001FF diff --git a/bootloaders/optiboot/optiboot_luminet.lst b/bootloaders/optiboot/optiboot_luminet.lst index 737d2c5..1be7e4f 100644 --- a/bootloaders/optiboot/optiboot_luminet.lst +++ b/bootloaders/optiboot/optiboot_luminet.lst @@ -3,620 +3,622 @@ optiboot_luminet.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 00000274 00001d00 00001d00 00000054 2**1 + 0 .version 00000002 00001efe 00001efe 000002c8 2**0 + CONTENTS, READONLY + 1 .text 00000274 00000000 00000000 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .debug_aranges 00000028 00000000 00000000 000002c8 2**0 + 2 .debug_aranges 00000028 00000000 00000000 000002ca 2**0 CONTENTS, READONLY, DEBUGGING - 2 .debug_pubnames 00000078 00000000 00000000 000002f0 2**0 + 3 .debug_pubnames 00000078 00000000 00000000 000002f2 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_info 000002a4 00000000 00000000 00000368 2**0 + 4 .debug_info 000002a5 00000000 00000000 0000036a 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_abbrev 000001ac 00000000 00000000 0000060c 2**0 + 5 .debug_abbrev 0000019d 00000000 00000000 0000060f 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_line 000004a9 00000000 00000000 000007b8 2**0 + 6 .debug_line 000004ac 00000000 00000000 000007ac 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_frame 000000a0 00000000 00000000 00000c64 2**2 + 7 .debug_frame 000000a0 00000000 00000000 00000c58 2**2 CONTENTS, READONLY, DEBUGGING - 7 .debug_str 00000150 00000000 00000000 00000d04 2**0 + 8 .debug_str 00000150 00000000 00000000 00000cf8 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_loc 00000194 00000000 00000000 00000e54 2**0 + 9 .debug_loc 00000194 00000000 00000000 00000e48 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_ranges 00000088 00000000 00000000 00000fe8 2**0 + 10 .debug_ranges 00000088 00000000 00000000 00000fdc 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: -00001d00
: +00000000
: #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 1d00: 11 24 eor r1, r1 + 0: 11 24 eor r1, r1 #ifdef __AVR_ATmega8__ SP=RAMEND; // This is done by hardware reset #endif // Adaboot no-wait mod ch = MCUSR; - 1d02: 84 b7 in r24, 0x34 ; 52 + 2: 84 b7 in r24, 0x34 ; 52 MCUSR = 0; - 1d04: 14 be out 0x34, r1 ; 52 + 4: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); - 1d06: 81 ff sbrs r24, 1 - 1d08: 22 d1 rcall .+580 ; 0x1f4e + 6: 81 ff sbrs r24, 1 + 8: 22 d1 rcall .+580 ; 0x24e #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 1d0a: 85 e0 ldi r24, 0x05 ; 5 - 1d0c: 8e bd out 0x2e, r24 ; 46 + a: 85 e0 ldi r24, 0x05 ; 5 + c: 8e bd out 0x2e, r24 ; 46 UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); #endif #endif // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); - 1d0e: 8e e0 ldi r24, 0x0E ; 14 - 1d10: 1a d1 rcall .+564 ; 0x1f46 + e: 8e e0 ldi r24, 0x0E ; 14 + 10: 1a d1 rcall .+564 ; 0x246 /* Set LED pin as output */ LED_DDR |= _BV(LED); - 1d12: d4 9a sbi 0x1a, 4 ; 26 + 12: d4 9a sbi 0x1a, 4 ; 26 #ifdef SOFT_UART /* Set TX pin as output */ UART_DDR |= _BV(UART_TX_BIT); - 1d14: d2 9a sbi 0x1a, 2 ; 26 - 1d16: 86 e0 ldi r24, 0x06 ; 6 + 14: d2 9a sbi 0x1a, 2 ; 26 + 16: 86 e0 ldi r24, 0x06 ; 6 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 1d18: 23 ec ldi r18, 0xC3 ; 195 - 1d1a: 3f ef ldi r19, 0xFF ; 255 + 18: 23 ec ldi r18, 0xC3 ; 195 + 1a: 3f ef ldi r19, 0xFF ; 255 TIFR1 = _BV(TOV1); - 1d1c: 91 e0 ldi r25, 0x01 ; 1 + 1c: 91 e0 ldi r25, 0x01 ; 1 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 1d1e: 3d bd out 0x2d, r19 ; 45 - 1d20: 2c bd out 0x2c, r18 ; 44 + 1e: 3d bd out 0x2d, r19 ; 45 + 20: 2c bd out 0x2c, r18 ; 44 TIFR1 = _BV(TOV1); - 1d22: 9b b9 out 0x0b, r25 ; 11 + 22: 9b b9 out 0x0b, r25 ; 11 while(!(TIFR1 & _BV(TOV1))); - 1d24: 58 9b sbis 0x0b, 0 ; 11 - 1d26: fe cf rjmp .-4 ; 0x1d24 + 24: 58 9b sbis 0x0b, 0 ; 11 + 26: fe cf rjmp .-4 ; 0x24 <__zero_reg__+0x23> #ifdef __AVR_ATmega8__ LED_PORT ^= _BV(LED); #else LED_PIN |= _BV(LED); - 1d28: cc 9a sbi 0x19, 4 ; 25 + 28: cc 9a sbi 0x19, 4 ; 25 return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 1d2a: a8 95 wdr + 2a: a8 95 wdr LED_PORT ^= _BV(LED); #else LED_PIN |= _BV(LED); #endif watchdogReset(); } while (--count); - 1d2c: 81 50 subi r24, 0x01 ; 1 - 1d2e: b9 f7 brne .-18 ; 0x1d1e + 2c: 81 50 subi r24, 0x01 ; 1 + 2e: b9 f7 brne .-18 ; 0x1e <__zero_reg__+0x1d> /* get character from UART */ ch = getch(); if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 1d30: dd 24 eor r13, r13 - 1d32: d3 94 inc r13 + 30: dd 24 eor r13, r13 + 32: d3 94 inc r13 __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); - + // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 1d34: 85 e0 ldi r24, 0x05 ; 5 - 1d36: c8 2e mov r12, r24 + 34: 85 e0 ldi r24, 0x05 ; 5 + 36: c8 2e mov r12, r24 vect -= 4; // Instruction is a relative jump (rjmp), so recalculate. buff[8] = vect & 0xff; buff[9] = vect >> 8; // Add jump to bootloader at RESET vector buff[0] = 0x7f; - 1d38: 0f e7 ldi r16, 0x7F ; 127 - 1d3a: f0 2e mov r15, r16 + 38: 0f e7 ldi r16, 0x7F ; 127 + 3a: f0 2e mov r15, r16 buff[1] = 0xce; // rjmp 0x1d00 instruction - 1d3c: 1e ec ldi r17, 0xCE ; 206 - 1d3e: e1 2e mov r14, r17 + 3c: 1e ec ldi r17, 0xCE ; 206 + 3e: e1 2e mov r14, r17 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 1d40: e9 d0 rcall .+466 ; 0x1f14 + 40: e9 d0 rcall .+466 ; 0x214 if(ch == STK_GET_PARAMETER) { - 1d42: 81 34 cpi r24, 0x41 ; 65 - 1d44: 21 f4 brne .+8 ; 0x1d4e + 42: 81 34 cpi r24, 0x41 ; 65 + 44: 21 f4 brne .+8 ; 0x4e <__SREG__+0xf> // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 1d46: 81 e0 ldi r24, 0x01 ; 1 - 1d48: 0d d1 rcall .+538 ; 0x1f64 + 46: 81 e0 ldi r24, 0x01 ; 1 + 48: 0d d1 rcall .+538 ; 0x264 putch(0x03); - 1d4a: 83 e0 ldi r24, 0x03 ; 3 - 1d4c: 20 c0 rjmp .+64 ; 0x1d8e + 4a: 83 e0 ldi r24, 0x03 ; 3 + 4c: 20 c0 rjmp .+64 ; 0x8e <__SREG__+0x4f> } else if(ch == STK_SET_DEVICE) { - 1d4e: 82 34 cpi r24, 0x42 ; 66 - 1d50: 11 f4 brne .+4 ; 0x1d56 + 4e: 82 34 cpi r24, 0x42 ; 66 + 50: 11 f4 brne .+4 ; 0x56 <__SREG__+0x17> // SET DEVICE is ignored getNch(20); - 1d52: 84 e1 ldi r24, 0x14 ; 20 - 1d54: 03 c0 rjmp .+6 ; 0x1d5c + 52: 84 e1 ldi r24, 0x14 ; 20 + 54: 03 c0 rjmp .+6 ; 0x5c <__SREG__+0x1d> } else if(ch == STK_SET_DEVICE_EXT) { - 1d56: 85 34 cpi r24, 0x45 ; 69 - 1d58: 19 f4 brne .+6 ; 0x1d60 + 56: 85 34 cpi r24, 0x45 ; 69 + 58: 19 f4 brne .+6 ; 0x60 <__SREG__+0x21> // SET DEVICE EXT is ignored getNch(5); - 1d5a: 85 e0 ldi r24, 0x05 ; 5 - 1d5c: 03 d1 rcall .+518 ; 0x1f64 - 1d5e: c8 c0 rjmp .+400 ; 0x1ef0 + 5a: 85 e0 ldi r24, 0x05 ; 5 + 5c: 03 d1 rcall .+518 ; 0x264 + 5e: c8 c0 rjmp .+400 ; 0x1f0 <__SREG__+0x1b1> } else if(ch == STK_LOAD_ADDRESS) { - 1d60: 85 35 cpi r24, 0x55 ; 85 - 1d62: 81 f4 brne .+32 ; 0x1d84 + 60: 85 35 cpi r24, 0x55 ; 85 + 62: 81 f4 brne .+32 ; 0x84 <__SREG__+0x45> // LOAD ADDRESS uint16_t newAddress; newAddress = getch(); - 1d64: d7 d0 rcall .+430 ; 0x1f14 + 64: d7 d0 rcall .+430 ; 0x214 newAddress = (newAddress & 0xff) | (getch() << 8); - 1d66: 08 2f mov r16, r24 - 1d68: 10 e0 ldi r17, 0x00 ; 0 - 1d6a: d4 d0 rcall .+424 ; 0x1f14 - 1d6c: 90 e0 ldi r25, 0x00 ; 0 - 1d6e: 98 2f mov r25, r24 - 1d70: 88 27 eor r24, r24 - 1d72: 80 2b or r24, r16 - 1d74: 91 2b or r25, r17 + 66: 08 2f mov r16, r24 + 68: 10 e0 ldi r17, 0x00 ; 0 + 6a: d4 d0 rcall .+424 ; 0x214 + 6c: 90 e0 ldi r25, 0x00 ; 0 + 6e: 98 2f mov r25, r24 + 70: 88 27 eor r24, r24 + 72: 80 2b or r24, r16 + 74: 91 2b or r25, r17 #ifdef RAMPZ // Transfer top bit to RAMPZ RAMPZ = (newAddress & 0x8000) ? 1 : 0; #endif newAddress += newAddress; // Convert from word address to byte address - 1d76: 88 0f add r24, r24 - 1d78: 99 1f adc r25, r25 + 76: 88 0f add r24, r24 + 78: 99 1f adc r25, r25 address = newAddress; - 1d7a: 90 93 81 01 sts 0x0181, r25 - 1d7e: 80 93 80 01 sts 0x0180, r24 - 1d82: b5 c0 rjmp .+362 ; 0x1eee + 7a: 90 93 81 01 sts 0x0181, r25 + 7e: 80 93 80 01 sts 0x0180, r24 + 82: b5 c0 rjmp .+362 ; 0x1ee <__SREG__+0x1af> verifySpace(); } else if(ch == STK_UNIVERSAL) { - 1d84: 86 35 cpi r24, 0x56 ; 86 - 1d86: 29 f4 brne .+10 ; 0x1d92 + 84: 86 35 cpi r24, 0x56 ; 86 + 86: 29 f4 brne .+10 ; 0x92 <__SREG__+0x53> // UNIVERSAL command is ignored getNch(4); - 1d88: 84 e0 ldi r24, 0x04 ; 4 - 1d8a: ec d0 rcall .+472 ; 0x1f64 + 88: 84 e0 ldi r24, 0x04 ; 4 + 8a: ec d0 rcall .+472 ; 0x264 putch(0x00); - 1d8c: 80 e0 ldi r24, 0x00 ; 0 - 1d8e: b3 d0 rcall .+358 ; 0x1ef6 - 1d90: af c0 rjmp .+350 ; 0x1ef0 + 8c: 80 e0 ldi r24, 0x00 ; 0 + 8e: b3 d0 rcall .+358 ; 0x1f6 + 90: af c0 rjmp .+350 ; 0x1f0 <__SREG__+0x1b1> } /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 1d92: 84 36 cpi r24, 0x64 ; 100 - 1d94: 09 f0 breq .+2 ; 0x1d98 - 1d96: 6b c0 rjmp .+214 ; 0x1e6e + 92: 84 36 cpi r24, 0x64 ; 100 + 94: 09 f0 breq .+2 ; 0x98 <__SREG__+0x59> + 96: 6b c0 rjmp .+214 ; 0x16e <__SREG__+0x12f> // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; getLen(); - 1d98: d1 d0 rcall .+418 ; 0x1f3c - 1d9a: c0 e0 ldi r28, 0x00 ; 0 - 1d9c: d1 e0 ldi r29, 0x01 ; 1 + 98: d1 d0 rcall .+418 ; 0x23c + 9a: c0 e0 ldi r28, 0x00 ; 0 + 9c: d1 e0 ldi r29, 0x01 ; 1 // If we are in RWW section, immediately start page erase if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 1d9e: ba d0 rcall .+372 ; 0x1f14 - 1da0: 89 93 st Y+, r24 + 9e: ba d0 rcall .+372 ; 0x214 + a0: 89 93 st Y+, r24 while (--length); - 1da2: 80 91 82 01 lds r24, 0x0182 - 1da6: 81 50 subi r24, 0x01 ; 1 - 1da8: 80 93 82 01 sts 0x0182, r24 - 1dac: 88 23 and r24, r24 - 1dae: b9 f7 brne .-18 ; 0x1d9e + a2: 80 91 82 01 lds r24, 0x0182 + a6: 81 50 subi r24, 0x01 ; 1 + a8: 80 93 82 01 sts 0x0182, r24 + ac: 88 23 and r24, r24 + ae: b9 f7 brne .-18 ; 0x9e <__SREG__+0x5f> // If we are in NRWW section, page erase has to be delayed until now. // Todo: Take RAMPZ into account if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 1db0: e0 91 80 01 lds r30, 0x0180 - 1db4: f0 91 81 01 lds r31, 0x0181 - 1db8: 83 e0 ldi r24, 0x03 ; 3 - 1dba: 87 bf out 0x37, r24 ; 55 - 1dbc: e8 95 spm + b0: e0 91 80 01 lds r30, 0x0180 + b4: f0 91 81 01 lds r31, 0x0181 + b8: 83 e0 ldi r24, 0x03 ; 3 + ba: 87 bf out 0x37, r24 ; 55 + bc: e8 95 spm // Read command terminator, start reply verifySpace(); - 1dbe: cc d0 rcall .+408 ; 0x1f58 - + be: cc d0 rcall .+408 ; 0x258 + // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 1dc0: 07 b6 in r0, 0x37 ; 55 - 1dc2: 00 fc sbrc r0, 0 - 1dc4: fd cf rjmp .-6 ; 0x1dc0 + c0: 07 b6 in r0, 0x37 ; 55 + c2: 00 fc sbrc r0, 0 + c4: fd cf rjmp .-6 ; 0xc0 <__SREG__+0x81> #ifdef VIRTUAL_BOOT_PARTITION if ((uint16_t)(void*)address == 0) { - 1dc6: 80 91 80 01 lds r24, 0x0180 - 1dca: 90 91 81 01 lds r25, 0x0181 - 1dce: 89 2b or r24, r25 - 1dd0: 41 f5 brne .+80 ; 0x1e22 + c6: 80 91 80 01 lds r24, 0x0180 + ca: 90 91 81 01 lds r25, 0x0181 + ce: 89 2b or r24, r25 + d0: 41 f5 brne .+80 ; 0x122 <__SREG__+0xe3> // This is the reset vector page. We need to live-patch the code so the // bootloader runs. // // Move RESET vector to WDT vector uint16_t vect = buff[0] | (buff[1]<<8); - 1dd2: 80 91 00 01 lds r24, 0x0100 - 1dd6: 20 91 01 01 lds r18, 0x0101 - 1dda: 30 e0 ldi r19, 0x00 ; 0 - 1ddc: 32 2f mov r19, r18 - 1dde: 22 27 eor r18, r18 - 1de0: 90 e0 ldi r25, 0x00 ; 0 - 1de2: 28 2b or r18, r24 - 1de4: 39 2b or r19, r25 + d2: 80 91 00 01 lds r24, 0x0100 + d6: 20 91 01 01 lds r18, 0x0101 + da: 30 e0 ldi r19, 0x00 ; 0 + dc: 32 2f mov r19, r18 + de: 22 27 eor r18, r18 + e0: 90 e0 ldi r25, 0x00 ; 0 + e2: 28 2b or r18, r24 + e4: 39 2b or r19, r25 rstVect = vect; - 1de6: 30 93 85 01 sts 0x0185, r19 - 1dea: 20 93 84 01 sts 0x0184, r18 + e6: 30 93 85 01 sts 0x0185, r19 + ea: 20 93 84 01 sts 0x0184, r18 wdtVect = buff[8] | (buff[9]<<8); - 1dee: 40 91 08 01 lds r20, 0x0108 - 1df2: 80 91 09 01 lds r24, 0x0109 - 1df6: 90 e0 ldi r25, 0x00 ; 0 - 1df8: 98 2f mov r25, r24 - 1dfa: 88 27 eor r24, r24 - 1dfc: 50 e0 ldi r21, 0x00 ; 0 - 1dfe: 84 2b or r24, r20 - 1e00: 95 2b or r25, r21 - 1e02: 90 93 87 01 sts 0x0187, r25 - 1e06: 80 93 86 01 sts 0x0186, r24 + ee: 40 91 08 01 lds r20, 0x0108 + f2: 80 91 09 01 lds r24, 0x0109 + f6: 90 e0 ldi r25, 0x00 ; 0 + f8: 98 2f mov r25, r24 + fa: 88 27 eor r24, r24 + fc: 50 e0 ldi r21, 0x00 ; 0 + fe: 84 2b or r24, r20 + 100: 95 2b or r25, r21 + 102: 90 93 87 01 sts 0x0187, r25 + 106: 80 93 86 01 sts 0x0186, r24 vect -= 4; // Instruction is a relative jump (rjmp), so recalculate. - 1e0a: 24 50 subi r18, 0x04 ; 4 - 1e0c: 30 40 sbci r19, 0x00 ; 0 + 10a: 24 50 subi r18, 0x04 ; 4 + 10c: 30 40 sbci r19, 0x00 ; 0 buff[8] = vect & 0xff; - 1e0e: 20 93 08 01 sts 0x0108, r18 + 10e: 20 93 08 01 sts 0x0108, r18 buff[9] = vect >> 8; - 1e12: 23 2f mov r18, r19 - 1e14: 33 27 eor r19, r19 - 1e16: 20 93 09 01 sts 0x0109, r18 + 112: 23 2f mov r18, r19 + 114: 33 27 eor r19, r19 + 116: 20 93 09 01 sts 0x0109, r18 // Add jump to bootloader at RESET vector buff[0] = 0x7f; - 1e1a: f0 92 00 01 sts 0x0100, r15 + 11a: f0 92 00 01 sts 0x0100, r15 buff[1] = 0xce; // rjmp 0x1d00 instruction - 1e1e: e0 92 01 01 sts 0x0101, r14 + 11e: e0 92 01 01 sts 0x0101, r14 } #endif // Copy buffer into programming buffer bufPtr = buff; addrPtr = (uint16_t)(void*)address; - 1e22: 40 91 80 01 lds r20, 0x0180 - 1e26: 50 91 81 01 lds r21, 0x0181 - 1e2a: a0 e0 ldi r26, 0x00 ; 0 - 1e2c: b1 e0 ldi r27, 0x01 ; 1 + 122: 40 91 80 01 lds r20, 0x0180 + 126: 50 91 81 01 lds r21, 0x0181 + 12a: a0 e0 ldi r26, 0x00 ; 0 + 12c: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 1e2e: 2c 91 ld r18, X - 1e30: 30 e0 ldi r19, 0x00 ; 0 + 12e: 2c 91 ld r18, X + 130: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 1e32: 11 96 adiw r26, 0x01 ; 1 - 1e34: 8c 91 ld r24, X - 1e36: 11 97 sbiw r26, 0x01 ; 1 - 1e38: 90 e0 ldi r25, 0x00 ; 0 - 1e3a: 98 2f mov r25, r24 - 1e3c: 88 27 eor r24, r24 - 1e3e: 82 2b or r24, r18 - 1e40: 93 2b or r25, r19 + 132: 11 96 adiw r26, 0x01 ; 1 + 134: 8c 91 ld r24, X + 136: 11 97 sbiw r26, 0x01 ; 1 + 138: 90 e0 ldi r25, 0x00 ; 0 + 13a: 98 2f mov r25, r24 + 13c: 88 27 eor r24, r24 + 13e: 82 2b or r24, r18 + 140: 93 2b or r25, r19 #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 1e42: 12 96 adiw r26, 0x02 ; 2 + 142: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 1e44: fa 01 movw r30, r20 - 1e46: 0c 01 movw r0, r24 - 1e48: d7 be out 0x37, r13 ; 55 - 1e4a: e8 95 spm - 1e4c: 11 24 eor r1, r1 + 144: fa 01 movw r30, r20 + 146: 0c 01 movw r0, r24 + 148: d7 be out 0x37, r13 ; 55 + 14a: e8 95 spm + 14c: 11 24 eor r1, r1 addrPtr += 2; - 1e4e: 4e 5f subi r20, 0xFE ; 254 - 1e50: 5f 4f sbci r21, 0xFF ; 255 + 14e: 4e 5f subi r20, 0xFE ; 254 + 150: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 1e52: f1 e0 ldi r31, 0x01 ; 1 - 1e54: a0 34 cpi r26, 0x40 ; 64 - 1e56: bf 07 cpc r27, r31 - 1e58: 51 f7 brne .-44 ; 0x1e2e - + 152: f1 e0 ldi r31, 0x01 ; 1 + 154: a0 34 cpi r26, 0x40 ; 64 + 156: bf 07 cpc r27, r31 + 158: 51 f7 brne .-44 ; 0x12e <__SREG__+0xef> + // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 1e5a: e0 91 80 01 lds r30, 0x0180 - 1e5e: f0 91 81 01 lds r31, 0x0181 - 1e62: c7 be out 0x37, r12 ; 55 - 1e64: e8 95 spm + 15a: e0 91 80 01 lds r30, 0x0180 + 15e: f0 91 81 01 lds r31, 0x0181 + 162: c7 be out 0x37, r12 ; 55 + 164: e8 95 spm boot_spm_busy_wait(); - 1e66: 07 b6 in r0, 0x37 ; 55 - 1e68: 00 fc sbrc r0, 0 - 1e6a: fd cf rjmp .-6 ; 0x1e66 - 1e6c: 41 c0 rjmp .+130 ; 0x1ef0 + 166: 07 b6 in r0, 0x37 ; 55 + 168: 00 fc sbrc r0, 0 + 16a: fd cf rjmp .-6 ; 0x166 <__SREG__+0x127> + 16c: 41 c0 rjmp .+130 ; 0x1f0 <__SREG__+0x1b1> boot_rww_enable(); #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 1e6e: 84 37 cpi r24, 0x74 ; 116 - 1e70: 89 f5 brne .+98 ; 0x1ed4 + 16e: 84 37 cpi r24, 0x74 ; 116 + 170: 89 f5 brne .+98 ; 0x1d4 <__SREG__+0x195> // READ PAGE - we only read flash getLen(); - 1e72: 64 d0 rcall .+200 ; 0x1f3c + 172: 64 d0 rcall .+200 ; 0x23c verifySpace(); - 1e74: 71 d0 rcall .+226 ; 0x1f58 + 174: 71 d0 rcall .+226 ; 0x258 #ifdef VIRTUAL_BOOT_PARTITION do { // Undo vector patch in bottom page so verify passes if (address == 0) ch=rstVect & 0xff; - 1e76: e0 91 80 01 lds r30, 0x0180 - 1e7a: f0 91 81 01 lds r31, 0x0181 - 1e7e: 30 97 sbiw r30, 0x00 ; 0 - 1e80: 19 f4 brne .+6 ; 0x1e88 - 1e82: 20 91 84 01 lds r18, 0x0184 - 1e86: 13 c0 rjmp .+38 ; 0x1eae + 176: e0 91 80 01 lds r30, 0x0180 + 17a: f0 91 81 01 lds r31, 0x0181 + 17e: 30 97 sbiw r30, 0x00 ; 0 + 180: 19 f4 brne .+6 ; 0x188 <__SREG__+0x149> + 182: 20 91 84 01 lds r18, 0x0184 + 186: 13 c0 rjmp .+38 ; 0x1ae <__SREG__+0x16f> else if (address == 1) ch=rstVect >> 8; - 1e88: e1 30 cpi r30, 0x01 ; 1 - 1e8a: f1 05 cpc r31, r1 - 1e8c: 19 f4 brne .+6 ; 0x1e94 - 1e8e: 20 91 85 01 lds r18, 0x0185 - 1e92: 0d c0 rjmp .+26 ; 0x1eae + 188: e1 30 cpi r30, 0x01 ; 1 + 18a: f1 05 cpc r31, r1 + 18c: 19 f4 brne .+6 ; 0x194 <__SREG__+0x155> + 18e: 20 91 85 01 lds r18, 0x0185 + 192: 0d c0 rjmp .+26 ; 0x1ae <__SREG__+0x16f> else if (address == 8) ch=wdtVect & 0xff; - 1e94: e8 30 cpi r30, 0x08 ; 8 - 1e96: f1 05 cpc r31, r1 - 1e98: 19 f4 brne .+6 ; 0x1ea0 - 1e9a: 20 91 86 01 lds r18, 0x0186 - 1e9e: 07 c0 rjmp .+14 ; 0x1eae + 194: e8 30 cpi r30, 0x08 ; 8 + 196: f1 05 cpc r31, r1 + 198: 19 f4 brne .+6 ; 0x1a0 <__SREG__+0x161> + 19a: 20 91 86 01 lds r18, 0x0186 + 19e: 07 c0 rjmp .+14 ; 0x1ae <__SREG__+0x16f> else if (address == 9) ch=wdtVect >> 8; - 1ea0: e9 30 cpi r30, 0x09 ; 9 - 1ea2: f1 05 cpc r31, r1 - 1ea4: 19 f4 brne .+6 ; 0x1eac - 1ea6: 20 91 87 01 lds r18, 0x0187 - 1eaa: 01 c0 rjmp .+2 ; 0x1eae + 1a0: e9 30 cpi r30, 0x09 ; 9 + 1a2: f1 05 cpc r31, r1 + 1a4: 19 f4 brne .+6 ; 0x1ac <__SREG__+0x16d> + 1a6: 20 91 87 01 lds r18, 0x0187 + 1aa: 01 c0 rjmp .+2 ; 0x1ae <__SREG__+0x16f> else ch = pgm_read_byte_near(address); - 1eac: 24 91 lpm r18, Z+ + 1ac: 24 91 lpm r18, Z+ address++; - 1eae: 80 91 80 01 lds r24, 0x0180 - 1eb2: 90 91 81 01 lds r25, 0x0181 - 1eb6: 01 96 adiw r24, 0x01 ; 1 - 1eb8: 90 93 81 01 sts 0x0181, r25 - 1ebc: 80 93 80 01 sts 0x0180, r24 + 1ae: 80 91 80 01 lds r24, 0x0180 + 1b2: 90 91 81 01 lds r25, 0x0181 + 1b6: 01 96 adiw r24, 0x01 ; 1 + 1b8: 90 93 81 01 sts 0x0181, r25 + 1bc: 80 93 80 01 sts 0x0180, r24 putch(ch); - 1ec0: 82 2f mov r24, r18 - 1ec2: 19 d0 rcall .+50 ; 0x1ef6 + 1c0: 82 2f mov r24, r18 + 1c2: 19 d0 rcall .+50 ; 0x1f6 } while (--length); - 1ec4: 80 91 82 01 lds r24, 0x0182 - 1ec8: 81 50 subi r24, 0x01 ; 1 - 1eca: 80 93 82 01 sts 0x0182, r24 - 1ece: 88 23 and r24, r24 - 1ed0: 91 f6 brne .-92 ; 0x1e76 - 1ed2: 0e c0 rjmp .+28 ; 0x1ef0 + 1c4: 80 91 82 01 lds r24, 0x0182 + 1c8: 81 50 subi r24, 0x01 ; 1 + 1ca: 80 93 82 01 sts 0x0182, r24 + 1ce: 88 23 and r24, r24 + 1d0: 91 f6 brne .-92 ; 0x176 <__SREG__+0x137> + 1d2: 0e c0 rjmp .+28 ; 0x1f0 <__SREG__+0x1b1> #endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 1ed4: 85 37 cpi r24, 0x75 ; 117 - 1ed6: 39 f4 brne .+14 ; 0x1ee6 + 1d4: 85 37 cpi r24, 0x75 ; 117 + 1d6: 39 f4 brne .+14 ; 0x1e6 <__SREG__+0x1a7> // READ SIGN - return what Avrdude wants to hear verifySpace(); - 1ed8: 3f d0 rcall .+126 ; 0x1f58 + 1d8: 3f d0 rcall .+126 ; 0x258 putch(SIGNATURE_0); - 1eda: 8e e1 ldi r24, 0x1E ; 30 - 1edc: 0c d0 rcall .+24 ; 0x1ef6 + 1da: 8e e1 ldi r24, 0x1E ; 30 + 1dc: 0c d0 rcall .+24 ; 0x1f6 putch(SIGNATURE_1); - 1ede: 83 e9 ldi r24, 0x93 ; 147 - 1ee0: 0a d0 rcall .+20 ; 0x1ef6 + 1de: 83 e9 ldi r24, 0x93 ; 147 + 1e0: 0a d0 rcall .+20 ; 0x1f6 putch(SIGNATURE_2); - 1ee2: 8c e0 ldi r24, 0x0C ; 12 - 1ee4: 54 cf rjmp .-344 ; 0x1d8e + 1e2: 8c e0 ldi r24, 0x0C ; 12 + 1e4: 54 cf rjmp .-344 ; 0x8e <__SREG__+0x4f> } else if (ch == 'Q') { - 1ee6: 81 35 cpi r24, 0x51 ; 81 - 1ee8: 11 f4 brne .+4 ; 0x1eee + 1e6: 81 35 cpi r24, 0x51 ; 81 + 1e8: 11 f4 brne .+4 ; 0x1ee <__SREG__+0x1af> // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 1eea: 88 e0 ldi r24, 0x08 ; 8 - 1eec: 2c d0 rcall .+88 ; 0x1f46 + 1ea: 88 e0 ldi r24, 0x08 ; 8 + 1ec: 2c d0 rcall .+88 ; 0x246 verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 1eee: 34 d0 rcall .+104 ; 0x1f58 + 1ee: 34 d0 rcall .+104 ; 0x258 } putch(STK_OK); - 1ef0: 80 e1 ldi r24, 0x10 ; 16 - 1ef2: 01 d0 rcall .+2 ; 0x1ef6 - 1ef4: 25 cf rjmp .-438 ; 0x1d40 + 1f0: 80 e1 ldi r24, 0x10 ; 16 + 1f2: 01 d0 rcall .+2 ; 0x1f6 + 1f4: 25 cf rjmp .-438 ; 0x40 <__SREG__+0x1> -00001ef6 : +000001f6 : void putch(char ch) { #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); UDR0 = ch; #else __asm__ __volatile__ ( - 1ef6: 2a e0 ldi r18, 0x0A ; 10 - 1ef8: 30 e0 ldi r19, 0x00 ; 0 - 1efa: 80 95 com r24 - 1efc: 08 94 sec - 1efe: 10 f4 brcc .+4 ; 0x1f04 - 1f00: da 98 cbi 0x1b, 2 ; 27 - 1f02: 02 c0 rjmp .+4 ; 0x1f08 - 1f04: da 9a sbi 0x1b, 2 ; 27 - 1f06: 00 00 nop - 1f08: 15 d0 rcall .+42 ; 0x1f34 - 1f0a: 14 d0 rcall .+40 ; 0x1f34 - 1f0c: 86 95 lsr r24 - 1f0e: 2a 95 dec r18 - 1f10: b1 f7 brne .-20 ; 0x1efe + 1f6: 2a e0 ldi r18, 0x0A ; 10 + 1f8: 30 e0 ldi r19, 0x00 ; 0 + 1fa: 80 95 com r24 + 1fc: 08 94 sec + 1fe: 10 f4 brcc .+4 ; 0x204 + 200: da 98 cbi 0x1b, 2 ; 27 + 202: 02 c0 rjmp .+4 ; 0x208 + 204: da 9a sbi 0x1b, 2 ; 27 + 206: 00 00 nop + 208: 15 d0 rcall .+42 ; 0x234 + 20a: 14 d0 rcall .+40 ; 0x234 + 20c: 86 95 lsr r24 + 20e: 2a 95 dec r18 + 210: b1 f7 brne .-20 ; 0x1fe [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 1f12: 08 95 ret + 212: 08 95 ret -00001f14 : +00000214 : return getch(); } // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 1f14: a8 95 wdr + 214: a8 95 wdr LED_PIN |= _BV(LED); #endif #endif return ch; } - 1f16: 29 e0 ldi r18, 0x09 ; 9 - 1f18: 30 e0 ldi r19, 0x00 ; 0 - 1f1a: cb 99 sbic 0x19, 3 ; 25 - 1f1c: fe cf rjmp .-4 ; 0x1f1a - 1f1e: 0a d0 rcall .+20 ; 0x1f34 - 1f20: 09 d0 rcall .+18 ; 0x1f34 - 1f22: 08 d0 rcall .+16 ; 0x1f34 - 1f24: 88 94 clc - 1f26: cb 99 sbic 0x19, 3 ; 25 - 1f28: 08 94 sec - 1f2a: 2a 95 dec r18 - 1f2c: 11 f0 breq .+4 ; 0x1f32 - 1f2e: 87 95 ror r24 - 1f30: f7 cf rjmp .-18 ; 0x1f20 - 1f32: 08 95 ret - -00001f34 : + 216: 29 e0 ldi r18, 0x09 ; 9 + 218: 30 e0 ldi r19, 0x00 ; 0 + 21a: cb 99 sbic 0x19, 3 ; 25 + 21c: fe cf rjmp .-4 ; 0x21a + 21e: 0a d0 rcall .+20 ; 0x234 + 220: 09 d0 rcall .+18 ; 0x234 + 222: 08 d0 rcall .+16 ; 0x234 + 224: 88 94 clc + 226: cb 99 sbic 0x19, 3 ; 25 + 228: 08 94 sec + 22a: 2a 95 dec r18 + 22c: 11 f0 breq .+4 ; 0x232 + 22e: 87 95 ror r24 + 230: f7 cf rjmp .-18 ; 0x220 + 232: 08 95 ret + +00000234 : #if UART_B_VALUE > 255 #error Baud rate too slow for soft UART #endif void uartDelay() { __asm__ __volatile__ ( - 1f34: 9e e0 ldi r25, 0x0E ; 14 - 1f36: 9a 95 dec r25 - 1f38: f1 f7 brne .-4 ; 0x1f36 - 1f3a: 08 95 ret + 234: 9e e0 ldi r25, 0x0E ; 14 + 236: 9a 95 dec r25 + 238: f1 f7 brne .-4 ; 0x236 + 23a: 08 95 ret -00001f3c : +0000023c : } while (--count); } #endif uint8_t getLen() { getch(); - 1f3c: eb df rcall .-42 ; 0x1f14 + 23c: eb df rcall .-42 ; 0x214 length = getch(); - 1f3e: ea df rcall .-44 ; 0x1f14 - 1f40: 80 93 82 01 sts 0x0182, r24 + 23e: ea df rcall .-44 ; 0x214 + 240: 80 93 82 01 sts 0x0182, r24 return getch(); } - 1f44: e7 cf rjmp .-50 ; 0x1f14 + 244: e7 cf rjmp .-50 ; 0x214 -00001f46 : +00000246 : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 1f46: 98 e1 ldi r25, 0x18 ; 24 - 1f48: 91 bd out 0x21, r25 ; 33 + 246: 98 e1 ldi r25, 0x18 ; 24 + 248: 91 bd out 0x21, r25 ; 33 WDTCSR = x; - 1f4a: 81 bd out 0x21, r24 ; 33 + 24a: 81 bd out 0x21, r24 ; 33 } - 1f4c: 08 95 ret + 24c: 08 95 ret -00001f4e : +0000024e : void appStart() { watchdogConfig(WATCHDOG_OFF); - 1f4e: 80 e0 ldi r24, 0x00 ; 0 - 1f50: fa df rcall .-12 ; 0x1f46 + 24e: 80 e0 ldi r24, 0x00 ; 0 + 250: fa df rcall .-12 ; 0x246 __asm__ __volatile__ ( - 1f52: e4 e0 ldi r30, 0x04 ; 4 - 1f54: ff 27 eor r31, r31 - 1f56: 09 94 ijmp + 252: e4 e0 ldi r30, 0x04 ; 4 + 254: ff 27 eor r31, r31 + 256: 09 94 ijmp -00001f58 : +00000258 : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) appStart(); - 1f58: dd df rcall .-70 ; 0x1f14 - 1f5a: 80 32 cpi r24, 0x20 ; 32 - 1f5c: 09 f0 breq .+2 ; 0x1f60 - 1f5e: f7 df rcall .-18 ; 0x1f4e + 258: dd df rcall .-70 ; 0x214 + 25a: 80 32 cpi r24, 0x20 ; 32 + 25c: 09 f0 breq .+2 ; 0x260 + 25e: f7 df rcall .-18 ; 0x24e putch(STK_INSYNC); - 1f60: 84 e1 ldi r24, 0x14 ; 20 + 260: 84 e1 ldi r24, 0x14 ; 20 } - 1f62: c9 cf rjmp .-110 ; 0x1ef6 + 262: c9 cf rjmp .-110 ; 0x1f6 -00001f64 : +00000264 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 1f64: 1f 93 push r17 - 1f66: 18 2f mov r17, r24 + 264: 1f 93 push r17 + 266: 18 2f mov r17, r24 do getch(); while (--count); - 1f68: d5 df rcall .-86 ; 0x1f14 - 1f6a: 11 50 subi r17, 0x01 ; 1 - 1f6c: e9 f7 brne .-6 ; 0x1f68 + 268: d5 df rcall .-86 ; 0x214 + 26a: 11 50 subi r17, 0x01 ; 1 + 26c: e9 f7 brne .-6 ; 0x268 verifySpace(); - 1f6e: f4 df rcall .-24 ; 0x1f58 + 26e: f4 df rcall .-24 ; 0x258 } - 1f70: 1f 91 pop r17 - 1f72: 08 95 ret + 270: 1f 91 pop r17 + 272: 08 95 ret diff --git a/bootloaders/optiboot/optiboot_pro_16MHz.hex b/bootloaders/optiboot/optiboot_pro_16MHz.hex index 2b4a582..3ac0de2 100644 --- a/bootloaders/optiboot/optiboot_pro_16MHz.hex +++ b/bootloaders/optiboot/optiboot_pro_16MHz.hex @@ -30,5 +30,6 @@ :103FD00090838083089580E0F8DFEE27FF2709941F :103FE000E7DF803209F0F7DF84E1DACF1F93182F83 :0C3FF000DFDF1150E9F7F4DF1F910895A6 +:023FFE000104BC :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_16MHz.lst b/bootloaders/optiboot/optiboot_pro_16MHz.lst index 25dc46b..516bed8 100644 --- a/bootloaders/optiboot/optiboot_pro_16MHz.lst +++ b/bootloaders/optiboot/optiboot_pro_16MHz.lst @@ -5,23 +5,25 @@ Sections: Idx Name Size VMA LMA File off Algn 0 .text 000001fc 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .debug_aranges 00000028 00000000 00000000 00000250 2**0 + 1 .version 00000002 00003ffe 00003ffe 00000250 2**0 + CONTENTS, READONLY + 2 .debug_aranges 00000028 00000000 00000000 00000252 2**0 CONTENTS, READONLY, DEBUGGING - 2 .debug_pubnames 0000006a 00000000 00000000 00000278 2**0 + 3 .debug_pubnames 0000006a 00000000 00000000 0000027a 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_info 00000284 00000000 00000000 000002e2 2**0 + 4 .debug_info 00000285 00000000 00000000 000002e4 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_abbrev 000001ae 00000000 00000000 00000566 2**0 + 5 .debug_abbrev 0000019f 00000000 00000000 00000569 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_line 00000450 00000000 00000000 00000714 2**0 + 6 .debug_line 00000453 00000000 00000000 00000708 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_frame 00000090 00000000 00000000 00000b64 2**2 + 7 .debug_frame 00000090 00000000 00000000 00000b5c 2**2 CONTENTS, READONLY, DEBUGGING - 7 .debug_str 00000141 00000000 00000000 00000bf4 2**0 + 8 .debug_str 00000141 00000000 00000000 00000bec 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_loc 000001e1 00000000 00000000 00000d35 2**0 + 9 .debug_loc 000001e1 00000000 00000000 00000d2d 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_ranges 00000068 00000000 00000000 00000f16 2**0 + 10 .debug_ranges 00000068 00000000 00000000 00000f0e 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -135,7 +137,7 @@ void watchdogReset() { __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); - + // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 3e50: a5 e0 ldi r26, 0x05 ; 5 @@ -249,7 +251,7 @@ void watchdogReset() { 3ec6: e8 95 spm 3ec8: c0 e0 ldi r28, 0x00 ; 0 3eca: d1 e0 ldi r29, 0x01 ; 1 - + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); @@ -278,7 +280,7 @@ void watchdogReset() { // Read command terminator, start reply verifySpace(); 3ef4: 75 d0 rcall .+234 ; 0x3fe0 - + // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); @@ -336,7 +338,7 @@ int main(void) { 3f2e: a0 38 cpi r26, 0x80 ; 128 3f30: bf 07 cpc r27, r31 3f32: 51 f7 brne .-44 ; 0x3f08 - + // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 3f34: e0 91 00 02 lds r30, 0x0200 diff --git a/bootloaders/optiboot/optiboot_pro_20mhz.hex b/bootloaders/optiboot/optiboot_pro_20mhz.hex index d147f8f..01c974c 100644 --- a/bootloaders/optiboot/optiboot_pro_20mhz.hex +++ b/bootloaders/optiboot/optiboot_pro_20mhz.hex @@ -30,5 +30,6 @@ :103FD00090838083089580E0F8DFEE27FF2709941F :103FE000E7DF803209F0F7DF84E1DACF1F93182F83 :0C3FF000DFDF1150E9F7F4DF1F910895A6 +:023FFE000104BC :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_20mhz.lst b/bootloaders/optiboot/optiboot_pro_20mhz.lst index 1868d16..ba7b6b6 100644 --- a/bootloaders/optiboot/optiboot_pro_20mhz.lst +++ b/bootloaders/optiboot/optiboot_pro_20mhz.lst @@ -5,23 +5,25 @@ Sections: Idx Name Size VMA LMA File off Algn 0 .text 000001fc 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .debug_aranges 00000028 00000000 00000000 00000250 2**0 + 1 .version 00000002 00003ffe 00003ffe 00000250 2**0 + CONTENTS, READONLY + 2 .debug_aranges 00000028 00000000 00000000 00000252 2**0 CONTENTS, READONLY, DEBUGGING - 2 .debug_pubnames 0000006a 00000000 00000000 00000278 2**0 + 3 .debug_pubnames 0000006a 00000000 00000000 0000027a 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_info 00000284 00000000 00000000 000002e2 2**0 + 4 .debug_info 00000285 00000000 00000000 000002e4 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_abbrev 000001ae 00000000 00000000 00000566 2**0 + 5 .debug_abbrev 0000019f 00000000 00000000 00000569 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_line 00000450 00000000 00000000 00000714 2**0 + 6 .debug_line 00000453 00000000 00000000 00000708 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_frame 00000090 00000000 00000000 00000b64 2**2 + 7 .debug_frame 00000090 00000000 00000000 00000b5c 2**2 CONTENTS, READONLY, DEBUGGING - 7 .debug_str 00000141 00000000 00000000 00000bf4 2**0 + 8 .debug_str 00000141 00000000 00000000 00000bec 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_loc 000001e1 00000000 00000000 00000d35 2**0 + 9 .debug_loc 000001e1 00000000 00000000 00000d2d 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_ranges 00000068 00000000 00000000 00000f16 2**0 + 10 .debug_ranges 00000068 00000000 00000000 00000f0e 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -135,7 +137,7 @@ void watchdogReset() { __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); - + // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 3e50: a5 e0 ldi r26, 0x05 ; 5 @@ -249,7 +251,7 @@ void watchdogReset() { 3ec6: e8 95 spm 3ec8: c0 e0 ldi r28, 0x00 ; 0 3eca: d1 e0 ldi r29, 0x01 ; 1 - + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); @@ -278,7 +280,7 @@ void watchdogReset() { // Read command terminator, start reply verifySpace(); 3ef4: 75 d0 rcall .+234 ; 0x3fe0 - + // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); @@ -336,7 +338,7 @@ int main(void) { 3f2e: a0 38 cpi r26, 0x80 ; 128 3f30: bf 07 cpc r27, r31 3f32: 51 f7 brne .-44 ; 0x3f08 - + // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 3f34: e0 91 00 02 lds r30, 0x0200 diff --git a/bootloaders/optiboot/optiboot_pro_8MHz.hex b/bootloaders/optiboot/optiboot_pro_8MHz.hex index 7579286..77897e7 100644 --- a/bootloaders/optiboot/optiboot_pro_8MHz.hex +++ b/bootloaders/optiboot/optiboot_pro_8MHz.hex @@ -30,5 +30,6 @@ :103FD00090838083089580E0F8DFEE27FF2709941F :103FE000E7DF803209F0F7DF84E1DACF1F93182F83 :0C3FF000DFDF1150E9F7F4DF1F910895A6 +:023FFE000104BC :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_8MHz.lst b/bootloaders/optiboot/optiboot_pro_8MHz.lst index 25a4bd2..23d5e1a 100644 --- a/bootloaders/optiboot/optiboot_pro_8MHz.lst +++ b/bootloaders/optiboot/optiboot_pro_8MHz.lst @@ -5,23 +5,25 @@ Sections: Idx Name Size VMA LMA File off Algn 0 .text 000001fc 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .debug_aranges 00000028 00000000 00000000 00000250 2**0 + 1 .version 00000002 00003ffe 00003ffe 00000250 2**0 + CONTENTS, READONLY + 2 .debug_aranges 00000028 00000000 00000000 00000252 2**0 CONTENTS, READONLY, DEBUGGING - 2 .debug_pubnames 0000006a 00000000 00000000 00000278 2**0 + 3 .debug_pubnames 0000006a 00000000 00000000 0000027a 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_info 00000284 00000000 00000000 000002e2 2**0 + 4 .debug_info 00000285 00000000 00000000 000002e4 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_abbrev 000001ae 00000000 00000000 00000566 2**0 + 5 .debug_abbrev 0000019f 00000000 00000000 00000569 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_line 00000450 00000000 00000000 00000714 2**0 + 6 .debug_line 00000453 00000000 00000000 00000708 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_frame 00000090 00000000 00000000 00000b64 2**2 + 7 .debug_frame 00000090 00000000 00000000 00000b5c 2**2 CONTENTS, READONLY, DEBUGGING - 7 .debug_str 00000141 00000000 00000000 00000bf4 2**0 + 8 .debug_str 00000141 00000000 00000000 00000bec 2**0 CONTENTS, READONLY, DEBUGGING - 8 .debug_loc 000001e1 00000000 00000000 00000d35 2**0 + 9 .debug_loc 000001e1 00000000 00000000 00000d2d 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_ranges 00000068 00000000 00000000 00000f16 2**0 + 10 .debug_ranges 00000068 00000000 00000000 00000f0e 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -135,7 +137,7 @@ void watchdogReset() { __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); - + // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 3e50: a5 e0 ldi r26, 0x05 ; 5 @@ -249,7 +251,7 @@ void watchdogReset() { 3ec6: e8 95 spm 3ec8: c0 e0 ldi r28, 0x00 ; 0 3eca: d1 e0 ldi r29, 0x01 ; 1 - + // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); @@ -278,7 +280,7 @@ void watchdogReset() { // Read command terminator, start reply verifySpace(); 3ef4: 75 d0 rcall .+234 ; 0x3fe0 - + // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); @@ -336,7 +338,7 @@ int main(void) { 3f2e: a0 38 cpi r26, 0x80 ; 128 3f30: bf 07 cpc r27, r31 3f32: 51 f7 brne .-44 ; 0x3f08 - + // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 3f34: e0 91 00 02 lds r30, 0x0200 -- cgit v1.2.3-18-g5258 From a78553bd13fb9cbb03b574b363c8f68a7289dc11 Mon Sep 17 00:00:00 2001 From: WestfW Date: Fri, 10 Jun 2011 23:02:25 -0700 Subject: Shrink code by using registers for variables "length" and "address" http://code.google.com/p/optiboot/issues/detail?id=33 Fix high-value watchdog timeouts on ATmega8 http://code.google.com/p/optiboot/issues/detail?id=38 Change "start app on bad commands" code to start the app via the watchdog timer, so that the app is always started with the chip in fully reset state. http://code.google.com/p/optiboot/issues/detail?id=37 --- bootloaders/optiboot/optiboot.c | 34 +- bootloaders/optiboot/optiboot_atmega328.hex | 58 +-- bootloaders/optiboot/optiboot_atmega328.lst | 439 ++++++++-------- .../optiboot/optiboot_atmega328_pro_8MHz.hex | 58 +-- .../optiboot/optiboot_atmega328_pro_8MHz.lst | 439 ++++++++-------- bootloaders/optiboot/optiboot_diecimila.hex | 58 +-- bootloaders/optiboot/optiboot_diecimila.lst | 439 ++++++++-------- bootloaders/optiboot/optiboot_lilypad.hex | 58 +-- bootloaders/optiboot/optiboot_lilypad.lst | 439 ++++++++-------- .../optiboot/optiboot_lilypad_resonator.hex | 58 +-- .../optiboot/optiboot_lilypad_resonator.lst | 439 ++++++++-------- bootloaders/optiboot/optiboot_luminet.hex | 75 ++- bootloaders/optiboot/optiboot_luminet.lst | 574 ++++++++++----------- bootloaders/optiboot/optiboot_pro_16MHz.hex | 58 +-- bootloaders/optiboot/optiboot_pro_16MHz.lst | 439 ++++++++-------- bootloaders/optiboot/optiboot_pro_20mhz.hex | 58 +-- bootloaders/optiboot/optiboot_pro_20mhz.lst | 439 ++++++++-------- bootloaders/optiboot/optiboot_pro_8MHz.hex | 58 +-- bootloaders/optiboot/optiboot_pro_8MHz.lst | 439 ++++++++-------- 19 files changed, 2344 insertions(+), 2315 deletions(-) diff --git a/bootloaders/optiboot/optiboot.c b/bootloaders/optiboot/optiboot.c index ece8b43..8940359 100644 --- a/bootloaders/optiboot/optiboot.c +++ b/bootloaders/optiboot/optiboot.c @@ -198,8 +198,8 @@ asm(" .section .version\n" #define WATCHDOG_1S (_BV(WDP2) | _BV(WDP1) | _BV(WDE)) #define WATCHDOG_2S (_BV(WDP2) | _BV(WDP1) | _BV(WDP0) | _BV(WDE)) #ifndef __AVR_ATmega8__ -#define WATCHDOG_4S (_BV(WDE3) | _BV(WDE)) -#define WATCHDOG_8S (_BV(WDE3) | _BV(WDE0) | _BV(WDE)) +#define WATCHDOG_4S (_BV(WDP3) | _BV(WDE)) +#define WATCHDOG_8S (_BV(WDP3) | _BV(WDP0) | _BV(WDE)) #endif /* Function Prototypes */ @@ -244,8 +244,6 @@ void appStart() __attribute__ ((naked)); /* These definitions are NOT zero initialised, but that doesn't matter */ /* This allows us to drop the zero init code, saving us memory */ #define buff ((uint8_t*)(RAMSTART)) -#define address (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2)) -#define length (*(uint8_t*)(RAMSTART+SPM_PAGESIZE*2+2)) #ifdef VIRTUAL_BOOT_PARTITION #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) @@ -255,6 +253,13 @@ void appStart() __attribute__ ((naked)); int main(void) { uint8_t ch; + /* + * Making these local and in registers prevents the need for initializing + * them, and also saves space because code no longer stores to memory. + */ + register uint16_t address; + register uint8_t length; + // After the zero init loop, this is the first code to run. // // This code makes the following assumptions: @@ -350,7 +355,9 @@ int main(void) { uint8_t *bufPtr; uint16_t addrPtr; - getLen(); + getch(); /* getlen() */ + length = getch(); + getch(); // If we are in RWW section, immediately start page erase if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); @@ -415,7 +422,10 @@ int main(void) { /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { // READ PAGE - we only read flash - getLen(); + getch(); /* getlen() */ + length = getch(); + getch(); + verifySpace(); #ifdef VIRTUAL_BOOT_PARTITION do { @@ -575,7 +585,11 @@ void getNch(uint8_t count) { } void verifySpace() { - if (getch() != CRC_EOP) appStart(); + if (getch() != CRC_EOP) { + watchdogConfig(WATCHDOG_16MS); // shorten WD timeout + while (1) // and busy-loop so that WD causes + ; // a reset and app start. + } putch(STK_INSYNC); } @@ -595,12 +609,6 @@ void flash_led(uint8_t count) { } #endif -uint8_t getLen() { - getch(); - length = getch(); - return getch(); -} - // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( diff --git a/bootloaders/optiboot/optiboot_atmega328.hex b/bootloaders/optiboot/optiboot_atmega328.hex index 7286e0d..11819d6 100644 --- a/bootloaders/optiboot/optiboot_atmega328.hex +++ b/bootloaders/optiboot/optiboot_atmega328.hex @@ -1,35 +1,33 @@ -:107E0000112484B714BE81FFE6D085E08093810001 +:107E0000112484B714BE81FFE3D085E08093810004 :107E100082E08093C00088E18093C10086E0809377 -:107E2000C20080E18093C4008EE0CFD0259A86E026 +:107E2000C20080E18093C4008EE0BCD0259A86E039 :107E300020E33CEF91E0309385002093840096BBD3 -:107E4000B09BFECF1D9AA8958150A9F7DD24D3944D -:107E5000A5E0EA2EF1E1FF2EABD0813421F481E0E0 -:107E6000C5D083E020C0823411F484E103C085349E -:107E700019F485E0BBD091C0853581F499D0082FE5 -:107E800010E096D090E0982F8827802B912B880FB8 -:107E9000991F90930102809300027EC0863529F4D9 -:107EA00084E0A4D080E07CD078C0843609F04EC055 -:107EB00087D0E0910002F091010280E7E030F807FE -:107EC00018F483E087BFE895C0E0D1E071D08993D2 -:107ED000809102028150809302028823B9F7E091D9 -:107EE0000002F091010280E7E030F80718F083E02B -:107EF00087BFE89575D007B600FCFDCF4091000222 -:107F000050910102A0E0B1E02C9130E011968C91EB -:107F1000119790E0982F8827822B932B1296FA01C5 -:107F20000C01D7BEE89511244E5F5F4FF1E0A038F9 -:107F3000BF0751F7E0910002F0910102E7BEE8951A -:107F400007B600FCFDCFF7BEE89527C08437B9F42B -:107F500037D046D0E0910002F09101023196F093C3 -:107F60000102E09300023197E4918E2F19D08091A5 -:107F70000202815080930202882361F70EC0853788 -:107F800039F42ED08EE10CD085E90AD08FE08BCF6A -:107F9000813511F488E019D023D080E101D05CCF85 -:107FA000982F8091C00085FFFCCF9093C600089564 -:107FB000A8958091C00087FFFCCF8091C6000895EE -:107FC000F7DFF6DF80930202F3CFE0E6F0E098E11E -:107FD00090838083089580E0F8DFEE27FF270994DF -:107FE000E7DF803209F0F7DF84E1DACF1F93182F43 -:0C7FF000DFDF1150E9F7F4DF1F91089566 +:107E4000B09BFECF1D9AA8958150A9F799249394D1 +:107E5000A5E0AA2EF1E1BF2E9DD0813421F481E06E +:107E6000AFD083E01FC0823411F484E103C08534B5 +:107E700019F485E0A5D083C0853579F48BD0E82E40 +:107E8000FF2488D0082F10E0102F00270E291F296B +:107E9000000F111F8DD0680172C0863529F484E06F +:107EA0008FD080E06FD06BC0843609F042C072D0B2 +:107EB00071D0082F6FD080E0C81680E7D80620F474 +:107EC00083E0F60187BFE895C0E0D1E063D08993F5 +:107ED0000C17E1F7F0E0CF16F0E7DF0620F083E0C3 +:107EE000F60187BFE89564D007B600FCFDCFA60178 +:107EF000A0E0B1E02C9130E011968C91119790E0C8 +:107F0000982F8827822B932B1296FA010C0197BE8B +:107F1000E89511244E5F5F4FF1E0A038BF0751F79D +:107F2000F601A7BEE89507B600FCFDCFB7BEE89501 +:107F300026C08437B1F42ED02DD0F82E2BD038D0D7 +:107F4000F601EF2C8F010F5F1F4F84911BD0EA9435 +:107F5000F801C1F70894C11CD11CFA94CF0CD11CB4 +:107F60000EC0853739F424D08EE10CD085E90AD0D3 +:107F70008FE098CF813511F488E014D019D080E1DA +:107F800001D06ACF982F8091C00085FFFCCF9093DD +:107F9000C6000895A8958091C00087FFFCCF80910E +:107FA000C6000895E0E6F0E098E1908380830895AC +:107FB000F1DF803219F088E0F5DFFFCF84E1E2CF16 +:107FC0001F93182FE7DF1150E9F7F2DF1F91089593 +:0A7FD00080E0E8DFEE27FF270994A8 :027FFE0001047C :0400000300007E007B :00000001FF diff --git a/bootloaders/optiboot/optiboot_atmega328.lst b/bootloaders/optiboot/optiboot_atmega328.lst index 0da8aaf..7876b96 100644 --- a/bootloaders/optiboot/optiboot_atmega328.lst +++ b/bootloaders/optiboot/optiboot_atmega328.lst @@ -3,27 +3,27 @@ optiboot_atmega328.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001fc 00007e00 00007e00 00000054 2**1 + 0 .text 000001da 00007e00 00007e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00007ffe 00007ffe 00000250 2**0 + 1 .version 00000002 00007ffe 00007ffe 0000022e 2**0 CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000252 2**0 + 2 .debug_aranges 00000028 00000000 00000000 00000230 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000006a 00000000 00000000 0000027a 2**0 + 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 00000285 00000000 00000000 000002e4 2**0 + 4 .debug_info 0000028c 00000000 00000000 000002b7 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000019f 00000000 00000000 00000569 2**0 + 5 .debug_abbrev 00000199 00000000 00000000 00000543 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000453 00000000 00000000 00000708 2**0 + 6 .debug_line 00000456 00000000 00000000 000006dc 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000090 00000000 00000000 00000b5c 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b34 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000141 00000000 00000000 00000bec 2**0 + 8 .debug_str 00000149 00000000 00000000 00000bb4 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 000001e1 00000000 00000000 00000d2d 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000cfd 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000068 00000000 00000000 00000f0e 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f7b 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 7e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 7e06: 81 ff sbrs r24, 1 - 7e08: e6 d0 rcall .+460 ; 0x7fd6 + 7e08: e3 d0 rcall .+454 ; 0x7fd0 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -77,7 +77,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); 7e28: 8e e0 ldi r24, 0x0E ; 14 - 7e2a: cf d0 rcall .+414 ; 0x7fca + 7e2a: bc d0 rcall .+376 ; 0x7fa4 /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -111,8 +111,8 @@ void flash_led(uint8_t count) { #else LED_PIN |= _BV(LED); 7e44: 1d 9a sbi 0x03, 5 ; 3 - return getch(); } +#endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { @@ -132,8 +132,8 @@ void watchdogReset() { if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 7e4c: dd 24 eor r13, r13 - 7e4e: d3 94 inc r13 + 7e4c: 99 24 eor r9, r9 + 7e4e: 93 94 inc r9 __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); @@ -141,21 +141,21 @@ void watchdogReset() { // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 7e50: a5 e0 ldi r26, 0x05 ; 5 - 7e52: ea 2e mov r14, r26 + 7e52: aa 2e mov r10, r26 boot_spm_busy_wait(); #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); 7e54: f1 e1 ldi r31, 0x11 ; 17 - 7e56: ff 2e mov r15, r31 + 7e56: bf 2e mov r11, r31 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 7e58: ab d0 rcall .+342 ; 0x7fb0 + 7e58: 9d d0 rcall .+314 ; 0x7f94 if(ch == STK_GET_PARAMETER) { 7e5a: 81 34 cpi r24, 0x41 ; 65 @@ -163,10 +163,10 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 7e5e: 81 e0 ldi r24, 0x01 ; 1 - 7e60: c5 d0 rcall .+394 ; 0x7fec + 7e60: af d0 rcall .+350 ; 0x7fc0 putch(0x03); 7e62: 83 e0 ldi r24, 0x03 ; 3 - 7e64: 20 c0 rjmp .+64 ; 0x7ea6 + 7e64: 1f c0 rjmp .+62 ; 0x7ea4 } else if(ch == STK_SET_DEVICE) { 7e66: 82 34 cpi r24, 0x42 ; 66 @@ -182,71 +182,77 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 7e72: 85 e0 ldi r24, 0x05 ; 5 - 7e74: bb d0 rcall .+374 ; 0x7fec - 7e76: 91 c0 rjmp .+290 ; 0x7f9a + 7e74: a5 d0 rcall .+330 ; 0x7fc0 + 7e76: 83 c0 rjmp .+262 ; 0x7f7e } else if(ch == STK_LOAD_ADDRESS) { 7e78: 85 35 cpi r24, 0x55 ; 85 - 7e7a: 81 f4 brne .+32 ; 0x7e9c + 7e7a: 79 f4 brne .+30 ; 0x7e9a // LOAD ADDRESS uint16_t newAddress; newAddress = getch(); - 7e7c: 99 d0 rcall .+306 ; 0x7fb0 + 7e7c: 8b d0 rcall .+278 ; 0x7f94 newAddress = (newAddress & 0xff) | (getch() << 8); - 7e7e: 08 2f mov r16, r24 - 7e80: 10 e0 ldi r17, 0x00 ; 0 - 7e82: 96 d0 rcall .+300 ; 0x7fb0 - 7e84: 90 e0 ldi r25, 0x00 ; 0 - 7e86: 98 2f mov r25, r24 - 7e88: 88 27 eor r24, r24 - 7e8a: 80 2b or r24, r16 - 7e8c: 91 2b or r25, r17 + 7e7e: e8 2e mov r14, r24 + 7e80: ff 24 eor r15, r15 + 7e82: 88 d0 rcall .+272 ; 0x7f94 + 7e84: 08 2f mov r16, r24 + 7e86: 10 e0 ldi r17, 0x00 ; 0 + 7e88: 10 2f mov r17, r16 + 7e8a: 00 27 eor r16, r16 + 7e8c: 0e 29 or r16, r14 + 7e8e: 1f 29 or r17, r15 #ifdef RAMPZ // Transfer top bit to RAMPZ RAMPZ = (newAddress & 0x8000) ? 1 : 0; #endif newAddress += newAddress; // Convert from word address to byte address - 7e8e: 88 0f add r24, r24 - 7e90: 99 1f adc r25, r25 + 7e90: 00 0f add r16, r16 + 7e92: 11 1f adc r17, r17 address = newAddress; - 7e92: 90 93 01 02 sts 0x0201, r25 - 7e96: 80 93 00 02 sts 0x0200, r24 - 7e9a: 7e c0 rjmp .+252 ; 0x7f98 verifySpace(); + 7e94: 8d d0 rcall .+282 ; 0x7fb0 + 7e96: 68 01 movw r12, r16 + 7e98: 72 c0 rjmp .+228 ; 0x7f7e } else if(ch == STK_UNIVERSAL) { - 7e9c: 86 35 cpi r24, 0x56 ; 86 - 7e9e: 29 f4 brne .+10 ; 0x7eaa + 7e9a: 86 35 cpi r24, 0x56 ; 86 + 7e9c: 29 f4 brne .+10 ; 0x7ea8 // UNIVERSAL command is ignored getNch(4); - 7ea0: 84 e0 ldi r24, 0x04 ; 4 - 7ea2: a4 d0 rcall .+328 ; 0x7fec + 7e9e: 84 e0 ldi r24, 0x04 ; 4 + 7ea0: 8f d0 rcall .+286 ; 0x7fc0 putch(0x00); - 7ea4: 80 e0 ldi r24, 0x00 ; 0 - 7ea6: 7c d0 rcall .+248 ; 0x7fa0 - 7ea8: 78 c0 rjmp .+240 ; 0x7f9a + 7ea2: 80 e0 ldi r24, 0x00 ; 0 + 7ea4: 6f d0 rcall .+222 ; 0x7f84 + 7ea6: 6b c0 rjmp .+214 ; 0x7f7e } /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 7eaa: 84 36 cpi r24, 0x64 ; 100 - 7eac: 09 f0 breq .+2 ; 0x7eb0 - 7eae: 4e c0 rjmp .+156 ; 0x7f4c + 7ea8: 84 36 cpi r24, 0x64 ; 100 + 7eaa: 09 f0 breq .+2 ; 0x7eae + 7eac: 42 c0 rjmp .+132 ; 0x7f32 // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; - getLen(); - 7eb0: 87 d0 rcall .+270 ; 0x7fc0 + getch(); /* getlen() */ + 7eae: 72 d0 rcall .+228 ; 0x7f94 + length = getch(); + 7eb0: 71 d0 rcall .+226 ; 0x7f94 + 7eb2: 08 2f mov r16, r24 + getch(); + 7eb4: 6f d0 rcall .+222 ; 0x7f94 // If we are in RWW section, immediately start page erase if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 7eb2: e0 91 00 02 lds r30, 0x0200 - 7eb6: f0 91 01 02 lds r31, 0x0201 + 7eb6: 80 e0 ldi r24, 0x00 ; 0 + 7eb8: c8 16 cp r12, r24 7eba: 80 e7 ldi r24, 0x70 ; 112 - 7ebc: e0 30 cpi r30, 0x00 ; 0 - 7ebe: f8 07 cpc r31, r24 - 7ec0: 18 f4 brcc .+6 ; 0x7ec8 - 7ec2: 83 e0 ldi r24, 0x03 ; 3 + 7ebc: d8 06 cpc r13, r24 + 7ebe: 20 f4 brcc .+8 ; 0x7ec8 + 7ec0: 83 e0 ldi r24, 0x03 ; 3 + 7ec2: f6 01 movw r30, r12 7ec4: 87 bf out 0x37, r24 ; 55 7ec6: e8 95 spm 7ec8: c0 e0 ldi r28, 0x00 ; 0 @@ -255,302 +261,301 @@ void watchdogReset() { // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 7ecc: 71 d0 rcall .+226 ; 0x7fb0 + 7ecc: 63 d0 rcall .+198 ; 0x7f94 7ece: 89 93 st Y+, r24 while (--length); - 7ed0: 80 91 02 02 lds r24, 0x0202 - 7ed4: 81 50 subi r24, 0x01 ; 1 - 7ed6: 80 93 02 02 sts 0x0202, r24 - 7eda: 88 23 and r24, r24 - 7edc: b9 f7 brne .-18 ; 0x7ecc + 7ed0: 0c 17 cp r16, r28 + 7ed2: e1 f7 brne .-8 ; 0x7ecc // If we are in NRWW section, page erase has to be delayed until now. // Todo: Take RAMPZ into account if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 7ede: e0 91 00 02 lds r30, 0x0200 - 7ee2: f0 91 01 02 lds r31, 0x0201 - 7ee6: 80 e7 ldi r24, 0x70 ; 112 - 7ee8: e0 30 cpi r30, 0x00 ; 0 - 7eea: f8 07 cpc r31, r24 - 7eec: 18 f0 brcs .+6 ; 0x7ef4 - 7eee: 83 e0 ldi r24, 0x03 ; 3 - 7ef0: 87 bf out 0x37, r24 ; 55 - 7ef2: e8 95 spm + 7ed4: f0 e0 ldi r31, 0x00 ; 0 + 7ed6: cf 16 cp r12, r31 + 7ed8: f0 e7 ldi r31, 0x70 ; 112 + 7eda: df 06 cpc r13, r31 + 7edc: 20 f0 brcs .+8 ; 0x7ee6 + 7ede: 83 e0 ldi r24, 0x03 ; 3 + 7ee0: f6 01 movw r30, r12 + 7ee2: 87 bf out 0x37, r24 ; 55 + 7ee4: e8 95 spm // Read command terminator, start reply verifySpace(); - 7ef4: 75 d0 rcall .+234 ; 0x7fe0 + 7ee6: 64 d0 rcall .+200 ; 0x7fb0 // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 7ef6: 07 b6 in r0, 0x37 ; 55 - 7ef8: 00 fc sbrc r0, 0 - 7efa: fd cf rjmp .-6 ; 0x7ef6 - } -#endif - - // Copy buffer into programming buffer + 7ee8: 07 b6 in r0, 0x37 ; 55 + 7eea: 00 fc sbrc r0, 0 + 7eec: fd cf rjmp .-6 ; 0x7ee8 + 7eee: a6 01 movw r20, r12 + 7ef0: a0 e0 ldi r26, 0x00 ; 0 + 7ef2: b1 e0 ldi r27, 0x01 ; 1 bufPtr = buff; addrPtr = (uint16_t)(void*)address; - 7efc: 40 91 00 02 lds r20, 0x0200 - 7f00: 50 91 01 02 lds r21, 0x0201 - 7f04: a0 e0 ldi r26, 0x00 ; 0 - 7f06: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 7f08: 2c 91 ld r18, X - 7f0a: 30 e0 ldi r19, 0x00 ; 0 + 7ef4: 2c 91 ld r18, X + 7ef6: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 7f0c: 11 96 adiw r26, 0x01 ; 1 - 7f0e: 8c 91 ld r24, X - 7f10: 11 97 sbiw r26, 0x01 ; 1 - 7f12: 90 e0 ldi r25, 0x00 ; 0 - 7f14: 98 2f mov r25, r24 - 7f16: 88 27 eor r24, r24 - 7f18: 82 2b or r24, r18 - 7f1a: 93 2b or r25, r19 + 7ef8: 11 96 adiw r26, 0x01 ; 1 + 7efa: 8c 91 ld r24, X + 7efc: 11 97 sbiw r26, 0x01 ; 1 + 7efe: 90 e0 ldi r25, 0x00 ; 0 + 7f00: 98 2f mov r25, r24 + 7f02: 88 27 eor r24, r24 + 7f04: 82 2b or r24, r18 + 7f06: 93 2b or r25, r19 #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 7f1c: 12 96 adiw r26, 0x02 ; 2 + 7f08: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 7f1e: fa 01 movw r30, r20 - 7f20: 0c 01 movw r0, r24 - 7f22: d7 be out 0x37, r13 ; 55 - 7f24: e8 95 spm - 7f26: 11 24 eor r1, r1 + 7f0a: fa 01 movw r30, r20 + 7f0c: 0c 01 movw r0, r24 + 7f0e: 97 be out 0x37, r9 ; 55 + 7f10: e8 95 spm + 7f12: 11 24 eor r1, r1 addrPtr += 2; - 7f28: 4e 5f subi r20, 0xFE ; 254 - 7f2a: 5f 4f sbci r21, 0xFF ; 255 + 7f14: 4e 5f subi r20, 0xFE ; 254 + 7f16: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 7f2c: f1 e0 ldi r31, 0x01 ; 1 - 7f2e: a0 38 cpi r26, 0x80 ; 128 - 7f30: bf 07 cpc r27, r31 - 7f32: 51 f7 brne .-44 ; 0x7f08 + 7f18: f1 e0 ldi r31, 0x01 ; 1 + 7f1a: a0 38 cpi r26, 0x80 ; 128 + 7f1c: bf 07 cpc r27, r31 + 7f1e: 51 f7 brne .-44 ; 0x7ef4 // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 7f34: e0 91 00 02 lds r30, 0x0200 - 7f38: f0 91 01 02 lds r31, 0x0201 - 7f3c: e7 be out 0x37, r14 ; 55 - 7f3e: e8 95 spm + 7f20: f6 01 movw r30, r12 + 7f22: a7 be out 0x37, r10 ; 55 + 7f24: e8 95 spm boot_spm_busy_wait(); - 7f40: 07 b6 in r0, 0x37 ; 55 - 7f42: 00 fc sbrc r0, 0 - 7f44: fd cf rjmp .-6 ; 0x7f40 + 7f26: 07 b6 in r0, 0x37 ; 55 + 7f28: 00 fc sbrc r0, 0 + 7f2a: fd cf rjmp .-6 ; 0x7f26 #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 7f46: f7 be out 0x37, r15 ; 55 - 7f48: e8 95 spm - 7f4a: 27 c0 rjmp .+78 ; 0x7f9a + 7f2c: b7 be out 0x37, r11 ; 55 + 7f2e: e8 95 spm + 7f30: 26 c0 rjmp .+76 ; 0x7f7e #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 7f4c: 84 37 cpi r24, 0x74 ; 116 - 7f4e: b9 f4 brne .+46 ; 0x7f7e + 7f32: 84 37 cpi r24, 0x74 ; 116 + 7f34: b1 f4 brne .+44 ; 0x7f62 // READ PAGE - we only read flash - getLen(); - 7f50: 37 d0 rcall .+110 ; 0x7fc0 + getch(); /* getlen() */ + 7f36: 2e d0 rcall .+92 ; 0x7f94 + length = getch(); + 7f38: 2d d0 rcall .+90 ; 0x7f94 + 7f3a: f8 2e mov r15, r24 + getch(); + 7f3c: 2b d0 rcall .+86 ; 0x7f94 + verifySpace(); - 7f52: 46 d0 rcall .+140 ; 0x7fe0 + 7f3e: 38 d0 rcall .+112 ; 0x7fb0 + 7f40: f6 01 movw r30, r12 + 7f42: ef 2c mov r14, r15 putch(result); address++; } while (--length); #else do putch(pgm_read_byte_near(address++)); - 7f54: e0 91 00 02 lds r30, 0x0200 - 7f58: f0 91 01 02 lds r31, 0x0201 - 7f5c: 31 96 adiw r30, 0x01 ; 1 - 7f5e: f0 93 01 02 sts 0x0201, r31 - 7f62: e0 93 00 02 sts 0x0200, r30 - 7f66: 31 97 sbiw r30, 0x01 ; 1 - 7f68: e4 91 lpm r30, Z+ - 7f6a: 8e 2f mov r24, r30 - 7f6c: 19 d0 rcall .+50 ; 0x7fa0 + 7f44: 8f 01 movw r16, r30 + 7f46: 0f 5f subi r16, 0xFF ; 255 + 7f48: 1f 4f sbci r17, 0xFF ; 255 + 7f4a: 84 91 lpm r24, Z+ + 7f4c: 1b d0 rcall .+54 ; 0x7f84 while (--length); - 7f6e: 80 91 02 02 lds r24, 0x0202 - 7f72: 81 50 subi r24, 0x01 ; 1 - 7f74: 80 93 02 02 sts 0x0202, r24 - 7f78: 88 23 and r24, r24 - 7f7a: 61 f7 brne .-40 ; 0x7f54 - 7f7c: 0e c0 rjmp .+28 ; 0x7f9a + 7f4e: ea 94 dec r14 + 7f50: f8 01 movw r30, r16 + 7f52: c1 f7 brne .-16 ; 0x7f44 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) +#endif + +/* main program starts here */ +int main(void) { + 7f54: 08 94 sec + 7f56: c1 1c adc r12, r1 + 7f58: d1 1c adc r13, r1 + 7f5a: fa 94 dec r15 + 7f5c: cf 0c add r12, r15 + 7f5e: d1 1c adc r13, r1 + 7f60: 0e c0 rjmp .+28 ; 0x7f7e #endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 7f7e: 85 37 cpi r24, 0x75 ; 117 - 7f80: 39 f4 brne .+14 ; 0x7f90 + 7f62: 85 37 cpi r24, 0x75 ; 117 + 7f64: 39 f4 brne .+14 ; 0x7f74 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 7f82: 2e d0 rcall .+92 ; 0x7fe0 + 7f66: 24 d0 rcall .+72 ; 0x7fb0 putch(SIGNATURE_0); - 7f84: 8e e1 ldi r24, 0x1E ; 30 - 7f86: 0c d0 rcall .+24 ; 0x7fa0 + 7f68: 8e e1 ldi r24, 0x1E ; 30 + 7f6a: 0c d0 rcall .+24 ; 0x7f84 putch(SIGNATURE_1); - 7f88: 85 e9 ldi r24, 0x95 ; 149 - 7f8a: 0a d0 rcall .+20 ; 0x7fa0 + 7f6c: 85 e9 ldi r24, 0x95 ; 149 + 7f6e: 0a d0 rcall .+20 ; 0x7f84 putch(SIGNATURE_2); - 7f8c: 8f e0 ldi r24, 0x0F ; 15 - 7f8e: 8b cf rjmp .-234 ; 0x7ea6 + 7f70: 8f e0 ldi r24, 0x0F ; 15 + 7f72: 98 cf rjmp .-208 ; 0x7ea4 } else if (ch == 'Q') { - 7f90: 81 35 cpi r24, 0x51 ; 81 - 7f92: 11 f4 brne .+4 ; 0x7f98 + 7f74: 81 35 cpi r24, 0x51 ; 81 + 7f76: 11 f4 brne .+4 ; 0x7f7c // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 7f94: 88 e0 ldi r24, 0x08 ; 8 - 7f96: 19 d0 rcall .+50 ; 0x7fca + 7f78: 88 e0 ldi r24, 0x08 ; 8 + 7f7a: 14 d0 rcall .+40 ; 0x7fa4 verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 7f98: 23 d0 rcall .+70 ; 0x7fe0 + 7f7c: 19 d0 rcall .+50 ; 0x7fb0 } putch(STK_OK); - 7f9a: 80 e1 ldi r24, 0x10 ; 16 - 7f9c: 01 d0 rcall .+2 ; 0x7fa0 - 7f9e: 5c cf rjmp .-328 ; 0x7e58 + 7f7e: 80 e1 ldi r24, 0x10 ; 16 + 7f80: 01 d0 rcall .+2 ; 0x7f84 + 7f82: 6a cf rjmp .-300 ; 0x7e58 -00007fa0 : +00007f84 : } } void putch(char ch) { - 7fa0: 98 2f mov r25, r24 + 7f84: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); - 7fa2: 80 91 c0 00 lds r24, 0x00C0 - 7fa6: 85 ff sbrs r24, 5 - 7fa8: fc cf rjmp .-8 ; 0x7fa2 + 7f86: 80 91 c0 00 lds r24, 0x00C0 + 7f8a: 85 ff sbrs r24, 5 + 7f8c: fc cf rjmp .-8 ; 0x7f86 UDR0 = ch; - 7faa: 90 93 c6 00 sts 0x00C6, r25 + 7f8e: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 7fae: 08 95 ret + 7f92: 08 95 ret -00007fb0 : - return getch(); +00007f94 : } +#endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 7fb0: a8 95 wdr + 7f94: a8 95 wdr [uartBit] "I" (UART_RX_BIT) : "r25" ); #else while(!(UCSR0A & _BV(RXC0))); - 7fb2: 80 91 c0 00 lds r24, 0x00C0 - 7fb6: 87 ff sbrs r24, 7 - 7fb8: fc cf rjmp .-8 ; 0x7fb2 + 7f96: 80 91 c0 00 lds r24, 0x00C0 + 7f9a: 87 ff sbrs r24, 7 + 7f9c: fc cf rjmp .-8 ; 0x7f96 ch = UDR0; - 7fba: 80 91 c6 00 lds r24, 0x00C6 + 7f9e: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 7fbe: 08 95 ret - -00007fc0 : - } while (--count); -} -#endif - -uint8_t getLen() { - getch(); - 7fc0: f7 df rcall .-18 ; 0x7fb0 - length = getch(); - 7fc2: f6 df rcall .-20 ; 0x7fb0 - 7fc4: 80 93 02 02 sts 0x0202, r24 - return getch(); -} - 7fc8: f3 cf rjmp .-26 ; 0x7fb0 + 7fa2: 08 95 ret -00007fca : +00007fa4 : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 7fca: e0 e6 ldi r30, 0x60 ; 96 - 7fcc: f0 e0 ldi r31, 0x00 ; 0 - 7fce: 98 e1 ldi r25, 0x18 ; 24 - 7fd0: 90 83 st Z, r25 + 7fa4: e0 e6 ldi r30, 0x60 ; 96 + 7fa6: f0 e0 ldi r31, 0x00 ; 0 + 7fa8: 98 e1 ldi r25, 0x18 ; 24 + 7faa: 90 83 st Z, r25 WDTCSR = x; - 7fd2: 80 83 st Z, r24 + 7fac: 80 83 st Z, r24 } - 7fd4: 08 95 ret - -00007fd6 : - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 7fd6: 80 e0 ldi r24, 0x00 ; 0 - 7fd8: f8 df rcall .-16 ; 0x7fca - __asm__ __volatile__ ( - 7fda: ee 27 eor r30, r30 - 7fdc: ff 27 eor r31, r31 - 7fde: 09 94 ijmp + 7fae: 08 95 ret -00007fe0 : +00007fb0 : do getch(); while (--count); verifySpace(); } void verifySpace() { - if (getch() != CRC_EOP) appStart(); - 7fe0: e7 df rcall .-50 ; 0x7fb0 - 7fe2: 80 32 cpi r24, 0x20 ; 32 - 7fe4: 09 f0 breq .+2 ; 0x7fe8 - 7fe6: f7 df rcall .-18 ; 0x7fd6 + if (getch() != CRC_EOP) { + 7fb0: f1 df rcall .-30 ; 0x7f94 + 7fb2: 80 32 cpi r24, 0x20 ; 32 + 7fb4: 19 f0 breq .+6 ; 0x7fbc + watchdogConfig(WATCHDOG_16MS); // shorten WD timeout + 7fb6: 88 e0 ldi r24, 0x08 ; 8 + 7fb8: f5 df rcall .-22 ; 0x7fa4 + 7fba: ff cf rjmp .-2 ; 0x7fba + while (1) // and busy-loop so that WD causes + ; // a reset and app start. + } putch(STK_INSYNC); - 7fe8: 84 e1 ldi r24, 0x14 ; 20 + 7fbc: 84 e1 ldi r24, 0x14 ; 20 } - 7fea: da cf rjmp .-76 ; 0x7fa0 + 7fbe: e2 cf rjmp .-60 ; 0x7f84 -00007fec : +00007fc0 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 7fec: 1f 93 push r17 - 7fee: 18 2f mov r17, r24 + 7fc0: 1f 93 push r17 + 7fc2: 18 2f mov r17, r24 do getch(); while (--count); - 7ff0: df df rcall .-66 ; 0x7fb0 - 7ff2: 11 50 subi r17, 0x01 ; 1 - 7ff4: e9 f7 brne .-6 ; 0x7ff0 + 7fc4: e7 df rcall .-50 ; 0x7f94 + 7fc6: 11 50 subi r17, 0x01 ; 1 + 7fc8: e9 f7 brne .-6 ; 0x7fc4 verifySpace(); - 7ff6: f4 df rcall .-24 ; 0x7fe0 + 7fca: f2 df rcall .-28 ; 0x7fb0 +} + 7fcc: 1f 91 pop r17 + 7fce: 08 95 ret + +00007fd0 : + WDTCSR = _BV(WDCE) | _BV(WDE); + WDTCSR = x; } - 7ff8: 1f 91 pop r17 - 7ffa: 08 95 ret + +void appStart() { + watchdogConfig(WATCHDOG_OFF); + 7fd0: 80 e0 ldi r24, 0x00 ; 0 + 7fd2: e8 df rcall .-48 ; 0x7fa4 + __asm__ __volatile__ ( + 7fd4: ee 27 eor r30, r30 + 7fd6: ff 27 eor r31, r31 + 7fd8: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex index 1e56839..a181f0b 100644 --- a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex +++ b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex @@ -1,34 +1,32 @@ -:10000000112484B714BE81FFE6D085E0809381007F +:10000000112484B714BE81FFE3D085E08093810082 :1000100082E08093C00088E18093C10086E08093F5 -:10002000C20088E08093C4008EE0CFD0259A86E09D +:10002000C20088E08093C4008EE0BCD0259A86E0B0 :1000300028E13EEF91E0309385002093840096BB49 -:10004000B09BFECF1D9AA8958150A9F7DD24D394CB -:10005000A5E0EA2EF1E1FF2EABD0813421F481E05E -:10006000C5D083E020C0823411F484E103C085341C -:1000700019F485E0BBD091C0853581F499D0082F63 -:1000800010E096D090E0982F8827802B912B880F36 -:10009000991F90930102809300027EC0863529F457 -:1000A00084E0A4D080E07CD078C0843609F04EC0D3 -:1000B00087D0E0910002F091010280E7E030F8077C -:1000C00018F483E087BFE895C0E0D1E071D0899350 -:1000D000809102028150809302028823B9F7E09157 -:1000E0000002F091010280E7E030F80718F083E0A9 -:1000F00087BFE89575D007B600FCFDCF40910002A0 -:1001000050910102A0E0B1E02C9130E011968C9169 -:10011000119790E0982F8827822B932B1296FA0143 -:100120000C01D7BEE89511244E5F5F4FF1E0A03877 -:10013000BF0751F7E0910002F0910102E7BEE89598 -:1001400007B600FCFDCFF7BEE89527C08437B9F4A9 -:1001500037D046D0E0910002F09101023196F09341 -:100160000102E09300023197E4918E2F19D0809123 -:100170000202815080930202882361F70EC0853706 -:1001800039F42ED08EE10CD085E90AD08FE08BCFE8 -:10019000813511F488E019D023D080E101D05CCF03 -:1001A000982F8091C00085FFFCCF9093C6000895E2 -:1001B000A8958091C00087FFFCCF8091C60008956C -:1001C000F7DFF6DF80930202F3CFE0E6F0E098E19C -:1001D00090838083089580E0F8DFEE27FF2709945D -:1001E000E7DF803209F0F7DF84E1DACF1F93182FC1 -:0C01F000DFDF1150E9F7F4DF1F910895E4 +:10004000B09BFECF1D9AA8958150A9F7992493944F +:10005000A5E0AA2EF1E1BF2E9DD0813421F481E0EC +:10006000AFD083E01FC0823411F484E103C0853433 +:1000700019F485E0A5D083C0853579F48BD0E82EBE +:10008000FF2488D0082F10E0102F00270E291F29E9 +:10009000000F111F8DD0680172C0863529F484E0ED +:1000A0008FD080E06FD06BC0843609F042C072D030 +:1000B00071D0082F6FD080E0C81680E7D80620F4F2 +:1000C00083E0F60187BFE895C0E0D1E063D0899373 +:1000D0000C17E1F7F0E0CF16F0E7DF0620F083E041 +:1000E000F60187BFE89564D007B600FCFDCFA601F6 +:1000F000A0E0B1E02C9130E011968C91119790E046 +:10010000982F8827822B932B1296FA010C0197BE09 +:10011000E89511244E5F5F4FF1E0A038BF0751F71B +:10012000F601A7BEE89507B600FCFDCFB7BEE8957F +:1001300026C08437B1F42ED02DD0F82E2BD038D055 +:10014000F601EF2C8F010F5F1F4F84911BD0EA94B3 +:10015000F801C1F70894C11CD11CFA94CF0CD11C32 +:100160000EC0853739F424D08EE10CD085E90AD051 +:100170008FE098CF813511F488E014D019D080E158 +:1001800001D06ACF982F8091C00085FFFCCF90935B +:10019000C6000895A8958091C00087FFFCCF80918C +:1001A000C6000895E0E6F0E098E19083808308952A +:1001B000F1DF803219F088E0F5DFFFCF84E1E2CF94 +:1001C0001F93182FE7DF1150E9F7F2DF1F91089511 +:0A01D00080E0E8DFEE27FF27099426 :027FFE0001047C :00000001FF diff --git a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst index d7ce991..a4da506 100644 --- a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst +++ b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst @@ -3,27 +3,27 @@ optiboot_atmega328_pro_8MHz.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001fc 00000000 00000000 00000054 2**1 + 0 .text 000001da 00000000 00000000 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00007ffe 00007ffe 00000250 2**0 + 1 .version 00000002 00007ffe 00007ffe 0000022e 2**0 CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000252 2**0 + 2 .debug_aranges 00000028 00000000 00000000 00000230 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000006a 00000000 00000000 0000027a 2**0 + 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 00000285 00000000 00000000 000002e4 2**0 + 4 .debug_info 0000028c 00000000 00000000 000002b7 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000019f 00000000 00000000 00000569 2**0 + 5 .debug_abbrev 00000199 00000000 00000000 00000543 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000453 00000000 00000000 00000708 2**0 + 6 .debug_line 00000456 00000000 00000000 000006dc 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000090 00000000 00000000 00000b5c 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b34 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000141 00000000 00000000 00000bec 2**0 + 8 .debug_str 00000149 00000000 00000000 00000bb4 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 000001e1 00000000 00000000 00000d2d 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000cfd 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000068 00000000 00000000 00000f0e 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f7b 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 4: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 6: 81 ff sbrs r24, 1 - 8: e6 d0 rcall .+460 ; 0x1d6 + 8: e3 d0 rcall .+454 ; 0x1d0 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -77,7 +77,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); 28: 8e e0 ldi r24, 0x0E ; 14 - 2a: cf d0 rcall .+414 ; 0x1ca + 2a: bc d0 rcall .+376 ; 0x1a4 /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -111,8 +111,8 @@ void flash_led(uint8_t count) { #else LED_PIN |= _BV(LED); 44: 1d 9a sbi 0x03, 5 ; 3 - return getch(); } +#endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { @@ -132,8 +132,8 @@ void watchdogReset() { if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 4c: dd 24 eor r13, r13 - 4e: d3 94 inc r13 + 4c: 99 24 eor r9, r9 + 4e: 93 94 inc r9 __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); @@ -141,21 +141,21 @@ void watchdogReset() { // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 50: a5 e0 ldi r26, 0x05 ; 5 - 52: ea 2e mov r14, r26 + 52: aa 2e mov r10, r26 boot_spm_busy_wait(); #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); 54: f1 e1 ldi r31, 0x11 ; 17 - 56: ff 2e mov r15, r31 + 56: bf 2e mov r11, r31 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 58: ab d0 rcall .+342 ; 0x1b0 + 58: 9d d0 rcall .+314 ; 0x194 if(ch == STK_GET_PARAMETER) { 5a: 81 34 cpi r24, 0x41 ; 65 @@ -163,10 +163,10 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 5e: 81 e0 ldi r24, 0x01 ; 1 - 60: c5 d0 rcall .+394 ; 0x1ec + 60: af d0 rcall .+350 ; 0x1c0 putch(0x03); 62: 83 e0 ldi r24, 0x03 ; 3 - 64: 20 c0 rjmp .+64 ; 0xa6 <__SREG__+0x67> + 64: 1f c0 rjmp .+62 ; 0xa4 <__SREG__+0x65> } else if(ch == STK_SET_DEVICE) { 66: 82 34 cpi r24, 0x42 ; 66 @@ -182,71 +182,77 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 72: 85 e0 ldi r24, 0x05 ; 5 - 74: bb d0 rcall .+374 ; 0x1ec - 76: 91 c0 rjmp .+290 ; 0x19a <__SREG__+0x15b> + 74: a5 d0 rcall .+330 ; 0x1c0 + 76: 83 c0 rjmp .+262 ; 0x17e <__SREG__+0x13f> } else if(ch == STK_LOAD_ADDRESS) { 78: 85 35 cpi r24, 0x55 ; 85 - 7a: 81 f4 brne .+32 ; 0x9c <__SREG__+0x5d> + 7a: 79 f4 brne .+30 ; 0x9a <__SREG__+0x5b> // LOAD ADDRESS uint16_t newAddress; newAddress = getch(); - 7c: 99 d0 rcall .+306 ; 0x1b0 + 7c: 8b d0 rcall .+278 ; 0x194 newAddress = (newAddress & 0xff) | (getch() << 8); - 7e: 08 2f mov r16, r24 - 80: 10 e0 ldi r17, 0x00 ; 0 - 82: 96 d0 rcall .+300 ; 0x1b0 - 84: 90 e0 ldi r25, 0x00 ; 0 - 86: 98 2f mov r25, r24 - 88: 88 27 eor r24, r24 - 8a: 80 2b or r24, r16 - 8c: 91 2b or r25, r17 + 7e: e8 2e mov r14, r24 + 80: ff 24 eor r15, r15 + 82: 88 d0 rcall .+272 ; 0x194 + 84: 08 2f mov r16, r24 + 86: 10 e0 ldi r17, 0x00 ; 0 + 88: 10 2f mov r17, r16 + 8a: 00 27 eor r16, r16 + 8c: 0e 29 or r16, r14 + 8e: 1f 29 or r17, r15 #ifdef RAMPZ // Transfer top bit to RAMPZ RAMPZ = (newAddress & 0x8000) ? 1 : 0; #endif newAddress += newAddress; // Convert from word address to byte address - 8e: 88 0f add r24, r24 - 90: 99 1f adc r25, r25 + 90: 00 0f add r16, r16 + 92: 11 1f adc r17, r17 address = newAddress; - 92: 90 93 01 02 sts 0x0201, r25 - 96: 80 93 00 02 sts 0x0200, r24 - 9a: 7e c0 rjmp .+252 ; 0x198 <__SREG__+0x159> verifySpace(); + 94: 8d d0 rcall .+282 ; 0x1b0 + 96: 68 01 movw r12, r16 + 98: 72 c0 rjmp .+228 ; 0x17e <__SREG__+0x13f> } else if(ch == STK_UNIVERSAL) { - 9c: 86 35 cpi r24, 0x56 ; 86 - 9e: 29 f4 brne .+10 ; 0xaa <__SREG__+0x6b> + 9a: 86 35 cpi r24, 0x56 ; 86 + 9c: 29 f4 brne .+10 ; 0xa8 <__SREG__+0x69> // UNIVERSAL command is ignored getNch(4); - a0: 84 e0 ldi r24, 0x04 ; 4 - a2: a4 d0 rcall .+328 ; 0x1ec + 9e: 84 e0 ldi r24, 0x04 ; 4 + a0: 8f d0 rcall .+286 ; 0x1c0 putch(0x00); - a4: 80 e0 ldi r24, 0x00 ; 0 - a6: 7c d0 rcall .+248 ; 0x1a0 - a8: 78 c0 rjmp .+240 ; 0x19a <__SREG__+0x15b> + a2: 80 e0 ldi r24, 0x00 ; 0 + a4: 6f d0 rcall .+222 ; 0x184 + a6: 6b c0 rjmp .+214 ; 0x17e <__SREG__+0x13f> } /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - aa: 84 36 cpi r24, 0x64 ; 100 - ac: 09 f0 breq .+2 ; 0xb0 <__SREG__+0x71> - ae: 4e c0 rjmp .+156 ; 0x14c <__SREG__+0x10d> + a8: 84 36 cpi r24, 0x64 ; 100 + aa: 09 f0 breq .+2 ; 0xae <__SREG__+0x6f> + ac: 42 c0 rjmp .+132 ; 0x132 <__SREG__+0xf3> // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; - getLen(); - b0: 87 d0 rcall .+270 ; 0x1c0 + getch(); /* getlen() */ + ae: 72 d0 rcall .+228 ; 0x194 + length = getch(); + b0: 71 d0 rcall .+226 ; 0x194 + b2: 08 2f mov r16, r24 + getch(); + b4: 6f d0 rcall .+222 ; 0x194 // If we are in RWW section, immediately start page erase if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - b2: e0 91 00 02 lds r30, 0x0200 - b6: f0 91 01 02 lds r31, 0x0201 + b6: 80 e0 ldi r24, 0x00 ; 0 + b8: c8 16 cp r12, r24 ba: 80 e7 ldi r24, 0x70 ; 112 - bc: e0 30 cpi r30, 0x00 ; 0 - be: f8 07 cpc r31, r24 - c0: 18 f4 brcc .+6 ; 0xc8 <__SREG__+0x89> - c2: 83 e0 ldi r24, 0x03 ; 3 + bc: d8 06 cpc r13, r24 + be: 20 f4 brcc .+8 ; 0xc8 <__SREG__+0x89> + c0: 83 e0 ldi r24, 0x03 ; 3 + c2: f6 01 movw r30, r12 c4: 87 bf out 0x37, r24 ; 55 c6: e8 95 spm c8: c0 e0 ldi r28, 0x00 ; 0 @@ -255,302 +261,301 @@ void watchdogReset() { // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - cc: 71 d0 rcall .+226 ; 0x1b0 + cc: 63 d0 rcall .+198 ; 0x194 ce: 89 93 st Y+, r24 while (--length); - d0: 80 91 02 02 lds r24, 0x0202 - d4: 81 50 subi r24, 0x01 ; 1 - d6: 80 93 02 02 sts 0x0202, r24 - da: 88 23 and r24, r24 - dc: b9 f7 brne .-18 ; 0xcc <__SREG__+0x8d> + d0: 0c 17 cp r16, r28 + d2: e1 f7 brne .-8 ; 0xcc <__SREG__+0x8d> // If we are in NRWW section, page erase has to be delayed until now. // Todo: Take RAMPZ into account if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - de: e0 91 00 02 lds r30, 0x0200 - e2: f0 91 01 02 lds r31, 0x0201 - e6: 80 e7 ldi r24, 0x70 ; 112 - e8: e0 30 cpi r30, 0x00 ; 0 - ea: f8 07 cpc r31, r24 - ec: 18 f0 brcs .+6 ; 0xf4 <__SREG__+0xb5> - ee: 83 e0 ldi r24, 0x03 ; 3 - f0: 87 bf out 0x37, r24 ; 55 - f2: e8 95 spm + d4: f0 e0 ldi r31, 0x00 ; 0 + d6: cf 16 cp r12, r31 + d8: f0 e7 ldi r31, 0x70 ; 112 + da: df 06 cpc r13, r31 + dc: 20 f0 brcs .+8 ; 0xe6 <__SREG__+0xa7> + de: 83 e0 ldi r24, 0x03 ; 3 + e0: f6 01 movw r30, r12 + e2: 87 bf out 0x37, r24 ; 55 + e4: e8 95 spm // Read command terminator, start reply verifySpace(); - f4: 75 d0 rcall .+234 ; 0x1e0 + e6: 64 d0 rcall .+200 ; 0x1b0 // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - f6: 07 b6 in r0, 0x37 ; 55 - f8: 00 fc sbrc r0, 0 - fa: fd cf rjmp .-6 ; 0xf6 <__SREG__+0xb7> - } -#endif - - // Copy buffer into programming buffer + e8: 07 b6 in r0, 0x37 ; 55 + ea: 00 fc sbrc r0, 0 + ec: fd cf rjmp .-6 ; 0xe8 <__SREG__+0xa9> + ee: a6 01 movw r20, r12 + f0: a0 e0 ldi r26, 0x00 ; 0 + f2: b1 e0 ldi r27, 0x01 ; 1 bufPtr = buff; addrPtr = (uint16_t)(void*)address; - fc: 40 91 00 02 lds r20, 0x0200 - 100: 50 91 01 02 lds r21, 0x0201 - 104: a0 e0 ldi r26, 0x00 ; 0 - 106: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 108: 2c 91 ld r18, X - 10a: 30 e0 ldi r19, 0x00 ; 0 + f4: 2c 91 ld r18, X + f6: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 10c: 11 96 adiw r26, 0x01 ; 1 - 10e: 8c 91 ld r24, X - 110: 11 97 sbiw r26, 0x01 ; 1 - 112: 90 e0 ldi r25, 0x00 ; 0 - 114: 98 2f mov r25, r24 - 116: 88 27 eor r24, r24 - 118: 82 2b or r24, r18 - 11a: 93 2b or r25, r19 + f8: 11 96 adiw r26, 0x01 ; 1 + fa: 8c 91 ld r24, X + fc: 11 97 sbiw r26, 0x01 ; 1 + fe: 90 e0 ldi r25, 0x00 ; 0 + 100: 98 2f mov r25, r24 + 102: 88 27 eor r24, r24 + 104: 82 2b or r24, r18 + 106: 93 2b or r25, r19 #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 11c: 12 96 adiw r26, 0x02 ; 2 + 108: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 11e: fa 01 movw r30, r20 - 120: 0c 01 movw r0, r24 - 122: d7 be out 0x37, r13 ; 55 - 124: e8 95 spm - 126: 11 24 eor r1, r1 + 10a: fa 01 movw r30, r20 + 10c: 0c 01 movw r0, r24 + 10e: 97 be out 0x37, r9 ; 55 + 110: e8 95 spm + 112: 11 24 eor r1, r1 addrPtr += 2; - 128: 4e 5f subi r20, 0xFE ; 254 - 12a: 5f 4f sbci r21, 0xFF ; 255 + 114: 4e 5f subi r20, 0xFE ; 254 + 116: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 12c: f1 e0 ldi r31, 0x01 ; 1 - 12e: a0 38 cpi r26, 0x80 ; 128 - 130: bf 07 cpc r27, r31 - 132: 51 f7 brne .-44 ; 0x108 <__SREG__+0xc9> + 118: f1 e0 ldi r31, 0x01 ; 1 + 11a: a0 38 cpi r26, 0x80 ; 128 + 11c: bf 07 cpc r27, r31 + 11e: 51 f7 brne .-44 ; 0xf4 <__SREG__+0xb5> // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 134: e0 91 00 02 lds r30, 0x0200 - 138: f0 91 01 02 lds r31, 0x0201 - 13c: e7 be out 0x37, r14 ; 55 - 13e: e8 95 spm + 120: f6 01 movw r30, r12 + 122: a7 be out 0x37, r10 ; 55 + 124: e8 95 spm boot_spm_busy_wait(); - 140: 07 b6 in r0, 0x37 ; 55 - 142: 00 fc sbrc r0, 0 - 144: fd cf rjmp .-6 ; 0x140 <__SREG__+0x101> + 126: 07 b6 in r0, 0x37 ; 55 + 128: 00 fc sbrc r0, 0 + 12a: fd cf rjmp .-6 ; 0x126 <__SREG__+0xe7> #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 146: f7 be out 0x37, r15 ; 55 - 148: e8 95 spm - 14a: 27 c0 rjmp .+78 ; 0x19a <__SREG__+0x15b> + 12c: b7 be out 0x37, r11 ; 55 + 12e: e8 95 spm + 130: 26 c0 rjmp .+76 ; 0x17e <__SREG__+0x13f> #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 14c: 84 37 cpi r24, 0x74 ; 116 - 14e: b9 f4 brne .+46 ; 0x17e <__SREG__+0x13f> + 132: 84 37 cpi r24, 0x74 ; 116 + 134: b1 f4 brne .+44 ; 0x162 <__SREG__+0x123> // READ PAGE - we only read flash - getLen(); - 150: 37 d0 rcall .+110 ; 0x1c0 + getch(); /* getlen() */ + 136: 2e d0 rcall .+92 ; 0x194 + length = getch(); + 138: 2d d0 rcall .+90 ; 0x194 + 13a: f8 2e mov r15, r24 + getch(); + 13c: 2b d0 rcall .+86 ; 0x194 + verifySpace(); - 152: 46 d0 rcall .+140 ; 0x1e0 + 13e: 38 d0 rcall .+112 ; 0x1b0 + 140: f6 01 movw r30, r12 + 142: ef 2c mov r14, r15 putch(result); address++; } while (--length); #else do putch(pgm_read_byte_near(address++)); - 154: e0 91 00 02 lds r30, 0x0200 - 158: f0 91 01 02 lds r31, 0x0201 - 15c: 31 96 adiw r30, 0x01 ; 1 - 15e: f0 93 01 02 sts 0x0201, r31 - 162: e0 93 00 02 sts 0x0200, r30 - 166: 31 97 sbiw r30, 0x01 ; 1 - 168: e4 91 lpm r30, Z+ - 16a: 8e 2f mov r24, r30 - 16c: 19 d0 rcall .+50 ; 0x1a0 + 144: 8f 01 movw r16, r30 + 146: 0f 5f subi r16, 0xFF ; 255 + 148: 1f 4f sbci r17, 0xFF ; 255 + 14a: 84 91 lpm r24, Z+ + 14c: 1b d0 rcall .+54 ; 0x184 while (--length); - 16e: 80 91 02 02 lds r24, 0x0202 - 172: 81 50 subi r24, 0x01 ; 1 - 174: 80 93 02 02 sts 0x0202, r24 - 178: 88 23 and r24, r24 - 17a: 61 f7 brne .-40 ; 0x154 <__SREG__+0x115> - 17c: 0e c0 rjmp .+28 ; 0x19a <__SREG__+0x15b> + 14e: ea 94 dec r14 + 150: f8 01 movw r30, r16 + 152: c1 f7 brne .-16 ; 0x144 <__SREG__+0x105> +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) +#endif + +/* main program starts here */ +int main(void) { + 154: 08 94 sec + 156: c1 1c adc r12, r1 + 158: d1 1c adc r13, r1 + 15a: fa 94 dec r15 + 15c: cf 0c add r12, r15 + 15e: d1 1c adc r13, r1 + 160: 0e c0 rjmp .+28 ; 0x17e <__SREG__+0x13f> #endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 17e: 85 37 cpi r24, 0x75 ; 117 - 180: 39 f4 brne .+14 ; 0x190 <__SREG__+0x151> + 162: 85 37 cpi r24, 0x75 ; 117 + 164: 39 f4 brne .+14 ; 0x174 <__SREG__+0x135> // READ SIGN - return what Avrdude wants to hear verifySpace(); - 182: 2e d0 rcall .+92 ; 0x1e0 + 166: 24 d0 rcall .+72 ; 0x1b0 putch(SIGNATURE_0); - 184: 8e e1 ldi r24, 0x1E ; 30 - 186: 0c d0 rcall .+24 ; 0x1a0 + 168: 8e e1 ldi r24, 0x1E ; 30 + 16a: 0c d0 rcall .+24 ; 0x184 putch(SIGNATURE_1); - 188: 85 e9 ldi r24, 0x95 ; 149 - 18a: 0a d0 rcall .+20 ; 0x1a0 + 16c: 85 e9 ldi r24, 0x95 ; 149 + 16e: 0a d0 rcall .+20 ; 0x184 putch(SIGNATURE_2); - 18c: 8f e0 ldi r24, 0x0F ; 15 - 18e: 8b cf rjmp .-234 ; 0xa6 <__SREG__+0x67> + 170: 8f e0 ldi r24, 0x0F ; 15 + 172: 98 cf rjmp .-208 ; 0xa4 <__SREG__+0x65> } else if (ch == 'Q') { - 190: 81 35 cpi r24, 0x51 ; 81 - 192: 11 f4 brne .+4 ; 0x198 <__SREG__+0x159> + 174: 81 35 cpi r24, 0x51 ; 81 + 176: 11 f4 brne .+4 ; 0x17c <__SREG__+0x13d> // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 194: 88 e0 ldi r24, 0x08 ; 8 - 196: 19 d0 rcall .+50 ; 0x1ca + 178: 88 e0 ldi r24, 0x08 ; 8 + 17a: 14 d0 rcall .+40 ; 0x1a4 verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 198: 23 d0 rcall .+70 ; 0x1e0 + 17c: 19 d0 rcall .+50 ; 0x1b0 } putch(STK_OK); - 19a: 80 e1 ldi r24, 0x10 ; 16 - 19c: 01 d0 rcall .+2 ; 0x1a0 - 19e: 5c cf rjmp .-328 ; 0x58 <__SREG__+0x19> + 17e: 80 e1 ldi r24, 0x10 ; 16 + 180: 01 d0 rcall .+2 ; 0x184 + 182: 6a cf rjmp .-300 ; 0x58 <__SREG__+0x19> -000001a0 : +00000184 : } } void putch(char ch) { - 1a0: 98 2f mov r25, r24 + 184: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); - 1a2: 80 91 c0 00 lds r24, 0x00C0 - 1a6: 85 ff sbrs r24, 5 - 1a8: fc cf rjmp .-8 ; 0x1a2 + 186: 80 91 c0 00 lds r24, 0x00C0 + 18a: 85 ff sbrs r24, 5 + 18c: fc cf rjmp .-8 ; 0x186 UDR0 = ch; - 1aa: 90 93 c6 00 sts 0x00C6, r25 + 18e: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 1ae: 08 95 ret + 192: 08 95 ret -000001b0 : - return getch(); +00000194 : } +#endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 1b0: a8 95 wdr + 194: a8 95 wdr [uartBit] "I" (UART_RX_BIT) : "r25" ); #else while(!(UCSR0A & _BV(RXC0))); - 1b2: 80 91 c0 00 lds r24, 0x00C0 - 1b6: 87 ff sbrs r24, 7 - 1b8: fc cf rjmp .-8 ; 0x1b2 + 196: 80 91 c0 00 lds r24, 0x00C0 + 19a: 87 ff sbrs r24, 7 + 19c: fc cf rjmp .-8 ; 0x196 ch = UDR0; - 1ba: 80 91 c6 00 lds r24, 0x00C6 + 19e: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 1be: 08 95 ret - -000001c0 : - } while (--count); -} -#endif - -uint8_t getLen() { - getch(); - 1c0: f7 df rcall .-18 ; 0x1b0 - length = getch(); - 1c2: f6 df rcall .-20 ; 0x1b0 - 1c4: 80 93 02 02 sts 0x0202, r24 - return getch(); -} - 1c8: f3 cf rjmp .-26 ; 0x1b0 + 1a2: 08 95 ret -000001ca : +000001a4 : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 1ca: e0 e6 ldi r30, 0x60 ; 96 - 1cc: f0 e0 ldi r31, 0x00 ; 0 - 1ce: 98 e1 ldi r25, 0x18 ; 24 - 1d0: 90 83 st Z, r25 + 1a4: e0 e6 ldi r30, 0x60 ; 96 + 1a6: f0 e0 ldi r31, 0x00 ; 0 + 1a8: 98 e1 ldi r25, 0x18 ; 24 + 1aa: 90 83 st Z, r25 WDTCSR = x; - 1d2: 80 83 st Z, r24 + 1ac: 80 83 st Z, r24 } - 1d4: 08 95 ret - -000001d6 : - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 1d6: 80 e0 ldi r24, 0x00 ; 0 - 1d8: f8 df rcall .-16 ; 0x1ca - __asm__ __volatile__ ( - 1da: ee 27 eor r30, r30 - 1dc: ff 27 eor r31, r31 - 1de: 09 94 ijmp + 1ae: 08 95 ret -000001e0 : +000001b0 : do getch(); while (--count); verifySpace(); } void verifySpace() { - if (getch() != CRC_EOP) appStart(); - 1e0: e7 df rcall .-50 ; 0x1b0 - 1e2: 80 32 cpi r24, 0x20 ; 32 - 1e4: 09 f0 breq .+2 ; 0x1e8 - 1e6: f7 df rcall .-18 ; 0x1d6 + if (getch() != CRC_EOP) { + 1b0: f1 df rcall .-30 ; 0x194 + 1b2: 80 32 cpi r24, 0x20 ; 32 + 1b4: 19 f0 breq .+6 ; 0x1bc + watchdogConfig(WATCHDOG_16MS); // shorten WD timeout + 1b6: 88 e0 ldi r24, 0x08 ; 8 + 1b8: f5 df rcall .-22 ; 0x1a4 + 1ba: ff cf rjmp .-2 ; 0x1ba + while (1) // and busy-loop so that WD causes + ; // a reset and app start. + } putch(STK_INSYNC); - 1e8: 84 e1 ldi r24, 0x14 ; 20 + 1bc: 84 e1 ldi r24, 0x14 ; 20 } - 1ea: da cf rjmp .-76 ; 0x1a0 + 1be: e2 cf rjmp .-60 ; 0x184 -000001ec : +000001c0 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 1ec: 1f 93 push r17 - 1ee: 18 2f mov r17, r24 + 1c0: 1f 93 push r17 + 1c2: 18 2f mov r17, r24 do getch(); while (--count); - 1f0: df df rcall .-66 ; 0x1b0 - 1f2: 11 50 subi r17, 0x01 ; 1 - 1f4: e9 f7 brne .-6 ; 0x1f0 + 1c4: e7 df rcall .-50 ; 0x194 + 1c6: 11 50 subi r17, 0x01 ; 1 + 1c8: e9 f7 brne .-6 ; 0x1c4 verifySpace(); - 1f6: f4 df rcall .-24 ; 0x1e0 + 1ca: f2 df rcall .-28 ; 0x1b0 +} + 1cc: 1f 91 pop r17 + 1ce: 08 95 ret + +000001d0 : + WDTCSR = _BV(WDCE) | _BV(WDE); + WDTCSR = x; } - 1f8: 1f 91 pop r17 - 1fa: 08 95 ret + +void appStart() { + watchdogConfig(WATCHDOG_OFF); + 1d0: 80 e0 ldi r24, 0x00 ; 0 + 1d2: e8 df rcall .-48 ; 0x1a4 + __asm__ __volatile__ ( + 1d4: ee 27 eor r30, r30 + 1d6: ff 27 eor r31, r31 + 1d8: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_diecimila.hex b/bootloaders/optiboot/optiboot_diecimila.hex index 3ac0de2..733a139 100644 --- a/bootloaders/optiboot/optiboot_diecimila.hex +++ b/bootloaders/optiboot/optiboot_diecimila.hex @@ -1,35 +1,33 @@ -:103E0000112484B714BE81FFE6D085E08093810041 +:103E0000112484B714BE81FFE3D085E08093810044 :103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20080E18093C4008EE0CFD0259A86E066 +:103E2000C20080E18093C4008EE0BCD0259A86E079 :103E300020E33CEF91E0309385002093840096BB13 -:103E4000B09BFECF1D9AA8958150A9F7DD24D3948D -:103E5000A5E0EA2EF1E1FF2EABD0813421F481E020 -:103E6000C5D083E020C0823411F484E103C08534DE -:103E700019F485E0BBD091C0853581F499D0082F25 -:103E800010E096D090E0982F8827802B912B880FF8 -:103E9000991F90930102809300027EC0863529F419 -:103EA00084E0A4D080E07CD078C0843609F04EC095 -:103EB00087D0E0910002F091010288E3E030F8073A -:103EC00018F483E087BFE895C0E0D1E071D0899312 -:103ED000809102028150809302028823B9F7E09119 -:103EE0000002F091010288E3E030F80718F083E067 -:103EF00087BFE89575D007B600FCFDCF4091000262 -:103F000050910102A0E0B1E02C9130E011968C912B -:103F1000119790E0982F8827822B932B1296FA0105 -:103F20000C01D7BEE89511244E5F5F4FF1E0A03839 -:103F3000BF0751F7E0910002F0910102E7BEE8955A -:103F400007B600FCFDCFF7BEE89527C08437B9F46B -:103F500037D046D0E0910002F09101023196F09303 -:103F60000102E09300023197E4918E2F19D08091E5 -:103F70000202815080930202882361F70EC08537C8 -:103F800039F42ED08EE10CD084E90AD086E08BCFB4 -:103F9000813511F488E019D023D080E101D05CCFC5 -:103FA000982F8091C00085FFFCCF9093C6000895A4 -:103FB000A8958091C00087FFFCCF8091C60008952E -:103FC000F7DFF6DF80930202F3CFE0E6F0E098E15E -:103FD00090838083089580E0F8DFEE27FF2709941F -:103FE000E7DF803209F0F7DF84E1DACF1F93182F83 -:0C3FF000DFDF1150E9F7F4DF1F910895A6 +:103E4000B09BFECF1D9AA8958150A9F79924939411 +:103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE +:103E6000AFD083E01FC0823411F484E103C08534F5 +:103E700019F485E0A5D083C0853579F48BD0E82E80 +:103E8000FF2488D0082F10E0102F00270E291F29AB +:103E9000000F111F8DD0680172C0863529F484E0AF +:103EA0008FD080E06FD06BC0843609F042C072D0F2 +:103EB00071D0082F6FD080E0C81688E3D80620F4B0 +:103EC00083E0F60187BFE895C0E0D1E063D0899335 +:103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF +:103EE000F60187BFE89564D007B600FCFDCFA601B8 +:103EF000A0E0B1E02C9130E011968C91119790E008 +:103F0000982F8827822B932B1296FA010C0197BECB +:103F1000E89511244E5F5F4FF1E0A038BF0751F7DD +:103F2000F601A7BEE89507B600FCFDCFB7BEE89541 +:103F300026C08437B1F42ED02DD0F82E2BD038D017 +:103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 +:103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 +:103F60000EC0853739F424D08EE10CD084E90AD014 +:103F700086E098CF813511F488E014D019D080E123 +:103F800001D06ACF982F8091C00085FFFCCF90931D +:103F9000C6000895A8958091C00087FFFCCF80914E +:103FA000C6000895E0E6F0E098E1908380830895EC +:103FB000F1DF803219F088E0F5DFFFCF84E1E2CF56 +:103FC0001F93182FE7DF1150E9F7F2DF1F910895D3 +:0A3FD00080E0E8DFEE27FF270994E8 :023FFE000104BC :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_diecimila.lst b/bootloaders/optiboot/optiboot_diecimila.lst index 8b17368..edd9cb3 100644 --- a/bootloaders/optiboot/optiboot_diecimila.lst +++ b/bootloaders/optiboot/optiboot_diecimila.lst @@ -3,27 +3,27 @@ optiboot_diecimila.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001fc 00003e00 00003e00 00000054 2**1 + 0 .text 000001da 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 00000250 2**0 + 1 .version 00000002 00003ffe 00003ffe 0000022e 2**0 CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000252 2**0 + 2 .debug_aranges 00000028 00000000 00000000 00000230 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000006a 00000000 00000000 0000027a 2**0 + 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 00000285 00000000 00000000 000002e4 2**0 + 4 .debug_info 0000028c 00000000 00000000 000002b7 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000019f 00000000 00000000 00000569 2**0 + 5 .debug_abbrev 00000199 00000000 00000000 00000543 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000453 00000000 00000000 00000708 2**0 + 6 .debug_line 00000456 00000000 00000000 000006dc 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000090 00000000 00000000 00000b5c 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b34 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000141 00000000 00000000 00000bec 2**0 + 8 .debug_str 00000149 00000000 00000000 00000bb4 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 000001e1 00000000 00000000 00000d2d 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000cfd 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000068 00000000 00000000 00000f0e 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f7b 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 3e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 3e06: 81 ff sbrs r24, 1 - 3e08: e6 d0 rcall .+460 ; 0x3fd6 + 3e08: e3 d0 rcall .+454 ; 0x3fd0 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -77,7 +77,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: cf d0 rcall .+414 ; 0x3fca + 3e2a: bc d0 rcall .+376 ; 0x3fa4 /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -111,8 +111,8 @@ void flash_led(uint8_t count) { #else LED_PIN |= _BV(LED); 3e44: 1d 9a sbi 0x03, 5 ; 3 - return getch(); } +#endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { @@ -132,8 +132,8 @@ void watchdogReset() { if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 3e4c: dd 24 eor r13, r13 - 3e4e: d3 94 inc r13 + 3e4c: 99 24 eor r9, r9 + 3e4e: 93 94 inc r9 __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); @@ -141,21 +141,21 @@ void watchdogReset() { // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 3e50: a5 e0 ldi r26, 0x05 ; 5 - 3e52: ea 2e mov r14, r26 + 3e52: aa 2e mov r10, r26 boot_spm_busy_wait(); #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); 3e54: f1 e1 ldi r31, 0x11 ; 17 - 3e56: ff 2e mov r15, r31 + 3e56: bf 2e mov r11, r31 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 3e58: ab d0 rcall .+342 ; 0x3fb0 + 3e58: 9d d0 rcall .+314 ; 0x3f94 if(ch == STK_GET_PARAMETER) { 3e5a: 81 34 cpi r24, 0x41 ; 65 @@ -163,10 +163,10 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: c5 d0 rcall .+394 ; 0x3fec + 3e60: af d0 rcall .+350 ; 0x3fc0 putch(0x03); 3e62: 83 e0 ldi r24, 0x03 ; 3 - 3e64: 20 c0 rjmp .+64 ; 0x3ea6 + 3e64: 1f c0 rjmp .+62 ; 0x3ea4 } else if(ch == STK_SET_DEVICE) { 3e66: 82 34 cpi r24, 0x42 ; 66 @@ -182,71 +182,77 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: bb d0 rcall .+374 ; 0x3fec - 3e76: 91 c0 rjmp .+290 ; 0x3f9a + 3e74: a5 d0 rcall .+330 ; 0x3fc0 + 3e76: 83 c0 rjmp .+262 ; 0x3f7e } else if(ch == STK_LOAD_ADDRESS) { 3e78: 85 35 cpi r24, 0x55 ; 85 - 3e7a: 81 f4 brne .+32 ; 0x3e9c + 3e7a: 79 f4 brne .+30 ; 0x3e9a // LOAD ADDRESS uint16_t newAddress; newAddress = getch(); - 3e7c: 99 d0 rcall .+306 ; 0x3fb0 + 3e7c: 8b d0 rcall .+278 ; 0x3f94 newAddress = (newAddress & 0xff) | (getch() << 8); - 3e7e: 08 2f mov r16, r24 - 3e80: 10 e0 ldi r17, 0x00 ; 0 - 3e82: 96 d0 rcall .+300 ; 0x3fb0 - 3e84: 90 e0 ldi r25, 0x00 ; 0 - 3e86: 98 2f mov r25, r24 - 3e88: 88 27 eor r24, r24 - 3e8a: 80 2b or r24, r16 - 3e8c: 91 2b or r25, r17 + 3e7e: e8 2e mov r14, r24 + 3e80: ff 24 eor r15, r15 + 3e82: 88 d0 rcall .+272 ; 0x3f94 + 3e84: 08 2f mov r16, r24 + 3e86: 10 e0 ldi r17, 0x00 ; 0 + 3e88: 10 2f mov r17, r16 + 3e8a: 00 27 eor r16, r16 + 3e8c: 0e 29 or r16, r14 + 3e8e: 1f 29 or r17, r15 #ifdef RAMPZ // Transfer top bit to RAMPZ RAMPZ = (newAddress & 0x8000) ? 1 : 0; #endif newAddress += newAddress; // Convert from word address to byte address - 3e8e: 88 0f add r24, r24 - 3e90: 99 1f adc r25, r25 + 3e90: 00 0f add r16, r16 + 3e92: 11 1f adc r17, r17 address = newAddress; - 3e92: 90 93 01 02 sts 0x0201, r25 - 3e96: 80 93 00 02 sts 0x0200, r24 - 3e9a: 7e c0 rjmp .+252 ; 0x3f98 verifySpace(); + 3e94: 8d d0 rcall .+282 ; 0x3fb0 + 3e96: 68 01 movw r12, r16 + 3e98: 72 c0 rjmp .+228 ; 0x3f7e } else if(ch == STK_UNIVERSAL) { - 3e9c: 86 35 cpi r24, 0x56 ; 86 - 3e9e: 29 f4 brne .+10 ; 0x3eaa + 3e9a: 86 35 cpi r24, 0x56 ; 86 + 3e9c: 29 f4 brne .+10 ; 0x3ea8 // UNIVERSAL command is ignored getNch(4); - 3ea0: 84 e0 ldi r24, 0x04 ; 4 - 3ea2: a4 d0 rcall .+328 ; 0x3fec + 3e9e: 84 e0 ldi r24, 0x04 ; 4 + 3ea0: 8f d0 rcall .+286 ; 0x3fc0 putch(0x00); - 3ea4: 80 e0 ldi r24, 0x00 ; 0 - 3ea6: 7c d0 rcall .+248 ; 0x3fa0 - 3ea8: 78 c0 rjmp .+240 ; 0x3f9a + 3ea2: 80 e0 ldi r24, 0x00 ; 0 + 3ea4: 6f d0 rcall .+222 ; 0x3f84 + 3ea6: 6b c0 rjmp .+214 ; 0x3f7e } /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 3eaa: 84 36 cpi r24, 0x64 ; 100 - 3eac: 09 f0 breq .+2 ; 0x3eb0 - 3eae: 4e c0 rjmp .+156 ; 0x3f4c + 3ea8: 84 36 cpi r24, 0x64 ; 100 + 3eaa: 09 f0 breq .+2 ; 0x3eae + 3eac: 42 c0 rjmp .+132 ; 0x3f32 // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; - getLen(); - 3eb0: 87 d0 rcall .+270 ; 0x3fc0 + getch(); /* getlen() */ + 3eae: 72 d0 rcall .+228 ; 0x3f94 + length = getch(); + 3eb0: 71 d0 rcall .+226 ; 0x3f94 + 3eb2: 08 2f mov r16, r24 + getch(); + 3eb4: 6f d0 rcall .+222 ; 0x3f94 // If we are in RWW section, immediately start page erase if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3eb2: e0 91 00 02 lds r30, 0x0200 - 3eb6: f0 91 01 02 lds r31, 0x0201 + 3eb6: 80 e0 ldi r24, 0x00 ; 0 + 3eb8: c8 16 cp r12, r24 3eba: 88 e3 ldi r24, 0x38 ; 56 - 3ebc: e0 30 cpi r30, 0x00 ; 0 - 3ebe: f8 07 cpc r31, r24 - 3ec0: 18 f4 brcc .+6 ; 0x3ec8 - 3ec2: 83 e0 ldi r24, 0x03 ; 3 + 3ebc: d8 06 cpc r13, r24 + 3ebe: 20 f4 brcc .+8 ; 0x3ec8 + 3ec0: 83 e0 ldi r24, 0x03 ; 3 + 3ec2: f6 01 movw r30, r12 3ec4: 87 bf out 0x37, r24 ; 55 3ec6: e8 95 spm 3ec8: c0 e0 ldi r28, 0x00 ; 0 @@ -255,302 +261,301 @@ void watchdogReset() { // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 3ecc: 71 d0 rcall .+226 ; 0x3fb0 + 3ecc: 63 d0 rcall .+198 ; 0x3f94 3ece: 89 93 st Y+, r24 while (--length); - 3ed0: 80 91 02 02 lds r24, 0x0202 - 3ed4: 81 50 subi r24, 0x01 ; 1 - 3ed6: 80 93 02 02 sts 0x0202, r24 - 3eda: 88 23 and r24, r24 - 3edc: b9 f7 brne .-18 ; 0x3ecc + 3ed0: 0c 17 cp r16, r28 + 3ed2: e1 f7 brne .-8 ; 0x3ecc // If we are in NRWW section, page erase has to be delayed until now. // Todo: Take RAMPZ into account if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3ede: e0 91 00 02 lds r30, 0x0200 - 3ee2: f0 91 01 02 lds r31, 0x0201 - 3ee6: 88 e3 ldi r24, 0x38 ; 56 - 3ee8: e0 30 cpi r30, 0x00 ; 0 - 3eea: f8 07 cpc r31, r24 - 3eec: 18 f0 brcs .+6 ; 0x3ef4 - 3eee: 83 e0 ldi r24, 0x03 ; 3 - 3ef0: 87 bf out 0x37, r24 ; 55 - 3ef2: e8 95 spm + 3ed4: f0 e0 ldi r31, 0x00 ; 0 + 3ed6: cf 16 cp r12, r31 + 3ed8: f8 e3 ldi r31, 0x38 ; 56 + 3eda: df 06 cpc r13, r31 + 3edc: 20 f0 brcs .+8 ; 0x3ee6 + 3ede: 83 e0 ldi r24, 0x03 ; 3 + 3ee0: f6 01 movw r30, r12 + 3ee2: 87 bf out 0x37, r24 ; 55 + 3ee4: e8 95 spm // Read command terminator, start reply verifySpace(); - 3ef4: 75 d0 rcall .+234 ; 0x3fe0 + 3ee6: 64 d0 rcall .+200 ; 0x3fb0 // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 3ef6: 07 b6 in r0, 0x37 ; 55 - 3ef8: 00 fc sbrc r0, 0 - 3efa: fd cf rjmp .-6 ; 0x3ef6 - } -#endif - - // Copy buffer into programming buffer + 3ee8: 07 b6 in r0, 0x37 ; 55 + 3eea: 00 fc sbrc r0, 0 + 3eec: fd cf rjmp .-6 ; 0x3ee8 + 3eee: a6 01 movw r20, r12 + 3ef0: a0 e0 ldi r26, 0x00 ; 0 + 3ef2: b1 e0 ldi r27, 0x01 ; 1 bufPtr = buff; addrPtr = (uint16_t)(void*)address; - 3efc: 40 91 00 02 lds r20, 0x0200 - 3f00: 50 91 01 02 lds r21, 0x0201 - 3f04: a0 e0 ldi r26, 0x00 ; 0 - 3f06: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 3f08: 2c 91 ld r18, X - 3f0a: 30 e0 ldi r19, 0x00 ; 0 + 3ef4: 2c 91 ld r18, X + 3ef6: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 3f0c: 11 96 adiw r26, 0x01 ; 1 - 3f0e: 8c 91 ld r24, X - 3f10: 11 97 sbiw r26, 0x01 ; 1 - 3f12: 90 e0 ldi r25, 0x00 ; 0 - 3f14: 98 2f mov r25, r24 - 3f16: 88 27 eor r24, r24 - 3f18: 82 2b or r24, r18 - 3f1a: 93 2b or r25, r19 + 3ef8: 11 96 adiw r26, 0x01 ; 1 + 3efa: 8c 91 ld r24, X + 3efc: 11 97 sbiw r26, 0x01 ; 1 + 3efe: 90 e0 ldi r25, 0x00 ; 0 + 3f00: 98 2f mov r25, r24 + 3f02: 88 27 eor r24, r24 + 3f04: 82 2b or r24, r18 + 3f06: 93 2b or r25, r19 #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 3f1c: 12 96 adiw r26, 0x02 ; 2 + 3f08: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f1e: fa 01 movw r30, r20 - 3f20: 0c 01 movw r0, r24 - 3f22: d7 be out 0x37, r13 ; 55 - 3f24: e8 95 spm - 3f26: 11 24 eor r1, r1 + 3f0a: fa 01 movw r30, r20 + 3f0c: 0c 01 movw r0, r24 + 3f0e: 97 be out 0x37, r9 ; 55 + 3f10: e8 95 spm + 3f12: 11 24 eor r1, r1 addrPtr += 2; - 3f28: 4e 5f subi r20, 0xFE ; 254 - 3f2a: 5f 4f sbci r21, 0xFF ; 255 + 3f14: 4e 5f subi r20, 0xFE ; 254 + 3f16: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 3f2c: f1 e0 ldi r31, 0x01 ; 1 - 3f2e: a0 38 cpi r26, 0x80 ; 128 - 3f30: bf 07 cpc r27, r31 - 3f32: 51 f7 brne .-44 ; 0x3f08 + 3f18: f1 e0 ldi r31, 0x01 ; 1 + 3f1a: a0 38 cpi r26, 0x80 ; 128 + 3f1c: bf 07 cpc r27, r31 + 3f1e: 51 f7 brne .-44 ; 0x3ef4 // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 3f34: e0 91 00 02 lds r30, 0x0200 - 3f38: f0 91 01 02 lds r31, 0x0201 - 3f3c: e7 be out 0x37, r14 ; 55 - 3f3e: e8 95 spm + 3f20: f6 01 movw r30, r12 + 3f22: a7 be out 0x37, r10 ; 55 + 3f24: e8 95 spm boot_spm_busy_wait(); - 3f40: 07 b6 in r0, 0x37 ; 55 - 3f42: 00 fc sbrc r0, 0 - 3f44: fd cf rjmp .-6 ; 0x3f40 + 3f26: 07 b6 in r0, 0x37 ; 55 + 3f28: 00 fc sbrc r0, 0 + 3f2a: fd cf rjmp .-6 ; 0x3f26 #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 3f46: f7 be out 0x37, r15 ; 55 - 3f48: e8 95 spm - 3f4a: 27 c0 rjmp .+78 ; 0x3f9a + 3f2c: b7 be out 0x37, r11 ; 55 + 3f2e: e8 95 spm + 3f30: 26 c0 rjmp .+76 ; 0x3f7e #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 3f4c: 84 37 cpi r24, 0x74 ; 116 - 3f4e: b9 f4 brne .+46 ; 0x3f7e + 3f32: 84 37 cpi r24, 0x74 ; 116 + 3f34: b1 f4 brne .+44 ; 0x3f62 // READ PAGE - we only read flash - getLen(); - 3f50: 37 d0 rcall .+110 ; 0x3fc0 + getch(); /* getlen() */ + 3f36: 2e d0 rcall .+92 ; 0x3f94 + length = getch(); + 3f38: 2d d0 rcall .+90 ; 0x3f94 + 3f3a: f8 2e mov r15, r24 + getch(); + 3f3c: 2b d0 rcall .+86 ; 0x3f94 + verifySpace(); - 3f52: 46 d0 rcall .+140 ; 0x3fe0 + 3f3e: 38 d0 rcall .+112 ; 0x3fb0 + 3f40: f6 01 movw r30, r12 + 3f42: ef 2c mov r14, r15 putch(result); address++; } while (--length); #else do putch(pgm_read_byte_near(address++)); - 3f54: e0 91 00 02 lds r30, 0x0200 - 3f58: f0 91 01 02 lds r31, 0x0201 - 3f5c: 31 96 adiw r30, 0x01 ; 1 - 3f5e: f0 93 01 02 sts 0x0201, r31 - 3f62: e0 93 00 02 sts 0x0200, r30 - 3f66: 31 97 sbiw r30, 0x01 ; 1 - 3f68: e4 91 lpm r30, Z+ - 3f6a: 8e 2f mov r24, r30 - 3f6c: 19 d0 rcall .+50 ; 0x3fa0 + 3f44: 8f 01 movw r16, r30 + 3f46: 0f 5f subi r16, 0xFF ; 255 + 3f48: 1f 4f sbci r17, 0xFF ; 255 + 3f4a: 84 91 lpm r24, Z+ + 3f4c: 1b d0 rcall .+54 ; 0x3f84 while (--length); - 3f6e: 80 91 02 02 lds r24, 0x0202 - 3f72: 81 50 subi r24, 0x01 ; 1 - 3f74: 80 93 02 02 sts 0x0202, r24 - 3f78: 88 23 and r24, r24 - 3f7a: 61 f7 brne .-40 ; 0x3f54 - 3f7c: 0e c0 rjmp .+28 ; 0x3f9a + 3f4e: ea 94 dec r14 + 3f50: f8 01 movw r30, r16 + 3f52: c1 f7 brne .-16 ; 0x3f44 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) +#endif + +/* main program starts here */ +int main(void) { + 3f54: 08 94 sec + 3f56: c1 1c adc r12, r1 + 3f58: d1 1c adc r13, r1 + 3f5a: fa 94 dec r15 + 3f5c: cf 0c add r12, r15 + 3f5e: d1 1c adc r13, r1 + 3f60: 0e c0 rjmp .+28 ; 0x3f7e #endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 3f7e: 85 37 cpi r24, 0x75 ; 117 - 3f80: 39 f4 brne .+14 ; 0x3f90 + 3f62: 85 37 cpi r24, 0x75 ; 117 + 3f64: 39 f4 brne .+14 ; 0x3f74 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 3f82: 2e d0 rcall .+92 ; 0x3fe0 + 3f66: 24 d0 rcall .+72 ; 0x3fb0 putch(SIGNATURE_0); - 3f84: 8e e1 ldi r24, 0x1E ; 30 - 3f86: 0c d0 rcall .+24 ; 0x3fa0 + 3f68: 8e e1 ldi r24, 0x1E ; 30 + 3f6a: 0c d0 rcall .+24 ; 0x3f84 putch(SIGNATURE_1); - 3f88: 84 e9 ldi r24, 0x94 ; 148 - 3f8a: 0a d0 rcall .+20 ; 0x3fa0 + 3f6c: 84 e9 ldi r24, 0x94 ; 148 + 3f6e: 0a d0 rcall .+20 ; 0x3f84 putch(SIGNATURE_2); - 3f8c: 86 e0 ldi r24, 0x06 ; 6 - 3f8e: 8b cf rjmp .-234 ; 0x3ea6 + 3f70: 86 e0 ldi r24, 0x06 ; 6 + 3f72: 98 cf rjmp .-208 ; 0x3ea4 } else if (ch == 'Q') { - 3f90: 81 35 cpi r24, 0x51 ; 81 - 3f92: 11 f4 brne .+4 ; 0x3f98 + 3f74: 81 35 cpi r24, 0x51 ; 81 + 3f76: 11 f4 brne .+4 ; 0x3f7c // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 3f94: 88 e0 ldi r24, 0x08 ; 8 - 3f96: 19 d0 rcall .+50 ; 0x3fca + 3f78: 88 e0 ldi r24, 0x08 ; 8 + 3f7a: 14 d0 rcall .+40 ; 0x3fa4 verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 3f98: 23 d0 rcall .+70 ; 0x3fe0 + 3f7c: 19 d0 rcall .+50 ; 0x3fb0 } putch(STK_OK); - 3f9a: 80 e1 ldi r24, 0x10 ; 16 - 3f9c: 01 d0 rcall .+2 ; 0x3fa0 - 3f9e: 5c cf rjmp .-328 ; 0x3e58 + 3f7e: 80 e1 ldi r24, 0x10 ; 16 + 3f80: 01 d0 rcall .+2 ; 0x3f84 + 3f82: 6a cf rjmp .-300 ; 0x3e58 -00003fa0 : +00003f84 : } } void putch(char ch) { - 3fa0: 98 2f mov r25, r24 + 3f84: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); - 3fa2: 80 91 c0 00 lds r24, 0x00C0 - 3fa6: 85 ff sbrs r24, 5 - 3fa8: fc cf rjmp .-8 ; 0x3fa2 + 3f86: 80 91 c0 00 lds r24, 0x00C0 + 3f8a: 85 ff sbrs r24, 5 + 3f8c: fc cf rjmp .-8 ; 0x3f86 UDR0 = ch; - 3faa: 90 93 c6 00 sts 0x00C6, r25 + 3f8e: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 3fae: 08 95 ret + 3f92: 08 95 ret -00003fb0 : - return getch(); +00003f94 : } +#endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3fb0: a8 95 wdr + 3f94: a8 95 wdr [uartBit] "I" (UART_RX_BIT) : "r25" ); #else while(!(UCSR0A & _BV(RXC0))); - 3fb2: 80 91 c0 00 lds r24, 0x00C0 - 3fb6: 87 ff sbrs r24, 7 - 3fb8: fc cf rjmp .-8 ; 0x3fb2 + 3f96: 80 91 c0 00 lds r24, 0x00C0 + 3f9a: 87 ff sbrs r24, 7 + 3f9c: fc cf rjmp .-8 ; 0x3f96 ch = UDR0; - 3fba: 80 91 c6 00 lds r24, 0x00C6 + 3f9e: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 3fbe: 08 95 ret - -00003fc0 : - } while (--count); -} -#endif - -uint8_t getLen() { - getch(); - 3fc0: f7 df rcall .-18 ; 0x3fb0 - length = getch(); - 3fc2: f6 df rcall .-20 ; 0x3fb0 - 3fc4: 80 93 02 02 sts 0x0202, r24 - return getch(); -} - 3fc8: f3 cf rjmp .-26 ; 0x3fb0 + 3fa2: 08 95 ret -00003fca : +00003fa4 : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 3fca: e0 e6 ldi r30, 0x60 ; 96 - 3fcc: f0 e0 ldi r31, 0x00 ; 0 - 3fce: 98 e1 ldi r25, 0x18 ; 24 - 3fd0: 90 83 st Z, r25 + 3fa4: e0 e6 ldi r30, 0x60 ; 96 + 3fa6: f0 e0 ldi r31, 0x00 ; 0 + 3fa8: 98 e1 ldi r25, 0x18 ; 24 + 3faa: 90 83 st Z, r25 WDTCSR = x; - 3fd2: 80 83 st Z, r24 + 3fac: 80 83 st Z, r24 } - 3fd4: 08 95 ret - -00003fd6 : - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 3fd6: 80 e0 ldi r24, 0x00 ; 0 - 3fd8: f8 df rcall .-16 ; 0x3fca - __asm__ __volatile__ ( - 3fda: ee 27 eor r30, r30 - 3fdc: ff 27 eor r31, r31 - 3fde: 09 94 ijmp + 3fae: 08 95 ret -00003fe0 : +00003fb0 : do getch(); while (--count); verifySpace(); } void verifySpace() { - if (getch() != CRC_EOP) appStart(); - 3fe0: e7 df rcall .-50 ; 0x3fb0 - 3fe2: 80 32 cpi r24, 0x20 ; 32 - 3fe4: 09 f0 breq .+2 ; 0x3fe8 - 3fe6: f7 df rcall .-18 ; 0x3fd6 + if (getch() != CRC_EOP) { + 3fb0: f1 df rcall .-30 ; 0x3f94 + 3fb2: 80 32 cpi r24, 0x20 ; 32 + 3fb4: 19 f0 breq .+6 ; 0x3fbc + watchdogConfig(WATCHDOG_16MS); // shorten WD timeout + 3fb6: 88 e0 ldi r24, 0x08 ; 8 + 3fb8: f5 df rcall .-22 ; 0x3fa4 + 3fba: ff cf rjmp .-2 ; 0x3fba + while (1) // and busy-loop so that WD causes + ; // a reset and app start. + } putch(STK_INSYNC); - 3fe8: 84 e1 ldi r24, 0x14 ; 20 + 3fbc: 84 e1 ldi r24, 0x14 ; 20 } - 3fea: da cf rjmp .-76 ; 0x3fa0 + 3fbe: e2 cf rjmp .-60 ; 0x3f84 -00003fec : +00003fc0 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 3fec: 1f 93 push r17 - 3fee: 18 2f mov r17, r24 + 3fc0: 1f 93 push r17 + 3fc2: 18 2f mov r17, r24 do getch(); while (--count); - 3ff0: df df rcall .-66 ; 0x3fb0 - 3ff2: 11 50 subi r17, 0x01 ; 1 - 3ff4: e9 f7 brne .-6 ; 0x3ff0 + 3fc4: e7 df rcall .-50 ; 0x3f94 + 3fc6: 11 50 subi r17, 0x01 ; 1 + 3fc8: e9 f7 brne .-6 ; 0x3fc4 verifySpace(); - 3ff6: f4 df rcall .-24 ; 0x3fe0 + 3fca: f2 df rcall .-28 ; 0x3fb0 +} + 3fcc: 1f 91 pop r17 + 3fce: 08 95 ret + +00003fd0 : + WDTCSR = _BV(WDCE) | _BV(WDE); + WDTCSR = x; } - 3ff8: 1f 91 pop r17 - 3ffa: 08 95 ret + +void appStart() { + watchdogConfig(WATCHDOG_OFF); + 3fd0: 80 e0 ldi r24, 0x00 ; 0 + 3fd2: e8 df rcall .-48 ; 0x3fa4 + __asm__ __volatile__ ( + 3fd4: ee 27 eor r30, r30 + 3fd6: ff 27 eor r31, r31 + 3fd8: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_lilypad.hex b/bootloaders/optiboot/optiboot_lilypad.hex index 77897e7..dcdbbb4 100644 --- a/bootloaders/optiboot/optiboot_lilypad.hex +++ b/bootloaders/optiboot/optiboot_lilypad.hex @@ -1,35 +1,33 @@ -:103E0000112484B714BE81FFE6D085E08093810041 +:103E0000112484B714BE81FFE3D085E08093810044 :103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20088E08093C4008EE0CFD0259A86E05F +:103E2000C20088E08093C4008EE0BCD0259A86E072 :103E300028E13EEF91E0309385002093840096BB0B -:103E4000B09BFECF1D9AA8958150A9F7DD24D3948D -:103E5000A5E0EA2EF1E1FF2EABD0813421F481E020 -:103E6000C5D083E020C0823411F484E103C08534DE -:103E700019F485E0BBD091C0853581F499D0082F25 -:103E800010E096D090E0982F8827802B912B880FF8 -:103E9000991F90930102809300027EC0863529F419 -:103EA00084E0A4D080E07CD078C0843609F04EC095 -:103EB00087D0E0910002F091010288E3E030F8073A -:103EC00018F483E087BFE895C0E0D1E071D0899312 -:103ED000809102028150809302028823B9F7E09119 -:103EE0000002F091010288E3E030F80718F083E067 -:103EF00087BFE89575D007B600FCFDCF4091000262 -:103F000050910102A0E0B1E02C9130E011968C912B -:103F1000119790E0982F8827822B932B1296FA0105 -:103F20000C01D7BEE89511244E5F5F4FF1E0A03839 -:103F3000BF0751F7E0910002F0910102E7BEE8955A -:103F400007B600FCFDCFF7BEE89527C08437B9F46B -:103F500037D046D0E0910002F09101023196F09303 -:103F60000102E09300023197E4918E2F19D08091E5 -:103F70000202815080930202882361F70EC08537C8 -:103F800039F42ED08EE10CD084E90AD086E08BCFB4 -:103F9000813511F488E019D023D080E101D05CCFC5 -:103FA000982F8091C00085FFFCCF9093C6000895A4 -:103FB000A8958091C00087FFFCCF8091C60008952E -:103FC000F7DFF6DF80930202F3CFE0E6F0E098E15E -:103FD00090838083089580E0F8DFEE27FF2709941F -:103FE000E7DF803209F0F7DF84E1DACF1F93182F83 -:0C3FF000DFDF1150E9F7F4DF1F910895A6 +:103E4000B09BFECF1D9AA8958150A9F79924939411 +:103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE +:103E6000AFD083E01FC0823411F484E103C08534F5 +:103E700019F485E0A5D083C0853579F48BD0E82E80 +:103E8000FF2488D0082F10E0102F00270E291F29AB +:103E9000000F111F8DD0680172C0863529F484E0AF +:103EA0008FD080E06FD06BC0843609F042C072D0F2 +:103EB00071D0082F6FD080E0C81688E3D80620F4B0 +:103EC00083E0F60187BFE895C0E0D1E063D0899335 +:103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF +:103EE000F60187BFE89564D007B600FCFDCFA601B8 +:103EF000A0E0B1E02C9130E011968C91119790E008 +:103F0000982F8827822B932B1296FA010C0197BECB +:103F1000E89511244E5F5F4FF1E0A038BF0751F7DD +:103F2000F601A7BEE89507B600FCFDCFB7BEE89541 +:103F300026C08437B1F42ED02DD0F82E2BD038D017 +:103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 +:103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 +:103F60000EC0853739F424D08EE10CD084E90AD014 +:103F700086E098CF813511F488E014D019D080E123 +:103F800001D06ACF982F8091C00085FFFCCF90931D +:103F9000C6000895A8958091C00087FFFCCF80914E +:103FA000C6000895E0E6F0E098E1908380830895EC +:103FB000F1DF803219F088E0F5DFFFCF84E1E2CF56 +:103FC0001F93182FE7DF1150E9F7F2DF1F910895D3 +:0A3FD00080E0E8DFEE27FF270994E8 :023FFE000104BC :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_lilypad.lst b/bootloaders/optiboot/optiboot_lilypad.lst index 75180bc..a70713a 100644 --- a/bootloaders/optiboot/optiboot_lilypad.lst +++ b/bootloaders/optiboot/optiboot_lilypad.lst @@ -3,27 +3,27 @@ optiboot_lilypad.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001fc 00003e00 00003e00 00000054 2**1 + 0 .text 000001da 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 00000250 2**0 + 1 .version 00000002 00003ffe 00003ffe 0000022e 2**0 CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000252 2**0 + 2 .debug_aranges 00000028 00000000 00000000 00000230 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000006a 00000000 00000000 0000027a 2**0 + 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 00000285 00000000 00000000 000002e4 2**0 + 4 .debug_info 0000028c 00000000 00000000 000002b7 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000019f 00000000 00000000 00000569 2**0 + 5 .debug_abbrev 00000199 00000000 00000000 00000543 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000453 00000000 00000000 00000708 2**0 + 6 .debug_line 00000456 00000000 00000000 000006dc 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000090 00000000 00000000 00000b5c 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b34 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000141 00000000 00000000 00000bec 2**0 + 8 .debug_str 00000149 00000000 00000000 00000bb4 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 000001e1 00000000 00000000 00000d2d 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000cfd 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000068 00000000 00000000 00000f0e 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f7b 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 3e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 3e06: 81 ff sbrs r24, 1 - 3e08: e6 d0 rcall .+460 ; 0x3fd6 + 3e08: e3 d0 rcall .+454 ; 0x3fd0 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -77,7 +77,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: cf d0 rcall .+414 ; 0x3fca + 3e2a: bc d0 rcall .+376 ; 0x3fa4 /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -111,8 +111,8 @@ void flash_led(uint8_t count) { #else LED_PIN |= _BV(LED); 3e44: 1d 9a sbi 0x03, 5 ; 3 - return getch(); } +#endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { @@ -132,8 +132,8 @@ void watchdogReset() { if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 3e4c: dd 24 eor r13, r13 - 3e4e: d3 94 inc r13 + 3e4c: 99 24 eor r9, r9 + 3e4e: 93 94 inc r9 __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); @@ -141,21 +141,21 @@ void watchdogReset() { // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 3e50: a5 e0 ldi r26, 0x05 ; 5 - 3e52: ea 2e mov r14, r26 + 3e52: aa 2e mov r10, r26 boot_spm_busy_wait(); #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); 3e54: f1 e1 ldi r31, 0x11 ; 17 - 3e56: ff 2e mov r15, r31 + 3e56: bf 2e mov r11, r31 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 3e58: ab d0 rcall .+342 ; 0x3fb0 + 3e58: 9d d0 rcall .+314 ; 0x3f94 if(ch == STK_GET_PARAMETER) { 3e5a: 81 34 cpi r24, 0x41 ; 65 @@ -163,10 +163,10 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: c5 d0 rcall .+394 ; 0x3fec + 3e60: af d0 rcall .+350 ; 0x3fc0 putch(0x03); 3e62: 83 e0 ldi r24, 0x03 ; 3 - 3e64: 20 c0 rjmp .+64 ; 0x3ea6 + 3e64: 1f c0 rjmp .+62 ; 0x3ea4 } else if(ch == STK_SET_DEVICE) { 3e66: 82 34 cpi r24, 0x42 ; 66 @@ -182,71 +182,77 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: bb d0 rcall .+374 ; 0x3fec - 3e76: 91 c0 rjmp .+290 ; 0x3f9a + 3e74: a5 d0 rcall .+330 ; 0x3fc0 + 3e76: 83 c0 rjmp .+262 ; 0x3f7e } else if(ch == STK_LOAD_ADDRESS) { 3e78: 85 35 cpi r24, 0x55 ; 85 - 3e7a: 81 f4 brne .+32 ; 0x3e9c + 3e7a: 79 f4 brne .+30 ; 0x3e9a // LOAD ADDRESS uint16_t newAddress; newAddress = getch(); - 3e7c: 99 d0 rcall .+306 ; 0x3fb0 + 3e7c: 8b d0 rcall .+278 ; 0x3f94 newAddress = (newAddress & 0xff) | (getch() << 8); - 3e7e: 08 2f mov r16, r24 - 3e80: 10 e0 ldi r17, 0x00 ; 0 - 3e82: 96 d0 rcall .+300 ; 0x3fb0 - 3e84: 90 e0 ldi r25, 0x00 ; 0 - 3e86: 98 2f mov r25, r24 - 3e88: 88 27 eor r24, r24 - 3e8a: 80 2b or r24, r16 - 3e8c: 91 2b or r25, r17 + 3e7e: e8 2e mov r14, r24 + 3e80: ff 24 eor r15, r15 + 3e82: 88 d0 rcall .+272 ; 0x3f94 + 3e84: 08 2f mov r16, r24 + 3e86: 10 e0 ldi r17, 0x00 ; 0 + 3e88: 10 2f mov r17, r16 + 3e8a: 00 27 eor r16, r16 + 3e8c: 0e 29 or r16, r14 + 3e8e: 1f 29 or r17, r15 #ifdef RAMPZ // Transfer top bit to RAMPZ RAMPZ = (newAddress & 0x8000) ? 1 : 0; #endif newAddress += newAddress; // Convert from word address to byte address - 3e8e: 88 0f add r24, r24 - 3e90: 99 1f adc r25, r25 + 3e90: 00 0f add r16, r16 + 3e92: 11 1f adc r17, r17 address = newAddress; - 3e92: 90 93 01 02 sts 0x0201, r25 - 3e96: 80 93 00 02 sts 0x0200, r24 - 3e9a: 7e c0 rjmp .+252 ; 0x3f98 verifySpace(); + 3e94: 8d d0 rcall .+282 ; 0x3fb0 + 3e96: 68 01 movw r12, r16 + 3e98: 72 c0 rjmp .+228 ; 0x3f7e } else if(ch == STK_UNIVERSAL) { - 3e9c: 86 35 cpi r24, 0x56 ; 86 - 3e9e: 29 f4 brne .+10 ; 0x3eaa + 3e9a: 86 35 cpi r24, 0x56 ; 86 + 3e9c: 29 f4 brne .+10 ; 0x3ea8 // UNIVERSAL command is ignored getNch(4); - 3ea0: 84 e0 ldi r24, 0x04 ; 4 - 3ea2: a4 d0 rcall .+328 ; 0x3fec + 3e9e: 84 e0 ldi r24, 0x04 ; 4 + 3ea0: 8f d0 rcall .+286 ; 0x3fc0 putch(0x00); - 3ea4: 80 e0 ldi r24, 0x00 ; 0 - 3ea6: 7c d0 rcall .+248 ; 0x3fa0 - 3ea8: 78 c0 rjmp .+240 ; 0x3f9a + 3ea2: 80 e0 ldi r24, 0x00 ; 0 + 3ea4: 6f d0 rcall .+222 ; 0x3f84 + 3ea6: 6b c0 rjmp .+214 ; 0x3f7e } /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 3eaa: 84 36 cpi r24, 0x64 ; 100 - 3eac: 09 f0 breq .+2 ; 0x3eb0 - 3eae: 4e c0 rjmp .+156 ; 0x3f4c + 3ea8: 84 36 cpi r24, 0x64 ; 100 + 3eaa: 09 f0 breq .+2 ; 0x3eae + 3eac: 42 c0 rjmp .+132 ; 0x3f32 // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; - getLen(); - 3eb0: 87 d0 rcall .+270 ; 0x3fc0 + getch(); /* getlen() */ + 3eae: 72 d0 rcall .+228 ; 0x3f94 + length = getch(); + 3eb0: 71 d0 rcall .+226 ; 0x3f94 + 3eb2: 08 2f mov r16, r24 + getch(); + 3eb4: 6f d0 rcall .+222 ; 0x3f94 // If we are in RWW section, immediately start page erase if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3eb2: e0 91 00 02 lds r30, 0x0200 - 3eb6: f0 91 01 02 lds r31, 0x0201 + 3eb6: 80 e0 ldi r24, 0x00 ; 0 + 3eb8: c8 16 cp r12, r24 3eba: 88 e3 ldi r24, 0x38 ; 56 - 3ebc: e0 30 cpi r30, 0x00 ; 0 - 3ebe: f8 07 cpc r31, r24 - 3ec0: 18 f4 brcc .+6 ; 0x3ec8 - 3ec2: 83 e0 ldi r24, 0x03 ; 3 + 3ebc: d8 06 cpc r13, r24 + 3ebe: 20 f4 brcc .+8 ; 0x3ec8 + 3ec0: 83 e0 ldi r24, 0x03 ; 3 + 3ec2: f6 01 movw r30, r12 3ec4: 87 bf out 0x37, r24 ; 55 3ec6: e8 95 spm 3ec8: c0 e0 ldi r28, 0x00 ; 0 @@ -255,302 +261,301 @@ void watchdogReset() { // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 3ecc: 71 d0 rcall .+226 ; 0x3fb0 + 3ecc: 63 d0 rcall .+198 ; 0x3f94 3ece: 89 93 st Y+, r24 while (--length); - 3ed0: 80 91 02 02 lds r24, 0x0202 - 3ed4: 81 50 subi r24, 0x01 ; 1 - 3ed6: 80 93 02 02 sts 0x0202, r24 - 3eda: 88 23 and r24, r24 - 3edc: b9 f7 brne .-18 ; 0x3ecc + 3ed0: 0c 17 cp r16, r28 + 3ed2: e1 f7 brne .-8 ; 0x3ecc // If we are in NRWW section, page erase has to be delayed until now. // Todo: Take RAMPZ into account if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3ede: e0 91 00 02 lds r30, 0x0200 - 3ee2: f0 91 01 02 lds r31, 0x0201 - 3ee6: 88 e3 ldi r24, 0x38 ; 56 - 3ee8: e0 30 cpi r30, 0x00 ; 0 - 3eea: f8 07 cpc r31, r24 - 3eec: 18 f0 brcs .+6 ; 0x3ef4 - 3eee: 83 e0 ldi r24, 0x03 ; 3 - 3ef0: 87 bf out 0x37, r24 ; 55 - 3ef2: e8 95 spm + 3ed4: f0 e0 ldi r31, 0x00 ; 0 + 3ed6: cf 16 cp r12, r31 + 3ed8: f8 e3 ldi r31, 0x38 ; 56 + 3eda: df 06 cpc r13, r31 + 3edc: 20 f0 brcs .+8 ; 0x3ee6 + 3ede: 83 e0 ldi r24, 0x03 ; 3 + 3ee0: f6 01 movw r30, r12 + 3ee2: 87 bf out 0x37, r24 ; 55 + 3ee4: e8 95 spm // Read command terminator, start reply verifySpace(); - 3ef4: 75 d0 rcall .+234 ; 0x3fe0 + 3ee6: 64 d0 rcall .+200 ; 0x3fb0 // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 3ef6: 07 b6 in r0, 0x37 ; 55 - 3ef8: 00 fc sbrc r0, 0 - 3efa: fd cf rjmp .-6 ; 0x3ef6 - } -#endif - - // Copy buffer into programming buffer + 3ee8: 07 b6 in r0, 0x37 ; 55 + 3eea: 00 fc sbrc r0, 0 + 3eec: fd cf rjmp .-6 ; 0x3ee8 + 3eee: a6 01 movw r20, r12 + 3ef0: a0 e0 ldi r26, 0x00 ; 0 + 3ef2: b1 e0 ldi r27, 0x01 ; 1 bufPtr = buff; addrPtr = (uint16_t)(void*)address; - 3efc: 40 91 00 02 lds r20, 0x0200 - 3f00: 50 91 01 02 lds r21, 0x0201 - 3f04: a0 e0 ldi r26, 0x00 ; 0 - 3f06: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 3f08: 2c 91 ld r18, X - 3f0a: 30 e0 ldi r19, 0x00 ; 0 + 3ef4: 2c 91 ld r18, X + 3ef6: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 3f0c: 11 96 adiw r26, 0x01 ; 1 - 3f0e: 8c 91 ld r24, X - 3f10: 11 97 sbiw r26, 0x01 ; 1 - 3f12: 90 e0 ldi r25, 0x00 ; 0 - 3f14: 98 2f mov r25, r24 - 3f16: 88 27 eor r24, r24 - 3f18: 82 2b or r24, r18 - 3f1a: 93 2b or r25, r19 + 3ef8: 11 96 adiw r26, 0x01 ; 1 + 3efa: 8c 91 ld r24, X + 3efc: 11 97 sbiw r26, 0x01 ; 1 + 3efe: 90 e0 ldi r25, 0x00 ; 0 + 3f00: 98 2f mov r25, r24 + 3f02: 88 27 eor r24, r24 + 3f04: 82 2b or r24, r18 + 3f06: 93 2b or r25, r19 #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 3f1c: 12 96 adiw r26, 0x02 ; 2 + 3f08: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f1e: fa 01 movw r30, r20 - 3f20: 0c 01 movw r0, r24 - 3f22: d7 be out 0x37, r13 ; 55 - 3f24: e8 95 spm - 3f26: 11 24 eor r1, r1 + 3f0a: fa 01 movw r30, r20 + 3f0c: 0c 01 movw r0, r24 + 3f0e: 97 be out 0x37, r9 ; 55 + 3f10: e8 95 spm + 3f12: 11 24 eor r1, r1 addrPtr += 2; - 3f28: 4e 5f subi r20, 0xFE ; 254 - 3f2a: 5f 4f sbci r21, 0xFF ; 255 + 3f14: 4e 5f subi r20, 0xFE ; 254 + 3f16: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 3f2c: f1 e0 ldi r31, 0x01 ; 1 - 3f2e: a0 38 cpi r26, 0x80 ; 128 - 3f30: bf 07 cpc r27, r31 - 3f32: 51 f7 brne .-44 ; 0x3f08 + 3f18: f1 e0 ldi r31, 0x01 ; 1 + 3f1a: a0 38 cpi r26, 0x80 ; 128 + 3f1c: bf 07 cpc r27, r31 + 3f1e: 51 f7 brne .-44 ; 0x3ef4 // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 3f34: e0 91 00 02 lds r30, 0x0200 - 3f38: f0 91 01 02 lds r31, 0x0201 - 3f3c: e7 be out 0x37, r14 ; 55 - 3f3e: e8 95 spm + 3f20: f6 01 movw r30, r12 + 3f22: a7 be out 0x37, r10 ; 55 + 3f24: e8 95 spm boot_spm_busy_wait(); - 3f40: 07 b6 in r0, 0x37 ; 55 - 3f42: 00 fc sbrc r0, 0 - 3f44: fd cf rjmp .-6 ; 0x3f40 + 3f26: 07 b6 in r0, 0x37 ; 55 + 3f28: 00 fc sbrc r0, 0 + 3f2a: fd cf rjmp .-6 ; 0x3f26 #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 3f46: f7 be out 0x37, r15 ; 55 - 3f48: e8 95 spm - 3f4a: 27 c0 rjmp .+78 ; 0x3f9a + 3f2c: b7 be out 0x37, r11 ; 55 + 3f2e: e8 95 spm + 3f30: 26 c0 rjmp .+76 ; 0x3f7e #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 3f4c: 84 37 cpi r24, 0x74 ; 116 - 3f4e: b9 f4 brne .+46 ; 0x3f7e + 3f32: 84 37 cpi r24, 0x74 ; 116 + 3f34: b1 f4 brne .+44 ; 0x3f62 // READ PAGE - we only read flash - getLen(); - 3f50: 37 d0 rcall .+110 ; 0x3fc0 + getch(); /* getlen() */ + 3f36: 2e d0 rcall .+92 ; 0x3f94 + length = getch(); + 3f38: 2d d0 rcall .+90 ; 0x3f94 + 3f3a: f8 2e mov r15, r24 + getch(); + 3f3c: 2b d0 rcall .+86 ; 0x3f94 + verifySpace(); - 3f52: 46 d0 rcall .+140 ; 0x3fe0 + 3f3e: 38 d0 rcall .+112 ; 0x3fb0 + 3f40: f6 01 movw r30, r12 + 3f42: ef 2c mov r14, r15 putch(result); address++; } while (--length); #else do putch(pgm_read_byte_near(address++)); - 3f54: e0 91 00 02 lds r30, 0x0200 - 3f58: f0 91 01 02 lds r31, 0x0201 - 3f5c: 31 96 adiw r30, 0x01 ; 1 - 3f5e: f0 93 01 02 sts 0x0201, r31 - 3f62: e0 93 00 02 sts 0x0200, r30 - 3f66: 31 97 sbiw r30, 0x01 ; 1 - 3f68: e4 91 lpm r30, Z+ - 3f6a: 8e 2f mov r24, r30 - 3f6c: 19 d0 rcall .+50 ; 0x3fa0 + 3f44: 8f 01 movw r16, r30 + 3f46: 0f 5f subi r16, 0xFF ; 255 + 3f48: 1f 4f sbci r17, 0xFF ; 255 + 3f4a: 84 91 lpm r24, Z+ + 3f4c: 1b d0 rcall .+54 ; 0x3f84 while (--length); - 3f6e: 80 91 02 02 lds r24, 0x0202 - 3f72: 81 50 subi r24, 0x01 ; 1 - 3f74: 80 93 02 02 sts 0x0202, r24 - 3f78: 88 23 and r24, r24 - 3f7a: 61 f7 brne .-40 ; 0x3f54 - 3f7c: 0e c0 rjmp .+28 ; 0x3f9a + 3f4e: ea 94 dec r14 + 3f50: f8 01 movw r30, r16 + 3f52: c1 f7 brne .-16 ; 0x3f44 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) +#endif + +/* main program starts here */ +int main(void) { + 3f54: 08 94 sec + 3f56: c1 1c adc r12, r1 + 3f58: d1 1c adc r13, r1 + 3f5a: fa 94 dec r15 + 3f5c: cf 0c add r12, r15 + 3f5e: d1 1c adc r13, r1 + 3f60: 0e c0 rjmp .+28 ; 0x3f7e #endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 3f7e: 85 37 cpi r24, 0x75 ; 117 - 3f80: 39 f4 brne .+14 ; 0x3f90 + 3f62: 85 37 cpi r24, 0x75 ; 117 + 3f64: 39 f4 brne .+14 ; 0x3f74 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 3f82: 2e d0 rcall .+92 ; 0x3fe0 + 3f66: 24 d0 rcall .+72 ; 0x3fb0 putch(SIGNATURE_0); - 3f84: 8e e1 ldi r24, 0x1E ; 30 - 3f86: 0c d0 rcall .+24 ; 0x3fa0 + 3f68: 8e e1 ldi r24, 0x1E ; 30 + 3f6a: 0c d0 rcall .+24 ; 0x3f84 putch(SIGNATURE_1); - 3f88: 84 e9 ldi r24, 0x94 ; 148 - 3f8a: 0a d0 rcall .+20 ; 0x3fa0 + 3f6c: 84 e9 ldi r24, 0x94 ; 148 + 3f6e: 0a d0 rcall .+20 ; 0x3f84 putch(SIGNATURE_2); - 3f8c: 86 e0 ldi r24, 0x06 ; 6 - 3f8e: 8b cf rjmp .-234 ; 0x3ea6 + 3f70: 86 e0 ldi r24, 0x06 ; 6 + 3f72: 98 cf rjmp .-208 ; 0x3ea4 } else if (ch == 'Q') { - 3f90: 81 35 cpi r24, 0x51 ; 81 - 3f92: 11 f4 brne .+4 ; 0x3f98 + 3f74: 81 35 cpi r24, 0x51 ; 81 + 3f76: 11 f4 brne .+4 ; 0x3f7c // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 3f94: 88 e0 ldi r24, 0x08 ; 8 - 3f96: 19 d0 rcall .+50 ; 0x3fca + 3f78: 88 e0 ldi r24, 0x08 ; 8 + 3f7a: 14 d0 rcall .+40 ; 0x3fa4 verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 3f98: 23 d0 rcall .+70 ; 0x3fe0 + 3f7c: 19 d0 rcall .+50 ; 0x3fb0 } putch(STK_OK); - 3f9a: 80 e1 ldi r24, 0x10 ; 16 - 3f9c: 01 d0 rcall .+2 ; 0x3fa0 - 3f9e: 5c cf rjmp .-328 ; 0x3e58 + 3f7e: 80 e1 ldi r24, 0x10 ; 16 + 3f80: 01 d0 rcall .+2 ; 0x3f84 + 3f82: 6a cf rjmp .-300 ; 0x3e58 -00003fa0 : +00003f84 : } } void putch(char ch) { - 3fa0: 98 2f mov r25, r24 + 3f84: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); - 3fa2: 80 91 c0 00 lds r24, 0x00C0 - 3fa6: 85 ff sbrs r24, 5 - 3fa8: fc cf rjmp .-8 ; 0x3fa2 + 3f86: 80 91 c0 00 lds r24, 0x00C0 + 3f8a: 85 ff sbrs r24, 5 + 3f8c: fc cf rjmp .-8 ; 0x3f86 UDR0 = ch; - 3faa: 90 93 c6 00 sts 0x00C6, r25 + 3f8e: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 3fae: 08 95 ret + 3f92: 08 95 ret -00003fb0 : - return getch(); +00003f94 : } +#endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3fb0: a8 95 wdr + 3f94: a8 95 wdr [uartBit] "I" (UART_RX_BIT) : "r25" ); #else while(!(UCSR0A & _BV(RXC0))); - 3fb2: 80 91 c0 00 lds r24, 0x00C0 - 3fb6: 87 ff sbrs r24, 7 - 3fb8: fc cf rjmp .-8 ; 0x3fb2 + 3f96: 80 91 c0 00 lds r24, 0x00C0 + 3f9a: 87 ff sbrs r24, 7 + 3f9c: fc cf rjmp .-8 ; 0x3f96 ch = UDR0; - 3fba: 80 91 c6 00 lds r24, 0x00C6 + 3f9e: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 3fbe: 08 95 ret - -00003fc0 : - } while (--count); -} -#endif - -uint8_t getLen() { - getch(); - 3fc0: f7 df rcall .-18 ; 0x3fb0 - length = getch(); - 3fc2: f6 df rcall .-20 ; 0x3fb0 - 3fc4: 80 93 02 02 sts 0x0202, r24 - return getch(); -} - 3fc8: f3 cf rjmp .-26 ; 0x3fb0 + 3fa2: 08 95 ret -00003fca : +00003fa4 : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 3fca: e0 e6 ldi r30, 0x60 ; 96 - 3fcc: f0 e0 ldi r31, 0x00 ; 0 - 3fce: 98 e1 ldi r25, 0x18 ; 24 - 3fd0: 90 83 st Z, r25 + 3fa4: e0 e6 ldi r30, 0x60 ; 96 + 3fa6: f0 e0 ldi r31, 0x00 ; 0 + 3fa8: 98 e1 ldi r25, 0x18 ; 24 + 3faa: 90 83 st Z, r25 WDTCSR = x; - 3fd2: 80 83 st Z, r24 + 3fac: 80 83 st Z, r24 } - 3fd4: 08 95 ret - -00003fd6 : - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 3fd6: 80 e0 ldi r24, 0x00 ; 0 - 3fd8: f8 df rcall .-16 ; 0x3fca - __asm__ __volatile__ ( - 3fda: ee 27 eor r30, r30 - 3fdc: ff 27 eor r31, r31 - 3fde: 09 94 ijmp + 3fae: 08 95 ret -00003fe0 : +00003fb0 : do getch(); while (--count); verifySpace(); } void verifySpace() { - if (getch() != CRC_EOP) appStart(); - 3fe0: e7 df rcall .-50 ; 0x3fb0 - 3fe2: 80 32 cpi r24, 0x20 ; 32 - 3fe4: 09 f0 breq .+2 ; 0x3fe8 - 3fe6: f7 df rcall .-18 ; 0x3fd6 + if (getch() != CRC_EOP) { + 3fb0: f1 df rcall .-30 ; 0x3f94 + 3fb2: 80 32 cpi r24, 0x20 ; 32 + 3fb4: 19 f0 breq .+6 ; 0x3fbc + watchdogConfig(WATCHDOG_16MS); // shorten WD timeout + 3fb6: 88 e0 ldi r24, 0x08 ; 8 + 3fb8: f5 df rcall .-22 ; 0x3fa4 + 3fba: ff cf rjmp .-2 ; 0x3fba + while (1) // and busy-loop so that WD causes + ; // a reset and app start. + } putch(STK_INSYNC); - 3fe8: 84 e1 ldi r24, 0x14 ; 20 + 3fbc: 84 e1 ldi r24, 0x14 ; 20 } - 3fea: da cf rjmp .-76 ; 0x3fa0 + 3fbe: e2 cf rjmp .-60 ; 0x3f84 -00003fec : +00003fc0 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 3fec: 1f 93 push r17 - 3fee: 18 2f mov r17, r24 + 3fc0: 1f 93 push r17 + 3fc2: 18 2f mov r17, r24 do getch(); while (--count); - 3ff0: df df rcall .-66 ; 0x3fb0 - 3ff2: 11 50 subi r17, 0x01 ; 1 - 3ff4: e9 f7 brne .-6 ; 0x3ff0 + 3fc4: e7 df rcall .-50 ; 0x3f94 + 3fc6: 11 50 subi r17, 0x01 ; 1 + 3fc8: e9 f7 brne .-6 ; 0x3fc4 verifySpace(); - 3ff6: f4 df rcall .-24 ; 0x3fe0 + 3fca: f2 df rcall .-28 ; 0x3fb0 +} + 3fcc: 1f 91 pop r17 + 3fce: 08 95 ret + +00003fd0 : + WDTCSR = _BV(WDCE) | _BV(WDE); + WDTCSR = x; } - 3ff8: 1f 91 pop r17 - 3ffa: 08 95 ret + +void appStart() { + watchdogConfig(WATCHDOG_OFF); + 3fd0: 80 e0 ldi r24, 0x00 ; 0 + 3fd2: e8 df rcall .-48 ; 0x3fa4 + __asm__ __volatile__ ( + 3fd4: ee 27 eor r30, r30 + 3fd6: ff 27 eor r31, r31 + 3fd8: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_lilypad_resonator.hex b/bootloaders/optiboot/optiboot_lilypad_resonator.hex index 77897e7..dcdbbb4 100644 --- a/bootloaders/optiboot/optiboot_lilypad_resonator.hex +++ b/bootloaders/optiboot/optiboot_lilypad_resonator.hex @@ -1,35 +1,33 @@ -:103E0000112484B714BE81FFE6D085E08093810041 +:103E0000112484B714BE81FFE3D085E08093810044 :103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20088E08093C4008EE0CFD0259A86E05F +:103E2000C20088E08093C4008EE0BCD0259A86E072 :103E300028E13EEF91E0309385002093840096BB0B -:103E4000B09BFECF1D9AA8958150A9F7DD24D3948D -:103E5000A5E0EA2EF1E1FF2EABD0813421F481E020 -:103E6000C5D083E020C0823411F484E103C08534DE -:103E700019F485E0BBD091C0853581F499D0082F25 -:103E800010E096D090E0982F8827802B912B880FF8 -:103E9000991F90930102809300027EC0863529F419 -:103EA00084E0A4D080E07CD078C0843609F04EC095 -:103EB00087D0E0910002F091010288E3E030F8073A -:103EC00018F483E087BFE895C0E0D1E071D0899312 -:103ED000809102028150809302028823B9F7E09119 -:103EE0000002F091010288E3E030F80718F083E067 -:103EF00087BFE89575D007B600FCFDCF4091000262 -:103F000050910102A0E0B1E02C9130E011968C912B -:103F1000119790E0982F8827822B932B1296FA0105 -:103F20000C01D7BEE89511244E5F5F4FF1E0A03839 -:103F3000BF0751F7E0910002F0910102E7BEE8955A -:103F400007B600FCFDCFF7BEE89527C08437B9F46B -:103F500037D046D0E0910002F09101023196F09303 -:103F60000102E09300023197E4918E2F19D08091E5 -:103F70000202815080930202882361F70EC08537C8 -:103F800039F42ED08EE10CD084E90AD086E08BCFB4 -:103F9000813511F488E019D023D080E101D05CCFC5 -:103FA000982F8091C00085FFFCCF9093C6000895A4 -:103FB000A8958091C00087FFFCCF8091C60008952E -:103FC000F7DFF6DF80930202F3CFE0E6F0E098E15E -:103FD00090838083089580E0F8DFEE27FF2709941F -:103FE000E7DF803209F0F7DF84E1DACF1F93182F83 -:0C3FF000DFDF1150E9F7F4DF1F910895A6 +:103E4000B09BFECF1D9AA8958150A9F79924939411 +:103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE +:103E6000AFD083E01FC0823411F484E103C08534F5 +:103E700019F485E0A5D083C0853579F48BD0E82E80 +:103E8000FF2488D0082F10E0102F00270E291F29AB +:103E9000000F111F8DD0680172C0863529F484E0AF +:103EA0008FD080E06FD06BC0843609F042C072D0F2 +:103EB00071D0082F6FD080E0C81688E3D80620F4B0 +:103EC00083E0F60187BFE895C0E0D1E063D0899335 +:103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF +:103EE000F60187BFE89564D007B600FCFDCFA601B8 +:103EF000A0E0B1E02C9130E011968C91119790E008 +:103F0000982F8827822B932B1296FA010C0197BECB +:103F1000E89511244E5F5F4FF1E0A038BF0751F7DD +:103F2000F601A7BEE89507B600FCFDCFB7BEE89541 +:103F300026C08437B1F42ED02DD0F82E2BD038D017 +:103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 +:103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 +:103F60000EC0853739F424D08EE10CD084E90AD014 +:103F700086E098CF813511F488E014D019D080E123 +:103F800001D06ACF982F8091C00085FFFCCF90931D +:103F9000C6000895A8958091C00087FFFCCF80914E +:103FA000C6000895E0E6F0E098E1908380830895EC +:103FB000F1DF803219F088E0F5DFFFCF84E1E2CF56 +:103FC0001F93182FE7DF1150E9F7F2DF1F910895D3 +:0A3FD00080E0E8DFEE27FF270994E8 :023FFE000104BC :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_lilypad_resonator.lst b/bootloaders/optiboot/optiboot_lilypad_resonator.lst index 48c2778..2676838 100644 --- a/bootloaders/optiboot/optiboot_lilypad_resonator.lst +++ b/bootloaders/optiboot/optiboot_lilypad_resonator.lst @@ -3,27 +3,27 @@ optiboot_lilypad_resonator.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001fc 00003e00 00003e00 00000054 2**1 + 0 .text 000001da 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 00000250 2**0 + 1 .version 00000002 00003ffe 00003ffe 0000022e 2**0 CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000252 2**0 + 2 .debug_aranges 00000028 00000000 00000000 00000230 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000006a 00000000 00000000 0000027a 2**0 + 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 00000285 00000000 00000000 000002e4 2**0 + 4 .debug_info 0000028c 00000000 00000000 000002b7 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000019f 00000000 00000000 00000569 2**0 + 5 .debug_abbrev 00000199 00000000 00000000 00000543 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000453 00000000 00000000 00000708 2**0 + 6 .debug_line 00000456 00000000 00000000 000006dc 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000090 00000000 00000000 00000b5c 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b34 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000141 00000000 00000000 00000bec 2**0 + 8 .debug_str 00000149 00000000 00000000 00000bb4 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 000001e1 00000000 00000000 00000d2d 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000cfd 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000068 00000000 00000000 00000f0e 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f7b 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 3e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 3e06: 81 ff sbrs r24, 1 - 3e08: e6 d0 rcall .+460 ; 0x3fd6 + 3e08: e3 d0 rcall .+454 ; 0x3fd0 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -77,7 +77,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: cf d0 rcall .+414 ; 0x3fca + 3e2a: bc d0 rcall .+376 ; 0x3fa4 /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -111,8 +111,8 @@ void flash_led(uint8_t count) { #else LED_PIN |= _BV(LED); 3e44: 1d 9a sbi 0x03, 5 ; 3 - return getch(); } +#endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { @@ -132,8 +132,8 @@ void watchdogReset() { if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 3e4c: dd 24 eor r13, r13 - 3e4e: d3 94 inc r13 + 3e4c: 99 24 eor r9, r9 + 3e4e: 93 94 inc r9 __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); @@ -141,21 +141,21 @@ void watchdogReset() { // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 3e50: a5 e0 ldi r26, 0x05 ; 5 - 3e52: ea 2e mov r14, r26 + 3e52: aa 2e mov r10, r26 boot_spm_busy_wait(); #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); 3e54: f1 e1 ldi r31, 0x11 ; 17 - 3e56: ff 2e mov r15, r31 + 3e56: bf 2e mov r11, r31 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 3e58: ab d0 rcall .+342 ; 0x3fb0 + 3e58: 9d d0 rcall .+314 ; 0x3f94 if(ch == STK_GET_PARAMETER) { 3e5a: 81 34 cpi r24, 0x41 ; 65 @@ -163,10 +163,10 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: c5 d0 rcall .+394 ; 0x3fec + 3e60: af d0 rcall .+350 ; 0x3fc0 putch(0x03); 3e62: 83 e0 ldi r24, 0x03 ; 3 - 3e64: 20 c0 rjmp .+64 ; 0x3ea6 + 3e64: 1f c0 rjmp .+62 ; 0x3ea4 } else if(ch == STK_SET_DEVICE) { 3e66: 82 34 cpi r24, 0x42 ; 66 @@ -182,71 +182,77 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: bb d0 rcall .+374 ; 0x3fec - 3e76: 91 c0 rjmp .+290 ; 0x3f9a + 3e74: a5 d0 rcall .+330 ; 0x3fc0 + 3e76: 83 c0 rjmp .+262 ; 0x3f7e } else if(ch == STK_LOAD_ADDRESS) { 3e78: 85 35 cpi r24, 0x55 ; 85 - 3e7a: 81 f4 brne .+32 ; 0x3e9c + 3e7a: 79 f4 brne .+30 ; 0x3e9a // LOAD ADDRESS uint16_t newAddress; newAddress = getch(); - 3e7c: 99 d0 rcall .+306 ; 0x3fb0 + 3e7c: 8b d0 rcall .+278 ; 0x3f94 newAddress = (newAddress & 0xff) | (getch() << 8); - 3e7e: 08 2f mov r16, r24 - 3e80: 10 e0 ldi r17, 0x00 ; 0 - 3e82: 96 d0 rcall .+300 ; 0x3fb0 - 3e84: 90 e0 ldi r25, 0x00 ; 0 - 3e86: 98 2f mov r25, r24 - 3e88: 88 27 eor r24, r24 - 3e8a: 80 2b or r24, r16 - 3e8c: 91 2b or r25, r17 + 3e7e: e8 2e mov r14, r24 + 3e80: ff 24 eor r15, r15 + 3e82: 88 d0 rcall .+272 ; 0x3f94 + 3e84: 08 2f mov r16, r24 + 3e86: 10 e0 ldi r17, 0x00 ; 0 + 3e88: 10 2f mov r17, r16 + 3e8a: 00 27 eor r16, r16 + 3e8c: 0e 29 or r16, r14 + 3e8e: 1f 29 or r17, r15 #ifdef RAMPZ // Transfer top bit to RAMPZ RAMPZ = (newAddress & 0x8000) ? 1 : 0; #endif newAddress += newAddress; // Convert from word address to byte address - 3e8e: 88 0f add r24, r24 - 3e90: 99 1f adc r25, r25 + 3e90: 00 0f add r16, r16 + 3e92: 11 1f adc r17, r17 address = newAddress; - 3e92: 90 93 01 02 sts 0x0201, r25 - 3e96: 80 93 00 02 sts 0x0200, r24 - 3e9a: 7e c0 rjmp .+252 ; 0x3f98 verifySpace(); + 3e94: 8d d0 rcall .+282 ; 0x3fb0 + 3e96: 68 01 movw r12, r16 + 3e98: 72 c0 rjmp .+228 ; 0x3f7e } else if(ch == STK_UNIVERSAL) { - 3e9c: 86 35 cpi r24, 0x56 ; 86 - 3e9e: 29 f4 brne .+10 ; 0x3eaa + 3e9a: 86 35 cpi r24, 0x56 ; 86 + 3e9c: 29 f4 brne .+10 ; 0x3ea8 // UNIVERSAL command is ignored getNch(4); - 3ea0: 84 e0 ldi r24, 0x04 ; 4 - 3ea2: a4 d0 rcall .+328 ; 0x3fec + 3e9e: 84 e0 ldi r24, 0x04 ; 4 + 3ea0: 8f d0 rcall .+286 ; 0x3fc0 putch(0x00); - 3ea4: 80 e0 ldi r24, 0x00 ; 0 - 3ea6: 7c d0 rcall .+248 ; 0x3fa0 - 3ea8: 78 c0 rjmp .+240 ; 0x3f9a + 3ea2: 80 e0 ldi r24, 0x00 ; 0 + 3ea4: 6f d0 rcall .+222 ; 0x3f84 + 3ea6: 6b c0 rjmp .+214 ; 0x3f7e } /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 3eaa: 84 36 cpi r24, 0x64 ; 100 - 3eac: 09 f0 breq .+2 ; 0x3eb0 - 3eae: 4e c0 rjmp .+156 ; 0x3f4c + 3ea8: 84 36 cpi r24, 0x64 ; 100 + 3eaa: 09 f0 breq .+2 ; 0x3eae + 3eac: 42 c0 rjmp .+132 ; 0x3f32 // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; - getLen(); - 3eb0: 87 d0 rcall .+270 ; 0x3fc0 + getch(); /* getlen() */ + 3eae: 72 d0 rcall .+228 ; 0x3f94 + length = getch(); + 3eb0: 71 d0 rcall .+226 ; 0x3f94 + 3eb2: 08 2f mov r16, r24 + getch(); + 3eb4: 6f d0 rcall .+222 ; 0x3f94 // If we are in RWW section, immediately start page erase if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3eb2: e0 91 00 02 lds r30, 0x0200 - 3eb6: f0 91 01 02 lds r31, 0x0201 + 3eb6: 80 e0 ldi r24, 0x00 ; 0 + 3eb8: c8 16 cp r12, r24 3eba: 88 e3 ldi r24, 0x38 ; 56 - 3ebc: e0 30 cpi r30, 0x00 ; 0 - 3ebe: f8 07 cpc r31, r24 - 3ec0: 18 f4 brcc .+6 ; 0x3ec8 - 3ec2: 83 e0 ldi r24, 0x03 ; 3 + 3ebc: d8 06 cpc r13, r24 + 3ebe: 20 f4 brcc .+8 ; 0x3ec8 + 3ec0: 83 e0 ldi r24, 0x03 ; 3 + 3ec2: f6 01 movw r30, r12 3ec4: 87 bf out 0x37, r24 ; 55 3ec6: e8 95 spm 3ec8: c0 e0 ldi r28, 0x00 ; 0 @@ -255,302 +261,301 @@ void watchdogReset() { // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 3ecc: 71 d0 rcall .+226 ; 0x3fb0 + 3ecc: 63 d0 rcall .+198 ; 0x3f94 3ece: 89 93 st Y+, r24 while (--length); - 3ed0: 80 91 02 02 lds r24, 0x0202 - 3ed4: 81 50 subi r24, 0x01 ; 1 - 3ed6: 80 93 02 02 sts 0x0202, r24 - 3eda: 88 23 and r24, r24 - 3edc: b9 f7 brne .-18 ; 0x3ecc + 3ed0: 0c 17 cp r16, r28 + 3ed2: e1 f7 brne .-8 ; 0x3ecc // If we are in NRWW section, page erase has to be delayed until now. // Todo: Take RAMPZ into account if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3ede: e0 91 00 02 lds r30, 0x0200 - 3ee2: f0 91 01 02 lds r31, 0x0201 - 3ee6: 88 e3 ldi r24, 0x38 ; 56 - 3ee8: e0 30 cpi r30, 0x00 ; 0 - 3eea: f8 07 cpc r31, r24 - 3eec: 18 f0 brcs .+6 ; 0x3ef4 - 3eee: 83 e0 ldi r24, 0x03 ; 3 - 3ef0: 87 bf out 0x37, r24 ; 55 - 3ef2: e8 95 spm + 3ed4: f0 e0 ldi r31, 0x00 ; 0 + 3ed6: cf 16 cp r12, r31 + 3ed8: f8 e3 ldi r31, 0x38 ; 56 + 3eda: df 06 cpc r13, r31 + 3edc: 20 f0 brcs .+8 ; 0x3ee6 + 3ede: 83 e0 ldi r24, 0x03 ; 3 + 3ee0: f6 01 movw r30, r12 + 3ee2: 87 bf out 0x37, r24 ; 55 + 3ee4: e8 95 spm // Read command terminator, start reply verifySpace(); - 3ef4: 75 d0 rcall .+234 ; 0x3fe0 + 3ee6: 64 d0 rcall .+200 ; 0x3fb0 // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 3ef6: 07 b6 in r0, 0x37 ; 55 - 3ef8: 00 fc sbrc r0, 0 - 3efa: fd cf rjmp .-6 ; 0x3ef6 - } -#endif - - // Copy buffer into programming buffer + 3ee8: 07 b6 in r0, 0x37 ; 55 + 3eea: 00 fc sbrc r0, 0 + 3eec: fd cf rjmp .-6 ; 0x3ee8 + 3eee: a6 01 movw r20, r12 + 3ef0: a0 e0 ldi r26, 0x00 ; 0 + 3ef2: b1 e0 ldi r27, 0x01 ; 1 bufPtr = buff; addrPtr = (uint16_t)(void*)address; - 3efc: 40 91 00 02 lds r20, 0x0200 - 3f00: 50 91 01 02 lds r21, 0x0201 - 3f04: a0 e0 ldi r26, 0x00 ; 0 - 3f06: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 3f08: 2c 91 ld r18, X - 3f0a: 30 e0 ldi r19, 0x00 ; 0 + 3ef4: 2c 91 ld r18, X + 3ef6: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 3f0c: 11 96 adiw r26, 0x01 ; 1 - 3f0e: 8c 91 ld r24, X - 3f10: 11 97 sbiw r26, 0x01 ; 1 - 3f12: 90 e0 ldi r25, 0x00 ; 0 - 3f14: 98 2f mov r25, r24 - 3f16: 88 27 eor r24, r24 - 3f18: 82 2b or r24, r18 - 3f1a: 93 2b or r25, r19 + 3ef8: 11 96 adiw r26, 0x01 ; 1 + 3efa: 8c 91 ld r24, X + 3efc: 11 97 sbiw r26, 0x01 ; 1 + 3efe: 90 e0 ldi r25, 0x00 ; 0 + 3f00: 98 2f mov r25, r24 + 3f02: 88 27 eor r24, r24 + 3f04: 82 2b or r24, r18 + 3f06: 93 2b or r25, r19 #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 3f1c: 12 96 adiw r26, 0x02 ; 2 + 3f08: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f1e: fa 01 movw r30, r20 - 3f20: 0c 01 movw r0, r24 - 3f22: d7 be out 0x37, r13 ; 55 - 3f24: e8 95 spm - 3f26: 11 24 eor r1, r1 + 3f0a: fa 01 movw r30, r20 + 3f0c: 0c 01 movw r0, r24 + 3f0e: 97 be out 0x37, r9 ; 55 + 3f10: e8 95 spm + 3f12: 11 24 eor r1, r1 addrPtr += 2; - 3f28: 4e 5f subi r20, 0xFE ; 254 - 3f2a: 5f 4f sbci r21, 0xFF ; 255 + 3f14: 4e 5f subi r20, 0xFE ; 254 + 3f16: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 3f2c: f1 e0 ldi r31, 0x01 ; 1 - 3f2e: a0 38 cpi r26, 0x80 ; 128 - 3f30: bf 07 cpc r27, r31 - 3f32: 51 f7 brne .-44 ; 0x3f08 + 3f18: f1 e0 ldi r31, 0x01 ; 1 + 3f1a: a0 38 cpi r26, 0x80 ; 128 + 3f1c: bf 07 cpc r27, r31 + 3f1e: 51 f7 brne .-44 ; 0x3ef4 // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 3f34: e0 91 00 02 lds r30, 0x0200 - 3f38: f0 91 01 02 lds r31, 0x0201 - 3f3c: e7 be out 0x37, r14 ; 55 - 3f3e: e8 95 spm + 3f20: f6 01 movw r30, r12 + 3f22: a7 be out 0x37, r10 ; 55 + 3f24: e8 95 spm boot_spm_busy_wait(); - 3f40: 07 b6 in r0, 0x37 ; 55 - 3f42: 00 fc sbrc r0, 0 - 3f44: fd cf rjmp .-6 ; 0x3f40 + 3f26: 07 b6 in r0, 0x37 ; 55 + 3f28: 00 fc sbrc r0, 0 + 3f2a: fd cf rjmp .-6 ; 0x3f26 #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 3f46: f7 be out 0x37, r15 ; 55 - 3f48: e8 95 spm - 3f4a: 27 c0 rjmp .+78 ; 0x3f9a + 3f2c: b7 be out 0x37, r11 ; 55 + 3f2e: e8 95 spm + 3f30: 26 c0 rjmp .+76 ; 0x3f7e #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 3f4c: 84 37 cpi r24, 0x74 ; 116 - 3f4e: b9 f4 brne .+46 ; 0x3f7e + 3f32: 84 37 cpi r24, 0x74 ; 116 + 3f34: b1 f4 brne .+44 ; 0x3f62 // READ PAGE - we only read flash - getLen(); - 3f50: 37 d0 rcall .+110 ; 0x3fc0 + getch(); /* getlen() */ + 3f36: 2e d0 rcall .+92 ; 0x3f94 + length = getch(); + 3f38: 2d d0 rcall .+90 ; 0x3f94 + 3f3a: f8 2e mov r15, r24 + getch(); + 3f3c: 2b d0 rcall .+86 ; 0x3f94 + verifySpace(); - 3f52: 46 d0 rcall .+140 ; 0x3fe0 + 3f3e: 38 d0 rcall .+112 ; 0x3fb0 + 3f40: f6 01 movw r30, r12 + 3f42: ef 2c mov r14, r15 putch(result); address++; } while (--length); #else do putch(pgm_read_byte_near(address++)); - 3f54: e0 91 00 02 lds r30, 0x0200 - 3f58: f0 91 01 02 lds r31, 0x0201 - 3f5c: 31 96 adiw r30, 0x01 ; 1 - 3f5e: f0 93 01 02 sts 0x0201, r31 - 3f62: e0 93 00 02 sts 0x0200, r30 - 3f66: 31 97 sbiw r30, 0x01 ; 1 - 3f68: e4 91 lpm r30, Z+ - 3f6a: 8e 2f mov r24, r30 - 3f6c: 19 d0 rcall .+50 ; 0x3fa0 + 3f44: 8f 01 movw r16, r30 + 3f46: 0f 5f subi r16, 0xFF ; 255 + 3f48: 1f 4f sbci r17, 0xFF ; 255 + 3f4a: 84 91 lpm r24, Z+ + 3f4c: 1b d0 rcall .+54 ; 0x3f84 while (--length); - 3f6e: 80 91 02 02 lds r24, 0x0202 - 3f72: 81 50 subi r24, 0x01 ; 1 - 3f74: 80 93 02 02 sts 0x0202, r24 - 3f78: 88 23 and r24, r24 - 3f7a: 61 f7 brne .-40 ; 0x3f54 - 3f7c: 0e c0 rjmp .+28 ; 0x3f9a + 3f4e: ea 94 dec r14 + 3f50: f8 01 movw r30, r16 + 3f52: c1 f7 brne .-16 ; 0x3f44 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) +#endif + +/* main program starts here */ +int main(void) { + 3f54: 08 94 sec + 3f56: c1 1c adc r12, r1 + 3f58: d1 1c adc r13, r1 + 3f5a: fa 94 dec r15 + 3f5c: cf 0c add r12, r15 + 3f5e: d1 1c adc r13, r1 + 3f60: 0e c0 rjmp .+28 ; 0x3f7e #endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 3f7e: 85 37 cpi r24, 0x75 ; 117 - 3f80: 39 f4 brne .+14 ; 0x3f90 + 3f62: 85 37 cpi r24, 0x75 ; 117 + 3f64: 39 f4 brne .+14 ; 0x3f74 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 3f82: 2e d0 rcall .+92 ; 0x3fe0 + 3f66: 24 d0 rcall .+72 ; 0x3fb0 putch(SIGNATURE_0); - 3f84: 8e e1 ldi r24, 0x1E ; 30 - 3f86: 0c d0 rcall .+24 ; 0x3fa0 + 3f68: 8e e1 ldi r24, 0x1E ; 30 + 3f6a: 0c d0 rcall .+24 ; 0x3f84 putch(SIGNATURE_1); - 3f88: 84 e9 ldi r24, 0x94 ; 148 - 3f8a: 0a d0 rcall .+20 ; 0x3fa0 + 3f6c: 84 e9 ldi r24, 0x94 ; 148 + 3f6e: 0a d0 rcall .+20 ; 0x3f84 putch(SIGNATURE_2); - 3f8c: 86 e0 ldi r24, 0x06 ; 6 - 3f8e: 8b cf rjmp .-234 ; 0x3ea6 + 3f70: 86 e0 ldi r24, 0x06 ; 6 + 3f72: 98 cf rjmp .-208 ; 0x3ea4 } else if (ch == 'Q') { - 3f90: 81 35 cpi r24, 0x51 ; 81 - 3f92: 11 f4 brne .+4 ; 0x3f98 + 3f74: 81 35 cpi r24, 0x51 ; 81 + 3f76: 11 f4 brne .+4 ; 0x3f7c // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 3f94: 88 e0 ldi r24, 0x08 ; 8 - 3f96: 19 d0 rcall .+50 ; 0x3fca + 3f78: 88 e0 ldi r24, 0x08 ; 8 + 3f7a: 14 d0 rcall .+40 ; 0x3fa4 verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 3f98: 23 d0 rcall .+70 ; 0x3fe0 + 3f7c: 19 d0 rcall .+50 ; 0x3fb0 } putch(STK_OK); - 3f9a: 80 e1 ldi r24, 0x10 ; 16 - 3f9c: 01 d0 rcall .+2 ; 0x3fa0 - 3f9e: 5c cf rjmp .-328 ; 0x3e58 + 3f7e: 80 e1 ldi r24, 0x10 ; 16 + 3f80: 01 d0 rcall .+2 ; 0x3f84 + 3f82: 6a cf rjmp .-300 ; 0x3e58 -00003fa0 : +00003f84 : } } void putch(char ch) { - 3fa0: 98 2f mov r25, r24 + 3f84: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); - 3fa2: 80 91 c0 00 lds r24, 0x00C0 - 3fa6: 85 ff sbrs r24, 5 - 3fa8: fc cf rjmp .-8 ; 0x3fa2 + 3f86: 80 91 c0 00 lds r24, 0x00C0 + 3f8a: 85 ff sbrs r24, 5 + 3f8c: fc cf rjmp .-8 ; 0x3f86 UDR0 = ch; - 3faa: 90 93 c6 00 sts 0x00C6, r25 + 3f8e: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 3fae: 08 95 ret + 3f92: 08 95 ret -00003fb0 : - return getch(); +00003f94 : } +#endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3fb0: a8 95 wdr + 3f94: a8 95 wdr [uartBit] "I" (UART_RX_BIT) : "r25" ); #else while(!(UCSR0A & _BV(RXC0))); - 3fb2: 80 91 c0 00 lds r24, 0x00C0 - 3fb6: 87 ff sbrs r24, 7 - 3fb8: fc cf rjmp .-8 ; 0x3fb2 + 3f96: 80 91 c0 00 lds r24, 0x00C0 + 3f9a: 87 ff sbrs r24, 7 + 3f9c: fc cf rjmp .-8 ; 0x3f96 ch = UDR0; - 3fba: 80 91 c6 00 lds r24, 0x00C6 + 3f9e: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 3fbe: 08 95 ret - -00003fc0 : - } while (--count); -} -#endif - -uint8_t getLen() { - getch(); - 3fc0: f7 df rcall .-18 ; 0x3fb0 - length = getch(); - 3fc2: f6 df rcall .-20 ; 0x3fb0 - 3fc4: 80 93 02 02 sts 0x0202, r24 - return getch(); -} - 3fc8: f3 cf rjmp .-26 ; 0x3fb0 + 3fa2: 08 95 ret -00003fca : +00003fa4 : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 3fca: e0 e6 ldi r30, 0x60 ; 96 - 3fcc: f0 e0 ldi r31, 0x00 ; 0 - 3fce: 98 e1 ldi r25, 0x18 ; 24 - 3fd0: 90 83 st Z, r25 + 3fa4: e0 e6 ldi r30, 0x60 ; 96 + 3fa6: f0 e0 ldi r31, 0x00 ; 0 + 3fa8: 98 e1 ldi r25, 0x18 ; 24 + 3faa: 90 83 st Z, r25 WDTCSR = x; - 3fd2: 80 83 st Z, r24 + 3fac: 80 83 st Z, r24 } - 3fd4: 08 95 ret - -00003fd6 : - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 3fd6: 80 e0 ldi r24, 0x00 ; 0 - 3fd8: f8 df rcall .-16 ; 0x3fca - __asm__ __volatile__ ( - 3fda: ee 27 eor r30, r30 - 3fdc: ff 27 eor r31, r31 - 3fde: 09 94 ijmp + 3fae: 08 95 ret -00003fe0 : +00003fb0 : do getch(); while (--count); verifySpace(); } void verifySpace() { - if (getch() != CRC_EOP) appStart(); - 3fe0: e7 df rcall .-50 ; 0x3fb0 - 3fe2: 80 32 cpi r24, 0x20 ; 32 - 3fe4: 09 f0 breq .+2 ; 0x3fe8 - 3fe6: f7 df rcall .-18 ; 0x3fd6 + if (getch() != CRC_EOP) { + 3fb0: f1 df rcall .-30 ; 0x3f94 + 3fb2: 80 32 cpi r24, 0x20 ; 32 + 3fb4: 19 f0 breq .+6 ; 0x3fbc + watchdogConfig(WATCHDOG_16MS); // shorten WD timeout + 3fb6: 88 e0 ldi r24, 0x08 ; 8 + 3fb8: f5 df rcall .-22 ; 0x3fa4 + 3fba: ff cf rjmp .-2 ; 0x3fba + while (1) // and busy-loop so that WD causes + ; // a reset and app start. + } putch(STK_INSYNC); - 3fe8: 84 e1 ldi r24, 0x14 ; 20 + 3fbc: 84 e1 ldi r24, 0x14 ; 20 } - 3fea: da cf rjmp .-76 ; 0x3fa0 + 3fbe: e2 cf rjmp .-60 ; 0x3f84 -00003fec : +00003fc0 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 3fec: 1f 93 push r17 - 3fee: 18 2f mov r17, r24 + 3fc0: 1f 93 push r17 + 3fc2: 18 2f mov r17, r24 do getch(); while (--count); - 3ff0: df df rcall .-66 ; 0x3fb0 - 3ff2: 11 50 subi r17, 0x01 ; 1 - 3ff4: e9 f7 brne .-6 ; 0x3ff0 + 3fc4: e7 df rcall .-50 ; 0x3f94 + 3fc6: 11 50 subi r17, 0x01 ; 1 + 3fc8: e9 f7 brne .-6 ; 0x3fc4 verifySpace(); - 3ff6: f4 df rcall .-24 ; 0x3fe0 + 3fca: f2 df rcall .-28 ; 0x3fb0 +} + 3fcc: 1f 91 pop r17 + 3fce: 08 95 ret + +00003fd0 : + WDTCSR = _BV(WDCE) | _BV(WDE); + WDTCSR = x; } - 3ff8: 1f 91 pop r17 - 3ffa: 08 95 ret + +void appStart() { + watchdogConfig(WATCHDOG_OFF); + 3fd0: 80 e0 ldi r24, 0x00 ; 0 + 3fd2: e8 df rcall .-48 ; 0x3fa4 + __asm__ __volatile__ ( + 3fd4: ee 27 eor r30, r30 + 3fd6: ff 27 eor r31, r31 + 3fd8: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_luminet.hex b/bootloaders/optiboot/optiboot_luminet.hex index 0f901f4..843b2ef 100644 --- a/bootloaders/optiboot/optiboot_luminet.hex +++ b/bootloaders/optiboot/optiboot_luminet.hex @@ -1,42 +1,39 @@ -:10000000112484B714BE81FF22D185E08EBD8EE01D -:100010001AD1D49AD29A86E023EC3FEF91E03DBD0D +:10000000112484B714BE81FF18D185E08EBD8EE027 +:1000100000D1D49AD29A86E023EC3FEF91E03DBD27 :100020002CBD9BB9589BFECFCC9AA8958150B9F7AF -:10003000DD24D39485E0C82E0FE7F02E1EECE12ED0 -:10004000E9D0813421F481E00DD183E020C08234F5 -:1000500011F484E103C0853419F485E003D1C8C0EC -:10006000853581F4D7D0082F10E0D4D090E0982FB8 -:100070008827802B912B880F991F90938101809363 -:100080008001B5C0863529F484E0ECD080E0B3D09F -:10009000AFC0843609F06BC0D1D0C0E0D1E0BAD097 -:1000A0008993809182018150809382018823B9F7DE -:1000B000E0918001F091810183E087BFE895CCD089 -:1000C00007B600FCFDCF8091800190918101892BC2 -:1000D00041F5809100012091010130E0322F22276B -:1000E00090E0282B392B3093850120938401409197 -:1000F00008018091090190E0982F882750E0842B17 -:10010000952B909387018093860124503040209353 -:100110000801232F332720930901F0920001E09278 -:1001200001014091800150918101A0E0B1E02C914A -:1001300030E011968C91119790E0982F8827822BB0 -:10014000932B1296FA010C01D7BEE89511244E5F4D -:100150005F4FF1E0A034BF0751F7E0918001F091CB -:100160008101C7BEE89507B600FCFDCF41C08437CA -:1001700089F564D071D0E0918001F09181013097D0 -:1001800019F42091840113C0E130F10519F4209194 -:1001900085010DC0E830F10519F42091860107C0F2 -:1001A000E930F10519F42091870101C02491809173 -:1001B000800190918101019690938101809380014B -:1001C000822F19D0809182018150809382018823EF -:1001D00091F60EC0853739F43FD08EE10CD083E91B -:1001E0000AD08CE054CF813511F488E02CD034D083 -:1001F00080E101D025CF2AE030E08095089410F40A -:10020000DA9802C0DA9A000015D014D086952A95A3 -:10021000B1F70895A89529E030E0CB99FECF0AD038 -:1002200009D008D08894CB9908942A9511F0879525 -:10023000F7CF08959EE09A95F1F70895EBDFEADF96 -:1002400080938201E7CF98E191BD81BD089580E060 -:10025000FADFE4E0FF270994DDDF803209F0F7DF01 -:1002600084E1C9CF1F93182FD5DF1150E9F7F4DFD0 -:040270001F9108953D +:10003000BB24B39425E0A22E9FE7D92E8EECC82EC8 +:10004000D4D0813421F481E0F0D083E0B5C0823493 +:1000500011F484E103C0853419F485E0E6D0B3C01F +:10006000853569F4C2D0E82EFF24BFD0082F10E0F8 +:10007000102F00270E291F29000F111FA3C086353E +:1000800021F484E0D2D080E097C0843609F060C0CB +:10009000ACD0ABD0F82EA9D0C0E0D1E0A6D08993E7 +:1000A000FC16E1F783E0F80187BFE895B6D007B604 +:1000B00000FCFDCF0115110511F0A8012AC08091A7 +:1000C00000012091010130E0322F222790E0282BFF +:1000D000392B309385012093840140910801809150 +:1000E000090190E0982F882750E0842B952B90935E +:1000F0008701809386012450304020930801232FEC +:10010000332720930901D0920001C092010140E001 +:1001100050E0A0E0B1E02C9130E011968C91119765 +:1001200090E0982F8827822B932B1296FA010C01CE +:10013000B7BEE89511244E5F5F4FF1E0A034BF07D2 +:1001400051F7F801A7BEE89507B600FCFDCF3BC00C +:10015000843751F54AD049D0F82E47D05ED0E80117 +:10016000EF2C209719F48091840114C0C130D1057F +:1001700019F4809185010EC0C830D10519F4809121 +:10018000860108C0C930D10519F48091870102C0E9 +:10019000FE01849121961AD0EA9419F70F5F1F4F40 +:1001A000FA940F0D111D0FC0853741F436D08EE142 +:1001B0000DD083E90BD08CE009D005C0813511F456 +:1001C00088E027D02AD080E101D03ACF2AE030E081 +:1001D0008095089410F4DA9802C0DA9A000015D0DD +:1001E00014D086952A95B1F70895A89529E030E0B6 +:1001F000CB99FECF0AD009D008D08894CB99089427 +:100200002A9511F08795F7CF08959EE09A95F1F71A +:10021000089598E191BD81BD0895E7DF803219F01E +:1002200088E0F7DFFFCF84E1D1CF1F93182FDDDF08 +:100230001150E9F7F2DF1F91089580E0EADFE4E072 +:04024000FF270994F7 :021EFE000104DD :00000001FF diff --git a/bootloaders/optiboot/optiboot_luminet.lst b/bootloaders/optiboot/optiboot_luminet.lst index 1be7e4f..8333670 100644 --- a/bootloaders/optiboot/optiboot_luminet.lst +++ b/bootloaders/optiboot/optiboot_luminet.lst @@ -3,27 +3,27 @@ optiboot_luminet.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .version 00000002 00001efe 00001efe 000002c8 2**0 + 0 .version 00000002 00001efe 00001efe 00000298 2**0 CONTENTS, READONLY - 1 .text 00000274 00000000 00000000 00000054 2**1 + 1 .text 00000244 00000000 00000000 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 2 .debug_aranges 00000028 00000000 00000000 000002ca 2**0 + 2 .debug_aranges 00000028 00000000 00000000 0000029a 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 00000078 00000000 00000000 000002f2 2**0 + 3 .debug_pubnames 0000006d 00000000 00000000 000002c2 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 000002a5 00000000 00000000 0000036a 2**0 + 4 .debug_info 000002b0 00000000 00000000 0000032f 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000019d 00000000 00000000 0000060f 2**0 + 5 .debug_abbrev 00000197 00000000 00000000 000005df 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 000004ac 00000000 00000000 000007ac 2**0 + 6 .debug_line 000004a7 00000000 00000000 00000776 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 000000a0 00000000 00000000 00000c58 2**2 + 7 .debug_frame 00000090 00000000 00000000 00000c20 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000150 00000000 00000000 00000cf8 2**0 + 8 .debug_str 00000158 00000000 00000000 00000cb0 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 00000194 00000000 00000000 00000e48 2**0 + 9 .debug_loc 00000268 00000000 00000000 00000e08 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000088 00000000 00000000 00000fdc 2**0 + 10 .debug_ranges 00000080 00000000 00000000 00001070 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 4: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 6: 81 ff sbrs r24, 1 - 8: 22 d1 rcall .+580 ; 0x24e + 8: 18 d1 rcall .+560 ; 0x23a #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -61,7 +61,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); e: 8e e0 ldi r24, 0x0E ; 14 - 10: 1a d1 rcall .+564 ; 0x246 + 10: 00 d1 rcall .+512 ; 0x212 /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -100,8 +100,8 @@ void flash_led(uint8_t count) { #else LED_PIN |= _BV(LED); 28: cc 9a sbi 0x19, 4 ; 25 - return getch(); } +#endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { @@ -121,34 +121,34 @@ void watchdogReset() { if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 30: dd 24 eor r13, r13 - 32: d3 94 inc r13 + 30: bb 24 eor r11, r11 + 32: b3 94 inc r11 __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 34: 85 e0 ldi r24, 0x05 ; 5 - 36: c8 2e mov r12, r24 + 34: 25 e0 ldi r18, 0x05 ; 5 + 36: a2 2e mov r10, r18 vect -= 4; // Instruction is a relative jump (rjmp), so recalculate. buff[8] = vect & 0xff; buff[9] = vect >> 8; // Add jump to bootloader at RESET vector buff[0] = 0x7f; - 38: 0f e7 ldi r16, 0x7F ; 127 - 3a: f0 2e mov r15, r16 + 38: 9f e7 ldi r25, 0x7F ; 127 + 3a: d9 2e mov r13, r25 buff[1] = 0xce; // rjmp 0x1d00 instruction - 3c: 1e ec ldi r17, 0xCE ; 206 - 3e: e1 2e mov r14, r17 + 3c: 8e ec ldi r24, 0xCE ; 206 + 3e: c8 2e mov r12, r24 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 40: e9 d0 rcall .+466 ; 0x214 + 40: d4 d0 rcall .+424 ; 0x1ea if(ch == STK_GET_PARAMETER) { 42: 81 34 cpi r24, 0x41 ; 65 @@ -156,10 +156,10 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 46: 81 e0 ldi r24, 0x01 ; 1 - 48: 0d d1 rcall .+538 ; 0x264 + 48: f0 d0 rcall .+480 ; 0x22a putch(0x03); 4a: 83 e0 ldi r24, 0x03 ; 3 - 4c: 20 c0 rjmp .+64 ; 0x8e <__SREG__+0x4f> + 4c: b5 c0 rjmp .+362 ; 0x1b8 <__SREG__+0x179> } else if(ch == STK_SET_DEVICE) { 4e: 82 34 cpi r24, 0x42 ; 66 @@ -175,450 +175,450 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 5a: 85 e0 ldi r24, 0x05 ; 5 - 5c: 03 d1 rcall .+518 ; 0x264 - 5e: c8 c0 rjmp .+400 ; 0x1f0 <__SREG__+0x1b1> + 5c: e6 d0 rcall .+460 ; 0x22a + 5e: b3 c0 rjmp .+358 ; 0x1c6 <__SREG__+0x187> } else if(ch == STK_LOAD_ADDRESS) { 60: 85 35 cpi r24, 0x55 ; 85 - 62: 81 f4 brne .+32 ; 0x84 <__SREG__+0x45> + 62: 69 f4 brne .+26 ; 0x7e <__SREG__+0x3f> // LOAD ADDRESS uint16_t newAddress; newAddress = getch(); - 64: d7 d0 rcall .+430 ; 0x214 + 64: c2 d0 rcall .+388 ; 0x1ea newAddress = (newAddress & 0xff) | (getch() << 8); - 66: 08 2f mov r16, r24 - 68: 10 e0 ldi r17, 0x00 ; 0 - 6a: d4 d0 rcall .+424 ; 0x214 - 6c: 90 e0 ldi r25, 0x00 ; 0 - 6e: 98 2f mov r25, r24 - 70: 88 27 eor r24, r24 - 72: 80 2b or r24, r16 - 74: 91 2b or r25, r17 + 66: e8 2e mov r14, r24 + 68: ff 24 eor r15, r15 + 6a: bf d0 rcall .+382 ; 0x1ea + 6c: 08 2f mov r16, r24 + 6e: 10 e0 ldi r17, 0x00 ; 0 + 70: 10 2f mov r17, r16 + 72: 00 27 eor r16, r16 + 74: 0e 29 or r16, r14 + 76: 1f 29 or r17, r15 #ifdef RAMPZ // Transfer top bit to RAMPZ RAMPZ = (newAddress & 0x8000) ? 1 : 0; #endif newAddress += newAddress; // Convert from word address to byte address - 76: 88 0f add r24, r24 - 78: 99 1f adc r25, r25 + 78: 00 0f add r16, r16 + 7a: 11 1f adc r17, r17 + 7c: a3 c0 rjmp .+326 ; 0x1c4 <__SREG__+0x185> address = newAddress; - 7a: 90 93 81 01 sts 0x0181, r25 - 7e: 80 93 80 01 sts 0x0180, r24 - 82: b5 c0 rjmp .+362 ; 0x1ee <__SREG__+0x1af> verifySpace(); } else if(ch == STK_UNIVERSAL) { - 84: 86 35 cpi r24, 0x56 ; 86 - 86: 29 f4 brne .+10 ; 0x92 <__SREG__+0x53> + 7e: 86 35 cpi r24, 0x56 ; 86 + 80: 21 f4 brne .+8 ; 0x8a <__SREG__+0x4b> // UNIVERSAL command is ignored getNch(4); - 88: 84 e0 ldi r24, 0x04 ; 4 - 8a: ec d0 rcall .+472 ; 0x264 + 82: 84 e0 ldi r24, 0x04 ; 4 + 84: d2 d0 rcall .+420 ; 0x22a putch(0x00); - 8c: 80 e0 ldi r24, 0x00 ; 0 - 8e: b3 d0 rcall .+358 ; 0x1f6 - 90: af c0 rjmp .+350 ; 0x1f0 <__SREG__+0x1b1> + 86: 80 e0 ldi r24, 0x00 ; 0 + 88: 97 c0 rjmp .+302 ; 0x1b8 <__SREG__+0x179> } /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 92: 84 36 cpi r24, 0x64 ; 100 - 94: 09 f0 breq .+2 ; 0x98 <__SREG__+0x59> - 96: 6b c0 rjmp .+214 ; 0x16e <__SREG__+0x12f> + 8a: 84 36 cpi r24, 0x64 ; 100 + 8c: 09 f0 breq .+2 ; 0x90 <__SREG__+0x51> + 8e: 60 c0 rjmp .+192 ; 0x150 <__SREG__+0x111> // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; - getLen(); - 98: d1 d0 rcall .+418 ; 0x23c - 9a: c0 e0 ldi r28, 0x00 ; 0 - 9c: d1 e0 ldi r29, 0x01 ; 1 + getch(); /* getlen() */ + 90: ac d0 rcall .+344 ; 0x1ea + length = getch(); + 92: ab d0 rcall .+342 ; 0x1ea + 94: f8 2e mov r15, r24 + getch(); + 96: a9 d0 rcall .+338 ; 0x1ea + 98: c0 e0 ldi r28, 0x00 ; 0 + 9a: d1 e0 ldi r29, 0x01 ; 1 // If we are in RWW section, immediately start page erase if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 9e: ba d0 rcall .+372 ; 0x214 - a0: 89 93 st Y+, r24 + 9c: a6 d0 rcall .+332 ; 0x1ea + 9e: 89 93 st Y+, r24 while (--length); - a2: 80 91 82 01 lds r24, 0x0182 - a6: 81 50 subi r24, 0x01 ; 1 - a8: 80 93 82 01 sts 0x0182, r24 - ac: 88 23 and r24, r24 - ae: b9 f7 brne .-18 ; 0x9e <__SREG__+0x5f> + a0: fc 16 cp r15, r28 + a2: e1 f7 brne .-8 ; 0x9c <__SREG__+0x5d> // If we are in NRWW section, page erase has to be delayed until now. // Todo: Take RAMPZ into account if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - b0: e0 91 80 01 lds r30, 0x0180 - b4: f0 91 81 01 lds r31, 0x0181 - b8: 83 e0 ldi r24, 0x03 ; 3 - ba: 87 bf out 0x37, r24 ; 55 - bc: e8 95 spm + a4: 83 e0 ldi r24, 0x03 ; 3 + a6: f8 01 movw r30, r16 + a8: 87 bf out 0x37, r24 ; 55 + aa: e8 95 spm // Read command terminator, start reply verifySpace(); - be: cc d0 rcall .+408 ; 0x258 + ac: b6 d0 rcall .+364 ; 0x21a // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - c0: 07 b6 in r0, 0x37 ; 55 - c2: 00 fc sbrc r0, 0 - c4: fd cf rjmp .-6 ; 0xc0 <__SREG__+0x81> + ae: 07 b6 in r0, 0x37 ; 55 + b0: 00 fc sbrc r0, 0 + b2: fd cf rjmp .-6 ; 0xae <__SREG__+0x6f> #ifdef VIRTUAL_BOOT_PARTITION if ((uint16_t)(void*)address == 0) { - c6: 80 91 80 01 lds r24, 0x0180 - ca: 90 91 81 01 lds r25, 0x0181 - ce: 89 2b or r24, r25 - d0: 41 f5 brne .+80 ; 0x122 <__SREG__+0xe3> + b4: 01 15 cp r16, r1 + b6: 11 05 cpc r17, r1 + b8: 11 f0 breq .+4 ; 0xbe <__SREG__+0x7f> + ba: a8 01 movw r20, r16 + bc: 2a c0 rjmp .+84 ; 0x112 <__SREG__+0xd3> // This is the reset vector page. We need to live-patch the code so the // bootloader runs. // // Move RESET vector to WDT vector uint16_t vect = buff[0] | (buff[1]<<8); - d2: 80 91 00 01 lds r24, 0x0100 - d6: 20 91 01 01 lds r18, 0x0101 - da: 30 e0 ldi r19, 0x00 ; 0 - dc: 32 2f mov r19, r18 - de: 22 27 eor r18, r18 - e0: 90 e0 ldi r25, 0x00 ; 0 - e2: 28 2b or r18, r24 - e4: 39 2b or r19, r25 + be: 80 91 00 01 lds r24, 0x0100 + c2: 20 91 01 01 lds r18, 0x0101 + c6: 30 e0 ldi r19, 0x00 ; 0 + c8: 32 2f mov r19, r18 + ca: 22 27 eor r18, r18 + cc: 90 e0 ldi r25, 0x00 ; 0 + ce: 28 2b or r18, r24 + d0: 39 2b or r19, r25 rstVect = vect; - e6: 30 93 85 01 sts 0x0185, r19 - ea: 20 93 84 01 sts 0x0184, r18 + d2: 30 93 85 01 sts 0x0185, r19 + d6: 20 93 84 01 sts 0x0184, r18 wdtVect = buff[8] | (buff[9]<<8); - ee: 40 91 08 01 lds r20, 0x0108 - f2: 80 91 09 01 lds r24, 0x0109 - f6: 90 e0 ldi r25, 0x00 ; 0 - f8: 98 2f mov r25, r24 - fa: 88 27 eor r24, r24 - fc: 50 e0 ldi r21, 0x00 ; 0 - fe: 84 2b or r24, r20 - 100: 95 2b or r25, r21 - 102: 90 93 87 01 sts 0x0187, r25 - 106: 80 93 86 01 sts 0x0186, r24 + da: 40 91 08 01 lds r20, 0x0108 + de: 80 91 09 01 lds r24, 0x0109 + e2: 90 e0 ldi r25, 0x00 ; 0 + e4: 98 2f mov r25, r24 + e6: 88 27 eor r24, r24 + e8: 50 e0 ldi r21, 0x00 ; 0 + ea: 84 2b or r24, r20 + ec: 95 2b or r25, r21 + ee: 90 93 87 01 sts 0x0187, r25 + f2: 80 93 86 01 sts 0x0186, r24 vect -= 4; // Instruction is a relative jump (rjmp), so recalculate. - 10a: 24 50 subi r18, 0x04 ; 4 - 10c: 30 40 sbci r19, 0x00 ; 0 + f6: 24 50 subi r18, 0x04 ; 4 + f8: 30 40 sbci r19, 0x00 ; 0 buff[8] = vect & 0xff; - 10e: 20 93 08 01 sts 0x0108, r18 + fa: 20 93 08 01 sts 0x0108, r18 buff[9] = vect >> 8; - 112: 23 2f mov r18, r19 - 114: 33 27 eor r19, r19 - 116: 20 93 09 01 sts 0x0109, r18 + fe: 23 2f mov r18, r19 + 100: 33 27 eor r19, r19 + 102: 20 93 09 01 sts 0x0109, r18 // Add jump to bootloader at RESET vector buff[0] = 0x7f; - 11a: f0 92 00 01 sts 0x0100, r15 + 106: d0 92 00 01 sts 0x0100, r13 buff[1] = 0xce; // rjmp 0x1d00 instruction - 11e: e0 92 01 01 sts 0x0101, r14 - } -#endif - - // Copy buffer into programming buffer + 10a: c0 92 01 01 sts 0x0101, r12 + 10e: 40 e0 ldi r20, 0x00 ; 0 + 110: 50 e0 ldi r21, 0x00 ; 0 + 112: a0 e0 ldi r26, 0x00 ; 0 + 114: b1 e0 ldi r27, 0x01 ; 1 bufPtr = buff; addrPtr = (uint16_t)(void*)address; - 122: 40 91 80 01 lds r20, 0x0180 - 126: 50 91 81 01 lds r21, 0x0181 - 12a: a0 e0 ldi r26, 0x00 ; 0 - 12c: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 12e: 2c 91 ld r18, X - 130: 30 e0 ldi r19, 0x00 ; 0 + 116: 2c 91 ld r18, X + 118: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 132: 11 96 adiw r26, 0x01 ; 1 - 134: 8c 91 ld r24, X - 136: 11 97 sbiw r26, 0x01 ; 1 - 138: 90 e0 ldi r25, 0x00 ; 0 - 13a: 98 2f mov r25, r24 - 13c: 88 27 eor r24, r24 - 13e: 82 2b or r24, r18 - 140: 93 2b or r25, r19 + 11a: 11 96 adiw r26, 0x01 ; 1 + 11c: 8c 91 ld r24, X + 11e: 11 97 sbiw r26, 0x01 ; 1 + 120: 90 e0 ldi r25, 0x00 ; 0 + 122: 98 2f mov r25, r24 + 124: 88 27 eor r24, r24 + 126: 82 2b or r24, r18 + 128: 93 2b or r25, r19 #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 142: 12 96 adiw r26, 0x02 ; 2 + 12a: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 144: fa 01 movw r30, r20 - 146: 0c 01 movw r0, r24 - 148: d7 be out 0x37, r13 ; 55 - 14a: e8 95 spm - 14c: 11 24 eor r1, r1 + 12c: fa 01 movw r30, r20 + 12e: 0c 01 movw r0, r24 + 130: b7 be out 0x37, r11 ; 55 + 132: e8 95 spm + 134: 11 24 eor r1, r1 addrPtr += 2; - 14e: 4e 5f subi r20, 0xFE ; 254 - 150: 5f 4f sbci r21, 0xFF ; 255 + 136: 4e 5f subi r20, 0xFE ; 254 + 138: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 152: f1 e0 ldi r31, 0x01 ; 1 - 154: a0 34 cpi r26, 0x40 ; 64 - 156: bf 07 cpc r27, r31 - 158: 51 f7 brne .-44 ; 0x12e <__SREG__+0xef> + 13a: f1 e0 ldi r31, 0x01 ; 1 + 13c: a0 34 cpi r26, 0x40 ; 64 + 13e: bf 07 cpc r27, r31 + 140: 51 f7 brne .-44 ; 0x116 <__SREG__+0xd7> // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 15a: e0 91 80 01 lds r30, 0x0180 - 15e: f0 91 81 01 lds r31, 0x0181 - 162: c7 be out 0x37, r12 ; 55 - 164: e8 95 spm + 142: f8 01 movw r30, r16 + 144: a7 be out 0x37, r10 ; 55 + 146: e8 95 spm boot_spm_busy_wait(); - 166: 07 b6 in r0, 0x37 ; 55 - 168: 00 fc sbrc r0, 0 - 16a: fd cf rjmp .-6 ; 0x166 <__SREG__+0x127> - 16c: 41 c0 rjmp .+130 ; 0x1f0 <__SREG__+0x1b1> + 148: 07 b6 in r0, 0x37 ; 55 + 14a: 00 fc sbrc r0, 0 + 14c: fd cf rjmp .-6 ; 0x148 <__SREG__+0x109> + 14e: 3b c0 rjmp .+118 ; 0x1c6 <__SREG__+0x187> boot_rww_enable(); #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 16e: 84 37 cpi r24, 0x74 ; 116 - 170: 89 f5 brne .+98 ; 0x1d4 <__SREG__+0x195> + 150: 84 37 cpi r24, 0x74 ; 116 + 152: 51 f5 brne .+84 ; 0x1a8 <__SREG__+0x169> // READ PAGE - we only read flash - getLen(); - 172: 64 d0 rcall .+200 ; 0x23c + getch(); /* getlen() */ + 154: 4a d0 rcall .+148 ; 0x1ea + length = getch(); + 156: 49 d0 rcall .+146 ; 0x1ea + 158: f8 2e mov r15, r24 + getch(); + 15a: 47 d0 rcall .+142 ; 0x1ea + verifySpace(); - 174: 71 d0 rcall .+226 ; 0x258 + 15c: 5e d0 rcall .+188 ; 0x21a + 15e: e8 01 movw r28, r16 + 160: ef 2c mov r14, r15 #ifdef VIRTUAL_BOOT_PARTITION do { // Undo vector patch in bottom page so verify passes if (address == 0) ch=rstVect & 0xff; - 176: e0 91 80 01 lds r30, 0x0180 - 17a: f0 91 81 01 lds r31, 0x0181 - 17e: 30 97 sbiw r30, 0x00 ; 0 - 180: 19 f4 brne .+6 ; 0x188 <__SREG__+0x149> - 182: 20 91 84 01 lds r18, 0x0184 - 186: 13 c0 rjmp .+38 ; 0x1ae <__SREG__+0x16f> + 162: 20 97 sbiw r28, 0x00 ; 0 + 164: 19 f4 brne .+6 ; 0x16c <__SREG__+0x12d> + 166: 80 91 84 01 lds r24, 0x0184 + 16a: 14 c0 rjmp .+40 ; 0x194 <__SREG__+0x155> else if (address == 1) ch=rstVect >> 8; - 188: e1 30 cpi r30, 0x01 ; 1 - 18a: f1 05 cpc r31, r1 - 18c: 19 f4 brne .+6 ; 0x194 <__SREG__+0x155> - 18e: 20 91 85 01 lds r18, 0x0185 - 192: 0d c0 rjmp .+26 ; 0x1ae <__SREG__+0x16f> + 16c: c1 30 cpi r28, 0x01 ; 1 + 16e: d1 05 cpc r29, r1 + 170: 19 f4 brne .+6 ; 0x178 <__SREG__+0x139> + 172: 80 91 85 01 lds r24, 0x0185 + 176: 0e c0 rjmp .+28 ; 0x194 <__SREG__+0x155> else if (address == 8) ch=wdtVect & 0xff; - 194: e8 30 cpi r30, 0x08 ; 8 - 196: f1 05 cpc r31, r1 - 198: 19 f4 brne .+6 ; 0x1a0 <__SREG__+0x161> - 19a: 20 91 86 01 lds r18, 0x0186 - 19e: 07 c0 rjmp .+14 ; 0x1ae <__SREG__+0x16f> + 178: c8 30 cpi r28, 0x08 ; 8 + 17a: d1 05 cpc r29, r1 + 17c: 19 f4 brne .+6 ; 0x184 <__SREG__+0x145> + 17e: 80 91 86 01 lds r24, 0x0186 + 182: 08 c0 rjmp .+16 ; 0x194 <__SREG__+0x155> else if (address == 9) ch=wdtVect >> 8; - 1a0: e9 30 cpi r30, 0x09 ; 9 - 1a2: f1 05 cpc r31, r1 - 1a4: 19 f4 brne .+6 ; 0x1ac <__SREG__+0x16d> - 1a6: 20 91 87 01 lds r18, 0x0187 - 1aa: 01 c0 rjmp .+2 ; 0x1ae <__SREG__+0x16f> + 184: c9 30 cpi r28, 0x09 ; 9 + 186: d1 05 cpc r29, r1 + 188: 19 f4 brne .+6 ; 0x190 <__SREG__+0x151> + 18a: 80 91 87 01 lds r24, 0x0187 + 18e: 02 c0 rjmp .+4 ; 0x194 <__SREG__+0x155> else ch = pgm_read_byte_near(address); - 1ac: 24 91 lpm r18, Z+ + 190: fe 01 movw r30, r28 + 192: 84 91 lpm r24, Z+ address++; - 1ae: 80 91 80 01 lds r24, 0x0180 - 1b2: 90 91 81 01 lds r25, 0x0181 - 1b6: 01 96 adiw r24, 0x01 ; 1 - 1b8: 90 93 81 01 sts 0x0181, r25 - 1bc: 80 93 80 01 sts 0x0180, r24 + 194: 21 96 adiw r28, 0x01 ; 1 putch(ch); - 1c0: 82 2f mov r24, r18 - 1c2: 19 d0 rcall .+50 ; 0x1f6 + 196: 1a d0 rcall .+52 ; 0x1cc } while (--length); - 1c4: 80 91 82 01 lds r24, 0x0182 - 1c8: 81 50 subi r24, 0x01 ; 1 - 1ca: 80 93 82 01 sts 0x0182, r24 - 1ce: 88 23 and r24, r24 - 1d0: 91 f6 brne .-92 ; 0x176 <__SREG__+0x137> - 1d2: 0e c0 rjmp .+28 ; 0x1f0 <__SREG__+0x1b1> + 198: ea 94 dec r14 + 19a: 19 f7 brne .-58 ; 0x162 <__SREG__+0x123> +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) +#endif + +/* main program starts here */ +int main(void) { + 19c: 0f 5f subi r16, 0xFF ; 255 + 19e: 1f 4f sbci r17, 0xFF ; 255 + 1a0: fa 94 dec r15 + 1a2: 0f 0d add r16, r15 + 1a4: 11 1d adc r17, r1 + 1a6: 0f c0 rjmp .+30 ; 0x1c6 <__SREG__+0x187> #endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 1d4: 85 37 cpi r24, 0x75 ; 117 - 1d6: 39 f4 brne .+14 ; 0x1e6 <__SREG__+0x1a7> + 1a8: 85 37 cpi r24, 0x75 ; 117 + 1aa: 41 f4 brne .+16 ; 0x1bc <__SREG__+0x17d> // READ SIGN - return what Avrdude wants to hear verifySpace(); - 1d8: 3f d0 rcall .+126 ; 0x258 + 1ac: 36 d0 rcall .+108 ; 0x21a putch(SIGNATURE_0); - 1da: 8e e1 ldi r24, 0x1E ; 30 - 1dc: 0c d0 rcall .+24 ; 0x1f6 + 1ae: 8e e1 ldi r24, 0x1E ; 30 + 1b0: 0d d0 rcall .+26 ; 0x1cc putch(SIGNATURE_1); - 1de: 83 e9 ldi r24, 0x93 ; 147 - 1e0: 0a d0 rcall .+20 ; 0x1f6 + 1b2: 83 e9 ldi r24, 0x93 ; 147 + 1b4: 0b d0 rcall .+22 ; 0x1cc putch(SIGNATURE_2); - 1e2: 8c e0 ldi r24, 0x0C ; 12 - 1e4: 54 cf rjmp .-344 ; 0x8e <__SREG__+0x4f> + 1b6: 8c e0 ldi r24, 0x0C ; 12 + 1b8: 09 d0 rcall .+18 ; 0x1cc + 1ba: 05 c0 rjmp .+10 ; 0x1c6 <__SREG__+0x187> } else if (ch == 'Q') { - 1e6: 81 35 cpi r24, 0x51 ; 81 - 1e8: 11 f4 brne .+4 ; 0x1ee <__SREG__+0x1af> + 1bc: 81 35 cpi r24, 0x51 ; 81 + 1be: 11 f4 brne .+4 ; 0x1c4 <__SREG__+0x185> // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 1ea: 88 e0 ldi r24, 0x08 ; 8 - 1ec: 2c d0 rcall .+88 ; 0x246 + 1c0: 88 e0 ldi r24, 0x08 ; 8 + 1c2: 27 d0 rcall .+78 ; 0x212 verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 1ee: 34 d0 rcall .+104 ; 0x258 + 1c4: 2a d0 rcall .+84 ; 0x21a } putch(STK_OK); - 1f0: 80 e1 ldi r24, 0x10 ; 16 - 1f2: 01 d0 rcall .+2 ; 0x1f6 - 1f4: 25 cf rjmp .-438 ; 0x40 <__SREG__+0x1> + 1c6: 80 e1 ldi r24, 0x10 ; 16 + 1c8: 01 d0 rcall .+2 ; 0x1cc + 1ca: 3a cf rjmp .-396 ; 0x40 <__SREG__+0x1> -000001f6 : +000001cc : void putch(char ch) { #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); UDR0 = ch; #else __asm__ __volatile__ ( - 1f6: 2a e0 ldi r18, 0x0A ; 10 - 1f8: 30 e0 ldi r19, 0x00 ; 0 - 1fa: 80 95 com r24 - 1fc: 08 94 sec - 1fe: 10 f4 brcc .+4 ; 0x204 - 200: da 98 cbi 0x1b, 2 ; 27 - 202: 02 c0 rjmp .+4 ; 0x208 - 204: da 9a sbi 0x1b, 2 ; 27 - 206: 00 00 nop - 208: 15 d0 rcall .+42 ; 0x234 - 20a: 14 d0 rcall .+40 ; 0x234 - 20c: 86 95 lsr r24 - 20e: 2a 95 dec r18 - 210: b1 f7 brne .-20 ; 0x1fe + 1cc: 2a e0 ldi r18, 0x0A ; 10 + 1ce: 30 e0 ldi r19, 0x00 ; 0 + 1d0: 80 95 com r24 + 1d2: 08 94 sec + 1d4: 10 f4 brcc .+4 ; 0x1da + 1d6: da 98 cbi 0x1b, 2 ; 27 + 1d8: 02 c0 rjmp .+4 ; 0x1de + 1da: da 9a sbi 0x1b, 2 ; 27 + 1dc: 00 00 nop + 1de: 15 d0 rcall .+42 ; 0x20a + 1e0: 14 d0 rcall .+40 ; 0x20a + 1e2: 86 95 lsr r24 + 1e4: 2a 95 dec r18 + 1e6: b1 f7 brne .-20 ; 0x1d4 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 212: 08 95 ret + 1e8: 08 95 ret -00000214 : - return getch(); +000001ea : } +#endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 214: a8 95 wdr + 1ea: a8 95 wdr LED_PIN |= _BV(LED); #endif #endif return ch; } - 216: 29 e0 ldi r18, 0x09 ; 9 - 218: 30 e0 ldi r19, 0x00 ; 0 - 21a: cb 99 sbic 0x19, 3 ; 25 - 21c: fe cf rjmp .-4 ; 0x21a - 21e: 0a d0 rcall .+20 ; 0x234 - 220: 09 d0 rcall .+18 ; 0x234 - 222: 08 d0 rcall .+16 ; 0x234 - 224: 88 94 clc - 226: cb 99 sbic 0x19, 3 ; 25 - 228: 08 94 sec - 22a: 2a 95 dec r18 - 22c: 11 f0 breq .+4 ; 0x232 - 22e: 87 95 ror r24 - 230: f7 cf rjmp .-18 ; 0x220 - 232: 08 95 ret - -00000234 : + 1ec: 29 e0 ldi r18, 0x09 ; 9 + 1ee: 30 e0 ldi r19, 0x00 ; 0 + 1f0: cb 99 sbic 0x19, 3 ; 25 + 1f2: fe cf rjmp .-4 ; 0x1f0 + 1f4: 0a d0 rcall .+20 ; 0x20a + 1f6: 09 d0 rcall .+18 ; 0x20a + 1f8: 08 d0 rcall .+16 ; 0x20a + 1fa: 88 94 clc + 1fc: cb 99 sbic 0x19, 3 ; 25 + 1fe: 08 94 sec + 200: 2a 95 dec r18 + 202: 11 f0 breq .+4 ; 0x208 + 204: 87 95 ror r24 + 206: f7 cf rjmp .-18 ; 0x1f6 + 208: 08 95 ret + +0000020a : #if UART_B_VALUE > 255 #error Baud rate too slow for soft UART #endif void uartDelay() { __asm__ __volatile__ ( - 234: 9e e0 ldi r25, 0x0E ; 14 - 236: 9a 95 dec r25 - 238: f1 f7 brne .-4 ; 0x236 - 23a: 08 95 ret - -0000023c : - } while (--count); -} -#endif + 20a: 9e e0 ldi r25, 0x0E ; 14 + 20c: 9a 95 dec r25 + 20e: f1 f7 brne .-4 ; 0x20c + 210: 08 95 ret -uint8_t getLen() { - getch(); - 23c: eb df rcall .-42 ; 0x214 - length = getch(); - 23e: ea df rcall .-44 ; 0x214 - 240: 80 93 82 01 sts 0x0182, r24 - return getch(); -} - 244: e7 cf rjmp .-50 ; 0x214 - -00000246 : +00000212 : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 246: 98 e1 ldi r25, 0x18 ; 24 - 248: 91 bd out 0x21, r25 ; 33 + 212: 98 e1 ldi r25, 0x18 ; 24 + 214: 91 bd out 0x21, r25 ; 33 WDTCSR = x; - 24a: 81 bd out 0x21, r24 ; 33 + 216: 81 bd out 0x21, r24 ; 33 } - 24c: 08 95 ret - -0000024e : - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 24e: 80 e0 ldi r24, 0x00 ; 0 - 250: fa df rcall .-12 ; 0x246 - __asm__ __volatile__ ( - 252: e4 e0 ldi r30, 0x04 ; 4 - 254: ff 27 eor r31, r31 - 256: 09 94 ijmp + 218: 08 95 ret -00000258 : +0000021a : do getch(); while (--count); verifySpace(); } void verifySpace() { - if (getch() != CRC_EOP) appStart(); - 258: dd df rcall .-70 ; 0x214 - 25a: 80 32 cpi r24, 0x20 ; 32 - 25c: 09 f0 breq .+2 ; 0x260 - 25e: f7 df rcall .-18 ; 0x24e + if (getch() != CRC_EOP) { + 21a: e7 df rcall .-50 ; 0x1ea + 21c: 80 32 cpi r24, 0x20 ; 32 + 21e: 19 f0 breq .+6 ; 0x226 + watchdogConfig(WATCHDOG_16MS); // shorten WD timeout + 220: 88 e0 ldi r24, 0x08 ; 8 + 222: f7 df rcall .-18 ; 0x212 + 224: ff cf rjmp .-2 ; 0x224 + while (1) // and busy-loop so that WD causes + ; // a reset and app start. + } putch(STK_INSYNC); - 260: 84 e1 ldi r24, 0x14 ; 20 + 226: 84 e1 ldi r24, 0x14 ; 20 } - 262: c9 cf rjmp .-110 ; 0x1f6 + 228: d1 cf rjmp .-94 ; 0x1cc -00000264 : +0000022a : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 264: 1f 93 push r17 - 266: 18 2f mov r17, r24 + 22a: 1f 93 push r17 + 22c: 18 2f mov r17, r24 do getch(); while (--count); - 268: d5 df rcall .-86 ; 0x214 - 26a: 11 50 subi r17, 0x01 ; 1 - 26c: e9 f7 brne .-6 ; 0x268 + 22e: dd df rcall .-70 ; 0x1ea + 230: 11 50 subi r17, 0x01 ; 1 + 232: e9 f7 brne .-6 ; 0x22e verifySpace(); - 26e: f4 df rcall .-24 ; 0x258 + 234: f2 df rcall .-28 ; 0x21a } - 270: 1f 91 pop r17 - 272: 08 95 ret + 236: 1f 91 pop r17 + 238: 08 95 ret + +0000023a : + WDTCSR = _BV(WDCE) | _BV(WDE); + WDTCSR = x; +} + +void appStart() { + watchdogConfig(WATCHDOG_OFF); + 23a: 80 e0 ldi r24, 0x00 ; 0 + 23c: ea df rcall .-44 ; 0x212 + __asm__ __volatile__ ( + 23e: e4 e0 ldi r30, 0x04 ; 4 + 240: ff 27 eor r31, r31 + 242: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_pro_16MHz.hex b/bootloaders/optiboot/optiboot_pro_16MHz.hex index 3ac0de2..733a139 100644 --- a/bootloaders/optiboot/optiboot_pro_16MHz.hex +++ b/bootloaders/optiboot/optiboot_pro_16MHz.hex @@ -1,35 +1,33 @@ -:103E0000112484B714BE81FFE6D085E08093810041 +:103E0000112484B714BE81FFE3D085E08093810044 :103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20080E18093C4008EE0CFD0259A86E066 +:103E2000C20080E18093C4008EE0BCD0259A86E079 :103E300020E33CEF91E0309385002093840096BB13 -:103E4000B09BFECF1D9AA8958150A9F7DD24D3948D -:103E5000A5E0EA2EF1E1FF2EABD0813421F481E020 -:103E6000C5D083E020C0823411F484E103C08534DE -:103E700019F485E0BBD091C0853581F499D0082F25 -:103E800010E096D090E0982F8827802B912B880FF8 -:103E9000991F90930102809300027EC0863529F419 -:103EA00084E0A4D080E07CD078C0843609F04EC095 -:103EB00087D0E0910002F091010288E3E030F8073A -:103EC00018F483E087BFE895C0E0D1E071D0899312 -:103ED000809102028150809302028823B9F7E09119 -:103EE0000002F091010288E3E030F80718F083E067 -:103EF00087BFE89575D007B600FCFDCF4091000262 -:103F000050910102A0E0B1E02C9130E011968C912B -:103F1000119790E0982F8827822B932B1296FA0105 -:103F20000C01D7BEE89511244E5F5F4FF1E0A03839 -:103F3000BF0751F7E0910002F0910102E7BEE8955A -:103F400007B600FCFDCFF7BEE89527C08437B9F46B -:103F500037D046D0E0910002F09101023196F09303 -:103F60000102E09300023197E4918E2F19D08091E5 -:103F70000202815080930202882361F70EC08537C8 -:103F800039F42ED08EE10CD084E90AD086E08BCFB4 -:103F9000813511F488E019D023D080E101D05CCFC5 -:103FA000982F8091C00085FFFCCF9093C6000895A4 -:103FB000A8958091C00087FFFCCF8091C60008952E -:103FC000F7DFF6DF80930202F3CFE0E6F0E098E15E -:103FD00090838083089580E0F8DFEE27FF2709941F -:103FE000E7DF803209F0F7DF84E1DACF1F93182F83 -:0C3FF000DFDF1150E9F7F4DF1F910895A6 +:103E4000B09BFECF1D9AA8958150A9F79924939411 +:103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE +:103E6000AFD083E01FC0823411F484E103C08534F5 +:103E700019F485E0A5D083C0853579F48BD0E82E80 +:103E8000FF2488D0082F10E0102F00270E291F29AB +:103E9000000F111F8DD0680172C0863529F484E0AF +:103EA0008FD080E06FD06BC0843609F042C072D0F2 +:103EB00071D0082F6FD080E0C81688E3D80620F4B0 +:103EC00083E0F60187BFE895C0E0D1E063D0899335 +:103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF +:103EE000F60187BFE89564D007B600FCFDCFA601B8 +:103EF000A0E0B1E02C9130E011968C91119790E008 +:103F0000982F8827822B932B1296FA010C0197BECB +:103F1000E89511244E5F5F4FF1E0A038BF0751F7DD +:103F2000F601A7BEE89507B600FCFDCFB7BEE89541 +:103F300026C08437B1F42ED02DD0F82E2BD038D017 +:103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 +:103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 +:103F60000EC0853739F424D08EE10CD084E90AD014 +:103F700086E098CF813511F488E014D019D080E123 +:103F800001D06ACF982F8091C00085FFFCCF90931D +:103F9000C6000895A8958091C00087FFFCCF80914E +:103FA000C6000895E0E6F0E098E1908380830895EC +:103FB000F1DF803219F088E0F5DFFFCF84E1E2CF56 +:103FC0001F93182FE7DF1150E9F7F2DF1F910895D3 +:0A3FD00080E0E8DFEE27FF270994E8 :023FFE000104BC :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_16MHz.lst b/bootloaders/optiboot/optiboot_pro_16MHz.lst index 516bed8..b1d8c1b 100644 --- a/bootloaders/optiboot/optiboot_pro_16MHz.lst +++ b/bootloaders/optiboot/optiboot_pro_16MHz.lst @@ -3,27 +3,27 @@ optiboot_pro_16MHz.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001fc 00003e00 00003e00 00000054 2**1 + 0 .text 000001da 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 00000250 2**0 + 1 .version 00000002 00003ffe 00003ffe 0000022e 2**0 CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000252 2**0 + 2 .debug_aranges 00000028 00000000 00000000 00000230 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000006a 00000000 00000000 0000027a 2**0 + 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 00000285 00000000 00000000 000002e4 2**0 + 4 .debug_info 0000028c 00000000 00000000 000002b7 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000019f 00000000 00000000 00000569 2**0 + 5 .debug_abbrev 00000199 00000000 00000000 00000543 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000453 00000000 00000000 00000708 2**0 + 6 .debug_line 00000456 00000000 00000000 000006dc 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000090 00000000 00000000 00000b5c 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b34 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000141 00000000 00000000 00000bec 2**0 + 8 .debug_str 00000149 00000000 00000000 00000bb4 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 000001e1 00000000 00000000 00000d2d 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000cfd 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000068 00000000 00000000 00000f0e 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f7b 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 3e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 3e06: 81 ff sbrs r24, 1 - 3e08: e6 d0 rcall .+460 ; 0x3fd6 + 3e08: e3 d0 rcall .+454 ; 0x3fd0 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -77,7 +77,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: cf d0 rcall .+414 ; 0x3fca + 3e2a: bc d0 rcall .+376 ; 0x3fa4 /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -111,8 +111,8 @@ void flash_led(uint8_t count) { #else LED_PIN |= _BV(LED); 3e44: 1d 9a sbi 0x03, 5 ; 3 - return getch(); } +#endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { @@ -132,8 +132,8 @@ void watchdogReset() { if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 3e4c: dd 24 eor r13, r13 - 3e4e: d3 94 inc r13 + 3e4c: 99 24 eor r9, r9 + 3e4e: 93 94 inc r9 __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); @@ -141,21 +141,21 @@ void watchdogReset() { // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 3e50: a5 e0 ldi r26, 0x05 ; 5 - 3e52: ea 2e mov r14, r26 + 3e52: aa 2e mov r10, r26 boot_spm_busy_wait(); #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); 3e54: f1 e1 ldi r31, 0x11 ; 17 - 3e56: ff 2e mov r15, r31 + 3e56: bf 2e mov r11, r31 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 3e58: ab d0 rcall .+342 ; 0x3fb0 + 3e58: 9d d0 rcall .+314 ; 0x3f94 if(ch == STK_GET_PARAMETER) { 3e5a: 81 34 cpi r24, 0x41 ; 65 @@ -163,10 +163,10 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: c5 d0 rcall .+394 ; 0x3fec + 3e60: af d0 rcall .+350 ; 0x3fc0 putch(0x03); 3e62: 83 e0 ldi r24, 0x03 ; 3 - 3e64: 20 c0 rjmp .+64 ; 0x3ea6 + 3e64: 1f c0 rjmp .+62 ; 0x3ea4 } else if(ch == STK_SET_DEVICE) { 3e66: 82 34 cpi r24, 0x42 ; 66 @@ -182,71 +182,77 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: bb d0 rcall .+374 ; 0x3fec - 3e76: 91 c0 rjmp .+290 ; 0x3f9a + 3e74: a5 d0 rcall .+330 ; 0x3fc0 + 3e76: 83 c0 rjmp .+262 ; 0x3f7e } else if(ch == STK_LOAD_ADDRESS) { 3e78: 85 35 cpi r24, 0x55 ; 85 - 3e7a: 81 f4 brne .+32 ; 0x3e9c + 3e7a: 79 f4 brne .+30 ; 0x3e9a // LOAD ADDRESS uint16_t newAddress; newAddress = getch(); - 3e7c: 99 d0 rcall .+306 ; 0x3fb0 + 3e7c: 8b d0 rcall .+278 ; 0x3f94 newAddress = (newAddress & 0xff) | (getch() << 8); - 3e7e: 08 2f mov r16, r24 - 3e80: 10 e0 ldi r17, 0x00 ; 0 - 3e82: 96 d0 rcall .+300 ; 0x3fb0 - 3e84: 90 e0 ldi r25, 0x00 ; 0 - 3e86: 98 2f mov r25, r24 - 3e88: 88 27 eor r24, r24 - 3e8a: 80 2b or r24, r16 - 3e8c: 91 2b or r25, r17 + 3e7e: e8 2e mov r14, r24 + 3e80: ff 24 eor r15, r15 + 3e82: 88 d0 rcall .+272 ; 0x3f94 + 3e84: 08 2f mov r16, r24 + 3e86: 10 e0 ldi r17, 0x00 ; 0 + 3e88: 10 2f mov r17, r16 + 3e8a: 00 27 eor r16, r16 + 3e8c: 0e 29 or r16, r14 + 3e8e: 1f 29 or r17, r15 #ifdef RAMPZ // Transfer top bit to RAMPZ RAMPZ = (newAddress & 0x8000) ? 1 : 0; #endif newAddress += newAddress; // Convert from word address to byte address - 3e8e: 88 0f add r24, r24 - 3e90: 99 1f adc r25, r25 + 3e90: 00 0f add r16, r16 + 3e92: 11 1f adc r17, r17 address = newAddress; - 3e92: 90 93 01 02 sts 0x0201, r25 - 3e96: 80 93 00 02 sts 0x0200, r24 - 3e9a: 7e c0 rjmp .+252 ; 0x3f98 verifySpace(); + 3e94: 8d d0 rcall .+282 ; 0x3fb0 + 3e96: 68 01 movw r12, r16 + 3e98: 72 c0 rjmp .+228 ; 0x3f7e } else if(ch == STK_UNIVERSAL) { - 3e9c: 86 35 cpi r24, 0x56 ; 86 - 3e9e: 29 f4 brne .+10 ; 0x3eaa + 3e9a: 86 35 cpi r24, 0x56 ; 86 + 3e9c: 29 f4 brne .+10 ; 0x3ea8 // UNIVERSAL command is ignored getNch(4); - 3ea0: 84 e0 ldi r24, 0x04 ; 4 - 3ea2: a4 d0 rcall .+328 ; 0x3fec + 3e9e: 84 e0 ldi r24, 0x04 ; 4 + 3ea0: 8f d0 rcall .+286 ; 0x3fc0 putch(0x00); - 3ea4: 80 e0 ldi r24, 0x00 ; 0 - 3ea6: 7c d0 rcall .+248 ; 0x3fa0 - 3ea8: 78 c0 rjmp .+240 ; 0x3f9a + 3ea2: 80 e0 ldi r24, 0x00 ; 0 + 3ea4: 6f d0 rcall .+222 ; 0x3f84 + 3ea6: 6b c0 rjmp .+214 ; 0x3f7e } /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 3eaa: 84 36 cpi r24, 0x64 ; 100 - 3eac: 09 f0 breq .+2 ; 0x3eb0 - 3eae: 4e c0 rjmp .+156 ; 0x3f4c + 3ea8: 84 36 cpi r24, 0x64 ; 100 + 3eaa: 09 f0 breq .+2 ; 0x3eae + 3eac: 42 c0 rjmp .+132 ; 0x3f32 // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; - getLen(); - 3eb0: 87 d0 rcall .+270 ; 0x3fc0 + getch(); /* getlen() */ + 3eae: 72 d0 rcall .+228 ; 0x3f94 + length = getch(); + 3eb0: 71 d0 rcall .+226 ; 0x3f94 + 3eb2: 08 2f mov r16, r24 + getch(); + 3eb4: 6f d0 rcall .+222 ; 0x3f94 // If we are in RWW section, immediately start page erase if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3eb2: e0 91 00 02 lds r30, 0x0200 - 3eb6: f0 91 01 02 lds r31, 0x0201 + 3eb6: 80 e0 ldi r24, 0x00 ; 0 + 3eb8: c8 16 cp r12, r24 3eba: 88 e3 ldi r24, 0x38 ; 56 - 3ebc: e0 30 cpi r30, 0x00 ; 0 - 3ebe: f8 07 cpc r31, r24 - 3ec0: 18 f4 brcc .+6 ; 0x3ec8 - 3ec2: 83 e0 ldi r24, 0x03 ; 3 + 3ebc: d8 06 cpc r13, r24 + 3ebe: 20 f4 brcc .+8 ; 0x3ec8 + 3ec0: 83 e0 ldi r24, 0x03 ; 3 + 3ec2: f6 01 movw r30, r12 3ec4: 87 bf out 0x37, r24 ; 55 3ec6: e8 95 spm 3ec8: c0 e0 ldi r28, 0x00 ; 0 @@ -255,302 +261,301 @@ void watchdogReset() { // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 3ecc: 71 d0 rcall .+226 ; 0x3fb0 + 3ecc: 63 d0 rcall .+198 ; 0x3f94 3ece: 89 93 st Y+, r24 while (--length); - 3ed0: 80 91 02 02 lds r24, 0x0202 - 3ed4: 81 50 subi r24, 0x01 ; 1 - 3ed6: 80 93 02 02 sts 0x0202, r24 - 3eda: 88 23 and r24, r24 - 3edc: b9 f7 brne .-18 ; 0x3ecc + 3ed0: 0c 17 cp r16, r28 + 3ed2: e1 f7 brne .-8 ; 0x3ecc // If we are in NRWW section, page erase has to be delayed until now. // Todo: Take RAMPZ into account if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3ede: e0 91 00 02 lds r30, 0x0200 - 3ee2: f0 91 01 02 lds r31, 0x0201 - 3ee6: 88 e3 ldi r24, 0x38 ; 56 - 3ee8: e0 30 cpi r30, 0x00 ; 0 - 3eea: f8 07 cpc r31, r24 - 3eec: 18 f0 brcs .+6 ; 0x3ef4 - 3eee: 83 e0 ldi r24, 0x03 ; 3 - 3ef0: 87 bf out 0x37, r24 ; 55 - 3ef2: e8 95 spm + 3ed4: f0 e0 ldi r31, 0x00 ; 0 + 3ed6: cf 16 cp r12, r31 + 3ed8: f8 e3 ldi r31, 0x38 ; 56 + 3eda: df 06 cpc r13, r31 + 3edc: 20 f0 brcs .+8 ; 0x3ee6 + 3ede: 83 e0 ldi r24, 0x03 ; 3 + 3ee0: f6 01 movw r30, r12 + 3ee2: 87 bf out 0x37, r24 ; 55 + 3ee4: e8 95 spm // Read command terminator, start reply verifySpace(); - 3ef4: 75 d0 rcall .+234 ; 0x3fe0 + 3ee6: 64 d0 rcall .+200 ; 0x3fb0 // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 3ef6: 07 b6 in r0, 0x37 ; 55 - 3ef8: 00 fc sbrc r0, 0 - 3efa: fd cf rjmp .-6 ; 0x3ef6 - } -#endif - - // Copy buffer into programming buffer + 3ee8: 07 b6 in r0, 0x37 ; 55 + 3eea: 00 fc sbrc r0, 0 + 3eec: fd cf rjmp .-6 ; 0x3ee8 + 3eee: a6 01 movw r20, r12 + 3ef0: a0 e0 ldi r26, 0x00 ; 0 + 3ef2: b1 e0 ldi r27, 0x01 ; 1 bufPtr = buff; addrPtr = (uint16_t)(void*)address; - 3efc: 40 91 00 02 lds r20, 0x0200 - 3f00: 50 91 01 02 lds r21, 0x0201 - 3f04: a0 e0 ldi r26, 0x00 ; 0 - 3f06: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 3f08: 2c 91 ld r18, X - 3f0a: 30 e0 ldi r19, 0x00 ; 0 + 3ef4: 2c 91 ld r18, X + 3ef6: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 3f0c: 11 96 adiw r26, 0x01 ; 1 - 3f0e: 8c 91 ld r24, X - 3f10: 11 97 sbiw r26, 0x01 ; 1 - 3f12: 90 e0 ldi r25, 0x00 ; 0 - 3f14: 98 2f mov r25, r24 - 3f16: 88 27 eor r24, r24 - 3f18: 82 2b or r24, r18 - 3f1a: 93 2b or r25, r19 + 3ef8: 11 96 adiw r26, 0x01 ; 1 + 3efa: 8c 91 ld r24, X + 3efc: 11 97 sbiw r26, 0x01 ; 1 + 3efe: 90 e0 ldi r25, 0x00 ; 0 + 3f00: 98 2f mov r25, r24 + 3f02: 88 27 eor r24, r24 + 3f04: 82 2b or r24, r18 + 3f06: 93 2b or r25, r19 #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 3f1c: 12 96 adiw r26, 0x02 ; 2 + 3f08: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f1e: fa 01 movw r30, r20 - 3f20: 0c 01 movw r0, r24 - 3f22: d7 be out 0x37, r13 ; 55 - 3f24: e8 95 spm - 3f26: 11 24 eor r1, r1 + 3f0a: fa 01 movw r30, r20 + 3f0c: 0c 01 movw r0, r24 + 3f0e: 97 be out 0x37, r9 ; 55 + 3f10: e8 95 spm + 3f12: 11 24 eor r1, r1 addrPtr += 2; - 3f28: 4e 5f subi r20, 0xFE ; 254 - 3f2a: 5f 4f sbci r21, 0xFF ; 255 + 3f14: 4e 5f subi r20, 0xFE ; 254 + 3f16: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 3f2c: f1 e0 ldi r31, 0x01 ; 1 - 3f2e: a0 38 cpi r26, 0x80 ; 128 - 3f30: bf 07 cpc r27, r31 - 3f32: 51 f7 brne .-44 ; 0x3f08 + 3f18: f1 e0 ldi r31, 0x01 ; 1 + 3f1a: a0 38 cpi r26, 0x80 ; 128 + 3f1c: bf 07 cpc r27, r31 + 3f1e: 51 f7 brne .-44 ; 0x3ef4 // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 3f34: e0 91 00 02 lds r30, 0x0200 - 3f38: f0 91 01 02 lds r31, 0x0201 - 3f3c: e7 be out 0x37, r14 ; 55 - 3f3e: e8 95 spm + 3f20: f6 01 movw r30, r12 + 3f22: a7 be out 0x37, r10 ; 55 + 3f24: e8 95 spm boot_spm_busy_wait(); - 3f40: 07 b6 in r0, 0x37 ; 55 - 3f42: 00 fc sbrc r0, 0 - 3f44: fd cf rjmp .-6 ; 0x3f40 + 3f26: 07 b6 in r0, 0x37 ; 55 + 3f28: 00 fc sbrc r0, 0 + 3f2a: fd cf rjmp .-6 ; 0x3f26 #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 3f46: f7 be out 0x37, r15 ; 55 - 3f48: e8 95 spm - 3f4a: 27 c0 rjmp .+78 ; 0x3f9a + 3f2c: b7 be out 0x37, r11 ; 55 + 3f2e: e8 95 spm + 3f30: 26 c0 rjmp .+76 ; 0x3f7e #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 3f4c: 84 37 cpi r24, 0x74 ; 116 - 3f4e: b9 f4 brne .+46 ; 0x3f7e + 3f32: 84 37 cpi r24, 0x74 ; 116 + 3f34: b1 f4 brne .+44 ; 0x3f62 // READ PAGE - we only read flash - getLen(); - 3f50: 37 d0 rcall .+110 ; 0x3fc0 + getch(); /* getlen() */ + 3f36: 2e d0 rcall .+92 ; 0x3f94 + length = getch(); + 3f38: 2d d0 rcall .+90 ; 0x3f94 + 3f3a: f8 2e mov r15, r24 + getch(); + 3f3c: 2b d0 rcall .+86 ; 0x3f94 + verifySpace(); - 3f52: 46 d0 rcall .+140 ; 0x3fe0 + 3f3e: 38 d0 rcall .+112 ; 0x3fb0 + 3f40: f6 01 movw r30, r12 + 3f42: ef 2c mov r14, r15 putch(result); address++; } while (--length); #else do putch(pgm_read_byte_near(address++)); - 3f54: e0 91 00 02 lds r30, 0x0200 - 3f58: f0 91 01 02 lds r31, 0x0201 - 3f5c: 31 96 adiw r30, 0x01 ; 1 - 3f5e: f0 93 01 02 sts 0x0201, r31 - 3f62: e0 93 00 02 sts 0x0200, r30 - 3f66: 31 97 sbiw r30, 0x01 ; 1 - 3f68: e4 91 lpm r30, Z+ - 3f6a: 8e 2f mov r24, r30 - 3f6c: 19 d0 rcall .+50 ; 0x3fa0 + 3f44: 8f 01 movw r16, r30 + 3f46: 0f 5f subi r16, 0xFF ; 255 + 3f48: 1f 4f sbci r17, 0xFF ; 255 + 3f4a: 84 91 lpm r24, Z+ + 3f4c: 1b d0 rcall .+54 ; 0x3f84 while (--length); - 3f6e: 80 91 02 02 lds r24, 0x0202 - 3f72: 81 50 subi r24, 0x01 ; 1 - 3f74: 80 93 02 02 sts 0x0202, r24 - 3f78: 88 23 and r24, r24 - 3f7a: 61 f7 brne .-40 ; 0x3f54 - 3f7c: 0e c0 rjmp .+28 ; 0x3f9a + 3f4e: ea 94 dec r14 + 3f50: f8 01 movw r30, r16 + 3f52: c1 f7 brne .-16 ; 0x3f44 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) +#endif + +/* main program starts here */ +int main(void) { + 3f54: 08 94 sec + 3f56: c1 1c adc r12, r1 + 3f58: d1 1c adc r13, r1 + 3f5a: fa 94 dec r15 + 3f5c: cf 0c add r12, r15 + 3f5e: d1 1c adc r13, r1 + 3f60: 0e c0 rjmp .+28 ; 0x3f7e #endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 3f7e: 85 37 cpi r24, 0x75 ; 117 - 3f80: 39 f4 brne .+14 ; 0x3f90 + 3f62: 85 37 cpi r24, 0x75 ; 117 + 3f64: 39 f4 brne .+14 ; 0x3f74 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 3f82: 2e d0 rcall .+92 ; 0x3fe0 + 3f66: 24 d0 rcall .+72 ; 0x3fb0 putch(SIGNATURE_0); - 3f84: 8e e1 ldi r24, 0x1E ; 30 - 3f86: 0c d0 rcall .+24 ; 0x3fa0 + 3f68: 8e e1 ldi r24, 0x1E ; 30 + 3f6a: 0c d0 rcall .+24 ; 0x3f84 putch(SIGNATURE_1); - 3f88: 84 e9 ldi r24, 0x94 ; 148 - 3f8a: 0a d0 rcall .+20 ; 0x3fa0 + 3f6c: 84 e9 ldi r24, 0x94 ; 148 + 3f6e: 0a d0 rcall .+20 ; 0x3f84 putch(SIGNATURE_2); - 3f8c: 86 e0 ldi r24, 0x06 ; 6 - 3f8e: 8b cf rjmp .-234 ; 0x3ea6 + 3f70: 86 e0 ldi r24, 0x06 ; 6 + 3f72: 98 cf rjmp .-208 ; 0x3ea4 } else if (ch == 'Q') { - 3f90: 81 35 cpi r24, 0x51 ; 81 - 3f92: 11 f4 brne .+4 ; 0x3f98 + 3f74: 81 35 cpi r24, 0x51 ; 81 + 3f76: 11 f4 brne .+4 ; 0x3f7c // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 3f94: 88 e0 ldi r24, 0x08 ; 8 - 3f96: 19 d0 rcall .+50 ; 0x3fca + 3f78: 88 e0 ldi r24, 0x08 ; 8 + 3f7a: 14 d0 rcall .+40 ; 0x3fa4 verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 3f98: 23 d0 rcall .+70 ; 0x3fe0 + 3f7c: 19 d0 rcall .+50 ; 0x3fb0 } putch(STK_OK); - 3f9a: 80 e1 ldi r24, 0x10 ; 16 - 3f9c: 01 d0 rcall .+2 ; 0x3fa0 - 3f9e: 5c cf rjmp .-328 ; 0x3e58 + 3f7e: 80 e1 ldi r24, 0x10 ; 16 + 3f80: 01 d0 rcall .+2 ; 0x3f84 + 3f82: 6a cf rjmp .-300 ; 0x3e58 -00003fa0 : +00003f84 : } } void putch(char ch) { - 3fa0: 98 2f mov r25, r24 + 3f84: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); - 3fa2: 80 91 c0 00 lds r24, 0x00C0 - 3fa6: 85 ff sbrs r24, 5 - 3fa8: fc cf rjmp .-8 ; 0x3fa2 + 3f86: 80 91 c0 00 lds r24, 0x00C0 + 3f8a: 85 ff sbrs r24, 5 + 3f8c: fc cf rjmp .-8 ; 0x3f86 UDR0 = ch; - 3faa: 90 93 c6 00 sts 0x00C6, r25 + 3f8e: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 3fae: 08 95 ret + 3f92: 08 95 ret -00003fb0 : - return getch(); +00003f94 : } +#endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3fb0: a8 95 wdr + 3f94: a8 95 wdr [uartBit] "I" (UART_RX_BIT) : "r25" ); #else while(!(UCSR0A & _BV(RXC0))); - 3fb2: 80 91 c0 00 lds r24, 0x00C0 - 3fb6: 87 ff sbrs r24, 7 - 3fb8: fc cf rjmp .-8 ; 0x3fb2 + 3f96: 80 91 c0 00 lds r24, 0x00C0 + 3f9a: 87 ff sbrs r24, 7 + 3f9c: fc cf rjmp .-8 ; 0x3f96 ch = UDR0; - 3fba: 80 91 c6 00 lds r24, 0x00C6 + 3f9e: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 3fbe: 08 95 ret - -00003fc0 : - } while (--count); -} -#endif - -uint8_t getLen() { - getch(); - 3fc0: f7 df rcall .-18 ; 0x3fb0 - length = getch(); - 3fc2: f6 df rcall .-20 ; 0x3fb0 - 3fc4: 80 93 02 02 sts 0x0202, r24 - return getch(); -} - 3fc8: f3 cf rjmp .-26 ; 0x3fb0 + 3fa2: 08 95 ret -00003fca : +00003fa4 : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 3fca: e0 e6 ldi r30, 0x60 ; 96 - 3fcc: f0 e0 ldi r31, 0x00 ; 0 - 3fce: 98 e1 ldi r25, 0x18 ; 24 - 3fd0: 90 83 st Z, r25 + 3fa4: e0 e6 ldi r30, 0x60 ; 96 + 3fa6: f0 e0 ldi r31, 0x00 ; 0 + 3fa8: 98 e1 ldi r25, 0x18 ; 24 + 3faa: 90 83 st Z, r25 WDTCSR = x; - 3fd2: 80 83 st Z, r24 + 3fac: 80 83 st Z, r24 } - 3fd4: 08 95 ret - -00003fd6 : - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 3fd6: 80 e0 ldi r24, 0x00 ; 0 - 3fd8: f8 df rcall .-16 ; 0x3fca - __asm__ __volatile__ ( - 3fda: ee 27 eor r30, r30 - 3fdc: ff 27 eor r31, r31 - 3fde: 09 94 ijmp + 3fae: 08 95 ret -00003fe0 : +00003fb0 : do getch(); while (--count); verifySpace(); } void verifySpace() { - if (getch() != CRC_EOP) appStart(); - 3fe0: e7 df rcall .-50 ; 0x3fb0 - 3fe2: 80 32 cpi r24, 0x20 ; 32 - 3fe4: 09 f0 breq .+2 ; 0x3fe8 - 3fe6: f7 df rcall .-18 ; 0x3fd6 + if (getch() != CRC_EOP) { + 3fb0: f1 df rcall .-30 ; 0x3f94 + 3fb2: 80 32 cpi r24, 0x20 ; 32 + 3fb4: 19 f0 breq .+6 ; 0x3fbc + watchdogConfig(WATCHDOG_16MS); // shorten WD timeout + 3fb6: 88 e0 ldi r24, 0x08 ; 8 + 3fb8: f5 df rcall .-22 ; 0x3fa4 + 3fba: ff cf rjmp .-2 ; 0x3fba + while (1) // and busy-loop so that WD causes + ; // a reset and app start. + } putch(STK_INSYNC); - 3fe8: 84 e1 ldi r24, 0x14 ; 20 + 3fbc: 84 e1 ldi r24, 0x14 ; 20 } - 3fea: da cf rjmp .-76 ; 0x3fa0 + 3fbe: e2 cf rjmp .-60 ; 0x3f84 -00003fec : +00003fc0 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 3fec: 1f 93 push r17 - 3fee: 18 2f mov r17, r24 + 3fc0: 1f 93 push r17 + 3fc2: 18 2f mov r17, r24 do getch(); while (--count); - 3ff0: df df rcall .-66 ; 0x3fb0 - 3ff2: 11 50 subi r17, 0x01 ; 1 - 3ff4: e9 f7 brne .-6 ; 0x3ff0 + 3fc4: e7 df rcall .-50 ; 0x3f94 + 3fc6: 11 50 subi r17, 0x01 ; 1 + 3fc8: e9 f7 brne .-6 ; 0x3fc4 verifySpace(); - 3ff6: f4 df rcall .-24 ; 0x3fe0 + 3fca: f2 df rcall .-28 ; 0x3fb0 +} + 3fcc: 1f 91 pop r17 + 3fce: 08 95 ret + +00003fd0 : + WDTCSR = _BV(WDCE) | _BV(WDE); + WDTCSR = x; } - 3ff8: 1f 91 pop r17 - 3ffa: 08 95 ret + +void appStart() { + watchdogConfig(WATCHDOG_OFF); + 3fd0: 80 e0 ldi r24, 0x00 ; 0 + 3fd2: e8 df rcall .-48 ; 0x3fa4 + __asm__ __volatile__ ( + 3fd4: ee 27 eor r30, r30 + 3fd6: ff 27 eor r31, r31 + 3fd8: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_pro_20mhz.hex b/bootloaders/optiboot/optiboot_pro_20mhz.hex index 01c974c..58ed1dc 100644 --- a/bootloaders/optiboot/optiboot_pro_20mhz.hex +++ b/bootloaders/optiboot/optiboot_pro_20mhz.hex @@ -1,35 +1,33 @@ -:103E0000112484B714BE81FFE6D085E08093810041 +:103E0000112484B714BE81FFE3D085E08093810044 :103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20085E18093C4008EE0CFD0259A86E061 +:103E2000C20085E18093C4008EE0BCD0259A86E074 :103E30002CE33BEF91E0309385002093840096BB08 -:103E4000B09BFECF1D9AA8958150A9F7DD24D3948D -:103E5000A5E0EA2EF1E1FF2EABD0813421F481E020 -:103E6000C5D083E020C0823411F484E103C08534DE -:103E700019F485E0BBD091C0853581F499D0082F25 -:103E800010E096D090E0982F8827802B912B880FF8 -:103E9000991F90930102809300027EC0863529F419 -:103EA00084E0A4D080E07CD078C0843609F04EC095 -:103EB00087D0E0910002F091010288E3E030F8073A -:103EC00018F483E087BFE895C0E0D1E071D0899312 -:103ED000809102028150809302028823B9F7E09119 -:103EE0000002F091010288E3E030F80718F083E067 -:103EF00087BFE89575D007B600FCFDCF4091000262 -:103F000050910102A0E0B1E02C9130E011968C912B -:103F1000119790E0982F8827822B932B1296FA0105 -:103F20000C01D7BEE89511244E5F5F4FF1E0A03839 -:103F3000BF0751F7E0910002F0910102E7BEE8955A -:103F400007B600FCFDCFF7BEE89527C08437B9F46B -:103F500037D046D0E0910002F09101023196F09303 -:103F60000102E09300023197E4918E2F19D08091E5 -:103F70000202815080930202882361F70EC08537C8 -:103F800039F42ED08EE10CD084E90AD086E08BCFB4 -:103F9000813511F488E019D023D080E101D05CCFC5 -:103FA000982F8091C00085FFFCCF9093C6000895A4 -:103FB000A8958091C00087FFFCCF8091C60008952E -:103FC000F7DFF6DF80930202F3CFE0E6F0E098E15E -:103FD00090838083089580E0F8DFEE27FF2709941F -:103FE000E7DF803209F0F7DF84E1DACF1F93182F83 -:0C3FF000DFDF1150E9F7F4DF1F910895A6 +:103E4000B09BFECF1D9AA8958150A9F79924939411 +:103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE +:103E6000AFD083E01FC0823411F484E103C08534F5 +:103E700019F485E0A5D083C0853579F48BD0E82E80 +:103E8000FF2488D0082F10E0102F00270E291F29AB +:103E9000000F111F8DD0680172C0863529F484E0AF +:103EA0008FD080E06FD06BC0843609F042C072D0F2 +:103EB00071D0082F6FD080E0C81688E3D80620F4B0 +:103EC00083E0F60187BFE895C0E0D1E063D0899335 +:103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF +:103EE000F60187BFE89564D007B600FCFDCFA601B8 +:103EF000A0E0B1E02C9130E011968C91119790E008 +:103F0000982F8827822B932B1296FA010C0197BECB +:103F1000E89511244E5F5F4FF1E0A038BF0751F7DD +:103F2000F601A7BEE89507B600FCFDCFB7BEE89541 +:103F300026C08437B1F42ED02DD0F82E2BD038D017 +:103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 +:103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 +:103F60000EC0853739F424D08EE10CD084E90AD014 +:103F700086E098CF813511F488E014D019D080E123 +:103F800001D06ACF982F8091C00085FFFCCF90931D +:103F9000C6000895A8958091C00087FFFCCF80914E +:103FA000C6000895E0E6F0E098E1908380830895EC +:103FB000F1DF803219F088E0F5DFFFCF84E1E2CF56 +:103FC0001F93182FE7DF1150E9F7F2DF1F910895D3 +:0A3FD00080E0E8DFEE27FF270994E8 :023FFE000104BC :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_20mhz.lst b/bootloaders/optiboot/optiboot_pro_20mhz.lst index ba7b6b6..cd2d66a 100644 --- a/bootloaders/optiboot/optiboot_pro_20mhz.lst +++ b/bootloaders/optiboot/optiboot_pro_20mhz.lst @@ -3,27 +3,27 @@ optiboot_pro_20mhz.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001fc 00003e00 00003e00 00000054 2**1 + 0 .text 000001da 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 00000250 2**0 + 1 .version 00000002 00003ffe 00003ffe 0000022e 2**0 CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000252 2**0 + 2 .debug_aranges 00000028 00000000 00000000 00000230 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000006a 00000000 00000000 0000027a 2**0 + 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 00000285 00000000 00000000 000002e4 2**0 + 4 .debug_info 0000028c 00000000 00000000 000002b7 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000019f 00000000 00000000 00000569 2**0 + 5 .debug_abbrev 00000199 00000000 00000000 00000543 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000453 00000000 00000000 00000708 2**0 + 6 .debug_line 00000456 00000000 00000000 000006dc 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000090 00000000 00000000 00000b5c 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b34 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000141 00000000 00000000 00000bec 2**0 + 8 .debug_str 00000149 00000000 00000000 00000bb4 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 000001e1 00000000 00000000 00000d2d 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000cfd 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000068 00000000 00000000 00000f0e 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f7b 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 3e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 3e06: 81 ff sbrs r24, 1 - 3e08: e6 d0 rcall .+460 ; 0x3fd6 + 3e08: e3 d0 rcall .+454 ; 0x3fd0 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -77,7 +77,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: cf d0 rcall .+414 ; 0x3fca + 3e2a: bc d0 rcall .+376 ; 0x3fa4 /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -111,8 +111,8 @@ void flash_led(uint8_t count) { #else LED_PIN |= _BV(LED); 3e44: 1d 9a sbi 0x03, 5 ; 3 - return getch(); } +#endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { @@ -132,8 +132,8 @@ void watchdogReset() { if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 3e4c: dd 24 eor r13, r13 - 3e4e: d3 94 inc r13 + 3e4c: 99 24 eor r9, r9 + 3e4e: 93 94 inc r9 __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); @@ -141,21 +141,21 @@ void watchdogReset() { // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 3e50: a5 e0 ldi r26, 0x05 ; 5 - 3e52: ea 2e mov r14, r26 + 3e52: aa 2e mov r10, r26 boot_spm_busy_wait(); #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); 3e54: f1 e1 ldi r31, 0x11 ; 17 - 3e56: ff 2e mov r15, r31 + 3e56: bf 2e mov r11, r31 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 3e58: ab d0 rcall .+342 ; 0x3fb0 + 3e58: 9d d0 rcall .+314 ; 0x3f94 if(ch == STK_GET_PARAMETER) { 3e5a: 81 34 cpi r24, 0x41 ; 65 @@ -163,10 +163,10 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: c5 d0 rcall .+394 ; 0x3fec + 3e60: af d0 rcall .+350 ; 0x3fc0 putch(0x03); 3e62: 83 e0 ldi r24, 0x03 ; 3 - 3e64: 20 c0 rjmp .+64 ; 0x3ea6 + 3e64: 1f c0 rjmp .+62 ; 0x3ea4 } else if(ch == STK_SET_DEVICE) { 3e66: 82 34 cpi r24, 0x42 ; 66 @@ -182,71 +182,77 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: bb d0 rcall .+374 ; 0x3fec - 3e76: 91 c0 rjmp .+290 ; 0x3f9a + 3e74: a5 d0 rcall .+330 ; 0x3fc0 + 3e76: 83 c0 rjmp .+262 ; 0x3f7e } else if(ch == STK_LOAD_ADDRESS) { 3e78: 85 35 cpi r24, 0x55 ; 85 - 3e7a: 81 f4 brne .+32 ; 0x3e9c + 3e7a: 79 f4 brne .+30 ; 0x3e9a // LOAD ADDRESS uint16_t newAddress; newAddress = getch(); - 3e7c: 99 d0 rcall .+306 ; 0x3fb0 + 3e7c: 8b d0 rcall .+278 ; 0x3f94 newAddress = (newAddress & 0xff) | (getch() << 8); - 3e7e: 08 2f mov r16, r24 - 3e80: 10 e0 ldi r17, 0x00 ; 0 - 3e82: 96 d0 rcall .+300 ; 0x3fb0 - 3e84: 90 e0 ldi r25, 0x00 ; 0 - 3e86: 98 2f mov r25, r24 - 3e88: 88 27 eor r24, r24 - 3e8a: 80 2b or r24, r16 - 3e8c: 91 2b or r25, r17 + 3e7e: e8 2e mov r14, r24 + 3e80: ff 24 eor r15, r15 + 3e82: 88 d0 rcall .+272 ; 0x3f94 + 3e84: 08 2f mov r16, r24 + 3e86: 10 e0 ldi r17, 0x00 ; 0 + 3e88: 10 2f mov r17, r16 + 3e8a: 00 27 eor r16, r16 + 3e8c: 0e 29 or r16, r14 + 3e8e: 1f 29 or r17, r15 #ifdef RAMPZ // Transfer top bit to RAMPZ RAMPZ = (newAddress & 0x8000) ? 1 : 0; #endif newAddress += newAddress; // Convert from word address to byte address - 3e8e: 88 0f add r24, r24 - 3e90: 99 1f adc r25, r25 + 3e90: 00 0f add r16, r16 + 3e92: 11 1f adc r17, r17 address = newAddress; - 3e92: 90 93 01 02 sts 0x0201, r25 - 3e96: 80 93 00 02 sts 0x0200, r24 - 3e9a: 7e c0 rjmp .+252 ; 0x3f98 verifySpace(); + 3e94: 8d d0 rcall .+282 ; 0x3fb0 + 3e96: 68 01 movw r12, r16 + 3e98: 72 c0 rjmp .+228 ; 0x3f7e } else if(ch == STK_UNIVERSAL) { - 3e9c: 86 35 cpi r24, 0x56 ; 86 - 3e9e: 29 f4 brne .+10 ; 0x3eaa + 3e9a: 86 35 cpi r24, 0x56 ; 86 + 3e9c: 29 f4 brne .+10 ; 0x3ea8 // UNIVERSAL command is ignored getNch(4); - 3ea0: 84 e0 ldi r24, 0x04 ; 4 - 3ea2: a4 d0 rcall .+328 ; 0x3fec + 3e9e: 84 e0 ldi r24, 0x04 ; 4 + 3ea0: 8f d0 rcall .+286 ; 0x3fc0 putch(0x00); - 3ea4: 80 e0 ldi r24, 0x00 ; 0 - 3ea6: 7c d0 rcall .+248 ; 0x3fa0 - 3ea8: 78 c0 rjmp .+240 ; 0x3f9a + 3ea2: 80 e0 ldi r24, 0x00 ; 0 + 3ea4: 6f d0 rcall .+222 ; 0x3f84 + 3ea6: 6b c0 rjmp .+214 ; 0x3f7e } /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 3eaa: 84 36 cpi r24, 0x64 ; 100 - 3eac: 09 f0 breq .+2 ; 0x3eb0 - 3eae: 4e c0 rjmp .+156 ; 0x3f4c + 3ea8: 84 36 cpi r24, 0x64 ; 100 + 3eaa: 09 f0 breq .+2 ; 0x3eae + 3eac: 42 c0 rjmp .+132 ; 0x3f32 // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; - getLen(); - 3eb0: 87 d0 rcall .+270 ; 0x3fc0 + getch(); /* getlen() */ + 3eae: 72 d0 rcall .+228 ; 0x3f94 + length = getch(); + 3eb0: 71 d0 rcall .+226 ; 0x3f94 + 3eb2: 08 2f mov r16, r24 + getch(); + 3eb4: 6f d0 rcall .+222 ; 0x3f94 // If we are in RWW section, immediately start page erase if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3eb2: e0 91 00 02 lds r30, 0x0200 - 3eb6: f0 91 01 02 lds r31, 0x0201 + 3eb6: 80 e0 ldi r24, 0x00 ; 0 + 3eb8: c8 16 cp r12, r24 3eba: 88 e3 ldi r24, 0x38 ; 56 - 3ebc: e0 30 cpi r30, 0x00 ; 0 - 3ebe: f8 07 cpc r31, r24 - 3ec0: 18 f4 brcc .+6 ; 0x3ec8 - 3ec2: 83 e0 ldi r24, 0x03 ; 3 + 3ebc: d8 06 cpc r13, r24 + 3ebe: 20 f4 brcc .+8 ; 0x3ec8 + 3ec0: 83 e0 ldi r24, 0x03 ; 3 + 3ec2: f6 01 movw r30, r12 3ec4: 87 bf out 0x37, r24 ; 55 3ec6: e8 95 spm 3ec8: c0 e0 ldi r28, 0x00 ; 0 @@ -255,302 +261,301 @@ void watchdogReset() { // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 3ecc: 71 d0 rcall .+226 ; 0x3fb0 + 3ecc: 63 d0 rcall .+198 ; 0x3f94 3ece: 89 93 st Y+, r24 while (--length); - 3ed0: 80 91 02 02 lds r24, 0x0202 - 3ed4: 81 50 subi r24, 0x01 ; 1 - 3ed6: 80 93 02 02 sts 0x0202, r24 - 3eda: 88 23 and r24, r24 - 3edc: b9 f7 brne .-18 ; 0x3ecc + 3ed0: 0c 17 cp r16, r28 + 3ed2: e1 f7 brne .-8 ; 0x3ecc // If we are in NRWW section, page erase has to be delayed until now. // Todo: Take RAMPZ into account if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3ede: e0 91 00 02 lds r30, 0x0200 - 3ee2: f0 91 01 02 lds r31, 0x0201 - 3ee6: 88 e3 ldi r24, 0x38 ; 56 - 3ee8: e0 30 cpi r30, 0x00 ; 0 - 3eea: f8 07 cpc r31, r24 - 3eec: 18 f0 brcs .+6 ; 0x3ef4 - 3eee: 83 e0 ldi r24, 0x03 ; 3 - 3ef0: 87 bf out 0x37, r24 ; 55 - 3ef2: e8 95 spm + 3ed4: f0 e0 ldi r31, 0x00 ; 0 + 3ed6: cf 16 cp r12, r31 + 3ed8: f8 e3 ldi r31, 0x38 ; 56 + 3eda: df 06 cpc r13, r31 + 3edc: 20 f0 brcs .+8 ; 0x3ee6 + 3ede: 83 e0 ldi r24, 0x03 ; 3 + 3ee0: f6 01 movw r30, r12 + 3ee2: 87 bf out 0x37, r24 ; 55 + 3ee4: e8 95 spm // Read command terminator, start reply verifySpace(); - 3ef4: 75 d0 rcall .+234 ; 0x3fe0 + 3ee6: 64 d0 rcall .+200 ; 0x3fb0 // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 3ef6: 07 b6 in r0, 0x37 ; 55 - 3ef8: 00 fc sbrc r0, 0 - 3efa: fd cf rjmp .-6 ; 0x3ef6 - } -#endif - - // Copy buffer into programming buffer + 3ee8: 07 b6 in r0, 0x37 ; 55 + 3eea: 00 fc sbrc r0, 0 + 3eec: fd cf rjmp .-6 ; 0x3ee8 + 3eee: a6 01 movw r20, r12 + 3ef0: a0 e0 ldi r26, 0x00 ; 0 + 3ef2: b1 e0 ldi r27, 0x01 ; 1 bufPtr = buff; addrPtr = (uint16_t)(void*)address; - 3efc: 40 91 00 02 lds r20, 0x0200 - 3f00: 50 91 01 02 lds r21, 0x0201 - 3f04: a0 e0 ldi r26, 0x00 ; 0 - 3f06: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 3f08: 2c 91 ld r18, X - 3f0a: 30 e0 ldi r19, 0x00 ; 0 + 3ef4: 2c 91 ld r18, X + 3ef6: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 3f0c: 11 96 adiw r26, 0x01 ; 1 - 3f0e: 8c 91 ld r24, X - 3f10: 11 97 sbiw r26, 0x01 ; 1 - 3f12: 90 e0 ldi r25, 0x00 ; 0 - 3f14: 98 2f mov r25, r24 - 3f16: 88 27 eor r24, r24 - 3f18: 82 2b or r24, r18 - 3f1a: 93 2b or r25, r19 + 3ef8: 11 96 adiw r26, 0x01 ; 1 + 3efa: 8c 91 ld r24, X + 3efc: 11 97 sbiw r26, 0x01 ; 1 + 3efe: 90 e0 ldi r25, 0x00 ; 0 + 3f00: 98 2f mov r25, r24 + 3f02: 88 27 eor r24, r24 + 3f04: 82 2b or r24, r18 + 3f06: 93 2b or r25, r19 #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 3f1c: 12 96 adiw r26, 0x02 ; 2 + 3f08: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f1e: fa 01 movw r30, r20 - 3f20: 0c 01 movw r0, r24 - 3f22: d7 be out 0x37, r13 ; 55 - 3f24: e8 95 spm - 3f26: 11 24 eor r1, r1 + 3f0a: fa 01 movw r30, r20 + 3f0c: 0c 01 movw r0, r24 + 3f0e: 97 be out 0x37, r9 ; 55 + 3f10: e8 95 spm + 3f12: 11 24 eor r1, r1 addrPtr += 2; - 3f28: 4e 5f subi r20, 0xFE ; 254 - 3f2a: 5f 4f sbci r21, 0xFF ; 255 + 3f14: 4e 5f subi r20, 0xFE ; 254 + 3f16: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 3f2c: f1 e0 ldi r31, 0x01 ; 1 - 3f2e: a0 38 cpi r26, 0x80 ; 128 - 3f30: bf 07 cpc r27, r31 - 3f32: 51 f7 brne .-44 ; 0x3f08 + 3f18: f1 e0 ldi r31, 0x01 ; 1 + 3f1a: a0 38 cpi r26, 0x80 ; 128 + 3f1c: bf 07 cpc r27, r31 + 3f1e: 51 f7 brne .-44 ; 0x3ef4 // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 3f34: e0 91 00 02 lds r30, 0x0200 - 3f38: f0 91 01 02 lds r31, 0x0201 - 3f3c: e7 be out 0x37, r14 ; 55 - 3f3e: e8 95 spm + 3f20: f6 01 movw r30, r12 + 3f22: a7 be out 0x37, r10 ; 55 + 3f24: e8 95 spm boot_spm_busy_wait(); - 3f40: 07 b6 in r0, 0x37 ; 55 - 3f42: 00 fc sbrc r0, 0 - 3f44: fd cf rjmp .-6 ; 0x3f40 + 3f26: 07 b6 in r0, 0x37 ; 55 + 3f28: 00 fc sbrc r0, 0 + 3f2a: fd cf rjmp .-6 ; 0x3f26 #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 3f46: f7 be out 0x37, r15 ; 55 - 3f48: e8 95 spm - 3f4a: 27 c0 rjmp .+78 ; 0x3f9a + 3f2c: b7 be out 0x37, r11 ; 55 + 3f2e: e8 95 spm + 3f30: 26 c0 rjmp .+76 ; 0x3f7e #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 3f4c: 84 37 cpi r24, 0x74 ; 116 - 3f4e: b9 f4 brne .+46 ; 0x3f7e + 3f32: 84 37 cpi r24, 0x74 ; 116 + 3f34: b1 f4 brne .+44 ; 0x3f62 // READ PAGE - we only read flash - getLen(); - 3f50: 37 d0 rcall .+110 ; 0x3fc0 + getch(); /* getlen() */ + 3f36: 2e d0 rcall .+92 ; 0x3f94 + length = getch(); + 3f38: 2d d0 rcall .+90 ; 0x3f94 + 3f3a: f8 2e mov r15, r24 + getch(); + 3f3c: 2b d0 rcall .+86 ; 0x3f94 + verifySpace(); - 3f52: 46 d0 rcall .+140 ; 0x3fe0 + 3f3e: 38 d0 rcall .+112 ; 0x3fb0 + 3f40: f6 01 movw r30, r12 + 3f42: ef 2c mov r14, r15 putch(result); address++; } while (--length); #else do putch(pgm_read_byte_near(address++)); - 3f54: e0 91 00 02 lds r30, 0x0200 - 3f58: f0 91 01 02 lds r31, 0x0201 - 3f5c: 31 96 adiw r30, 0x01 ; 1 - 3f5e: f0 93 01 02 sts 0x0201, r31 - 3f62: e0 93 00 02 sts 0x0200, r30 - 3f66: 31 97 sbiw r30, 0x01 ; 1 - 3f68: e4 91 lpm r30, Z+ - 3f6a: 8e 2f mov r24, r30 - 3f6c: 19 d0 rcall .+50 ; 0x3fa0 + 3f44: 8f 01 movw r16, r30 + 3f46: 0f 5f subi r16, 0xFF ; 255 + 3f48: 1f 4f sbci r17, 0xFF ; 255 + 3f4a: 84 91 lpm r24, Z+ + 3f4c: 1b d0 rcall .+54 ; 0x3f84 while (--length); - 3f6e: 80 91 02 02 lds r24, 0x0202 - 3f72: 81 50 subi r24, 0x01 ; 1 - 3f74: 80 93 02 02 sts 0x0202, r24 - 3f78: 88 23 and r24, r24 - 3f7a: 61 f7 brne .-40 ; 0x3f54 - 3f7c: 0e c0 rjmp .+28 ; 0x3f9a + 3f4e: ea 94 dec r14 + 3f50: f8 01 movw r30, r16 + 3f52: c1 f7 brne .-16 ; 0x3f44 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) +#endif + +/* main program starts here */ +int main(void) { + 3f54: 08 94 sec + 3f56: c1 1c adc r12, r1 + 3f58: d1 1c adc r13, r1 + 3f5a: fa 94 dec r15 + 3f5c: cf 0c add r12, r15 + 3f5e: d1 1c adc r13, r1 + 3f60: 0e c0 rjmp .+28 ; 0x3f7e #endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 3f7e: 85 37 cpi r24, 0x75 ; 117 - 3f80: 39 f4 brne .+14 ; 0x3f90 + 3f62: 85 37 cpi r24, 0x75 ; 117 + 3f64: 39 f4 brne .+14 ; 0x3f74 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 3f82: 2e d0 rcall .+92 ; 0x3fe0 + 3f66: 24 d0 rcall .+72 ; 0x3fb0 putch(SIGNATURE_0); - 3f84: 8e e1 ldi r24, 0x1E ; 30 - 3f86: 0c d0 rcall .+24 ; 0x3fa0 + 3f68: 8e e1 ldi r24, 0x1E ; 30 + 3f6a: 0c d0 rcall .+24 ; 0x3f84 putch(SIGNATURE_1); - 3f88: 84 e9 ldi r24, 0x94 ; 148 - 3f8a: 0a d0 rcall .+20 ; 0x3fa0 + 3f6c: 84 e9 ldi r24, 0x94 ; 148 + 3f6e: 0a d0 rcall .+20 ; 0x3f84 putch(SIGNATURE_2); - 3f8c: 86 e0 ldi r24, 0x06 ; 6 - 3f8e: 8b cf rjmp .-234 ; 0x3ea6 + 3f70: 86 e0 ldi r24, 0x06 ; 6 + 3f72: 98 cf rjmp .-208 ; 0x3ea4 } else if (ch == 'Q') { - 3f90: 81 35 cpi r24, 0x51 ; 81 - 3f92: 11 f4 brne .+4 ; 0x3f98 + 3f74: 81 35 cpi r24, 0x51 ; 81 + 3f76: 11 f4 brne .+4 ; 0x3f7c // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 3f94: 88 e0 ldi r24, 0x08 ; 8 - 3f96: 19 d0 rcall .+50 ; 0x3fca + 3f78: 88 e0 ldi r24, 0x08 ; 8 + 3f7a: 14 d0 rcall .+40 ; 0x3fa4 verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 3f98: 23 d0 rcall .+70 ; 0x3fe0 + 3f7c: 19 d0 rcall .+50 ; 0x3fb0 } putch(STK_OK); - 3f9a: 80 e1 ldi r24, 0x10 ; 16 - 3f9c: 01 d0 rcall .+2 ; 0x3fa0 - 3f9e: 5c cf rjmp .-328 ; 0x3e58 + 3f7e: 80 e1 ldi r24, 0x10 ; 16 + 3f80: 01 d0 rcall .+2 ; 0x3f84 + 3f82: 6a cf rjmp .-300 ; 0x3e58 -00003fa0 : +00003f84 : } } void putch(char ch) { - 3fa0: 98 2f mov r25, r24 + 3f84: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); - 3fa2: 80 91 c0 00 lds r24, 0x00C0 - 3fa6: 85 ff sbrs r24, 5 - 3fa8: fc cf rjmp .-8 ; 0x3fa2 + 3f86: 80 91 c0 00 lds r24, 0x00C0 + 3f8a: 85 ff sbrs r24, 5 + 3f8c: fc cf rjmp .-8 ; 0x3f86 UDR0 = ch; - 3faa: 90 93 c6 00 sts 0x00C6, r25 + 3f8e: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 3fae: 08 95 ret + 3f92: 08 95 ret -00003fb0 : - return getch(); +00003f94 : } +#endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3fb0: a8 95 wdr + 3f94: a8 95 wdr [uartBit] "I" (UART_RX_BIT) : "r25" ); #else while(!(UCSR0A & _BV(RXC0))); - 3fb2: 80 91 c0 00 lds r24, 0x00C0 - 3fb6: 87 ff sbrs r24, 7 - 3fb8: fc cf rjmp .-8 ; 0x3fb2 + 3f96: 80 91 c0 00 lds r24, 0x00C0 + 3f9a: 87 ff sbrs r24, 7 + 3f9c: fc cf rjmp .-8 ; 0x3f96 ch = UDR0; - 3fba: 80 91 c6 00 lds r24, 0x00C6 + 3f9e: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 3fbe: 08 95 ret - -00003fc0 : - } while (--count); -} -#endif - -uint8_t getLen() { - getch(); - 3fc0: f7 df rcall .-18 ; 0x3fb0 - length = getch(); - 3fc2: f6 df rcall .-20 ; 0x3fb0 - 3fc4: 80 93 02 02 sts 0x0202, r24 - return getch(); -} - 3fc8: f3 cf rjmp .-26 ; 0x3fb0 + 3fa2: 08 95 ret -00003fca : +00003fa4 : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 3fca: e0 e6 ldi r30, 0x60 ; 96 - 3fcc: f0 e0 ldi r31, 0x00 ; 0 - 3fce: 98 e1 ldi r25, 0x18 ; 24 - 3fd0: 90 83 st Z, r25 + 3fa4: e0 e6 ldi r30, 0x60 ; 96 + 3fa6: f0 e0 ldi r31, 0x00 ; 0 + 3fa8: 98 e1 ldi r25, 0x18 ; 24 + 3faa: 90 83 st Z, r25 WDTCSR = x; - 3fd2: 80 83 st Z, r24 + 3fac: 80 83 st Z, r24 } - 3fd4: 08 95 ret - -00003fd6 : - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 3fd6: 80 e0 ldi r24, 0x00 ; 0 - 3fd8: f8 df rcall .-16 ; 0x3fca - __asm__ __volatile__ ( - 3fda: ee 27 eor r30, r30 - 3fdc: ff 27 eor r31, r31 - 3fde: 09 94 ijmp + 3fae: 08 95 ret -00003fe0 : +00003fb0 : do getch(); while (--count); verifySpace(); } void verifySpace() { - if (getch() != CRC_EOP) appStart(); - 3fe0: e7 df rcall .-50 ; 0x3fb0 - 3fe2: 80 32 cpi r24, 0x20 ; 32 - 3fe4: 09 f0 breq .+2 ; 0x3fe8 - 3fe6: f7 df rcall .-18 ; 0x3fd6 + if (getch() != CRC_EOP) { + 3fb0: f1 df rcall .-30 ; 0x3f94 + 3fb2: 80 32 cpi r24, 0x20 ; 32 + 3fb4: 19 f0 breq .+6 ; 0x3fbc + watchdogConfig(WATCHDOG_16MS); // shorten WD timeout + 3fb6: 88 e0 ldi r24, 0x08 ; 8 + 3fb8: f5 df rcall .-22 ; 0x3fa4 + 3fba: ff cf rjmp .-2 ; 0x3fba + while (1) // and busy-loop so that WD causes + ; // a reset and app start. + } putch(STK_INSYNC); - 3fe8: 84 e1 ldi r24, 0x14 ; 20 + 3fbc: 84 e1 ldi r24, 0x14 ; 20 } - 3fea: da cf rjmp .-76 ; 0x3fa0 + 3fbe: e2 cf rjmp .-60 ; 0x3f84 -00003fec : +00003fc0 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 3fec: 1f 93 push r17 - 3fee: 18 2f mov r17, r24 + 3fc0: 1f 93 push r17 + 3fc2: 18 2f mov r17, r24 do getch(); while (--count); - 3ff0: df df rcall .-66 ; 0x3fb0 - 3ff2: 11 50 subi r17, 0x01 ; 1 - 3ff4: e9 f7 brne .-6 ; 0x3ff0 + 3fc4: e7 df rcall .-50 ; 0x3f94 + 3fc6: 11 50 subi r17, 0x01 ; 1 + 3fc8: e9 f7 brne .-6 ; 0x3fc4 verifySpace(); - 3ff6: f4 df rcall .-24 ; 0x3fe0 + 3fca: f2 df rcall .-28 ; 0x3fb0 +} + 3fcc: 1f 91 pop r17 + 3fce: 08 95 ret + +00003fd0 : + WDTCSR = _BV(WDCE) | _BV(WDE); + WDTCSR = x; } - 3ff8: 1f 91 pop r17 - 3ffa: 08 95 ret + +void appStart() { + watchdogConfig(WATCHDOG_OFF); + 3fd0: 80 e0 ldi r24, 0x00 ; 0 + 3fd2: e8 df rcall .-48 ; 0x3fa4 + __asm__ __volatile__ ( + 3fd4: ee 27 eor r30, r30 + 3fd6: ff 27 eor r31, r31 + 3fd8: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_pro_8MHz.hex b/bootloaders/optiboot/optiboot_pro_8MHz.hex index 77897e7..dcdbbb4 100644 --- a/bootloaders/optiboot/optiboot_pro_8MHz.hex +++ b/bootloaders/optiboot/optiboot_pro_8MHz.hex @@ -1,35 +1,33 @@ -:103E0000112484B714BE81FFE6D085E08093810041 +:103E0000112484B714BE81FFE3D085E08093810044 :103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20088E08093C4008EE0CFD0259A86E05F +:103E2000C20088E08093C4008EE0BCD0259A86E072 :103E300028E13EEF91E0309385002093840096BB0B -:103E4000B09BFECF1D9AA8958150A9F7DD24D3948D -:103E5000A5E0EA2EF1E1FF2EABD0813421F481E020 -:103E6000C5D083E020C0823411F484E103C08534DE -:103E700019F485E0BBD091C0853581F499D0082F25 -:103E800010E096D090E0982F8827802B912B880FF8 -:103E9000991F90930102809300027EC0863529F419 -:103EA00084E0A4D080E07CD078C0843609F04EC095 -:103EB00087D0E0910002F091010288E3E030F8073A -:103EC00018F483E087BFE895C0E0D1E071D0899312 -:103ED000809102028150809302028823B9F7E09119 -:103EE0000002F091010288E3E030F80718F083E067 -:103EF00087BFE89575D007B600FCFDCF4091000262 -:103F000050910102A0E0B1E02C9130E011968C912B -:103F1000119790E0982F8827822B932B1296FA0105 -:103F20000C01D7BEE89511244E5F5F4FF1E0A03839 -:103F3000BF0751F7E0910002F0910102E7BEE8955A -:103F400007B600FCFDCFF7BEE89527C08437B9F46B -:103F500037D046D0E0910002F09101023196F09303 -:103F60000102E09300023197E4918E2F19D08091E5 -:103F70000202815080930202882361F70EC08537C8 -:103F800039F42ED08EE10CD084E90AD086E08BCFB4 -:103F9000813511F488E019D023D080E101D05CCFC5 -:103FA000982F8091C00085FFFCCF9093C6000895A4 -:103FB000A8958091C00087FFFCCF8091C60008952E -:103FC000F7DFF6DF80930202F3CFE0E6F0E098E15E -:103FD00090838083089580E0F8DFEE27FF2709941F -:103FE000E7DF803209F0F7DF84E1DACF1F93182F83 -:0C3FF000DFDF1150E9F7F4DF1F910895A6 +:103E4000B09BFECF1D9AA8958150A9F79924939411 +:103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE +:103E6000AFD083E01FC0823411F484E103C08534F5 +:103E700019F485E0A5D083C0853579F48BD0E82E80 +:103E8000FF2488D0082F10E0102F00270E291F29AB +:103E9000000F111F8DD0680172C0863529F484E0AF +:103EA0008FD080E06FD06BC0843609F042C072D0F2 +:103EB00071D0082F6FD080E0C81688E3D80620F4B0 +:103EC00083E0F60187BFE895C0E0D1E063D0899335 +:103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF +:103EE000F60187BFE89564D007B600FCFDCFA601B8 +:103EF000A0E0B1E02C9130E011968C91119790E008 +:103F0000982F8827822B932B1296FA010C0197BECB +:103F1000E89511244E5F5F4FF1E0A038BF0751F7DD +:103F2000F601A7BEE89507B600FCFDCFB7BEE89541 +:103F300026C08437B1F42ED02DD0F82E2BD038D017 +:103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 +:103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 +:103F60000EC0853739F424D08EE10CD084E90AD014 +:103F700086E098CF813511F488E014D019D080E123 +:103F800001D06ACF982F8091C00085FFFCCF90931D +:103F9000C6000895A8958091C00087FFFCCF80914E +:103FA000C6000895E0E6F0E098E1908380830895EC +:103FB000F1DF803219F088E0F5DFFFCF84E1E2CF56 +:103FC0001F93182FE7DF1150E9F7F2DF1F910895D3 +:0A3FD00080E0E8DFEE27FF270994E8 :023FFE000104BC :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_8MHz.lst b/bootloaders/optiboot/optiboot_pro_8MHz.lst index 23d5e1a..d3d760e 100644 --- a/bootloaders/optiboot/optiboot_pro_8MHz.lst +++ b/bootloaders/optiboot/optiboot_pro_8MHz.lst @@ -3,27 +3,27 @@ optiboot_pro_8MHz.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001fc 00003e00 00003e00 00000054 2**1 + 0 .text 000001da 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 00000250 2**0 + 1 .version 00000002 00003ffe 00003ffe 0000022e 2**0 CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000252 2**0 + 2 .debug_aranges 00000028 00000000 00000000 00000230 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000006a 00000000 00000000 0000027a 2**0 + 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 00000285 00000000 00000000 000002e4 2**0 + 4 .debug_info 0000028c 00000000 00000000 000002b7 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000019f 00000000 00000000 00000569 2**0 + 5 .debug_abbrev 00000199 00000000 00000000 00000543 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000453 00000000 00000000 00000708 2**0 + 6 .debug_line 00000456 00000000 00000000 000006dc 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000090 00000000 00000000 00000b5c 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b34 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000141 00000000 00000000 00000bec 2**0 + 8 .debug_str 00000149 00000000 00000000 00000bb4 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 000001e1 00000000 00000000 00000d2d 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000cfd 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000068 00000000 00000000 00000f0e 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f7b 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 3e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 3e06: 81 ff sbrs r24, 1 - 3e08: e6 d0 rcall .+460 ; 0x3fd6 + 3e08: e3 d0 rcall .+454 ; 0x3fd0 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -77,7 +77,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: cf d0 rcall .+414 ; 0x3fca + 3e2a: bc d0 rcall .+376 ; 0x3fa4 /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -111,8 +111,8 @@ void flash_led(uint8_t count) { #else LED_PIN |= _BV(LED); 3e44: 1d 9a sbi 0x03, 5 ; 3 - return getch(); } +#endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { @@ -132,8 +132,8 @@ void watchdogReset() { if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 3e4c: dd 24 eor r13, r13 - 3e4e: d3 94 inc r13 + 3e4c: 99 24 eor r9, r9 + 3e4e: 93 94 inc r9 __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); @@ -141,21 +141,21 @@ void watchdogReset() { // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); 3e50: a5 e0 ldi r26, 0x05 ; 5 - 3e52: ea 2e mov r14, r26 + 3e52: aa 2e mov r10, r26 boot_spm_busy_wait(); #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); 3e54: f1 e1 ldi r31, 0x11 ; 17 - 3e56: ff 2e mov r15, r31 + 3e56: bf 2e mov r11, r31 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 3e58: ab d0 rcall .+342 ; 0x3fb0 + 3e58: 9d d0 rcall .+314 ; 0x3f94 if(ch == STK_GET_PARAMETER) { 3e5a: 81 34 cpi r24, 0x41 ; 65 @@ -163,10 +163,10 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: c5 d0 rcall .+394 ; 0x3fec + 3e60: af d0 rcall .+350 ; 0x3fc0 putch(0x03); 3e62: 83 e0 ldi r24, 0x03 ; 3 - 3e64: 20 c0 rjmp .+64 ; 0x3ea6 + 3e64: 1f c0 rjmp .+62 ; 0x3ea4 } else if(ch == STK_SET_DEVICE) { 3e66: 82 34 cpi r24, 0x42 ; 66 @@ -182,71 +182,77 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: bb d0 rcall .+374 ; 0x3fec - 3e76: 91 c0 rjmp .+290 ; 0x3f9a + 3e74: a5 d0 rcall .+330 ; 0x3fc0 + 3e76: 83 c0 rjmp .+262 ; 0x3f7e } else if(ch == STK_LOAD_ADDRESS) { 3e78: 85 35 cpi r24, 0x55 ; 85 - 3e7a: 81 f4 brne .+32 ; 0x3e9c + 3e7a: 79 f4 brne .+30 ; 0x3e9a // LOAD ADDRESS uint16_t newAddress; newAddress = getch(); - 3e7c: 99 d0 rcall .+306 ; 0x3fb0 + 3e7c: 8b d0 rcall .+278 ; 0x3f94 newAddress = (newAddress & 0xff) | (getch() << 8); - 3e7e: 08 2f mov r16, r24 - 3e80: 10 e0 ldi r17, 0x00 ; 0 - 3e82: 96 d0 rcall .+300 ; 0x3fb0 - 3e84: 90 e0 ldi r25, 0x00 ; 0 - 3e86: 98 2f mov r25, r24 - 3e88: 88 27 eor r24, r24 - 3e8a: 80 2b or r24, r16 - 3e8c: 91 2b or r25, r17 + 3e7e: e8 2e mov r14, r24 + 3e80: ff 24 eor r15, r15 + 3e82: 88 d0 rcall .+272 ; 0x3f94 + 3e84: 08 2f mov r16, r24 + 3e86: 10 e0 ldi r17, 0x00 ; 0 + 3e88: 10 2f mov r17, r16 + 3e8a: 00 27 eor r16, r16 + 3e8c: 0e 29 or r16, r14 + 3e8e: 1f 29 or r17, r15 #ifdef RAMPZ // Transfer top bit to RAMPZ RAMPZ = (newAddress & 0x8000) ? 1 : 0; #endif newAddress += newAddress; // Convert from word address to byte address - 3e8e: 88 0f add r24, r24 - 3e90: 99 1f adc r25, r25 + 3e90: 00 0f add r16, r16 + 3e92: 11 1f adc r17, r17 address = newAddress; - 3e92: 90 93 01 02 sts 0x0201, r25 - 3e96: 80 93 00 02 sts 0x0200, r24 - 3e9a: 7e c0 rjmp .+252 ; 0x3f98 verifySpace(); + 3e94: 8d d0 rcall .+282 ; 0x3fb0 + 3e96: 68 01 movw r12, r16 + 3e98: 72 c0 rjmp .+228 ; 0x3f7e } else if(ch == STK_UNIVERSAL) { - 3e9c: 86 35 cpi r24, 0x56 ; 86 - 3e9e: 29 f4 brne .+10 ; 0x3eaa + 3e9a: 86 35 cpi r24, 0x56 ; 86 + 3e9c: 29 f4 brne .+10 ; 0x3ea8 // UNIVERSAL command is ignored getNch(4); - 3ea0: 84 e0 ldi r24, 0x04 ; 4 - 3ea2: a4 d0 rcall .+328 ; 0x3fec + 3e9e: 84 e0 ldi r24, 0x04 ; 4 + 3ea0: 8f d0 rcall .+286 ; 0x3fc0 putch(0x00); - 3ea4: 80 e0 ldi r24, 0x00 ; 0 - 3ea6: 7c d0 rcall .+248 ; 0x3fa0 - 3ea8: 78 c0 rjmp .+240 ; 0x3f9a + 3ea2: 80 e0 ldi r24, 0x00 ; 0 + 3ea4: 6f d0 rcall .+222 ; 0x3f84 + 3ea6: 6b c0 rjmp .+214 ; 0x3f7e } /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 3eaa: 84 36 cpi r24, 0x64 ; 100 - 3eac: 09 f0 breq .+2 ; 0x3eb0 - 3eae: 4e c0 rjmp .+156 ; 0x3f4c + 3ea8: 84 36 cpi r24, 0x64 ; 100 + 3eaa: 09 f0 breq .+2 ; 0x3eae + 3eac: 42 c0 rjmp .+132 ; 0x3f32 // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; - getLen(); - 3eb0: 87 d0 rcall .+270 ; 0x3fc0 + getch(); /* getlen() */ + 3eae: 72 d0 rcall .+228 ; 0x3f94 + length = getch(); + 3eb0: 71 d0 rcall .+226 ; 0x3f94 + 3eb2: 08 2f mov r16, r24 + getch(); + 3eb4: 6f d0 rcall .+222 ; 0x3f94 // If we are in RWW section, immediately start page erase if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3eb2: e0 91 00 02 lds r30, 0x0200 - 3eb6: f0 91 01 02 lds r31, 0x0201 + 3eb6: 80 e0 ldi r24, 0x00 ; 0 + 3eb8: c8 16 cp r12, r24 3eba: 88 e3 ldi r24, 0x38 ; 56 - 3ebc: e0 30 cpi r30, 0x00 ; 0 - 3ebe: f8 07 cpc r31, r24 - 3ec0: 18 f4 brcc .+6 ; 0x3ec8 - 3ec2: 83 e0 ldi r24, 0x03 ; 3 + 3ebc: d8 06 cpc r13, r24 + 3ebe: 20 f4 brcc .+8 ; 0x3ec8 + 3ec0: 83 e0 ldi r24, 0x03 ; 3 + 3ec2: f6 01 movw r30, r12 3ec4: 87 bf out 0x37, r24 ; 55 3ec6: e8 95 spm 3ec8: c0 e0 ldi r28, 0x00 ; 0 @@ -255,302 +261,301 @@ void watchdogReset() { // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 3ecc: 71 d0 rcall .+226 ; 0x3fb0 + 3ecc: 63 d0 rcall .+198 ; 0x3f94 3ece: 89 93 st Y+, r24 while (--length); - 3ed0: 80 91 02 02 lds r24, 0x0202 - 3ed4: 81 50 subi r24, 0x01 ; 1 - 3ed6: 80 93 02 02 sts 0x0202, r24 - 3eda: 88 23 and r24, r24 - 3edc: b9 f7 brne .-18 ; 0x3ecc + 3ed0: 0c 17 cp r16, r28 + 3ed2: e1 f7 brne .-8 ; 0x3ecc // If we are in NRWW section, page erase has to be delayed until now. // Todo: Take RAMPZ into account if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3ede: e0 91 00 02 lds r30, 0x0200 - 3ee2: f0 91 01 02 lds r31, 0x0201 - 3ee6: 88 e3 ldi r24, 0x38 ; 56 - 3ee8: e0 30 cpi r30, 0x00 ; 0 - 3eea: f8 07 cpc r31, r24 - 3eec: 18 f0 brcs .+6 ; 0x3ef4 - 3eee: 83 e0 ldi r24, 0x03 ; 3 - 3ef0: 87 bf out 0x37, r24 ; 55 - 3ef2: e8 95 spm + 3ed4: f0 e0 ldi r31, 0x00 ; 0 + 3ed6: cf 16 cp r12, r31 + 3ed8: f8 e3 ldi r31, 0x38 ; 56 + 3eda: df 06 cpc r13, r31 + 3edc: 20 f0 brcs .+8 ; 0x3ee6 + 3ede: 83 e0 ldi r24, 0x03 ; 3 + 3ee0: f6 01 movw r30, r12 + 3ee2: 87 bf out 0x37, r24 ; 55 + 3ee4: e8 95 spm // Read command terminator, start reply verifySpace(); - 3ef4: 75 d0 rcall .+234 ; 0x3fe0 + 3ee6: 64 d0 rcall .+200 ; 0x3fb0 // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 3ef6: 07 b6 in r0, 0x37 ; 55 - 3ef8: 00 fc sbrc r0, 0 - 3efa: fd cf rjmp .-6 ; 0x3ef6 - } -#endif - - // Copy buffer into programming buffer + 3ee8: 07 b6 in r0, 0x37 ; 55 + 3eea: 00 fc sbrc r0, 0 + 3eec: fd cf rjmp .-6 ; 0x3ee8 + 3eee: a6 01 movw r20, r12 + 3ef0: a0 e0 ldi r26, 0x00 ; 0 + 3ef2: b1 e0 ldi r27, 0x01 ; 1 bufPtr = buff; addrPtr = (uint16_t)(void*)address; - 3efc: 40 91 00 02 lds r20, 0x0200 - 3f00: 50 91 01 02 lds r21, 0x0201 - 3f04: a0 e0 ldi r26, 0x00 ; 0 - 3f06: b1 e0 ldi r27, 0x01 ; 1 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 3f08: 2c 91 ld r18, X - 3f0a: 30 e0 ldi r19, 0x00 ; 0 + 3ef4: 2c 91 ld r18, X + 3ef6: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 3f0c: 11 96 adiw r26, 0x01 ; 1 - 3f0e: 8c 91 ld r24, X - 3f10: 11 97 sbiw r26, 0x01 ; 1 - 3f12: 90 e0 ldi r25, 0x00 ; 0 - 3f14: 98 2f mov r25, r24 - 3f16: 88 27 eor r24, r24 - 3f18: 82 2b or r24, r18 - 3f1a: 93 2b or r25, r19 + 3ef8: 11 96 adiw r26, 0x01 ; 1 + 3efa: 8c 91 ld r24, X + 3efc: 11 97 sbiw r26, 0x01 ; 1 + 3efe: 90 e0 ldi r25, 0x00 ; 0 + 3f00: 98 2f mov r25, r24 + 3f02: 88 27 eor r24, r24 + 3f04: 82 2b or r24, r18 + 3f06: 93 2b or r25, r19 #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 3f1c: 12 96 adiw r26, 0x02 ; 2 + 3f08: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f1e: fa 01 movw r30, r20 - 3f20: 0c 01 movw r0, r24 - 3f22: d7 be out 0x37, r13 ; 55 - 3f24: e8 95 spm - 3f26: 11 24 eor r1, r1 + 3f0a: fa 01 movw r30, r20 + 3f0c: 0c 01 movw r0, r24 + 3f0e: 97 be out 0x37, r9 ; 55 + 3f10: e8 95 spm + 3f12: 11 24 eor r1, r1 addrPtr += 2; - 3f28: 4e 5f subi r20, 0xFE ; 254 - 3f2a: 5f 4f sbci r21, 0xFF ; 255 + 3f14: 4e 5f subi r20, 0xFE ; 254 + 3f16: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 3f2c: f1 e0 ldi r31, 0x01 ; 1 - 3f2e: a0 38 cpi r26, 0x80 ; 128 - 3f30: bf 07 cpc r27, r31 - 3f32: 51 f7 brne .-44 ; 0x3f08 + 3f18: f1 e0 ldi r31, 0x01 ; 1 + 3f1a: a0 38 cpi r26, 0x80 ; 128 + 3f1c: bf 07 cpc r27, r31 + 3f1e: 51 f7 brne .-44 ; 0x3ef4 // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 3f34: e0 91 00 02 lds r30, 0x0200 - 3f38: f0 91 01 02 lds r31, 0x0201 - 3f3c: e7 be out 0x37, r14 ; 55 - 3f3e: e8 95 spm + 3f20: f6 01 movw r30, r12 + 3f22: a7 be out 0x37, r10 ; 55 + 3f24: e8 95 spm boot_spm_busy_wait(); - 3f40: 07 b6 in r0, 0x37 ; 55 - 3f42: 00 fc sbrc r0, 0 - 3f44: fd cf rjmp .-6 ; 0x3f40 + 3f26: 07 b6 in r0, 0x37 ; 55 + 3f28: 00 fc sbrc r0, 0 + 3f2a: fd cf rjmp .-6 ; 0x3f26 #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 3f46: f7 be out 0x37, r15 ; 55 - 3f48: e8 95 spm - 3f4a: 27 c0 rjmp .+78 ; 0x3f9a + 3f2c: b7 be out 0x37, r11 ; 55 + 3f2e: e8 95 spm + 3f30: 26 c0 rjmp .+76 ; 0x3f7e #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 3f4c: 84 37 cpi r24, 0x74 ; 116 - 3f4e: b9 f4 brne .+46 ; 0x3f7e + 3f32: 84 37 cpi r24, 0x74 ; 116 + 3f34: b1 f4 brne .+44 ; 0x3f62 // READ PAGE - we only read flash - getLen(); - 3f50: 37 d0 rcall .+110 ; 0x3fc0 + getch(); /* getlen() */ + 3f36: 2e d0 rcall .+92 ; 0x3f94 + length = getch(); + 3f38: 2d d0 rcall .+90 ; 0x3f94 + 3f3a: f8 2e mov r15, r24 + getch(); + 3f3c: 2b d0 rcall .+86 ; 0x3f94 + verifySpace(); - 3f52: 46 d0 rcall .+140 ; 0x3fe0 + 3f3e: 38 d0 rcall .+112 ; 0x3fb0 + 3f40: f6 01 movw r30, r12 + 3f42: ef 2c mov r14, r15 putch(result); address++; } while (--length); #else do putch(pgm_read_byte_near(address++)); - 3f54: e0 91 00 02 lds r30, 0x0200 - 3f58: f0 91 01 02 lds r31, 0x0201 - 3f5c: 31 96 adiw r30, 0x01 ; 1 - 3f5e: f0 93 01 02 sts 0x0201, r31 - 3f62: e0 93 00 02 sts 0x0200, r30 - 3f66: 31 97 sbiw r30, 0x01 ; 1 - 3f68: e4 91 lpm r30, Z+ - 3f6a: 8e 2f mov r24, r30 - 3f6c: 19 d0 rcall .+50 ; 0x3fa0 + 3f44: 8f 01 movw r16, r30 + 3f46: 0f 5f subi r16, 0xFF ; 255 + 3f48: 1f 4f sbci r17, 0xFF ; 255 + 3f4a: 84 91 lpm r24, Z+ + 3f4c: 1b d0 rcall .+54 ; 0x3f84 while (--length); - 3f6e: 80 91 02 02 lds r24, 0x0202 - 3f72: 81 50 subi r24, 0x01 ; 1 - 3f74: 80 93 02 02 sts 0x0202, r24 - 3f78: 88 23 and r24, r24 - 3f7a: 61 f7 brne .-40 ; 0x3f54 - 3f7c: 0e c0 rjmp .+28 ; 0x3f9a + 3f4e: ea 94 dec r14 + 3f50: f8 01 movw r30, r16 + 3f52: c1 f7 brne .-16 ; 0x3f44 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) +#endif + +/* main program starts here */ +int main(void) { + 3f54: 08 94 sec + 3f56: c1 1c adc r12, r1 + 3f58: d1 1c adc r13, r1 + 3f5a: fa 94 dec r15 + 3f5c: cf 0c add r12, r15 + 3f5e: d1 1c adc r13, r1 + 3f60: 0e c0 rjmp .+28 ; 0x3f7e #endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 3f7e: 85 37 cpi r24, 0x75 ; 117 - 3f80: 39 f4 brne .+14 ; 0x3f90 + 3f62: 85 37 cpi r24, 0x75 ; 117 + 3f64: 39 f4 brne .+14 ; 0x3f74 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 3f82: 2e d0 rcall .+92 ; 0x3fe0 + 3f66: 24 d0 rcall .+72 ; 0x3fb0 putch(SIGNATURE_0); - 3f84: 8e e1 ldi r24, 0x1E ; 30 - 3f86: 0c d0 rcall .+24 ; 0x3fa0 + 3f68: 8e e1 ldi r24, 0x1E ; 30 + 3f6a: 0c d0 rcall .+24 ; 0x3f84 putch(SIGNATURE_1); - 3f88: 84 e9 ldi r24, 0x94 ; 148 - 3f8a: 0a d0 rcall .+20 ; 0x3fa0 + 3f6c: 84 e9 ldi r24, 0x94 ; 148 + 3f6e: 0a d0 rcall .+20 ; 0x3f84 putch(SIGNATURE_2); - 3f8c: 86 e0 ldi r24, 0x06 ; 6 - 3f8e: 8b cf rjmp .-234 ; 0x3ea6 + 3f70: 86 e0 ldi r24, 0x06 ; 6 + 3f72: 98 cf rjmp .-208 ; 0x3ea4 } else if (ch == 'Q') { - 3f90: 81 35 cpi r24, 0x51 ; 81 - 3f92: 11 f4 brne .+4 ; 0x3f98 + 3f74: 81 35 cpi r24, 0x51 ; 81 + 3f76: 11 f4 brne .+4 ; 0x3f7c // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 3f94: 88 e0 ldi r24, 0x08 ; 8 - 3f96: 19 d0 rcall .+50 ; 0x3fca + 3f78: 88 e0 ldi r24, 0x08 ; 8 + 3f7a: 14 d0 rcall .+40 ; 0x3fa4 verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 3f98: 23 d0 rcall .+70 ; 0x3fe0 + 3f7c: 19 d0 rcall .+50 ; 0x3fb0 } putch(STK_OK); - 3f9a: 80 e1 ldi r24, 0x10 ; 16 - 3f9c: 01 d0 rcall .+2 ; 0x3fa0 - 3f9e: 5c cf rjmp .-328 ; 0x3e58 + 3f7e: 80 e1 ldi r24, 0x10 ; 16 + 3f80: 01 d0 rcall .+2 ; 0x3f84 + 3f82: 6a cf rjmp .-300 ; 0x3e58 -00003fa0 : +00003f84 : } } void putch(char ch) { - 3fa0: 98 2f mov r25, r24 + 3f84: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); - 3fa2: 80 91 c0 00 lds r24, 0x00C0 - 3fa6: 85 ff sbrs r24, 5 - 3fa8: fc cf rjmp .-8 ; 0x3fa2 + 3f86: 80 91 c0 00 lds r24, 0x00C0 + 3f8a: 85 ff sbrs r24, 5 + 3f8c: fc cf rjmp .-8 ; 0x3f86 UDR0 = ch; - 3faa: 90 93 c6 00 sts 0x00C6, r25 + 3f8e: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 3fae: 08 95 ret + 3f92: 08 95 ret -00003fb0 : - return getch(); +00003f94 : } +#endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3fb0: a8 95 wdr + 3f94: a8 95 wdr [uartBit] "I" (UART_RX_BIT) : "r25" ); #else while(!(UCSR0A & _BV(RXC0))); - 3fb2: 80 91 c0 00 lds r24, 0x00C0 - 3fb6: 87 ff sbrs r24, 7 - 3fb8: fc cf rjmp .-8 ; 0x3fb2 + 3f96: 80 91 c0 00 lds r24, 0x00C0 + 3f9a: 87 ff sbrs r24, 7 + 3f9c: fc cf rjmp .-8 ; 0x3f96 ch = UDR0; - 3fba: 80 91 c6 00 lds r24, 0x00C6 + 3f9e: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 3fbe: 08 95 ret - -00003fc0 : - } while (--count); -} -#endif - -uint8_t getLen() { - getch(); - 3fc0: f7 df rcall .-18 ; 0x3fb0 - length = getch(); - 3fc2: f6 df rcall .-20 ; 0x3fb0 - 3fc4: 80 93 02 02 sts 0x0202, r24 - return getch(); -} - 3fc8: f3 cf rjmp .-26 ; 0x3fb0 + 3fa2: 08 95 ret -00003fca : +00003fa4 : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 3fca: e0 e6 ldi r30, 0x60 ; 96 - 3fcc: f0 e0 ldi r31, 0x00 ; 0 - 3fce: 98 e1 ldi r25, 0x18 ; 24 - 3fd0: 90 83 st Z, r25 + 3fa4: e0 e6 ldi r30, 0x60 ; 96 + 3fa6: f0 e0 ldi r31, 0x00 ; 0 + 3fa8: 98 e1 ldi r25, 0x18 ; 24 + 3faa: 90 83 st Z, r25 WDTCSR = x; - 3fd2: 80 83 st Z, r24 + 3fac: 80 83 st Z, r24 } - 3fd4: 08 95 ret - -00003fd6 : - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 3fd6: 80 e0 ldi r24, 0x00 ; 0 - 3fd8: f8 df rcall .-16 ; 0x3fca - __asm__ __volatile__ ( - 3fda: ee 27 eor r30, r30 - 3fdc: ff 27 eor r31, r31 - 3fde: 09 94 ijmp + 3fae: 08 95 ret -00003fe0 : +00003fb0 : do getch(); while (--count); verifySpace(); } void verifySpace() { - if (getch() != CRC_EOP) appStart(); - 3fe0: e7 df rcall .-50 ; 0x3fb0 - 3fe2: 80 32 cpi r24, 0x20 ; 32 - 3fe4: 09 f0 breq .+2 ; 0x3fe8 - 3fe6: f7 df rcall .-18 ; 0x3fd6 + if (getch() != CRC_EOP) { + 3fb0: f1 df rcall .-30 ; 0x3f94 + 3fb2: 80 32 cpi r24, 0x20 ; 32 + 3fb4: 19 f0 breq .+6 ; 0x3fbc + watchdogConfig(WATCHDOG_16MS); // shorten WD timeout + 3fb6: 88 e0 ldi r24, 0x08 ; 8 + 3fb8: f5 df rcall .-22 ; 0x3fa4 + 3fba: ff cf rjmp .-2 ; 0x3fba + while (1) // and busy-loop so that WD causes + ; // a reset and app start. + } putch(STK_INSYNC); - 3fe8: 84 e1 ldi r24, 0x14 ; 20 + 3fbc: 84 e1 ldi r24, 0x14 ; 20 } - 3fea: da cf rjmp .-76 ; 0x3fa0 + 3fbe: e2 cf rjmp .-60 ; 0x3f84 -00003fec : +00003fc0 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 3fec: 1f 93 push r17 - 3fee: 18 2f mov r17, r24 + 3fc0: 1f 93 push r17 + 3fc2: 18 2f mov r17, r24 do getch(); while (--count); - 3ff0: df df rcall .-66 ; 0x3fb0 - 3ff2: 11 50 subi r17, 0x01 ; 1 - 3ff4: e9 f7 brne .-6 ; 0x3ff0 + 3fc4: e7 df rcall .-50 ; 0x3f94 + 3fc6: 11 50 subi r17, 0x01 ; 1 + 3fc8: e9 f7 brne .-6 ; 0x3fc4 verifySpace(); - 3ff6: f4 df rcall .-24 ; 0x3fe0 + 3fca: f2 df rcall .-28 ; 0x3fb0 +} + 3fcc: 1f 91 pop r17 + 3fce: 08 95 ret + +00003fd0 : + WDTCSR = _BV(WDCE) | _BV(WDE); + WDTCSR = x; } - 3ff8: 1f 91 pop r17 - 3ffa: 08 95 ret + +void appStart() { + watchdogConfig(WATCHDOG_OFF); + 3fd0: 80 e0 ldi r24, 0x00 ; 0 + 3fd2: e8 df rcall .-48 ; 0x3fa4 + __asm__ __volatile__ ( + 3fd4: ee 27 eor r30, r30 + 3fd6: ff 27 eor r31, r31 + 3fd8: 09 94 ijmp -- cgit v1.2.3-18-g5258 From 6a466797f77e3342aef213fdf0526e5b1dda2f6a Mon Sep 17 00:00:00 2001 From: WestfW Date: Fri, 10 Jun 2011 23:16:21 -0700 Subject: Update version to reflect previous edit. Sigh. --- bootloaders/optiboot/optiboot.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bootloaders/optiboot/optiboot.c b/bootloaders/optiboot/optiboot.c index 8940359..8dbe1bf 100644 --- a/bootloaders/optiboot/optiboot.c +++ b/bootloaders/optiboot/optiboot.c @@ -132,11 +132,13 @@ /**********************************************************/ /* Edit History: */ /* */ +/* 4.2 WestfW: reduce code size, fix timeouts, change */ +/* verifySpace to use WDT instead of appstart */ /* 4.1 WestfW: put version number in binary. */ /**********************************************************/ #define OPTIBOOT_MAJVER 4 -#define OPTIBOOT_MINVER 1 +#define OPTIBOOT_MINVER 2 #define MAKESTR(a) #a #define MAKEVER(a, b) MAKESTR(a*256+b) -- cgit v1.2.3-18-g5258 From 738e5ca709769e6b42d0ae93285435aeaa459a56 Mon Sep 17 00:00:00 2001 From: WestfW Date: Sat, 11 Jun 2011 03:15:33 -0700 Subject: Fix errors in LDSECTIONS refactoring (found during atmega8 testing.) --- bootloaders/optiboot/Makefile | 14 +++++++------- bootloaders/optiboot/optiboot_atmega328.hex | 2 +- bootloaders/optiboot/optiboot_atmega328.lst | 14 +++++++------- bootloaders/optiboot/optiboot_diecimila.hex | 2 +- bootloaders/optiboot/optiboot_diecimila.lst | 14 +++++++------- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/bootloaders/optiboot/Makefile b/bootloaders/optiboot/Makefile index ce25ac3..f6ba374 100644 --- a/bootloaders/optiboot/Makefile +++ b/bootloaders/optiboot/Makefile @@ -129,7 +129,7 @@ virboot328: TARGET = atmega328 virboot328: MCU_TARGET = atmega328p virboot328: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' '-DVIRTUAL_BOOT' virboot328: AVR_FREQ = 16000000L -virboot328: LDSECTIONS = --section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe +virboot328: LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe virboot328: $(PROGRAM)_atmega328.hex virboot328: $(PROGRAM)_atmega328.lst @@ -221,7 +221,7 @@ sanguino: TARGET = atmega644p sanguino: MCU_TARGET = atmega644p sanguino: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' '-DBIGBOOT' sanguino: AVR_FREQ = 16000000L -sanguino: LDSECTION = --section-start=.text=0xfc00 +sanguino: LDSECTIONS = -Wl,--section-start=.text=0xfc00 sanguino: $(PROGRAM)_atmega644p.hex sanguino: $(PROGRAM)_atmega644p.lst @@ -241,7 +241,7 @@ sanguino_isp: isp mega: MCU_TARGET = atmega1280 mega: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' '-DBIGBOOT' mega: AVR_FREQ = 16000000L -mega: LDSECTION = --section-start=.text=0x1fc00 +mega: LDSECTIONS = -Wl,--section-start=.text=0x1fc00 mega: $(PROGRAM)_atmega1280.hex mega: $(PROGRAM)_atmega1280.lst @@ -262,7 +262,7 @@ atmega8: TARGET = atmega8 atmega8: MCU_TARGET = atmega8 atmega8: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' atmega8: AVR_FREQ = 16000000L -atmega8: LDSECTIONS = --section-start=.text=0x1e00 -Wl,--section-start=.version=0x1ffe +atmega8: LDSECTIONS = -Wl,--section-start=.text=0x1e00 -Wl,--section-start=.version=0x1ffe atmega8: $(PROGRAM)_atmega8.hex atmega8: $(PROGRAM)_atmega8.lst @@ -281,7 +281,7 @@ atmega88: TARGET = atmega88 atmega88: MCU_TARGET = atmega88 atmega88: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' atmega88: AVR_FREQ = 16000000L -atmega88: LDSECTIONS = --section-start=.text=0x1e00 -Wl,--section-start=.version=0x1ffe +atmega88: LDSECTIONS = -Wl,--section-start=.text=0x1e00 -Wl,--section-start=.version=0x1ffe atmega88: $(PROGRAM)_atmega88.hex atmega88: $(PROGRAM)_atmega88.lst @@ -357,7 +357,7 @@ atmega328_pro8: TARGET = atmega328_pro_8MHz atmega328_pro8: MCU_TARGET = atmega328p atmega328_pro8: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' atmega328_pro8: AVR_FREQ = 8000000L -atmega328_pro8: LDSECTIONS = --section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe +atmega328_pro8: LDSECTIONS = -Wl,--section-start=.text=0x7e00 -Wl,--section-start=.version=0x7ffe atmega328_pro8: $(PROGRAM)_atmega328_pro_8MHz.hex atmega328_pro8: $(PROGRAM)_atmega328_pro_8MHz.lst @@ -382,7 +382,7 @@ luminet: MCU_TARGET = attiny84 luminet: CFLAGS += '-DLED_START_FLASHES=3' '-DSOFT_UART' '-DBAUD_RATE=9600' luminet: CFLAGS += '-DVIRTUAL_BOOT_PARTITION' luminet: AVR_FREQ = 1000000L -luminet: LDSECTIONS = --section-start=.text=0x1d00 -Wl,--section-start=.version=0x1efe +luminet: LDSECTIONS = -Wl,--section-start=.text=0x1d00 -Wl,--section-start=.version=0x1efe luminet: $(PROGRAM)_luminet.hex luminet: $(PROGRAM)_luminet.lst diff --git a/bootloaders/optiboot/optiboot_atmega328.hex b/bootloaders/optiboot/optiboot_atmega328.hex index 11819d6..10dcd6c 100644 --- a/bootloaders/optiboot/optiboot_atmega328.hex +++ b/bootloaders/optiboot/optiboot_atmega328.hex @@ -28,6 +28,6 @@ :107FB000F1DF803219F088E0F5DFFFCF84E1E2CF16 :107FC0001F93182FE7DF1150E9F7F2DF1F91089593 :0A7FD00080E0E8DFEE27FF270994A8 -:027FFE0001047C +:027FFE0002047B :0400000300007E007B :00000001FF diff --git a/bootloaders/optiboot/optiboot_atmega328.lst b/bootloaders/optiboot/optiboot_atmega328.lst index 7876b96..89577f6 100644 --- a/bootloaders/optiboot/optiboot_atmega328.lst +++ b/bootloaders/optiboot/optiboot_atmega328.lst @@ -11,19 +11,19 @@ Idx Name Size VMA LMA File off Algn CONTENTS, READONLY, DEBUGGING 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028c 00000000 00000000 000002b7 2**0 + 4 .debug_info 0000028d 00000000 00000000 000002b7 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000199 00000000 00000000 00000543 2**0 + 5 .debug_abbrev 0000018a 00000000 00000000 00000544 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000456 00000000 00000000 000006dc 2**0 + 6 .debug_line 00000456 00000000 00000000 000006ce 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b34 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b24 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000bb4 2**0 + 8 .debug_str 00000149 00000000 00000000 00000ba4 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000cfd 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000ced 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f7b 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f6b 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: diff --git a/bootloaders/optiboot/optiboot_diecimila.hex b/bootloaders/optiboot/optiboot_diecimila.hex index 733a139..26bbd4c 100644 --- a/bootloaders/optiboot/optiboot_diecimila.hex +++ b/bootloaders/optiboot/optiboot_diecimila.hex @@ -28,6 +28,6 @@ :103FB000F1DF803219F088E0F5DFFFCF84E1E2CF56 :103FC0001F93182FE7DF1150E9F7F2DF1F910895D3 :0A3FD00080E0E8DFEE27FF270994E8 -:023FFE000104BC +:023FFE000204BB :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_diecimila.lst b/bootloaders/optiboot/optiboot_diecimila.lst index edd9cb3..6e0843d 100644 --- a/bootloaders/optiboot/optiboot_diecimila.lst +++ b/bootloaders/optiboot/optiboot_diecimila.lst @@ -11,19 +11,19 @@ Idx Name Size VMA LMA File off Algn CONTENTS, READONLY, DEBUGGING 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028c 00000000 00000000 000002b7 2**0 + 4 .debug_info 0000028d 00000000 00000000 000002b7 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000199 00000000 00000000 00000543 2**0 + 5 .debug_abbrev 0000018a 00000000 00000000 00000544 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000456 00000000 00000000 000006dc 2**0 + 6 .debug_line 00000456 00000000 00000000 000006ce 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b34 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b24 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000bb4 2**0 + 8 .debug_str 00000149 00000000 00000000 00000ba4 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000cfd 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000ced 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f7b 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f6b 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: -- cgit v1.2.3-18-g5258 From 5c27dd97a0df974fa7f42b08d8eba6bf1fd50cb8 Mon Sep 17 00:00:00 2001 From: WestfW Date: Sat, 11 Jun 2011 03:17:38 -0700 Subject: (make sure .hex and .lst are updated as well.) --- .../optiboot/optiboot_atmega328_pro_8MHz.hex | 63 +-- .../optiboot/optiboot_atmega328_pro_8MHz.lst | 482 ++++++++--------- bootloaders/optiboot/optiboot_lilypad.hex | 2 +- bootloaders/optiboot/optiboot_lilypad.lst | 14 +- .../optiboot/optiboot_lilypad_resonator.hex | 2 +- .../optiboot/optiboot_lilypad_resonator.lst | 14 +- bootloaders/optiboot/optiboot_luminet.hex | 77 +-- bootloaders/optiboot/optiboot_luminet.lst | 586 ++++++++++----------- bootloaders/optiboot/optiboot_pro_16MHz.hex | 2 +- bootloaders/optiboot/optiboot_pro_16MHz.lst | 14 +- bootloaders/optiboot/optiboot_pro_20mhz.hex | 2 +- bootloaders/optiboot/optiboot_pro_20mhz.lst | 14 +- bootloaders/optiboot/optiboot_pro_8MHz.hex | 2 +- bootloaders/optiboot/optiboot_pro_8MHz.lst | 14 +- 14 files changed, 645 insertions(+), 643 deletions(-) diff --git a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex index a181f0b..3b543c1 100644 --- a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex +++ b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex @@ -1,32 +1,33 @@ -:10000000112484B714BE81FFE3D085E08093810082 -:1000100082E08093C00088E18093C10086E08093F5 -:10002000C20088E08093C4008EE0BCD0259A86E0B0 -:1000300028E13EEF91E0309385002093840096BB49 -:10004000B09BFECF1D9AA8958150A9F7992493944F -:10005000A5E0AA2EF1E1BF2E9DD0813421F481E0EC -:10006000AFD083E01FC0823411F484E103C0853433 -:1000700019F485E0A5D083C0853579F48BD0E82EBE -:10008000FF2488D0082F10E0102F00270E291F29E9 -:10009000000F111F8DD0680172C0863529F484E0ED -:1000A0008FD080E06FD06BC0843609F042C072D030 -:1000B00071D0082F6FD080E0C81680E7D80620F4F2 -:1000C00083E0F60187BFE895C0E0D1E063D0899373 -:1000D0000C17E1F7F0E0CF16F0E7DF0620F083E041 -:1000E000F60187BFE89564D007B600FCFDCFA601F6 -:1000F000A0E0B1E02C9130E011968C91119790E046 -:10010000982F8827822B932B1296FA010C0197BE09 -:10011000E89511244E5F5F4FF1E0A038BF0751F71B -:10012000F601A7BEE89507B600FCFDCFB7BEE8957F -:1001300026C08437B1F42ED02DD0F82E2BD038D055 -:10014000F601EF2C8F010F5F1F4F84911BD0EA94B3 -:10015000F801C1F70894C11CD11CFA94CF0CD11C32 -:100160000EC0853739F424D08EE10CD085E90AD051 -:100170008FE098CF813511F488E014D019D080E158 -:1001800001D06ACF982F8091C00085FFFCCF90935B -:10019000C6000895A8958091C00087FFFCCF80918C -:1001A000C6000895E0E6F0E098E19083808308952A -:1001B000F1DF803219F088E0F5DFFFCF84E1E2CF94 -:1001C0001F93182FE7DF1150E9F7F2DF1F91089511 -:0A01D00080E0E8DFEE27FF27099426 -:027FFE0001047C +:107E0000112484B714BE81FFE3D085E08093810004 +:107E100082E08093C00088E18093C10086E0809377 +:107E2000C20088E08093C4008EE0BCD0259A86E032 +:107E300028E13EEF91E0309385002093840096BBCB +:107E4000B09BFECF1D9AA8958150A9F799249394D1 +:107E5000A5E0AA2EF1E1BF2E9DD0813421F481E06E +:107E6000AFD083E01FC0823411F484E103C08534B5 +:107E700019F485E0A5D083C0853579F48BD0E82E40 +:107E8000FF2488D0082F10E0102F00270E291F296B +:107E9000000F111F8DD0680172C0863529F484E06F +:107EA0008FD080E06FD06BC0843609F042C072D0B2 +:107EB00071D0082F6FD080E0C81680E7D80620F474 +:107EC00083E0F60187BFE895C0E0D1E063D08993F5 +:107ED0000C17E1F7F0E0CF16F0E7DF0620F083E0C3 +:107EE000F60187BFE89564D007B600FCFDCFA60178 +:107EF000A0E0B1E02C9130E011968C91119790E0C8 +:107F0000982F8827822B932B1296FA010C0197BE8B +:107F1000E89511244E5F5F4FF1E0A038BF0751F79D +:107F2000F601A7BEE89507B600FCFDCFB7BEE89501 +:107F300026C08437B1F42ED02DD0F82E2BD038D0D7 +:107F4000F601EF2C8F010F5F1F4F84911BD0EA9435 +:107F5000F801C1F70894C11CD11CFA94CF0CD11CB4 +:107F60000EC0853739F424D08EE10CD085E90AD0D3 +:107F70008FE098CF813511F488E014D019D080E1DA +:107F800001D06ACF982F8091C00085FFFCCF9093DD +:107F9000C6000895A8958091C00087FFFCCF80910E +:107FA000C6000895E0E6F0E098E1908380830895AC +:107FB000F1DF803219F088E0F5DFFFCF84E1E2CF16 +:107FC0001F93182FE7DF1150E9F7F2DF1F91089593 +:0A7FD00080E0E8DFEE27FF270994A8 +:027FFE0002047B +:0400000300007E007B :00000001FF diff --git a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst index a4da506..002f9a3 100644 --- a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst +++ b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst @@ -3,7 +3,7 @@ optiboot_atmega328_pro_8MHz.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001da 00000000 00000000 00000054 2**1 + 0 .text 000001da 00007e00 00007e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE 1 .version 00000002 00007ffe 00007ffe 0000022e 2**0 CONTENTS, READONLY @@ -11,551 +11,551 @@ Idx Name Size VMA LMA File off Algn CONTENTS, READONLY, DEBUGGING 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028c 00000000 00000000 000002b7 2**0 + 4 .debug_info 0000028d 00000000 00000000 000002b7 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000199 00000000 00000000 00000543 2**0 + 5 .debug_abbrev 0000018a 00000000 00000000 00000544 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000456 00000000 00000000 000006dc 2**0 + 6 .debug_line 00000456 00000000 00000000 000006ce 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b34 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b24 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000bb4 2**0 + 8 .debug_str 00000149 00000000 00000000 00000ba4 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000cfd 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000ced 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f7b 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f6b 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: -00000000
: +00007e00
: #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 0: 11 24 eor r1, r1 + 7e00: 11 24 eor r1, r1 #ifdef __AVR_ATmega8__ SP=RAMEND; // This is done by hardware reset #endif // Adaboot no-wait mod ch = MCUSR; - 2: 84 b7 in r24, 0x34 ; 52 + 7e02: 84 b7 in r24, 0x34 ; 52 MCUSR = 0; - 4: 14 be out 0x34, r1 ; 52 + 7e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); - 6: 81 ff sbrs r24, 1 - 8: e3 d0 rcall .+454 ; 0x1d0 + 7e06: 81 ff sbrs r24, 1 + 7e08: e3 d0 rcall .+454 ; 0x7fd0 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - a: 85 e0 ldi r24, 0x05 ; 5 - c: 80 93 81 00 sts 0x0081, r24 + 7e0a: 85 e0 ldi r24, 0x05 ; 5 + 7e0c: 80 93 81 00 sts 0x0081, r24 UCSRA = _BV(U2X); //Double speed mode USART UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); #else UCSR0A = _BV(U2X0); //Double speed mode USART0 - 10: 82 e0 ldi r24, 0x02 ; 2 - 12: 80 93 c0 00 sts 0x00C0, r24 + 7e10: 82 e0 ldi r24, 0x02 ; 2 + 7e12: 80 93 c0 00 sts 0x00C0, r24 UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 16: 88 e1 ldi r24, 0x18 ; 24 - 18: 80 93 c1 00 sts 0x00C1, r24 + 7e16: 88 e1 ldi r24, 0x18 ; 24 + 7e18: 80 93 c1 00 sts 0x00C1, r24 UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 1c: 86 e0 ldi r24, 0x06 ; 6 - 1e: 80 93 c2 00 sts 0x00C2, r24 + 7e1c: 86 e0 ldi r24, 0x06 ; 6 + 7e1e: 80 93 c2 00 sts 0x00C2, r24 UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 22: 88 e0 ldi r24, 0x08 ; 8 - 24: 80 93 c4 00 sts 0x00C4, r24 + 7e22: 88 e0 ldi r24, 0x08 ; 8 + 7e24: 80 93 c4 00 sts 0x00C4, r24 #endif #endif // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); - 28: 8e e0 ldi r24, 0x0E ; 14 - 2a: bc d0 rcall .+376 ; 0x1a4 + 7e28: 8e e0 ldi r24, 0x0E ; 14 + 7e2a: bc d0 rcall .+376 ; 0x7fa4 /* Set LED pin as output */ LED_DDR |= _BV(LED); - 2c: 25 9a sbi 0x04, 5 ; 4 - 2e: 86 e0 ldi r24, 0x06 ; 6 + 7e2c: 25 9a sbi 0x04, 5 ; 4 + 7e2e: 86 e0 ldi r24, 0x06 ; 6 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 30: 28 e1 ldi r18, 0x18 ; 24 - 32: 3e ef ldi r19, 0xFE ; 254 + 7e30: 28 e1 ldi r18, 0x18 ; 24 + 7e32: 3e ef ldi r19, 0xFE ; 254 TIFR1 = _BV(TOV1); - 34: 91 e0 ldi r25, 0x01 ; 1 + 7e34: 91 e0 ldi r25, 0x01 ; 1 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 36: 30 93 85 00 sts 0x0085, r19 - 3a: 20 93 84 00 sts 0x0084, r18 + 7e36: 30 93 85 00 sts 0x0085, r19 + 7e3a: 20 93 84 00 sts 0x0084, r18 TIFR1 = _BV(TOV1); - 3e: 96 bb out 0x16, r25 ; 22 + 7e3e: 96 bb out 0x16, r25 ; 22 while(!(TIFR1 & _BV(TOV1))); - 40: b0 9b sbis 0x16, 0 ; 22 - 42: fe cf rjmp .-4 ; 0x40 <__SREG__+0x1> + 7e40: b0 9b sbis 0x16, 0 ; 22 + 7e42: fe cf rjmp .-4 ; 0x7e40 #ifdef __AVR_ATmega8__ LED_PORT ^= _BV(LED); #else LED_PIN |= _BV(LED); - 44: 1d 9a sbi 0x03, 5 ; 3 + 7e44: 1d 9a sbi 0x03, 5 ; 3 } #endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 46: a8 95 wdr + 7e46: a8 95 wdr LED_PORT ^= _BV(LED); #else LED_PIN |= _BV(LED); #endif watchdogReset(); } while (--count); - 48: 81 50 subi r24, 0x01 ; 1 - 4a: a9 f7 brne .-22 ; 0x36 <__CCP__+0x2> + 7e48: 81 50 subi r24, 0x01 ; 1 + 7e4a: a9 f7 brne .-22 ; 0x7e36 /* get character from UART */ ch = getch(); if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 4c: 99 24 eor r9, r9 - 4e: 93 94 inc r9 + 7e4c: 99 24 eor r9, r9 + 7e4e: 93 94 inc r9 __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 50: a5 e0 ldi r26, 0x05 ; 5 - 52: aa 2e mov r10, r26 + 7e50: a5 e0 ldi r26, 0x05 ; 5 + 7e52: aa 2e mov r10, r26 boot_spm_busy_wait(); #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 54: f1 e1 ldi r31, 0x11 ; 17 - 56: bf 2e mov r11, r31 + 7e54: f1 e1 ldi r31, 0x11 ; 17 + 7e56: bf 2e mov r11, r31 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 58: 9d d0 rcall .+314 ; 0x194 + 7e58: 9d d0 rcall .+314 ; 0x7f94 if(ch == STK_GET_PARAMETER) { - 5a: 81 34 cpi r24, 0x41 ; 65 - 5c: 21 f4 brne .+8 ; 0x66 <__SREG__+0x27> + 7e5a: 81 34 cpi r24, 0x41 ; 65 + 7e5c: 21 f4 brne .+8 ; 0x7e66 // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 5e: 81 e0 ldi r24, 0x01 ; 1 - 60: af d0 rcall .+350 ; 0x1c0 + 7e5e: 81 e0 ldi r24, 0x01 ; 1 + 7e60: af d0 rcall .+350 ; 0x7fc0 putch(0x03); - 62: 83 e0 ldi r24, 0x03 ; 3 - 64: 1f c0 rjmp .+62 ; 0xa4 <__SREG__+0x65> + 7e62: 83 e0 ldi r24, 0x03 ; 3 + 7e64: 1f c0 rjmp .+62 ; 0x7ea4 } else if(ch == STK_SET_DEVICE) { - 66: 82 34 cpi r24, 0x42 ; 66 - 68: 11 f4 brne .+4 ; 0x6e <__SREG__+0x2f> + 7e66: 82 34 cpi r24, 0x42 ; 66 + 7e68: 11 f4 brne .+4 ; 0x7e6e // SET DEVICE is ignored getNch(20); - 6a: 84 e1 ldi r24, 0x14 ; 20 - 6c: 03 c0 rjmp .+6 ; 0x74 <__SREG__+0x35> + 7e6a: 84 e1 ldi r24, 0x14 ; 20 + 7e6c: 03 c0 rjmp .+6 ; 0x7e74 } else if(ch == STK_SET_DEVICE_EXT) { - 6e: 85 34 cpi r24, 0x45 ; 69 - 70: 19 f4 brne .+6 ; 0x78 <__SREG__+0x39> + 7e6e: 85 34 cpi r24, 0x45 ; 69 + 7e70: 19 f4 brne .+6 ; 0x7e78 // SET DEVICE EXT is ignored getNch(5); - 72: 85 e0 ldi r24, 0x05 ; 5 - 74: a5 d0 rcall .+330 ; 0x1c0 - 76: 83 c0 rjmp .+262 ; 0x17e <__SREG__+0x13f> + 7e72: 85 e0 ldi r24, 0x05 ; 5 + 7e74: a5 d0 rcall .+330 ; 0x7fc0 + 7e76: 83 c0 rjmp .+262 ; 0x7f7e } else if(ch == STK_LOAD_ADDRESS) { - 78: 85 35 cpi r24, 0x55 ; 85 - 7a: 79 f4 brne .+30 ; 0x9a <__SREG__+0x5b> + 7e78: 85 35 cpi r24, 0x55 ; 85 + 7e7a: 79 f4 brne .+30 ; 0x7e9a // LOAD ADDRESS uint16_t newAddress; newAddress = getch(); - 7c: 8b d0 rcall .+278 ; 0x194 + 7e7c: 8b d0 rcall .+278 ; 0x7f94 newAddress = (newAddress & 0xff) | (getch() << 8); - 7e: e8 2e mov r14, r24 - 80: ff 24 eor r15, r15 - 82: 88 d0 rcall .+272 ; 0x194 - 84: 08 2f mov r16, r24 - 86: 10 e0 ldi r17, 0x00 ; 0 - 88: 10 2f mov r17, r16 - 8a: 00 27 eor r16, r16 - 8c: 0e 29 or r16, r14 - 8e: 1f 29 or r17, r15 + 7e7e: e8 2e mov r14, r24 + 7e80: ff 24 eor r15, r15 + 7e82: 88 d0 rcall .+272 ; 0x7f94 + 7e84: 08 2f mov r16, r24 + 7e86: 10 e0 ldi r17, 0x00 ; 0 + 7e88: 10 2f mov r17, r16 + 7e8a: 00 27 eor r16, r16 + 7e8c: 0e 29 or r16, r14 + 7e8e: 1f 29 or r17, r15 #ifdef RAMPZ // Transfer top bit to RAMPZ RAMPZ = (newAddress & 0x8000) ? 1 : 0; #endif newAddress += newAddress; // Convert from word address to byte address - 90: 00 0f add r16, r16 - 92: 11 1f adc r17, r17 + 7e90: 00 0f add r16, r16 + 7e92: 11 1f adc r17, r17 address = newAddress; verifySpace(); - 94: 8d d0 rcall .+282 ; 0x1b0 - 96: 68 01 movw r12, r16 - 98: 72 c0 rjmp .+228 ; 0x17e <__SREG__+0x13f> + 7e94: 8d d0 rcall .+282 ; 0x7fb0 + 7e96: 68 01 movw r12, r16 + 7e98: 72 c0 rjmp .+228 ; 0x7f7e } else if(ch == STK_UNIVERSAL) { - 9a: 86 35 cpi r24, 0x56 ; 86 - 9c: 29 f4 brne .+10 ; 0xa8 <__SREG__+0x69> + 7e9a: 86 35 cpi r24, 0x56 ; 86 + 7e9c: 29 f4 brne .+10 ; 0x7ea8 // UNIVERSAL command is ignored getNch(4); - 9e: 84 e0 ldi r24, 0x04 ; 4 - a0: 8f d0 rcall .+286 ; 0x1c0 + 7e9e: 84 e0 ldi r24, 0x04 ; 4 + 7ea0: 8f d0 rcall .+286 ; 0x7fc0 putch(0x00); - a2: 80 e0 ldi r24, 0x00 ; 0 - a4: 6f d0 rcall .+222 ; 0x184 - a6: 6b c0 rjmp .+214 ; 0x17e <__SREG__+0x13f> + 7ea2: 80 e0 ldi r24, 0x00 ; 0 + 7ea4: 6f d0 rcall .+222 ; 0x7f84 + 7ea6: 6b c0 rjmp .+214 ; 0x7f7e } /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - a8: 84 36 cpi r24, 0x64 ; 100 - aa: 09 f0 breq .+2 ; 0xae <__SREG__+0x6f> - ac: 42 c0 rjmp .+132 ; 0x132 <__SREG__+0xf3> + 7ea8: 84 36 cpi r24, 0x64 ; 100 + 7eaa: 09 f0 breq .+2 ; 0x7eae + 7eac: 42 c0 rjmp .+132 ; 0x7f32 // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; getch(); /* getlen() */ - ae: 72 d0 rcall .+228 ; 0x194 + 7eae: 72 d0 rcall .+228 ; 0x7f94 length = getch(); - b0: 71 d0 rcall .+226 ; 0x194 - b2: 08 2f mov r16, r24 + 7eb0: 71 d0 rcall .+226 ; 0x7f94 + 7eb2: 08 2f mov r16, r24 getch(); - b4: 6f d0 rcall .+222 ; 0x194 + 7eb4: 6f d0 rcall .+222 ; 0x7f94 // If we are in RWW section, immediately start page erase if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - b6: 80 e0 ldi r24, 0x00 ; 0 - b8: c8 16 cp r12, r24 - ba: 80 e7 ldi r24, 0x70 ; 112 - bc: d8 06 cpc r13, r24 - be: 20 f4 brcc .+8 ; 0xc8 <__SREG__+0x89> - c0: 83 e0 ldi r24, 0x03 ; 3 - c2: f6 01 movw r30, r12 - c4: 87 bf out 0x37, r24 ; 55 - c6: e8 95 spm - c8: c0 e0 ldi r28, 0x00 ; 0 - ca: d1 e0 ldi r29, 0x01 ; 1 + 7eb6: 80 e0 ldi r24, 0x00 ; 0 + 7eb8: c8 16 cp r12, r24 + 7eba: 80 e7 ldi r24, 0x70 ; 112 + 7ebc: d8 06 cpc r13, r24 + 7ebe: 20 f4 brcc .+8 ; 0x7ec8 + 7ec0: 83 e0 ldi r24, 0x03 ; 3 + 7ec2: f6 01 movw r30, r12 + 7ec4: 87 bf out 0x37, r24 ; 55 + 7ec6: e8 95 spm + 7ec8: c0 e0 ldi r28, 0x00 ; 0 + 7eca: d1 e0 ldi r29, 0x01 ; 1 // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - cc: 63 d0 rcall .+198 ; 0x194 - ce: 89 93 st Y+, r24 + 7ecc: 63 d0 rcall .+198 ; 0x7f94 + 7ece: 89 93 st Y+, r24 while (--length); - d0: 0c 17 cp r16, r28 - d2: e1 f7 brne .-8 ; 0xcc <__SREG__+0x8d> + 7ed0: 0c 17 cp r16, r28 + 7ed2: e1 f7 brne .-8 ; 0x7ecc // If we are in NRWW section, page erase has to be delayed until now. // Todo: Take RAMPZ into account if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - d4: f0 e0 ldi r31, 0x00 ; 0 - d6: cf 16 cp r12, r31 - d8: f0 e7 ldi r31, 0x70 ; 112 - da: df 06 cpc r13, r31 - dc: 20 f0 brcs .+8 ; 0xe6 <__SREG__+0xa7> - de: 83 e0 ldi r24, 0x03 ; 3 - e0: f6 01 movw r30, r12 - e2: 87 bf out 0x37, r24 ; 55 - e4: e8 95 spm + 7ed4: f0 e0 ldi r31, 0x00 ; 0 + 7ed6: cf 16 cp r12, r31 + 7ed8: f0 e7 ldi r31, 0x70 ; 112 + 7eda: df 06 cpc r13, r31 + 7edc: 20 f0 brcs .+8 ; 0x7ee6 + 7ede: 83 e0 ldi r24, 0x03 ; 3 + 7ee0: f6 01 movw r30, r12 + 7ee2: 87 bf out 0x37, r24 ; 55 + 7ee4: e8 95 spm // Read command terminator, start reply verifySpace(); - e6: 64 d0 rcall .+200 ; 0x1b0 + 7ee6: 64 d0 rcall .+200 ; 0x7fb0 // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - e8: 07 b6 in r0, 0x37 ; 55 - ea: 00 fc sbrc r0, 0 - ec: fd cf rjmp .-6 ; 0xe8 <__SREG__+0xa9> - ee: a6 01 movw r20, r12 - f0: a0 e0 ldi r26, 0x00 ; 0 - f2: b1 e0 ldi r27, 0x01 ; 1 + 7ee8: 07 b6 in r0, 0x37 ; 55 + 7eea: 00 fc sbrc r0, 0 + 7eec: fd cf rjmp .-6 ; 0x7ee8 + 7eee: a6 01 movw r20, r12 + 7ef0: a0 e0 ldi r26, 0x00 ; 0 + 7ef2: b1 e0 ldi r27, 0x01 ; 1 bufPtr = buff; addrPtr = (uint16_t)(void*)address; ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - f4: 2c 91 ld r18, X - f6: 30 e0 ldi r19, 0x00 ; 0 + 7ef4: 2c 91 ld r18, X + 7ef6: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - f8: 11 96 adiw r26, 0x01 ; 1 - fa: 8c 91 ld r24, X - fc: 11 97 sbiw r26, 0x01 ; 1 - fe: 90 e0 ldi r25, 0x00 ; 0 - 100: 98 2f mov r25, r24 - 102: 88 27 eor r24, r24 - 104: 82 2b or r24, r18 - 106: 93 2b or r25, r19 + 7ef8: 11 96 adiw r26, 0x01 ; 1 + 7efa: 8c 91 ld r24, X + 7efc: 11 97 sbiw r26, 0x01 ; 1 + 7efe: 90 e0 ldi r25, 0x00 ; 0 + 7f00: 98 2f mov r25, r24 + 7f02: 88 27 eor r24, r24 + 7f04: 82 2b or r24, r18 + 7f06: 93 2b or r25, r19 #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 108: 12 96 adiw r26, 0x02 ; 2 + 7f08: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 10a: fa 01 movw r30, r20 - 10c: 0c 01 movw r0, r24 - 10e: 97 be out 0x37, r9 ; 55 - 110: e8 95 spm - 112: 11 24 eor r1, r1 + 7f0a: fa 01 movw r30, r20 + 7f0c: 0c 01 movw r0, r24 + 7f0e: 97 be out 0x37, r9 ; 55 + 7f10: e8 95 spm + 7f12: 11 24 eor r1, r1 addrPtr += 2; - 114: 4e 5f subi r20, 0xFE ; 254 - 116: 5f 4f sbci r21, 0xFF ; 255 + 7f14: 4e 5f subi r20, 0xFE ; 254 + 7f16: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 118: f1 e0 ldi r31, 0x01 ; 1 - 11a: a0 38 cpi r26, 0x80 ; 128 - 11c: bf 07 cpc r27, r31 - 11e: 51 f7 brne .-44 ; 0xf4 <__SREG__+0xb5> + 7f18: f1 e0 ldi r31, 0x01 ; 1 + 7f1a: a0 38 cpi r26, 0x80 ; 128 + 7f1c: bf 07 cpc r27, r31 + 7f1e: 51 f7 brne .-44 ; 0x7ef4 // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 120: f6 01 movw r30, r12 - 122: a7 be out 0x37, r10 ; 55 - 124: e8 95 spm + 7f20: f6 01 movw r30, r12 + 7f22: a7 be out 0x37, r10 ; 55 + 7f24: e8 95 spm boot_spm_busy_wait(); - 126: 07 b6 in r0, 0x37 ; 55 - 128: 00 fc sbrc r0, 0 - 12a: fd cf rjmp .-6 ; 0x126 <__SREG__+0xe7> + 7f26: 07 b6 in r0, 0x37 ; 55 + 7f28: 00 fc sbrc r0, 0 + 7f2a: fd cf rjmp .-6 ; 0x7f26 #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 12c: b7 be out 0x37, r11 ; 55 - 12e: e8 95 spm - 130: 26 c0 rjmp .+76 ; 0x17e <__SREG__+0x13f> + 7f2c: b7 be out 0x37, r11 ; 55 + 7f2e: e8 95 spm + 7f30: 26 c0 rjmp .+76 ; 0x7f7e #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 132: 84 37 cpi r24, 0x74 ; 116 - 134: b1 f4 brne .+44 ; 0x162 <__SREG__+0x123> + 7f32: 84 37 cpi r24, 0x74 ; 116 + 7f34: b1 f4 brne .+44 ; 0x7f62 // READ PAGE - we only read flash getch(); /* getlen() */ - 136: 2e d0 rcall .+92 ; 0x194 + 7f36: 2e d0 rcall .+92 ; 0x7f94 length = getch(); - 138: 2d d0 rcall .+90 ; 0x194 - 13a: f8 2e mov r15, r24 + 7f38: 2d d0 rcall .+90 ; 0x7f94 + 7f3a: f8 2e mov r15, r24 getch(); - 13c: 2b d0 rcall .+86 ; 0x194 + 7f3c: 2b d0 rcall .+86 ; 0x7f94 verifySpace(); - 13e: 38 d0 rcall .+112 ; 0x1b0 - 140: f6 01 movw r30, r12 - 142: ef 2c mov r14, r15 + 7f3e: 38 d0 rcall .+112 ; 0x7fb0 + 7f40: f6 01 movw r30, r12 + 7f42: ef 2c mov r14, r15 putch(result); address++; } while (--length); #else do putch(pgm_read_byte_near(address++)); - 144: 8f 01 movw r16, r30 - 146: 0f 5f subi r16, 0xFF ; 255 - 148: 1f 4f sbci r17, 0xFF ; 255 - 14a: 84 91 lpm r24, Z+ - 14c: 1b d0 rcall .+54 ; 0x184 + 7f44: 8f 01 movw r16, r30 + 7f46: 0f 5f subi r16, 0xFF ; 255 + 7f48: 1f 4f sbci r17, 0xFF ; 255 + 7f4a: 84 91 lpm r24, Z+ + 7f4c: 1b d0 rcall .+54 ; 0x7f84 while (--length); - 14e: ea 94 dec r14 - 150: f8 01 movw r30, r16 - 152: c1 f7 brne .-16 ; 0x144 <__SREG__+0x105> + 7f4e: ea 94 dec r14 + 7f50: f8 01 movw r30, r16 + 7f52: c1 f7 brne .-16 ; 0x7f44 #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 154: 08 94 sec - 156: c1 1c adc r12, r1 - 158: d1 1c adc r13, r1 - 15a: fa 94 dec r15 - 15c: cf 0c add r12, r15 - 15e: d1 1c adc r13, r1 - 160: 0e c0 rjmp .+28 ; 0x17e <__SREG__+0x13f> + 7f54: 08 94 sec + 7f56: c1 1c adc r12, r1 + 7f58: d1 1c adc r13, r1 + 7f5a: fa 94 dec r15 + 7f5c: cf 0c add r12, r15 + 7f5e: d1 1c adc r13, r1 + 7f60: 0e c0 rjmp .+28 ; 0x7f7e #endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 162: 85 37 cpi r24, 0x75 ; 117 - 164: 39 f4 brne .+14 ; 0x174 <__SREG__+0x135> + 7f62: 85 37 cpi r24, 0x75 ; 117 + 7f64: 39 f4 brne .+14 ; 0x7f74 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 166: 24 d0 rcall .+72 ; 0x1b0 + 7f66: 24 d0 rcall .+72 ; 0x7fb0 putch(SIGNATURE_0); - 168: 8e e1 ldi r24, 0x1E ; 30 - 16a: 0c d0 rcall .+24 ; 0x184 + 7f68: 8e e1 ldi r24, 0x1E ; 30 + 7f6a: 0c d0 rcall .+24 ; 0x7f84 putch(SIGNATURE_1); - 16c: 85 e9 ldi r24, 0x95 ; 149 - 16e: 0a d0 rcall .+20 ; 0x184 + 7f6c: 85 e9 ldi r24, 0x95 ; 149 + 7f6e: 0a d0 rcall .+20 ; 0x7f84 putch(SIGNATURE_2); - 170: 8f e0 ldi r24, 0x0F ; 15 - 172: 98 cf rjmp .-208 ; 0xa4 <__SREG__+0x65> + 7f70: 8f e0 ldi r24, 0x0F ; 15 + 7f72: 98 cf rjmp .-208 ; 0x7ea4 } else if (ch == 'Q') { - 174: 81 35 cpi r24, 0x51 ; 81 - 176: 11 f4 brne .+4 ; 0x17c <__SREG__+0x13d> + 7f74: 81 35 cpi r24, 0x51 ; 81 + 7f76: 11 f4 brne .+4 ; 0x7f7c // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 178: 88 e0 ldi r24, 0x08 ; 8 - 17a: 14 d0 rcall .+40 ; 0x1a4 + 7f78: 88 e0 ldi r24, 0x08 ; 8 + 7f7a: 14 d0 rcall .+40 ; 0x7fa4 verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 17c: 19 d0 rcall .+50 ; 0x1b0 + 7f7c: 19 d0 rcall .+50 ; 0x7fb0 } putch(STK_OK); - 17e: 80 e1 ldi r24, 0x10 ; 16 - 180: 01 d0 rcall .+2 ; 0x184 - 182: 6a cf rjmp .-300 ; 0x58 <__SREG__+0x19> + 7f7e: 80 e1 ldi r24, 0x10 ; 16 + 7f80: 01 d0 rcall .+2 ; 0x7f84 + 7f82: 6a cf rjmp .-300 ; 0x7e58 -00000184 : +00007f84 : } } void putch(char ch) { - 184: 98 2f mov r25, r24 + 7f84: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); - 186: 80 91 c0 00 lds r24, 0x00C0 - 18a: 85 ff sbrs r24, 5 - 18c: fc cf rjmp .-8 ; 0x186 + 7f86: 80 91 c0 00 lds r24, 0x00C0 + 7f8a: 85 ff sbrs r24, 5 + 7f8c: fc cf rjmp .-8 ; 0x7f86 UDR0 = ch; - 18e: 90 93 c6 00 sts 0x00C6, r25 + 7f8e: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 192: 08 95 ret + 7f92: 08 95 ret -00000194 : +00007f94 : } #endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 194: a8 95 wdr + 7f94: a8 95 wdr [uartBit] "I" (UART_RX_BIT) : "r25" ); #else while(!(UCSR0A & _BV(RXC0))); - 196: 80 91 c0 00 lds r24, 0x00C0 - 19a: 87 ff sbrs r24, 7 - 19c: fc cf rjmp .-8 ; 0x196 + 7f96: 80 91 c0 00 lds r24, 0x00C0 + 7f9a: 87 ff sbrs r24, 7 + 7f9c: fc cf rjmp .-8 ; 0x7f96 ch = UDR0; - 19e: 80 91 c6 00 lds r24, 0x00C6 + 7f9e: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 1a2: 08 95 ret + 7fa2: 08 95 ret -000001a4 : +00007fa4 : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 1a4: e0 e6 ldi r30, 0x60 ; 96 - 1a6: f0 e0 ldi r31, 0x00 ; 0 - 1a8: 98 e1 ldi r25, 0x18 ; 24 - 1aa: 90 83 st Z, r25 + 7fa4: e0 e6 ldi r30, 0x60 ; 96 + 7fa6: f0 e0 ldi r31, 0x00 ; 0 + 7fa8: 98 e1 ldi r25, 0x18 ; 24 + 7faa: 90 83 st Z, r25 WDTCSR = x; - 1ac: 80 83 st Z, r24 + 7fac: 80 83 st Z, r24 } - 1ae: 08 95 ret + 7fae: 08 95 ret -000001b0 : +00007fb0 : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) { - 1b0: f1 df rcall .-30 ; 0x194 - 1b2: 80 32 cpi r24, 0x20 ; 32 - 1b4: 19 f0 breq .+6 ; 0x1bc + 7fb0: f1 df rcall .-30 ; 0x7f94 + 7fb2: 80 32 cpi r24, 0x20 ; 32 + 7fb4: 19 f0 breq .+6 ; 0x7fbc watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 1b6: 88 e0 ldi r24, 0x08 ; 8 - 1b8: f5 df rcall .-22 ; 0x1a4 - 1ba: ff cf rjmp .-2 ; 0x1ba + 7fb6: 88 e0 ldi r24, 0x08 ; 8 + 7fb8: f5 df rcall .-22 ; 0x7fa4 + 7fba: ff cf rjmp .-2 ; 0x7fba while (1) // and busy-loop so that WD causes ; // a reset and app start. } putch(STK_INSYNC); - 1bc: 84 e1 ldi r24, 0x14 ; 20 + 7fbc: 84 e1 ldi r24, 0x14 ; 20 } - 1be: e2 cf rjmp .-60 ; 0x184 + 7fbe: e2 cf rjmp .-60 ; 0x7f84 -000001c0 : +00007fc0 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 1c0: 1f 93 push r17 - 1c2: 18 2f mov r17, r24 + 7fc0: 1f 93 push r17 + 7fc2: 18 2f mov r17, r24 do getch(); while (--count); - 1c4: e7 df rcall .-50 ; 0x194 - 1c6: 11 50 subi r17, 0x01 ; 1 - 1c8: e9 f7 brne .-6 ; 0x1c4 + 7fc4: e7 df rcall .-50 ; 0x7f94 + 7fc6: 11 50 subi r17, 0x01 ; 1 + 7fc8: e9 f7 brne .-6 ; 0x7fc4 verifySpace(); - 1ca: f2 df rcall .-28 ; 0x1b0 + 7fca: f2 df rcall .-28 ; 0x7fb0 } - 1cc: 1f 91 pop r17 - 1ce: 08 95 ret + 7fcc: 1f 91 pop r17 + 7fce: 08 95 ret -000001d0 : +00007fd0 : WDTCSR = _BV(WDCE) | _BV(WDE); WDTCSR = x; } void appStart() { watchdogConfig(WATCHDOG_OFF); - 1d0: 80 e0 ldi r24, 0x00 ; 0 - 1d2: e8 df rcall .-48 ; 0x1a4 + 7fd0: 80 e0 ldi r24, 0x00 ; 0 + 7fd2: e8 df rcall .-48 ; 0x7fa4 __asm__ __volatile__ ( - 1d4: ee 27 eor r30, r30 - 1d6: ff 27 eor r31, r31 - 1d8: 09 94 ijmp + 7fd4: ee 27 eor r30, r30 + 7fd6: ff 27 eor r31, r31 + 7fd8: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_lilypad.hex b/bootloaders/optiboot/optiboot_lilypad.hex index dcdbbb4..00f7a38 100644 --- a/bootloaders/optiboot/optiboot_lilypad.hex +++ b/bootloaders/optiboot/optiboot_lilypad.hex @@ -28,6 +28,6 @@ :103FB000F1DF803219F088E0F5DFFFCF84E1E2CF56 :103FC0001F93182FE7DF1150E9F7F2DF1F910895D3 :0A3FD00080E0E8DFEE27FF270994E8 -:023FFE000104BC +:023FFE000204BB :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_lilypad.lst b/bootloaders/optiboot/optiboot_lilypad.lst index a70713a..4cebc2e 100644 --- a/bootloaders/optiboot/optiboot_lilypad.lst +++ b/bootloaders/optiboot/optiboot_lilypad.lst @@ -11,19 +11,19 @@ Idx Name Size VMA LMA File off Algn CONTENTS, READONLY, DEBUGGING 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028c 00000000 00000000 000002b7 2**0 + 4 .debug_info 0000028d 00000000 00000000 000002b7 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000199 00000000 00000000 00000543 2**0 + 5 .debug_abbrev 0000018a 00000000 00000000 00000544 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000456 00000000 00000000 000006dc 2**0 + 6 .debug_line 00000456 00000000 00000000 000006ce 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b34 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b24 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000bb4 2**0 + 8 .debug_str 00000149 00000000 00000000 00000ba4 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000cfd 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000ced 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f7b 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f6b 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: diff --git a/bootloaders/optiboot/optiboot_lilypad_resonator.hex b/bootloaders/optiboot/optiboot_lilypad_resonator.hex index dcdbbb4..00f7a38 100644 --- a/bootloaders/optiboot/optiboot_lilypad_resonator.hex +++ b/bootloaders/optiboot/optiboot_lilypad_resonator.hex @@ -28,6 +28,6 @@ :103FB000F1DF803219F088E0F5DFFFCF84E1E2CF56 :103FC0001F93182FE7DF1150E9F7F2DF1F910895D3 :0A3FD00080E0E8DFEE27FF270994E8 -:023FFE000104BC +:023FFE000204BB :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_lilypad_resonator.lst b/bootloaders/optiboot/optiboot_lilypad_resonator.lst index 2676838..c8d0743 100644 --- a/bootloaders/optiboot/optiboot_lilypad_resonator.lst +++ b/bootloaders/optiboot/optiboot_lilypad_resonator.lst @@ -11,19 +11,19 @@ Idx Name Size VMA LMA File off Algn CONTENTS, READONLY, DEBUGGING 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028c 00000000 00000000 000002b7 2**0 + 4 .debug_info 0000028d 00000000 00000000 000002b7 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000199 00000000 00000000 00000543 2**0 + 5 .debug_abbrev 0000018a 00000000 00000000 00000544 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000456 00000000 00000000 000006dc 2**0 + 6 .debug_line 00000456 00000000 00000000 000006ce 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b34 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b24 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000bb4 2**0 + 8 .debug_str 00000149 00000000 00000000 00000ba4 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000cfd 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000ced 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f7b 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f6b 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: diff --git a/bootloaders/optiboot/optiboot_luminet.hex b/bootloaders/optiboot/optiboot_luminet.hex index 843b2ef..78fdc70 100644 --- a/bootloaders/optiboot/optiboot_luminet.hex +++ b/bootloaders/optiboot/optiboot_luminet.hex @@ -1,39 +1,40 @@ -:10000000112484B714BE81FF18D185E08EBD8EE027 -:1000100000D1D49AD29A86E023EC3FEF91E03DBD27 -:100020002CBD9BB9589BFECFCC9AA8958150B9F7AF -:10003000BB24B39425E0A22E9FE7D92E8EECC82EC8 -:10004000D4D0813421F481E0F0D083E0B5C0823493 -:1000500011F484E103C0853419F485E0E6D0B3C01F -:10006000853569F4C2D0E82EFF24BFD0082F10E0F8 -:10007000102F00270E291F29000F111FA3C086353E -:1000800021F484E0D2D080E097C0843609F060C0CB -:10009000ACD0ABD0F82EA9D0C0E0D1E0A6D08993E7 -:1000A000FC16E1F783E0F80187BFE895B6D007B604 -:1000B00000FCFDCF0115110511F0A8012AC08091A7 -:1000C00000012091010130E0322F222790E0282BFF -:1000D000392B309385012093840140910801809150 -:1000E000090190E0982F882750E0842B952B90935E -:1000F0008701809386012450304020930801232FEC -:10010000332720930901D0920001C092010140E001 -:1001100050E0A0E0B1E02C9130E011968C91119765 -:1001200090E0982F8827822B932B1296FA010C01CE -:10013000B7BEE89511244E5F5F4FF1E0A034BF07D2 -:1001400051F7F801A7BEE89507B600FCFDCF3BC00C -:10015000843751F54AD049D0F82E47D05ED0E80117 -:10016000EF2C209719F48091840114C0C130D1057F -:1001700019F4809185010EC0C830D10519F4809121 -:10018000860108C0C930D10519F48091870102C0E9 -:10019000FE01849121961AD0EA9419F70F5F1F4F40 -:1001A000FA940F0D111D0FC0853741F436D08EE142 -:1001B0000DD083E90BD08CE009D005C0813511F456 -:1001C00088E027D02AD080E101D03ACF2AE030E081 -:1001D0008095089410F4DA9802C0DA9A000015D0DD -:1001E00014D086952A95B1F70895A89529E030E0B6 -:1001F000CB99FECF0AD009D008D08894CB99089427 -:100200002A9511F08795F7CF08959EE09A95F1F71A -:10021000089598E191BD81BD0895E7DF803219F01E -:1002200088E0F7DFFFCF84E1D1CF1F93182FDDDF08 -:100230001150E9F7F2DF1F91089580E0EADFE4E072 -:04024000FF270994F7 -:021EFE000104DD +:101D0000112484B714BE81FF18D185E08EBD8EE00A +:101D100000D1D49AD29A86E023EC3FEF91E03DBD0A +:101D20002CBD9BB9589BFECFCC9AA8958150B9F792 +:101D3000BB24B39425E0A22E9FE7D92E8EECC82EAB +:101D4000D4D0813421F481E0F0D083E0B5C0823476 +:101D500011F484E103C0853419F485E0E6D0B3C002 +:101D6000853569F4C2D0E82EFF24BFD0082F10E0DB +:101D7000102F00270E291F29000F111FA3C0863521 +:101D800021F484E0D2D080E097C0843609F060C0AE +:101D9000ACD0ABD0F82EA9D0C0E0D1E0A6D08993CA +:101DA000FC16E1F783E0F80187BFE895B6D007B6E7 +:101DB00000FCFDCF0115110511F0A8012AC080918A +:101DC00000012091010130E0322F222790E0282BE2 +:101DD000392B309385012093840140910801809133 +:101DE000090190E0982F882750E0842B952B909341 +:101DF0008701809386012450304020930801232FCF +:101E0000332720930901D0920001C092010140E0E4 +:101E100050E0A0E0B1E02C9130E011968C91119748 +:101E200090E0982F8827822B932B1296FA010C01B1 +:101E3000B7BEE89511244E5F5F4FF1E0A034BF07B5 +:101E400051F7F801A7BEE89507B600FCFDCF3BC0EF +:101E5000843751F54AD049D0F82E47D05ED0E801FA +:101E6000EF2C209719F48091840114C0C130D10562 +:101E700019F4809185010EC0C830D10519F4809104 +:101E8000860108C0C930D10519F48091870102C0CC +:101E9000FE01849121961AD0EA9419F70F5F1F4F23 +:101EA000FA940F0D111D0FC0853741F436D08EE125 +:101EB0000DD083E90BD08CE009D005C0813511F439 +:101EC00088E027D02AD080E101D03ACF2AE030E064 +:101ED0008095089410F4DA9802C0DA9A000015D0C0 +:101EE00014D086952A95B1F70895A89529E030E099 +:101EF000CB99FECF0AD009D008D08894CB9908940A +:101F00002A9511F08795F7CF08959EE09A95F1F7FD +:101F1000089598E191BD81BD0895E7DF803219F001 +:101F200088E0F7DFFFCF84E1D1CF1F93182FDDDFEB +:101F30001150E9F7F2DF1F91089580E0EADFE4E055 +:041F4000FF270994DA +:021EFE000204DC +:0400000300001D00DC :00000001FF diff --git a/bootloaders/optiboot/optiboot_luminet.lst b/bootloaders/optiboot/optiboot_luminet.lst index 8333670..447349d 100644 --- a/bootloaders/optiboot/optiboot_luminet.lst +++ b/bootloaders/optiboot/optiboot_luminet.lst @@ -3,622 +3,622 @@ optiboot_luminet.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .version 00000002 00001efe 00001efe 00000298 2**0 - CONTENTS, READONLY - 1 .text 00000244 00000000 00000000 00000054 2**1 + 0 .text 00000244 00001d00 00001d00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE + 1 .version 00000002 00001efe 00001efe 00000298 2**0 + CONTENTS, READONLY 2 .debug_aranges 00000028 00000000 00000000 0000029a 2**0 CONTENTS, READONLY, DEBUGGING 3 .debug_pubnames 0000006d 00000000 00000000 000002c2 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 000002b0 00000000 00000000 0000032f 2**0 + 4 .debug_info 000002b1 00000000 00000000 0000032f 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000197 00000000 00000000 000005df 2**0 + 5 .debug_abbrev 00000188 00000000 00000000 000005e0 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 000004a7 00000000 00000000 00000776 2**0 + 6 .debug_line 000004a7 00000000 00000000 00000768 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000090 00000000 00000000 00000c20 2**2 + 7 .debug_frame 00000090 00000000 00000000 00000c10 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000158 00000000 00000000 00000cb0 2**0 + 8 .debug_str 00000158 00000000 00000000 00000ca0 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 00000268 00000000 00000000 00000e08 2**0 + 9 .debug_loc 00000268 00000000 00000000 00000df8 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000080 00000000 00000000 00001070 2**0 + 10 .debug_ranges 00000080 00000000 00000000 00001060 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: -00000000
: +00001d00
: #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 0: 11 24 eor r1, r1 + 1d00: 11 24 eor r1, r1 #ifdef __AVR_ATmega8__ SP=RAMEND; // This is done by hardware reset #endif // Adaboot no-wait mod ch = MCUSR; - 2: 84 b7 in r24, 0x34 ; 52 + 1d02: 84 b7 in r24, 0x34 ; 52 MCUSR = 0; - 4: 14 be out 0x34, r1 ; 52 + 1d04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); - 6: 81 ff sbrs r24, 1 - 8: 18 d1 rcall .+560 ; 0x23a + 1d06: 81 ff sbrs r24, 1 + 1d08: 18 d1 rcall .+560 ; 0x1f3a #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - a: 85 e0 ldi r24, 0x05 ; 5 - c: 8e bd out 0x2e, r24 ; 46 + 1d0a: 85 e0 ldi r24, 0x05 ; 5 + 1d0c: 8e bd out 0x2e, r24 ; 46 UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); #endif #endif // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); - e: 8e e0 ldi r24, 0x0E ; 14 - 10: 00 d1 rcall .+512 ; 0x212 + 1d0e: 8e e0 ldi r24, 0x0E ; 14 + 1d10: 00 d1 rcall .+512 ; 0x1f12 /* Set LED pin as output */ LED_DDR |= _BV(LED); - 12: d4 9a sbi 0x1a, 4 ; 26 + 1d12: d4 9a sbi 0x1a, 4 ; 26 #ifdef SOFT_UART /* Set TX pin as output */ UART_DDR |= _BV(UART_TX_BIT); - 14: d2 9a sbi 0x1a, 2 ; 26 - 16: 86 e0 ldi r24, 0x06 ; 6 + 1d14: d2 9a sbi 0x1a, 2 ; 26 + 1d16: 86 e0 ldi r24, 0x06 ; 6 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 18: 23 ec ldi r18, 0xC3 ; 195 - 1a: 3f ef ldi r19, 0xFF ; 255 + 1d18: 23 ec ldi r18, 0xC3 ; 195 + 1d1a: 3f ef ldi r19, 0xFF ; 255 TIFR1 = _BV(TOV1); - 1c: 91 e0 ldi r25, 0x01 ; 1 + 1d1c: 91 e0 ldi r25, 0x01 ; 1 } #if LED_START_FLASHES > 0 void flash_led(uint8_t count) { do { TCNT1 = -(F_CPU/(1024*16)); - 1e: 3d bd out 0x2d, r19 ; 45 - 20: 2c bd out 0x2c, r18 ; 44 + 1d1e: 3d bd out 0x2d, r19 ; 45 + 1d20: 2c bd out 0x2c, r18 ; 44 TIFR1 = _BV(TOV1); - 22: 9b b9 out 0x0b, r25 ; 11 + 1d22: 9b b9 out 0x0b, r25 ; 11 while(!(TIFR1 & _BV(TOV1))); - 24: 58 9b sbis 0x0b, 0 ; 11 - 26: fe cf rjmp .-4 ; 0x24 <__zero_reg__+0x23> + 1d24: 58 9b sbis 0x0b, 0 ; 11 + 1d26: fe cf rjmp .-4 ; 0x1d24 #ifdef __AVR_ATmega8__ LED_PORT ^= _BV(LED); #else LED_PIN |= _BV(LED); - 28: cc 9a sbi 0x19, 4 ; 25 + 1d28: cc 9a sbi 0x19, 4 ; 25 } #endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 2a: a8 95 wdr + 1d2a: a8 95 wdr LED_PORT ^= _BV(LED); #else LED_PIN |= _BV(LED); #endif watchdogReset(); } while (--count); - 2c: 81 50 subi r24, 0x01 ; 1 - 2e: b9 f7 brne .-18 ; 0x1e <__zero_reg__+0x1d> + 1d2c: 81 50 subi r24, 0x01 ; 1 + 1d2e: b9 f7 brne .-18 ; 0x1d1e /* get character from UART */ ch = getch(); if(ch == STK_GET_PARAMETER) { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 30: bb 24 eor r11, r11 - 32: b3 94 inc r11 + 1d30: bb 24 eor r11, r11 + 1d32: b3 94 inc r11 __boot_page_fill_short((uint16_t)(void*)addrPtr,a); addrPtr += 2; } while (--ch); // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 34: 25 e0 ldi r18, 0x05 ; 5 - 36: a2 2e mov r10, r18 + 1d34: 25 e0 ldi r18, 0x05 ; 5 + 1d36: a2 2e mov r10, r18 vect -= 4; // Instruction is a relative jump (rjmp), so recalculate. buff[8] = vect & 0xff; buff[9] = vect >> 8; // Add jump to bootloader at RESET vector buff[0] = 0x7f; - 38: 9f e7 ldi r25, 0x7F ; 127 - 3a: d9 2e mov r13, r25 + 1d38: 9f e7 ldi r25, 0x7F ; 127 + 1d3a: d9 2e mov r13, r25 buff[1] = 0xce; // rjmp 0x1d00 instruction - 3c: 8e ec ldi r24, 0xCE ; 206 - 3e: c8 2e mov r12, r24 + 1d3c: 8e ec ldi r24, 0xCE ; 206 + 1d3e: c8 2e mov r12, r24 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 40: d4 d0 rcall .+424 ; 0x1ea + 1d40: d4 d0 rcall .+424 ; 0x1eea if(ch == STK_GET_PARAMETER) { - 42: 81 34 cpi r24, 0x41 ; 65 - 44: 21 f4 brne .+8 ; 0x4e <__SREG__+0xf> + 1d42: 81 34 cpi r24, 0x41 ; 65 + 1d44: 21 f4 brne .+8 ; 0x1d4e // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); - 46: 81 e0 ldi r24, 0x01 ; 1 - 48: f0 d0 rcall .+480 ; 0x22a + 1d46: 81 e0 ldi r24, 0x01 ; 1 + 1d48: f0 d0 rcall .+480 ; 0x1f2a putch(0x03); - 4a: 83 e0 ldi r24, 0x03 ; 3 - 4c: b5 c0 rjmp .+362 ; 0x1b8 <__SREG__+0x179> + 1d4a: 83 e0 ldi r24, 0x03 ; 3 + 1d4c: b5 c0 rjmp .+362 ; 0x1eb8 } else if(ch == STK_SET_DEVICE) { - 4e: 82 34 cpi r24, 0x42 ; 66 - 50: 11 f4 brne .+4 ; 0x56 <__SREG__+0x17> + 1d4e: 82 34 cpi r24, 0x42 ; 66 + 1d50: 11 f4 brne .+4 ; 0x1d56 // SET DEVICE is ignored getNch(20); - 52: 84 e1 ldi r24, 0x14 ; 20 - 54: 03 c0 rjmp .+6 ; 0x5c <__SREG__+0x1d> + 1d52: 84 e1 ldi r24, 0x14 ; 20 + 1d54: 03 c0 rjmp .+6 ; 0x1d5c } else if(ch == STK_SET_DEVICE_EXT) { - 56: 85 34 cpi r24, 0x45 ; 69 - 58: 19 f4 brne .+6 ; 0x60 <__SREG__+0x21> + 1d56: 85 34 cpi r24, 0x45 ; 69 + 1d58: 19 f4 brne .+6 ; 0x1d60 // SET DEVICE EXT is ignored getNch(5); - 5a: 85 e0 ldi r24, 0x05 ; 5 - 5c: e6 d0 rcall .+460 ; 0x22a - 5e: b3 c0 rjmp .+358 ; 0x1c6 <__SREG__+0x187> + 1d5a: 85 e0 ldi r24, 0x05 ; 5 + 1d5c: e6 d0 rcall .+460 ; 0x1f2a + 1d5e: b3 c0 rjmp .+358 ; 0x1ec6 } else if(ch == STK_LOAD_ADDRESS) { - 60: 85 35 cpi r24, 0x55 ; 85 - 62: 69 f4 brne .+26 ; 0x7e <__SREG__+0x3f> + 1d60: 85 35 cpi r24, 0x55 ; 85 + 1d62: 69 f4 brne .+26 ; 0x1d7e // LOAD ADDRESS uint16_t newAddress; newAddress = getch(); - 64: c2 d0 rcall .+388 ; 0x1ea + 1d64: c2 d0 rcall .+388 ; 0x1eea newAddress = (newAddress & 0xff) | (getch() << 8); - 66: e8 2e mov r14, r24 - 68: ff 24 eor r15, r15 - 6a: bf d0 rcall .+382 ; 0x1ea - 6c: 08 2f mov r16, r24 - 6e: 10 e0 ldi r17, 0x00 ; 0 - 70: 10 2f mov r17, r16 - 72: 00 27 eor r16, r16 - 74: 0e 29 or r16, r14 - 76: 1f 29 or r17, r15 + 1d66: e8 2e mov r14, r24 + 1d68: ff 24 eor r15, r15 + 1d6a: bf d0 rcall .+382 ; 0x1eea + 1d6c: 08 2f mov r16, r24 + 1d6e: 10 e0 ldi r17, 0x00 ; 0 + 1d70: 10 2f mov r17, r16 + 1d72: 00 27 eor r16, r16 + 1d74: 0e 29 or r16, r14 + 1d76: 1f 29 or r17, r15 #ifdef RAMPZ // Transfer top bit to RAMPZ RAMPZ = (newAddress & 0x8000) ? 1 : 0; #endif newAddress += newAddress; // Convert from word address to byte address - 78: 00 0f add r16, r16 - 7a: 11 1f adc r17, r17 - 7c: a3 c0 rjmp .+326 ; 0x1c4 <__SREG__+0x185> + 1d78: 00 0f add r16, r16 + 1d7a: 11 1f adc r17, r17 + 1d7c: a3 c0 rjmp .+326 ; 0x1ec4 address = newAddress; verifySpace(); } else if(ch == STK_UNIVERSAL) { - 7e: 86 35 cpi r24, 0x56 ; 86 - 80: 21 f4 brne .+8 ; 0x8a <__SREG__+0x4b> + 1d7e: 86 35 cpi r24, 0x56 ; 86 + 1d80: 21 f4 brne .+8 ; 0x1d8a // UNIVERSAL command is ignored getNch(4); - 82: 84 e0 ldi r24, 0x04 ; 4 - 84: d2 d0 rcall .+420 ; 0x22a + 1d82: 84 e0 ldi r24, 0x04 ; 4 + 1d84: d2 d0 rcall .+420 ; 0x1f2a putch(0x00); - 86: 80 e0 ldi r24, 0x00 ; 0 - 88: 97 c0 rjmp .+302 ; 0x1b8 <__SREG__+0x179> + 1d86: 80 e0 ldi r24, 0x00 ; 0 + 1d88: 97 c0 rjmp .+302 ; 0x1eb8 } /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 8a: 84 36 cpi r24, 0x64 ; 100 - 8c: 09 f0 breq .+2 ; 0x90 <__SREG__+0x51> - 8e: 60 c0 rjmp .+192 ; 0x150 <__SREG__+0x111> + 1d8a: 84 36 cpi r24, 0x64 ; 100 + 1d8c: 09 f0 breq .+2 ; 0x1d90 + 1d8e: 60 c0 rjmp .+192 ; 0x1e50 // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; getch(); /* getlen() */ - 90: ac d0 rcall .+344 ; 0x1ea + 1d90: ac d0 rcall .+344 ; 0x1eea length = getch(); - 92: ab d0 rcall .+342 ; 0x1ea - 94: f8 2e mov r15, r24 + 1d92: ab d0 rcall .+342 ; 0x1eea + 1d94: f8 2e mov r15, r24 getch(); - 96: a9 d0 rcall .+338 ; 0x1ea - 98: c0 e0 ldi r28, 0x00 ; 0 - 9a: d1 e0 ldi r29, 0x01 ; 1 + 1d96: a9 d0 rcall .+338 ; 0x1eea + 1d98: c0 e0 ldi r28, 0x00 ; 0 + 1d9a: d1 e0 ldi r29, 0x01 ; 1 // If we are in RWW section, immediately start page erase if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 9c: a6 d0 rcall .+332 ; 0x1ea - 9e: 89 93 st Y+, r24 + 1d9c: a6 d0 rcall .+332 ; 0x1eea + 1d9e: 89 93 st Y+, r24 while (--length); - a0: fc 16 cp r15, r28 - a2: e1 f7 brne .-8 ; 0x9c <__SREG__+0x5d> + 1da0: fc 16 cp r15, r28 + 1da2: e1 f7 brne .-8 ; 0x1d9c // If we are in NRWW section, page erase has to be delayed until now. // Todo: Take RAMPZ into account if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - a4: 83 e0 ldi r24, 0x03 ; 3 - a6: f8 01 movw r30, r16 - a8: 87 bf out 0x37, r24 ; 55 - aa: e8 95 spm + 1da4: 83 e0 ldi r24, 0x03 ; 3 + 1da6: f8 01 movw r30, r16 + 1da8: 87 bf out 0x37, r24 ; 55 + 1daa: e8 95 spm // Read command terminator, start reply verifySpace(); - ac: b6 d0 rcall .+364 ; 0x21a + 1dac: b6 d0 rcall .+364 ; 0x1f1a // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - ae: 07 b6 in r0, 0x37 ; 55 - b0: 00 fc sbrc r0, 0 - b2: fd cf rjmp .-6 ; 0xae <__SREG__+0x6f> + 1dae: 07 b6 in r0, 0x37 ; 55 + 1db0: 00 fc sbrc r0, 0 + 1db2: fd cf rjmp .-6 ; 0x1dae #ifdef VIRTUAL_BOOT_PARTITION if ((uint16_t)(void*)address == 0) { - b4: 01 15 cp r16, r1 - b6: 11 05 cpc r17, r1 - b8: 11 f0 breq .+4 ; 0xbe <__SREG__+0x7f> - ba: a8 01 movw r20, r16 - bc: 2a c0 rjmp .+84 ; 0x112 <__SREG__+0xd3> + 1db4: 01 15 cp r16, r1 + 1db6: 11 05 cpc r17, r1 + 1db8: 11 f0 breq .+4 ; 0x1dbe + 1dba: a8 01 movw r20, r16 + 1dbc: 2a c0 rjmp .+84 ; 0x1e12 // This is the reset vector page. We need to live-patch the code so the // bootloader runs. // // Move RESET vector to WDT vector uint16_t vect = buff[0] | (buff[1]<<8); - be: 80 91 00 01 lds r24, 0x0100 - c2: 20 91 01 01 lds r18, 0x0101 - c6: 30 e0 ldi r19, 0x00 ; 0 - c8: 32 2f mov r19, r18 - ca: 22 27 eor r18, r18 - cc: 90 e0 ldi r25, 0x00 ; 0 - ce: 28 2b or r18, r24 - d0: 39 2b or r19, r25 + 1dbe: 80 91 00 01 lds r24, 0x0100 + 1dc2: 20 91 01 01 lds r18, 0x0101 + 1dc6: 30 e0 ldi r19, 0x00 ; 0 + 1dc8: 32 2f mov r19, r18 + 1dca: 22 27 eor r18, r18 + 1dcc: 90 e0 ldi r25, 0x00 ; 0 + 1dce: 28 2b or r18, r24 + 1dd0: 39 2b or r19, r25 rstVect = vect; - d2: 30 93 85 01 sts 0x0185, r19 - d6: 20 93 84 01 sts 0x0184, r18 + 1dd2: 30 93 85 01 sts 0x0185, r19 + 1dd6: 20 93 84 01 sts 0x0184, r18 wdtVect = buff[8] | (buff[9]<<8); - da: 40 91 08 01 lds r20, 0x0108 - de: 80 91 09 01 lds r24, 0x0109 - e2: 90 e0 ldi r25, 0x00 ; 0 - e4: 98 2f mov r25, r24 - e6: 88 27 eor r24, r24 - e8: 50 e0 ldi r21, 0x00 ; 0 - ea: 84 2b or r24, r20 - ec: 95 2b or r25, r21 - ee: 90 93 87 01 sts 0x0187, r25 - f2: 80 93 86 01 sts 0x0186, r24 + 1dda: 40 91 08 01 lds r20, 0x0108 + 1dde: 80 91 09 01 lds r24, 0x0109 + 1de2: 90 e0 ldi r25, 0x00 ; 0 + 1de4: 98 2f mov r25, r24 + 1de6: 88 27 eor r24, r24 + 1de8: 50 e0 ldi r21, 0x00 ; 0 + 1dea: 84 2b or r24, r20 + 1dec: 95 2b or r25, r21 + 1dee: 90 93 87 01 sts 0x0187, r25 + 1df2: 80 93 86 01 sts 0x0186, r24 vect -= 4; // Instruction is a relative jump (rjmp), so recalculate. - f6: 24 50 subi r18, 0x04 ; 4 - f8: 30 40 sbci r19, 0x00 ; 0 + 1df6: 24 50 subi r18, 0x04 ; 4 + 1df8: 30 40 sbci r19, 0x00 ; 0 buff[8] = vect & 0xff; - fa: 20 93 08 01 sts 0x0108, r18 + 1dfa: 20 93 08 01 sts 0x0108, r18 buff[9] = vect >> 8; - fe: 23 2f mov r18, r19 - 100: 33 27 eor r19, r19 - 102: 20 93 09 01 sts 0x0109, r18 + 1dfe: 23 2f mov r18, r19 + 1e00: 33 27 eor r19, r19 + 1e02: 20 93 09 01 sts 0x0109, r18 // Add jump to bootloader at RESET vector buff[0] = 0x7f; - 106: d0 92 00 01 sts 0x0100, r13 + 1e06: d0 92 00 01 sts 0x0100, r13 buff[1] = 0xce; // rjmp 0x1d00 instruction - 10a: c0 92 01 01 sts 0x0101, r12 - 10e: 40 e0 ldi r20, 0x00 ; 0 - 110: 50 e0 ldi r21, 0x00 ; 0 - 112: a0 e0 ldi r26, 0x00 ; 0 - 114: b1 e0 ldi r27, 0x01 ; 1 + 1e0a: c0 92 01 01 sts 0x0101, r12 + 1e0e: 40 e0 ldi r20, 0x00 ; 0 + 1e10: 50 e0 ldi r21, 0x00 ; 0 + 1e12: a0 e0 ldi r26, 0x00 ; 0 + 1e14: b1 e0 ldi r27, 0x01 ; 1 bufPtr = buff; addrPtr = (uint16_t)(void*)address; ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 116: 2c 91 ld r18, X - 118: 30 e0 ldi r19, 0x00 ; 0 + 1e16: 2c 91 ld r18, X + 1e18: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 11a: 11 96 adiw r26, 0x01 ; 1 - 11c: 8c 91 ld r24, X - 11e: 11 97 sbiw r26, 0x01 ; 1 - 120: 90 e0 ldi r25, 0x00 ; 0 - 122: 98 2f mov r25, r24 - 124: 88 27 eor r24, r24 - 126: 82 2b or r24, r18 - 128: 93 2b or r25, r19 + 1e1a: 11 96 adiw r26, 0x01 ; 1 + 1e1c: 8c 91 ld r24, X + 1e1e: 11 97 sbiw r26, 0x01 ; 1 + 1e20: 90 e0 ldi r25, 0x00 ; 0 + 1e22: 98 2f mov r25, r24 + 1e24: 88 27 eor r24, r24 + 1e26: 82 2b or r24, r18 + 1e28: 93 2b or r25, r19 #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 12a: 12 96 adiw r26, 0x02 ; 2 + 1e2a: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 12c: fa 01 movw r30, r20 - 12e: 0c 01 movw r0, r24 - 130: b7 be out 0x37, r11 ; 55 - 132: e8 95 spm - 134: 11 24 eor r1, r1 + 1e2c: fa 01 movw r30, r20 + 1e2e: 0c 01 movw r0, r24 + 1e30: b7 be out 0x37, r11 ; 55 + 1e32: e8 95 spm + 1e34: 11 24 eor r1, r1 addrPtr += 2; - 136: 4e 5f subi r20, 0xFE ; 254 - 138: 5f 4f sbci r21, 0xFF ; 255 + 1e36: 4e 5f subi r20, 0xFE ; 254 + 1e38: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 13a: f1 e0 ldi r31, 0x01 ; 1 - 13c: a0 34 cpi r26, 0x40 ; 64 - 13e: bf 07 cpc r27, r31 - 140: 51 f7 brne .-44 ; 0x116 <__SREG__+0xd7> + 1e3a: f1 e0 ldi r31, 0x01 ; 1 + 1e3c: a0 34 cpi r26, 0x40 ; 64 + 1e3e: bf 07 cpc r27, r31 + 1e40: 51 f7 brne .-44 ; 0x1e16 // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 142: f8 01 movw r30, r16 - 144: a7 be out 0x37, r10 ; 55 - 146: e8 95 spm + 1e42: f8 01 movw r30, r16 + 1e44: a7 be out 0x37, r10 ; 55 + 1e46: e8 95 spm boot_spm_busy_wait(); - 148: 07 b6 in r0, 0x37 ; 55 - 14a: 00 fc sbrc r0, 0 - 14c: fd cf rjmp .-6 ; 0x148 <__SREG__+0x109> - 14e: 3b c0 rjmp .+118 ; 0x1c6 <__SREG__+0x187> + 1e48: 07 b6 in r0, 0x37 ; 55 + 1e4a: 00 fc sbrc r0, 0 + 1e4c: fd cf rjmp .-6 ; 0x1e48 + 1e4e: 3b c0 rjmp .+118 ; 0x1ec6 boot_rww_enable(); #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 150: 84 37 cpi r24, 0x74 ; 116 - 152: 51 f5 brne .+84 ; 0x1a8 <__SREG__+0x169> + 1e50: 84 37 cpi r24, 0x74 ; 116 + 1e52: 51 f5 brne .+84 ; 0x1ea8 // READ PAGE - we only read flash getch(); /* getlen() */ - 154: 4a d0 rcall .+148 ; 0x1ea + 1e54: 4a d0 rcall .+148 ; 0x1eea length = getch(); - 156: 49 d0 rcall .+146 ; 0x1ea - 158: f8 2e mov r15, r24 + 1e56: 49 d0 rcall .+146 ; 0x1eea + 1e58: f8 2e mov r15, r24 getch(); - 15a: 47 d0 rcall .+142 ; 0x1ea + 1e5a: 47 d0 rcall .+142 ; 0x1eea verifySpace(); - 15c: 5e d0 rcall .+188 ; 0x21a - 15e: e8 01 movw r28, r16 - 160: ef 2c mov r14, r15 + 1e5c: 5e d0 rcall .+188 ; 0x1f1a + 1e5e: e8 01 movw r28, r16 + 1e60: ef 2c mov r14, r15 #ifdef VIRTUAL_BOOT_PARTITION do { // Undo vector patch in bottom page so verify passes if (address == 0) ch=rstVect & 0xff; - 162: 20 97 sbiw r28, 0x00 ; 0 - 164: 19 f4 brne .+6 ; 0x16c <__SREG__+0x12d> - 166: 80 91 84 01 lds r24, 0x0184 - 16a: 14 c0 rjmp .+40 ; 0x194 <__SREG__+0x155> + 1e62: 20 97 sbiw r28, 0x00 ; 0 + 1e64: 19 f4 brne .+6 ; 0x1e6c + 1e66: 80 91 84 01 lds r24, 0x0184 + 1e6a: 14 c0 rjmp .+40 ; 0x1e94 else if (address == 1) ch=rstVect >> 8; - 16c: c1 30 cpi r28, 0x01 ; 1 - 16e: d1 05 cpc r29, r1 - 170: 19 f4 brne .+6 ; 0x178 <__SREG__+0x139> - 172: 80 91 85 01 lds r24, 0x0185 - 176: 0e c0 rjmp .+28 ; 0x194 <__SREG__+0x155> + 1e6c: c1 30 cpi r28, 0x01 ; 1 + 1e6e: d1 05 cpc r29, r1 + 1e70: 19 f4 brne .+6 ; 0x1e78 + 1e72: 80 91 85 01 lds r24, 0x0185 + 1e76: 0e c0 rjmp .+28 ; 0x1e94 else if (address == 8) ch=wdtVect & 0xff; - 178: c8 30 cpi r28, 0x08 ; 8 - 17a: d1 05 cpc r29, r1 - 17c: 19 f4 brne .+6 ; 0x184 <__SREG__+0x145> - 17e: 80 91 86 01 lds r24, 0x0186 - 182: 08 c0 rjmp .+16 ; 0x194 <__SREG__+0x155> + 1e78: c8 30 cpi r28, 0x08 ; 8 + 1e7a: d1 05 cpc r29, r1 + 1e7c: 19 f4 brne .+6 ; 0x1e84 + 1e7e: 80 91 86 01 lds r24, 0x0186 + 1e82: 08 c0 rjmp .+16 ; 0x1e94 else if (address == 9) ch=wdtVect >> 8; - 184: c9 30 cpi r28, 0x09 ; 9 - 186: d1 05 cpc r29, r1 - 188: 19 f4 brne .+6 ; 0x190 <__SREG__+0x151> - 18a: 80 91 87 01 lds r24, 0x0187 - 18e: 02 c0 rjmp .+4 ; 0x194 <__SREG__+0x155> + 1e84: c9 30 cpi r28, 0x09 ; 9 + 1e86: d1 05 cpc r29, r1 + 1e88: 19 f4 brne .+6 ; 0x1e90 + 1e8a: 80 91 87 01 lds r24, 0x0187 + 1e8e: 02 c0 rjmp .+4 ; 0x1e94 else ch = pgm_read_byte_near(address); - 190: fe 01 movw r30, r28 - 192: 84 91 lpm r24, Z+ + 1e90: fe 01 movw r30, r28 + 1e92: 84 91 lpm r24, Z+ address++; - 194: 21 96 adiw r28, 0x01 ; 1 + 1e94: 21 96 adiw r28, 0x01 ; 1 putch(ch); - 196: 1a d0 rcall .+52 ; 0x1cc + 1e96: 1a d0 rcall .+52 ; 0x1ecc } while (--length); - 198: ea 94 dec r14 - 19a: 19 f7 brne .-58 ; 0x162 <__SREG__+0x123> + 1e98: ea 94 dec r14 + 1e9a: 19 f7 brne .-58 ; 0x1e62 #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 19c: 0f 5f subi r16, 0xFF ; 255 - 19e: 1f 4f sbci r17, 0xFF ; 255 - 1a0: fa 94 dec r15 - 1a2: 0f 0d add r16, r15 - 1a4: 11 1d adc r17, r1 - 1a6: 0f c0 rjmp .+30 ; 0x1c6 <__SREG__+0x187> + 1e9c: 0f 5f subi r16, 0xFF ; 255 + 1e9e: 1f 4f sbci r17, 0xFF ; 255 + 1ea0: fa 94 dec r15 + 1ea2: 0f 0d add r16, r15 + 1ea4: 11 1d adc r17, r1 + 1ea6: 0f c0 rjmp .+30 ; 0x1ec6 #endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 1a8: 85 37 cpi r24, 0x75 ; 117 - 1aa: 41 f4 brne .+16 ; 0x1bc <__SREG__+0x17d> + 1ea8: 85 37 cpi r24, 0x75 ; 117 + 1eaa: 41 f4 brne .+16 ; 0x1ebc // READ SIGN - return what Avrdude wants to hear verifySpace(); - 1ac: 36 d0 rcall .+108 ; 0x21a + 1eac: 36 d0 rcall .+108 ; 0x1f1a putch(SIGNATURE_0); - 1ae: 8e e1 ldi r24, 0x1E ; 30 - 1b0: 0d d0 rcall .+26 ; 0x1cc + 1eae: 8e e1 ldi r24, 0x1E ; 30 + 1eb0: 0d d0 rcall .+26 ; 0x1ecc putch(SIGNATURE_1); - 1b2: 83 e9 ldi r24, 0x93 ; 147 - 1b4: 0b d0 rcall .+22 ; 0x1cc + 1eb2: 83 e9 ldi r24, 0x93 ; 147 + 1eb4: 0b d0 rcall .+22 ; 0x1ecc putch(SIGNATURE_2); - 1b6: 8c e0 ldi r24, 0x0C ; 12 - 1b8: 09 d0 rcall .+18 ; 0x1cc - 1ba: 05 c0 rjmp .+10 ; 0x1c6 <__SREG__+0x187> + 1eb6: 8c e0 ldi r24, 0x0C ; 12 + 1eb8: 09 d0 rcall .+18 ; 0x1ecc + 1eba: 05 c0 rjmp .+10 ; 0x1ec6 } else if (ch == 'Q') { - 1bc: 81 35 cpi r24, 0x51 ; 81 - 1be: 11 f4 brne .+4 ; 0x1c4 <__SREG__+0x185> + 1ebc: 81 35 cpi r24, 0x51 ; 81 + 1ebe: 11 f4 brne .+4 ; 0x1ec4 // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 1c0: 88 e0 ldi r24, 0x08 ; 8 - 1c2: 27 d0 rcall .+78 ; 0x212 + 1ec0: 88 e0 ldi r24, 0x08 ; 8 + 1ec2: 27 d0 rcall .+78 ; 0x1f12 verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 1c4: 2a d0 rcall .+84 ; 0x21a + 1ec4: 2a d0 rcall .+84 ; 0x1f1a } putch(STK_OK); - 1c6: 80 e1 ldi r24, 0x10 ; 16 - 1c8: 01 d0 rcall .+2 ; 0x1cc - 1ca: 3a cf rjmp .-396 ; 0x40 <__SREG__+0x1> + 1ec6: 80 e1 ldi r24, 0x10 ; 16 + 1ec8: 01 d0 rcall .+2 ; 0x1ecc + 1eca: 3a cf rjmp .-396 ; 0x1d40 -000001cc : +00001ecc : void putch(char ch) { #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); UDR0 = ch; #else __asm__ __volatile__ ( - 1cc: 2a e0 ldi r18, 0x0A ; 10 - 1ce: 30 e0 ldi r19, 0x00 ; 0 - 1d0: 80 95 com r24 - 1d2: 08 94 sec - 1d4: 10 f4 brcc .+4 ; 0x1da - 1d6: da 98 cbi 0x1b, 2 ; 27 - 1d8: 02 c0 rjmp .+4 ; 0x1de - 1da: da 9a sbi 0x1b, 2 ; 27 - 1dc: 00 00 nop - 1de: 15 d0 rcall .+42 ; 0x20a - 1e0: 14 d0 rcall .+40 ; 0x20a - 1e2: 86 95 lsr r24 - 1e4: 2a 95 dec r18 - 1e6: b1 f7 brne .-20 ; 0x1d4 + 1ecc: 2a e0 ldi r18, 0x0A ; 10 + 1ece: 30 e0 ldi r19, 0x00 ; 0 + 1ed0: 80 95 com r24 + 1ed2: 08 94 sec + 1ed4: 10 f4 brcc .+4 ; 0x1eda + 1ed6: da 98 cbi 0x1b, 2 ; 27 + 1ed8: 02 c0 rjmp .+4 ; 0x1ede + 1eda: da 9a sbi 0x1b, 2 ; 27 + 1edc: 00 00 nop + 1ede: 15 d0 rcall .+42 ; 0x1f0a + 1ee0: 14 d0 rcall .+40 ; 0x1f0a + 1ee2: 86 95 lsr r24 + 1ee4: 2a 95 dec r18 + 1ee6: b1 f7 brne .-20 ; 0x1ed4 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 1e8: 08 95 ret + 1ee8: 08 95 ret -000001ea : +00001eea : } #endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 1ea: a8 95 wdr + 1eea: a8 95 wdr LED_PIN |= _BV(LED); #endif #endif return ch; } - 1ec: 29 e0 ldi r18, 0x09 ; 9 - 1ee: 30 e0 ldi r19, 0x00 ; 0 - 1f0: cb 99 sbic 0x19, 3 ; 25 - 1f2: fe cf rjmp .-4 ; 0x1f0 - 1f4: 0a d0 rcall .+20 ; 0x20a - 1f6: 09 d0 rcall .+18 ; 0x20a - 1f8: 08 d0 rcall .+16 ; 0x20a - 1fa: 88 94 clc - 1fc: cb 99 sbic 0x19, 3 ; 25 - 1fe: 08 94 sec - 200: 2a 95 dec r18 - 202: 11 f0 breq .+4 ; 0x208 - 204: 87 95 ror r24 - 206: f7 cf rjmp .-18 ; 0x1f6 - 208: 08 95 ret - -0000020a : + 1eec: 29 e0 ldi r18, 0x09 ; 9 + 1eee: 30 e0 ldi r19, 0x00 ; 0 + 1ef0: cb 99 sbic 0x19, 3 ; 25 + 1ef2: fe cf rjmp .-4 ; 0x1ef0 + 1ef4: 0a d0 rcall .+20 ; 0x1f0a + 1ef6: 09 d0 rcall .+18 ; 0x1f0a + 1ef8: 08 d0 rcall .+16 ; 0x1f0a + 1efa: 88 94 clc + 1efc: cb 99 sbic 0x19, 3 ; 25 + 1efe: 08 94 sec + 1f00: 2a 95 dec r18 + 1f02: 11 f0 breq .+4 ; 0x1f08 + 1f04: 87 95 ror r24 + 1f06: f7 cf rjmp .-18 ; 0x1ef6 + 1f08: 08 95 ret + +00001f0a : #if UART_B_VALUE > 255 #error Baud rate too slow for soft UART #endif void uartDelay() { __asm__ __volatile__ ( - 20a: 9e e0 ldi r25, 0x0E ; 14 - 20c: 9a 95 dec r25 - 20e: f1 f7 brne .-4 ; 0x20c - 210: 08 95 ret + 1f0a: 9e e0 ldi r25, 0x0E ; 14 + 1f0c: 9a 95 dec r25 + 1f0e: f1 f7 brne .-4 ; 0x1f0c + 1f10: 08 95 ret -00000212 : +00001f12 : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 212: 98 e1 ldi r25, 0x18 ; 24 - 214: 91 bd out 0x21, r25 ; 33 + 1f12: 98 e1 ldi r25, 0x18 ; 24 + 1f14: 91 bd out 0x21, r25 ; 33 WDTCSR = x; - 216: 81 bd out 0x21, r24 ; 33 + 1f16: 81 bd out 0x21, r24 ; 33 } - 218: 08 95 ret + 1f18: 08 95 ret -0000021a : +00001f1a : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) { - 21a: e7 df rcall .-50 ; 0x1ea - 21c: 80 32 cpi r24, 0x20 ; 32 - 21e: 19 f0 breq .+6 ; 0x226 + 1f1a: e7 df rcall .-50 ; 0x1eea + 1f1c: 80 32 cpi r24, 0x20 ; 32 + 1f1e: 19 f0 breq .+6 ; 0x1f26 watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 220: 88 e0 ldi r24, 0x08 ; 8 - 222: f7 df rcall .-18 ; 0x212 - 224: ff cf rjmp .-2 ; 0x224 + 1f20: 88 e0 ldi r24, 0x08 ; 8 + 1f22: f7 df rcall .-18 ; 0x1f12 + 1f24: ff cf rjmp .-2 ; 0x1f24 while (1) // and busy-loop so that WD causes ; // a reset and app start. } putch(STK_INSYNC); - 226: 84 e1 ldi r24, 0x14 ; 20 + 1f26: 84 e1 ldi r24, 0x14 ; 20 } - 228: d1 cf rjmp .-94 ; 0x1cc + 1f28: d1 cf rjmp .-94 ; 0x1ecc -0000022a : +00001f2a : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 22a: 1f 93 push r17 - 22c: 18 2f mov r17, r24 + 1f2a: 1f 93 push r17 + 1f2c: 18 2f mov r17, r24 do getch(); while (--count); - 22e: dd df rcall .-70 ; 0x1ea - 230: 11 50 subi r17, 0x01 ; 1 - 232: e9 f7 brne .-6 ; 0x22e + 1f2e: dd df rcall .-70 ; 0x1eea + 1f30: 11 50 subi r17, 0x01 ; 1 + 1f32: e9 f7 brne .-6 ; 0x1f2e verifySpace(); - 234: f2 df rcall .-28 ; 0x21a + 1f34: f2 df rcall .-28 ; 0x1f1a } - 236: 1f 91 pop r17 - 238: 08 95 ret + 1f36: 1f 91 pop r17 + 1f38: 08 95 ret -0000023a : +00001f3a : WDTCSR = _BV(WDCE) | _BV(WDE); WDTCSR = x; } void appStart() { watchdogConfig(WATCHDOG_OFF); - 23a: 80 e0 ldi r24, 0x00 ; 0 - 23c: ea df rcall .-44 ; 0x212 + 1f3a: 80 e0 ldi r24, 0x00 ; 0 + 1f3c: ea df rcall .-44 ; 0x1f12 __asm__ __volatile__ ( - 23e: e4 e0 ldi r30, 0x04 ; 4 - 240: ff 27 eor r31, r31 - 242: 09 94 ijmp + 1f3e: e4 e0 ldi r30, 0x04 ; 4 + 1f40: ff 27 eor r31, r31 + 1f42: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_pro_16MHz.hex b/bootloaders/optiboot/optiboot_pro_16MHz.hex index 733a139..26bbd4c 100644 --- a/bootloaders/optiboot/optiboot_pro_16MHz.hex +++ b/bootloaders/optiboot/optiboot_pro_16MHz.hex @@ -28,6 +28,6 @@ :103FB000F1DF803219F088E0F5DFFFCF84E1E2CF56 :103FC0001F93182FE7DF1150E9F7F2DF1F910895D3 :0A3FD00080E0E8DFEE27FF270994E8 -:023FFE000104BC +:023FFE000204BB :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_16MHz.lst b/bootloaders/optiboot/optiboot_pro_16MHz.lst index b1d8c1b..e615a8e 100644 --- a/bootloaders/optiboot/optiboot_pro_16MHz.lst +++ b/bootloaders/optiboot/optiboot_pro_16MHz.lst @@ -11,19 +11,19 @@ Idx Name Size VMA LMA File off Algn CONTENTS, READONLY, DEBUGGING 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028c 00000000 00000000 000002b7 2**0 + 4 .debug_info 0000028d 00000000 00000000 000002b7 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000199 00000000 00000000 00000543 2**0 + 5 .debug_abbrev 0000018a 00000000 00000000 00000544 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000456 00000000 00000000 000006dc 2**0 + 6 .debug_line 00000456 00000000 00000000 000006ce 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b34 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b24 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000bb4 2**0 + 8 .debug_str 00000149 00000000 00000000 00000ba4 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000cfd 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000ced 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f7b 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f6b 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: diff --git a/bootloaders/optiboot/optiboot_pro_20mhz.hex b/bootloaders/optiboot/optiboot_pro_20mhz.hex index 58ed1dc..dbd29c1 100644 --- a/bootloaders/optiboot/optiboot_pro_20mhz.hex +++ b/bootloaders/optiboot/optiboot_pro_20mhz.hex @@ -28,6 +28,6 @@ :103FB000F1DF803219F088E0F5DFFFCF84E1E2CF56 :103FC0001F93182FE7DF1150E9F7F2DF1F910895D3 :0A3FD00080E0E8DFEE27FF270994E8 -:023FFE000104BC +:023FFE000204BB :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_20mhz.lst b/bootloaders/optiboot/optiboot_pro_20mhz.lst index cd2d66a..20d4db6 100644 --- a/bootloaders/optiboot/optiboot_pro_20mhz.lst +++ b/bootloaders/optiboot/optiboot_pro_20mhz.lst @@ -11,19 +11,19 @@ Idx Name Size VMA LMA File off Algn CONTENTS, READONLY, DEBUGGING 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028c 00000000 00000000 000002b7 2**0 + 4 .debug_info 0000028d 00000000 00000000 000002b7 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000199 00000000 00000000 00000543 2**0 + 5 .debug_abbrev 0000018a 00000000 00000000 00000544 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000456 00000000 00000000 000006dc 2**0 + 6 .debug_line 00000456 00000000 00000000 000006ce 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b34 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b24 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000bb4 2**0 + 8 .debug_str 00000149 00000000 00000000 00000ba4 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000cfd 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000ced 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f7b 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f6b 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: diff --git a/bootloaders/optiboot/optiboot_pro_8MHz.hex b/bootloaders/optiboot/optiboot_pro_8MHz.hex index dcdbbb4..00f7a38 100644 --- a/bootloaders/optiboot/optiboot_pro_8MHz.hex +++ b/bootloaders/optiboot/optiboot_pro_8MHz.hex @@ -28,6 +28,6 @@ :103FB000F1DF803219F088E0F5DFFFCF84E1E2CF56 :103FC0001F93182FE7DF1150E9F7F2DF1F910895D3 :0A3FD00080E0E8DFEE27FF270994E8 -:023FFE000104BC +:023FFE000204BB :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_8MHz.lst b/bootloaders/optiboot/optiboot_pro_8MHz.lst index d3d760e..6c117ca 100644 --- a/bootloaders/optiboot/optiboot_pro_8MHz.lst +++ b/bootloaders/optiboot/optiboot_pro_8MHz.lst @@ -11,19 +11,19 @@ Idx Name Size VMA LMA File off Algn CONTENTS, READONLY, DEBUGGING 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028c 00000000 00000000 000002b7 2**0 + 4 .debug_info 0000028d 00000000 00000000 000002b7 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000199 00000000 00000000 00000543 2**0 + 5 .debug_abbrev 0000018a 00000000 00000000 00000544 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000456 00000000 00000000 000006dc 2**0 + 6 .debug_line 00000456 00000000 00000000 000006ce 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b34 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b24 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000bb4 2**0 + 8 .debug_str 00000149 00000000 00000000 00000ba4 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000cfd 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000ced 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f7b 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f6b 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: -- cgit v1.2.3-18-g5258 From a0d00b4d86cfbd5cb508eda69997175fab39e725 Mon Sep 17 00:00:00 2001 From: WestfW Date: Mon, 13 Jun 2011 19:07:07 -0700 Subject: http://code.google.com/p/arduino/issues/detail?id=368 Optiboot does not support ArduinoasISP programmer. When avrdude runs and talks to an arduino running ArduinoISP, it needs the optiboot (entered due to auto-reset) to abort and start the ArduinoISP "application" when it sees communications at the wrong serial speed. Unfortunately, optiboot treats all unrecognized command characters as "no-ops" and responds/loops for more commands, leading to a nice loop that never gets to the sketch. This patch causes characters received with Framing errors (the most likely error for speed mis-matches) to NOT reset the watchdog timer (normally done in getch()), which will cause the application to start if it continues for "a while." (tested. Works! Running ArduinoISP at speeds as high as 57600 still causes the bootloader to start the sketch (although it fails later on for other reasons.)) --- bootloaders/optiboot/README.TXT | 19 ++- bootloaders/optiboot/optiboot.c | 22 ++- bootloaders/optiboot/optiboot_atmega328.hex | 33 ++--- bootloaders/optiboot/optiboot_atmega328.lst | 140 ++++++++++--------- .../optiboot/optiboot_atmega328_pro_8MHz.hex | 33 ++--- .../optiboot/optiboot_atmega328_pro_8MHz.lst | 140 ++++++++++--------- bootloaders/optiboot/optiboot_diecimila.hex | 33 ++--- bootloaders/optiboot/optiboot_diecimila.lst | 140 ++++++++++--------- bootloaders/optiboot/optiboot_lilypad.hex | 33 ++--- bootloaders/optiboot/optiboot_lilypad.lst | 140 ++++++++++--------- .../optiboot/optiboot_lilypad_resonator.hex | 33 ++--- .../optiboot/optiboot_lilypad_resonator.lst | 140 ++++++++++--------- bootloaders/optiboot/optiboot_luminet.hex | 36 ++--- bootloaders/optiboot/optiboot_luminet.lst | 153 ++++++++++----------- bootloaders/optiboot/optiboot_pro_16MHz.hex | 33 ++--- bootloaders/optiboot/optiboot_pro_16MHz.lst | 140 ++++++++++--------- bootloaders/optiboot/optiboot_pro_20mhz.hex | 33 ++--- bootloaders/optiboot/optiboot_pro_20mhz.lst | 140 ++++++++++--------- bootloaders/optiboot/optiboot_pro_8MHz.hex | 33 ++--- bootloaders/optiboot/optiboot_pro_8MHz.lst | 140 ++++++++++--------- bootloaders/optiboot/pin_defs.h | 1 + 21 files changed, 863 insertions(+), 752 deletions(-) diff --git a/bootloaders/optiboot/README.TXT b/bootloaders/optiboot/README.TXT index 9a68e23..7e2f46d 100644 --- a/bootloaders/optiboot/README.TXT +++ b/bootloaders/optiboot/README.TXT @@ -27,7 +27,7 @@ this may change if compiler versions drift apart between CrossPack and the Arduino IDE.) -Building optiboot in the arduino IDE install. +Building Optiboot in the Arduino IDE Install. Work in the .../hardware/arduino/bootloaders/optiboot/ and use the "omake " command, which just generates a command that uses @@ -44,7 +44,7 @@ the programs it needs, so you need to work in the existing optiboot directory (or something created at the same "level") for it to work. -Building optiboot in the arduino source development install. +Building Optiboot in the Arduino Source Development Install. In this case, there is no special shell script, and you're assumed to have "make" installed somewhere in your path. @@ -53,3 +53,18 @@ expected directory. Work in Arduino/hardware/arduino/bootloaders/optiboot and use make OS=windows ENV=arduinodev or make OS=macosx ENV=arduinodev + + +Programming Chips Using the _isp Targets + +The CPU targets have corresponding ISP targets that will actuall +program the bootloader into a chip. "atmega328_isp" for the atmega328, +for example. These will set the fuses and lock bits as appropriate as +well as uploading the bootloader code. + +The makefiles default to using a USB programmer, but you can use +a serial programmer like ArduinoISP by changing the appropriate +variables when you invoke make: + + make ISPTOOL=stk500v1 ISPPORT=/dev/tty.usbserial-A20e1eAN \ + ISPSPEED=-b19200 atmega328_isp diff --git a/bootloaders/optiboot/optiboot.c b/bootloaders/optiboot/optiboot.c index 8dbe1bf..3f4404d 100644 --- a/bootloaders/optiboot/optiboot.c +++ b/bootloaders/optiboot/optiboot.c @@ -132,13 +132,16 @@ /**********************************************************/ /* Edit History: */ /* */ +/* 4.3 WestfW: catch framing errors in getch(), so that */ +/* AVRISP works without HW kludges. */ +/* http://code.google.com/p/arduino/issues/detail?id=368n*/ /* 4.2 WestfW: reduce code size, fix timeouts, change */ /* verifySpace to use WDT instead of appstart */ /* 4.1 WestfW: put version number in binary. */ /**********************************************************/ #define OPTIBOOT_MAJVER 4 -#define OPTIBOOT_MINVER 2 +#define OPTIBOOT_MINVER 3 #define MAKESTR(a) #a #define MAKEVER(a, b) MAKESTR(a*256+b) @@ -512,8 +515,6 @@ void putch(char ch) { uint8_t getch(void) { uint8_t ch; - watchdogReset(); - #ifdef LED_DATA_FLASH #ifdef __AVR_ATmega8__ LED_PORT ^= _BV(LED); @@ -547,7 +548,20 @@ uint8_t getch(void) { "r25" ); #else - while(!(UCSR0A & _BV(RXC0))); + while(!(UCSR0A & _BV(RXC0))) + ; + if (!(UCSR0A & _BV(FE0))) { + /* + * A Framing Error indicates (probably) that something is talking + * to us at the wrong bit rate. Assume that this is because it + * expects to be talking to the application, and DON'T reset the + * watchdog. This should cause the bootloader to abort and run + * the application "soon", if it keeps happening. (Note that we + * don't care that an invalid char is returned...) + */ + watchdogReset(); + } + ch = UDR0; #endif diff --git a/bootloaders/optiboot/optiboot_atmega328.hex b/bootloaders/optiboot/optiboot_atmega328.hex index 10dcd6c..f147e81 100644 --- a/bootloaders/optiboot/optiboot_atmega328.hex +++ b/bootloaders/optiboot/optiboot_atmega328.hex @@ -1,33 +1,34 @@ -:107E0000112484B714BE81FFE3D085E08093810004 +:107E0000112484B714BE81FFE7D085E08093810000 :107E100082E08093C00088E18093C10086E0809377 -:107E2000C20080E18093C4008EE0BCD0259A86E039 +:107E2000C20080E18093C4008EE0C0D0259A86E035 :107E300020E33CEF91E0309385002093840096BBD3 :107E4000B09BFECF1D9AA8958150A9F799249394D1 :107E5000A5E0AA2EF1E1BF2E9DD0813421F481E06E -:107E6000AFD083E01FC0823411F484E103C08534B5 -:107E700019F485E0A5D083C0853579F48BD0E82E40 +:107E6000B3D083E01FC0823411F484E103C08534B1 +:107E700019F485E0A9D083C0853579F48BD0E82E3C :107E8000FF2488D0082F10E0102F00270E291F296B -:107E9000000F111F8DD0680172C0863529F484E06F -:107EA0008FD080E06FD06BC0843609F042C072D0B2 +:107E9000000F111F91D0680172C0863529F484E06B +:107EA00093D080E06FD06BC0843609F042C072D0AE :107EB00071D0082F6FD080E0C81680E7D80620F474 :107EC00083E0F60187BFE895C0E0D1E063D08993F5 :107ED0000C17E1F7F0E0CF16F0E7DF0620F083E0C3 -:107EE000F60187BFE89564D007B600FCFDCFA60178 +:107EE000F60187BFE89568D007B600FCFDCFA60174 :107EF000A0E0B1E02C9130E011968C91119790E0C8 :107F0000982F8827822B932B1296FA010C0197BE8B :107F1000E89511244E5F5F4FF1E0A038BF0751F79D :107F2000F601A7BEE89507B600FCFDCFB7BEE89501 -:107F300026C08437B1F42ED02DD0F82E2BD038D0D7 +:107F300026C08437B1F42ED02DD0F82E2BD03CD0D3 :107F4000F601EF2C8F010F5F1F4F84911BD0EA9435 :107F5000F801C1F70894C11CD11CFA94CF0CD11CB4 -:107F60000EC0853739F424D08EE10CD085E90AD0D3 -:107F70008FE098CF813511F488E014D019D080E1DA +:107F60000EC0853739F428D08EE10CD085E90AD0CF +:107F70008FE098CF813511F488E018D01DD080E1D2 :107F800001D06ACF982F8091C00085FFFCCF9093DD -:107F9000C6000895A8958091C00087FFFCCF80910E -:107FA000C6000895E0E6F0E098E1908380830895AC -:107FB000F1DF803219F088E0F5DFFFCF84E1E2CF16 -:107FC0001F93182FE7DF1150E9F7F2DF1F91089593 -:0A7FD00080E0E8DFEE27FF270994A8 -:027FFE0002047B +:107F9000C60008958091C00087FFFCCF8091C0008B +:107FA00084FD01C0A8958091C6000895E0E6F0E048 +:107FB00098E1908380830895EDDF803219F088E0A6 +:107FC000F5DFFFCF84E1DECF1F93182FE3DF1150E1 +:107FD000E9F7F2DF1F91089580E0E8DFEE27FF2741 +:027FE000099402 +:027FFE0003047A :0400000300007E007B :00000001FF diff --git a/bootloaders/optiboot/optiboot_atmega328.lst b/bootloaders/optiboot/optiboot_atmega328.lst index 89577f6..db45462 100644 --- a/bootloaders/optiboot/optiboot_atmega328.lst +++ b/bootloaders/optiboot/optiboot_atmega328.lst @@ -3,27 +3,27 @@ optiboot_atmega328.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001da 00007e00 00007e00 00000054 2**1 + 0 .text 000001e2 00007e00 00007e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00007ffe 00007ffe 0000022e 2**0 + 1 .version 00000002 00007ffe 00007ffe 00000236 2**0 CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000230 2**0 + 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 + 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028d 00000000 00000000 000002b7 2**0 + 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000018a 00000000 00000000 00000544 2**0 + 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000456 00000000 00000000 000006ce 2**0 + 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b24 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000ba4 2**0 + 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ced 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f6b 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 7e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 7e06: 81 ff sbrs r24, 1 - 7e08: e3 d0 rcall .+454 ; 0x7fd0 + 7e08: e7 d0 rcall .+462 ; 0x7fd8 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -77,7 +77,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); 7e28: 8e e0 ldi r24, 0x0E ; 14 - 7e2a: bc d0 rcall .+376 ; 0x7fa4 + 7e2a: c0 d0 rcall .+384 ; 0x7fac /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -163,7 +163,7 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 7e5e: 81 e0 ldi r24, 0x01 ; 1 - 7e60: af d0 rcall .+350 ; 0x7fc0 + 7e60: b3 d0 rcall .+358 ; 0x7fc8 putch(0x03); 7e62: 83 e0 ldi r24, 0x03 ; 3 7e64: 1f c0 rjmp .+62 ; 0x7ea4 @@ -182,7 +182,7 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 7e72: 85 e0 ldi r24, 0x05 ; 5 - 7e74: a5 d0 rcall .+330 ; 0x7fc0 + 7e74: a9 d0 rcall .+338 ; 0x7fc8 7e76: 83 c0 rjmp .+262 ; 0x7f7e } else if(ch == STK_LOAD_ADDRESS) { @@ -211,7 +211,7 @@ void watchdogReset() { 7e92: 11 1f adc r17, r17 address = newAddress; verifySpace(); - 7e94: 8d d0 rcall .+282 ; 0x7fb0 + 7e94: 91 d0 rcall .+290 ; 0x7fb8 7e96: 68 01 movw r12, r16 7e98: 72 c0 rjmp .+228 ; 0x7f7e } @@ -221,7 +221,7 @@ void watchdogReset() { // UNIVERSAL command is ignored getNch(4); 7e9e: 84 e0 ldi r24, 0x04 ; 4 - 7ea0: 8f d0 rcall .+286 ; 0x7fc0 + 7ea0: 93 d0 rcall .+294 ; 0x7fc8 putch(0x00); 7ea2: 80 e0 ldi r24, 0x00 ; 0 7ea4: 6f d0 rcall .+222 ; 0x7f84 @@ -282,7 +282,7 @@ void watchdogReset() { // Read command terminator, start reply verifySpace(); - 7ee6: 64 d0 rcall .+200 ; 0x7fb0 + 7ee6: 68 d0 rcall .+208 ; 0x7fb8 // If only a partial page is to be programmed, the erase might not be complete. // So check that here @@ -370,7 +370,7 @@ int main(void) { 7f3c: 2b d0 rcall .+86 ; 0x7f94 verifySpace(); - 7f3e: 38 d0 rcall .+112 ; 0x7fb0 + 7f3e: 3c d0 rcall .+120 ; 0x7fb8 7f40: f6 01 movw r30, r12 7f42: ef 2c mov r14, r15 putch(result); @@ -411,7 +411,7 @@ int main(void) { 7f64: 39 f4 brne .+14 ; 0x7f74 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 7f66: 24 d0 rcall .+72 ; 0x7fb0 + 7f66: 28 d0 rcall .+80 ; 0x7fb8 putch(SIGNATURE_0); 7f68: 8e e1 ldi r24, 0x1E ; 30 7f6a: 0c d0 rcall .+24 ; 0x7f84 @@ -428,13 +428,13 @@ int main(void) { // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); 7f78: 88 e0 ldi r24, 0x08 ; 8 - 7f7a: 14 d0 rcall .+40 ; 0x7fa4 + 7f7a: 18 d0 rcall .+48 ; 0x7fac verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 7f7c: 19 d0 rcall .+50 ; 0x7fb0 + 7f7c: 1d d0 rcall .+58 ; 0x7fb8 } putch(STK_OK); 7f7e: 80 e1 ldi r24, 0x10 ; 16 @@ -463,99 +463,109 @@ void putch(char ch) { 7f92: 08 95 ret 00007f94 : + [uartBit] "I" (UART_RX_BIT) + : + "r25" +); +#else + while(!(UCSR0A & _BV(RXC0))) + 7f94: 80 91 c0 00 lds r24, 0x00C0 + 7f98: 87 ff sbrs r24, 7 + 7f9a: fc cf rjmp .-8 ; 0x7f94 + ; + if (!(UCSR0A & _BV(FE0))) { + 7f9c: 80 91 c0 00 lds r24, 0x00C0 + 7fa0: 84 fd sbrc r24, 4 + 7fa2: 01 c0 rjmp .+2 ; 0x7fa6 } #endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 7f94: a8 95 wdr - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))); - 7f96: 80 91 c0 00 lds r24, 0x00C0 - 7f9a: 87 ff sbrs r24, 7 - 7f9c: fc cf rjmp .-8 ; 0x7f96 + 7fa4: a8 95 wdr + * don't care that an invalid char is returned...) + */ + watchdogReset(); + } + ch = UDR0; - 7f9e: 80 91 c6 00 lds r24, 0x00C6 + 7fa6: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 7fa2: 08 95 ret + 7faa: 08 95 ret -00007fa4 : +00007fac : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 7fa4: e0 e6 ldi r30, 0x60 ; 96 - 7fa6: f0 e0 ldi r31, 0x00 ; 0 - 7fa8: 98 e1 ldi r25, 0x18 ; 24 - 7faa: 90 83 st Z, r25 + 7fac: e0 e6 ldi r30, 0x60 ; 96 + 7fae: f0 e0 ldi r31, 0x00 ; 0 + 7fb0: 98 e1 ldi r25, 0x18 ; 24 + 7fb2: 90 83 st Z, r25 WDTCSR = x; - 7fac: 80 83 st Z, r24 + 7fb4: 80 83 st Z, r24 } - 7fae: 08 95 ret + 7fb6: 08 95 ret -00007fb0 : +00007fb8 : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) { - 7fb0: f1 df rcall .-30 ; 0x7f94 - 7fb2: 80 32 cpi r24, 0x20 ; 32 - 7fb4: 19 f0 breq .+6 ; 0x7fbc + 7fb8: ed df rcall .-38 ; 0x7f94 + 7fba: 80 32 cpi r24, 0x20 ; 32 + 7fbc: 19 f0 breq .+6 ; 0x7fc4 watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 7fb6: 88 e0 ldi r24, 0x08 ; 8 - 7fb8: f5 df rcall .-22 ; 0x7fa4 - 7fba: ff cf rjmp .-2 ; 0x7fba + 7fbe: 88 e0 ldi r24, 0x08 ; 8 + 7fc0: f5 df rcall .-22 ; 0x7fac + 7fc2: ff cf rjmp .-2 ; 0x7fc2 while (1) // and busy-loop so that WD causes ; // a reset and app start. } putch(STK_INSYNC); - 7fbc: 84 e1 ldi r24, 0x14 ; 20 + 7fc4: 84 e1 ldi r24, 0x14 ; 20 } - 7fbe: e2 cf rjmp .-60 ; 0x7f84 + 7fc6: de cf rjmp .-68 ; 0x7f84 -00007fc0 : +00007fc8 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 7fc0: 1f 93 push r17 - 7fc2: 18 2f mov r17, r24 + 7fc8: 1f 93 push r17 + 7fca: 18 2f mov r17, r24 do getch(); while (--count); - 7fc4: e7 df rcall .-50 ; 0x7f94 - 7fc6: 11 50 subi r17, 0x01 ; 1 - 7fc8: e9 f7 brne .-6 ; 0x7fc4 + 7fcc: e3 df rcall .-58 ; 0x7f94 + 7fce: 11 50 subi r17, 0x01 ; 1 + 7fd0: e9 f7 brne .-6 ; 0x7fcc verifySpace(); - 7fca: f2 df rcall .-28 ; 0x7fb0 + 7fd2: f2 df rcall .-28 ; 0x7fb8 } - 7fcc: 1f 91 pop r17 - 7fce: 08 95 ret + 7fd4: 1f 91 pop r17 + 7fd6: 08 95 ret -00007fd0 : +00007fd8 : WDTCSR = _BV(WDCE) | _BV(WDE); WDTCSR = x; } void appStart() { watchdogConfig(WATCHDOG_OFF); - 7fd0: 80 e0 ldi r24, 0x00 ; 0 - 7fd2: e8 df rcall .-48 ; 0x7fa4 + 7fd8: 80 e0 ldi r24, 0x00 ; 0 + 7fda: e8 df rcall .-48 ; 0x7fac __asm__ __volatile__ ( - 7fd4: ee 27 eor r30, r30 - 7fd6: ff 27 eor r31, r31 - 7fd8: 09 94 ijmp + 7fdc: ee 27 eor r30, r30 + 7fde: ff 27 eor r31, r31 + 7fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex index 3b543c1..499c631 100644 --- a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex +++ b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex @@ -1,33 +1,34 @@ -:107E0000112484B714BE81FFE3D085E08093810004 +:107E0000112484B714BE81FFE7D085E08093810000 :107E100082E08093C00088E18093C10086E0809377 -:107E2000C20088E08093C4008EE0BCD0259A86E032 +:107E2000C20088E08093C4008EE0C0D0259A86E02E :107E300028E13EEF91E0309385002093840096BBCB :107E4000B09BFECF1D9AA8958150A9F799249394D1 :107E5000A5E0AA2EF1E1BF2E9DD0813421F481E06E -:107E6000AFD083E01FC0823411F484E103C08534B5 -:107E700019F485E0A5D083C0853579F48BD0E82E40 +:107E6000B3D083E01FC0823411F484E103C08534B1 +:107E700019F485E0A9D083C0853579F48BD0E82E3C :107E8000FF2488D0082F10E0102F00270E291F296B -:107E9000000F111F8DD0680172C0863529F484E06F -:107EA0008FD080E06FD06BC0843609F042C072D0B2 +:107E9000000F111F91D0680172C0863529F484E06B +:107EA00093D080E06FD06BC0843609F042C072D0AE :107EB00071D0082F6FD080E0C81680E7D80620F474 :107EC00083E0F60187BFE895C0E0D1E063D08993F5 :107ED0000C17E1F7F0E0CF16F0E7DF0620F083E0C3 -:107EE000F60187BFE89564D007B600FCFDCFA60178 +:107EE000F60187BFE89568D007B600FCFDCFA60174 :107EF000A0E0B1E02C9130E011968C91119790E0C8 :107F0000982F8827822B932B1296FA010C0197BE8B :107F1000E89511244E5F5F4FF1E0A038BF0751F79D :107F2000F601A7BEE89507B600FCFDCFB7BEE89501 -:107F300026C08437B1F42ED02DD0F82E2BD038D0D7 +:107F300026C08437B1F42ED02DD0F82E2BD03CD0D3 :107F4000F601EF2C8F010F5F1F4F84911BD0EA9435 :107F5000F801C1F70894C11CD11CFA94CF0CD11CB4 -:107F60000EC0853739F424D08EE10CD085E90AD0D3 -:107F70008FE098CF813511F488E014D019D080E1DA +:107F60000EC0853739F428D08EE10CD085E90AD0CF +:107F70008FE098CF813511F488E018D01DD080E1D2 :107F800001D06ACF982F8091C00085FFFCCF9093DD -:107F9000C6000895A8958091C00087FFFCCF80910E -:107FA000C6000895E0E6F0E098E1908380830895AC -:107FB000F1DF803219F088E0F5DFFFCF84E1E2CF16 -:107FC0001F93182FE7DF1150E9F7F2DF1F91089593 -:0A7FD00080E0E8DFEE27FF270994A8 -:027FFE0002047B +:107F9000C60008958091C00087FFFCCF8091C0008B +:107FA00084FD01C0A8958091C6000895E0E6F0E048 +:107FB00098E1908380830895EDDF803219F088E0A6 +:107FC000F5DFFFCF84E1DECF1F93182FE3DF1150E1 +:107FD000E9F7F2DF1F91089580E0E8DFEE27FF2741 +:027FE000099402 +:027FFE0003047A :0400000300007E007B :00000001FF diff --git a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst index 002f9a3..0577bdc 100644 --- a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst +++ b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst @@ -3,27 +3,27 @@ optiboot_atmega328_pro_8MHz.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001da 00007e00 00007e00 00000054 2**1 + 0 .text 000001e2 00007e00 00007e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00007ffe 00007ffe 0000022e 2**0 + 1 .version 00000002 00007ffe 00007ffe 00000236 2**0 CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000230 2**0 + 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 + 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028d 00000000 00000000 000002b7 2**0 + 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000018a 00000000 00000000 00000544 2**0 + 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000456 00000000 00000000 000006ce 2**0 + 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b24 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000ba4 2**0 + 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ced 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f6b 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 7e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 7e06: 81 ff sbrs r24, 1 - 7e08: e3 d0 rcall .+454 ; 0x7fd0 + 7e08: e7 d0 rcall .+462 ; 0x7fd8 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -77,7 +77,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); 7e28: 8e e0 ldi r24, 0x0E ; 14 - 7e2a: bc d0 rcall .+376 ; 0x7fa4 + 7e2a: c0 d0 rcall .+384 ; 0x7fac /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -163,7 +163,7 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 7e5e: 81 e0 ldi r24, 0x01 ; 1 - 7e60: af d0 rcall .+350 ; 0x7fc0 + 7e60: b3 d0 rcall .+358 ; 0x7fc8 putch(0x03); 7e62: 83 e0 ldi r24, 0x03 ; 3 7e64: 1f c0 rjmp .+62 ; 0x7ea4 @@ -182,7 +182,7 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 7e72: 85 e0 ldi r24, 0x05 ; 5 - 7e74: a5 d0 rcall .+330 ; 0x7fc0 + 7e74: a9 d0 rcall .+338 ; 0x7fc8 7e76: 83 c0 rjmp .+262 ; 0x7f7e } else if(ch == STK_LOAD_ADDRESS) { @@ -211,7 +211,7 @@ void watchdogReset() { 7e92: 11 1f adc r17, r17 address = newAddress; verifySpace(); - 7e94: 8d d0 rcall .+282 ; 0x7fb0 + 7e94: 91 d0 rcall .+290 ; 0x7fb8 7e96: 68 01 movw r12, r16 7e98: 72 c0 rjmp .+228 ; 0x7f7e } @@ -221,7 +221,7 @@ void watchdogReset() { // UNIVERSAL command is ignored getNch(4); 7e9e: 84 e0 ldi r24, 0x04 ; 4 - 7ea0: 8f d0 rcall .+286 ; 0x7fc0 + 7ea0: 93 d0 rcall .+294 ; 0x7fc8 putch(0x00); 7ea2: 80 e0 ldi r24, 0x00 ; 0 7ea4: 6f d0 rcall .+222 ; 0x7f84 @@ -282,7 +282,7 @@ void watchdogReset() { // Read command terminator, start reply verifySpace(); - 7ee6: 64 d0 rcall .+200 ; 0x7fb0 + 7ee6: 68 d0 rcall .+208 ; 0x7fb8 // If only a partial page is to be programmed, the erase might not be complete. // So check that here @@ -370,7 +370,7 @@ int main(void) { 7f3c: 2b d0 rcall .+86 ; 0x7f94 verifySpace(); - 7f3e: 38 d0 rcall .+112 ; 0x7fb0 + 7f3e: 3c d0 rcall .+120 ; 0x7fb8 7f40: f6 01 movw r30, r12 7f42: ef 2c mov r14, r15 putch(result); @@ -411,7 +411,7 @@ int main(void) { 7f64: 39 f4 brne .+14 ; 0x7f74 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 7f66: 24 d0 rcall .+72 ; 0x7fb0 + 7f66: 28 d0 rcall .+80 ; 0x7fb8 putch(SIGNATURE_0); 7f68: 8e e1 ldi r24, 0x1E ; 30 7f6a: 0c d0 rcall .+24 ; 0x7f84 @@ -428,13 +428,13 @@ int main(void) { // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); 7f78: 88 e0 ldi r24, 0x08 ; 8 - 7f7a: 14 d0 rcall .+40 ; 0x7fa4 + 7f7a: 18 d0 rcall .+48 ; 0x7fac verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 7f7c: 19 d0 rcall .+50 ; 0x7fb0 + 7f7c: 1d d0 rcall .+58 ; 0x7fb8 } putch(STK_OK); 7f7e: 80 e1 ldi r24, 0x10 ; 16 @@ -463,99 +463,109 @@ void putch(char ch) { 7f92: 08 95 ret 00007f94 : + [uartBit] "I" (UART_RX_BIT) + : + "r25" +); +#else + while(!(UCSR0A & _BV(RXC0))) + 7f94: 80 91 c0 00 lds r24, 0x00C0 + 7f98: 87 ff sbrs r24, 7 + 7f9a: fc cf rjmp .-8 ; 0x7f94 + ; + if (!(UCSR0A & _BV(FE0))) { + 7f9c: 80 91 c0 00 lds r24, 0x00C0 + 7fa0: 84 fd sbrc r24, 4 + 7fa2: 01 c0 rjmp .+2 ; 0x7fa6 } #endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 7f94: a8 95 wdr - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))); - 7f96: 80 91 c0 00 lds r24, 0x00C0 - 7f9a: 87 ff sbrs r24, 7 - 7f9c: fc cf rjmp .-8 ; 0x7f96 + 7fa4: a8 95 wdr + * don't care that an invalid char is returned...) + */ + watchdogReset(); + } + ch = UDR0; - 7f9e: 80 91 c6 00 lds r24, 0x00C6 + 7fa6: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 7fa2: 08 95 ret + 7faa: 08 95 ret -00007fa4 : +00007fac : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 7fa4: e0 e6 ldi r30, 0x60 ; 96 - 7fa6: f0 e0 ldi r31, 0x00 ; 0 - 7fa8: 98 e1 ldi r25, 0x18 ; 24 - 7faa: 90 83 st Z, r25 + 7fac: e0 e6 ldi r30, 0x60 ; 96 + 7fae: f0 e0 ldi r31, 0x00 ; 0 + 7fb0: 98 e1 ldi r25, 0x18 ; 24 + 7fb2: 90 83 st Z, r25 WDTCSR = x; - 7fac: 80 83 st Z, r24 + 7fb4: 80 83 st Z, r24 } - 7fae: 08 95 ret + 7fb6: 08 95 ret -00007fb0 : +00007fb8 : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) { - 7fb0: f1 df rcall .-30 ; 0x7f94 - 7fb2: 80 32 cpi r24, 0x20 ; 32 - 7fb4: 19 f0 breq .+6 ; 0x7fbc + 7fb8: ed df rcall .-38 ; 0x7f94 + 7fba: 80 32 cpi r24, 0x20 ; 32 + 7fbc: 19 f0 breq .+6 ; 0x7fc4 watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 7fb6: 88 e0 ldi r24, 0x08 ; 8 - 7fb8: f5 df rcall .-22 ; 0x7fa4 - 7fba: ff cf rjmp .-2 ; 0x7fba + 7fbe: 88 e0 ldi r24, 0x08 ; 8 + 7fc0: f5 df rcall .-22 ; 0x7fac + 7fc2: ff cf rjmp .-2 ; 0x7fc2 while (1) // and busy-loop so that WD causes ; // a reset and app start. } putch(STK_INSYNC); - 7fbc: 84 e1 ldi r24, 0x14 ; 20 + 7fc4: 84 e1 ldi r24, 0x14 ; 20 } - 7fbe: e2 cf rjmp .-60 ; 0x7f84 + 7fc6: de cf rjmp .-68 ; 0x7f84 -00007fc0 : +00007fc8 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 7fc0: 1f 93 push r17 - 7fc2: 18 2f mov r17, r24 + 7fc8: 1f 93 push r17 + 7fca: 18 2f mov r17, r24 do getch(); while (--count); - 7fc4: e7 df rcall .-50 ; 0x7f94 - 7fc6: 11 50 subi r17, 0x01 ; 1 - 7fc8: e9 f7 brne .-6 ; 0x7fc4 + 7fcc: e3 df rcall .-58 ; 0x7f94 + 7fce: 11 50 subi r17, 0x01 ; 1 + 7fd0: e9 f7 brne .-6 ; 0x7fcc verifySpace(); - 7fca: f2 df rcall .-28 ; 0x7fb0 + 7fd2: f2 df rcall .-28 ; 0x7fb8 } - 7fcc: 1f 91 pop r17 - 7fce: 08 95 ret + 7fd4: 1f 91 pop r17 + 7fd6: 08 95 ret -00007fd0 : +00007fd8 : WDTCSR = _BV(WDCE) | _BV(WDE); WDTCSR = x; } void appStart() { watchdogConfig(WATCHDOG_OFF); - 7fd0: 80 e0 ldi r24, 0x00 ; 0 - 7fd2: e8 df rcall .-48 ; 0x7fa4 + 7fd8: 80 e0 ldi r24, 0x00 ; 0 + 7fda: e8 df rcall .-48 ; 0x7fac __asm__ __volatile__ ( - 7fd4: ee 27 eor r30, r30 - 7fd6: ff 27 eor r31, r31 - 7fd8: 09 94 ijmp + 7fdc: ee 27 eor r30, r30 + 7fde: ff 27 eor r31, r31 + 7fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_diecimila.hex b/bootloaders/optiboot/optiboot_diecimila.hex index 26bbd4c..b685a4e 100644 --- a/bootloaders/optiboot/optiboot_diecimila.hex +++ b/bootloaders/optiboot/optiboot_diecimila.hex @@ -1,33 +1,34 @@ -:103E0000112484B714BE81FFE3D085E08093810044 +:103E0000112484B714BE81FFE7D085E08093810040 :103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20080E18093C4008EE0BCD0259A86E079 +:103E2000C20080E18093C4008EE0C0D0259A86E075 :103E300020E33CEF91E0309385002093840096BB13 :103E4000B09BFECF1D9AA8958150A9F79924939411 :103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE -:103E6000AFD083E01FC0823411F484E103C08534F5 -:103E700019F485E0A5D083C0853579F48BD0E82E80 +:103E6000B3D083E01FC0823411F484E103C08534F1 +:103E700019F485E0A9D083C0853579F48BD0E82E7C :103E8000FF2488D0082F10E0102F00270E291F29AB -:103E9000000F111F8DD0680172C0863529F484E0AF -:103EA0008FD080E06FD06BC0843609F042C072D0F2 +:103E9000000F111F91D0680172C0863529F484E0AB +:103EA00093D080E06FD06BC0843609F042C072D0EE :103EB00071D0082F6FD080E0C81688E3D80620F4B0 :103EC00083E0F60187BFE895C0E0D1E063D0899335 :103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF -:103EE000F60187BFE89564D007B600FCFDCFA601B8 +:103EE000F60187BFE89568D007B600FCFDCFA601B4 :103EF000A0E0B1E02C9130E011968C91119790E008 :103F0000982F8827822B932B1296FA010C0197BECB :103F1000E89511244E5F5F4FF1E0A038BF0751F7DD :103F2000F601A7BEE89507B600FCFDCFB7BEE89541 -:103F300026C08437B1F42ED02DD0F82E2BD038D017 +:103F300026C08437B1F42ED02DD0F82E2BD03CD013 :103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 :103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 -:103F60000EC0853739F424D08EE10CD084E90AD014 -:103F700086E098CF813511F488E014D019D080E123 +:103F60000EC0853739F428D08EE10CD084E90AD010 +:103F700086E098CF813511F488E018D01DD080E11B :103F800001D06ACF982F8091C00085FFFCCF90931D -:103F9000C6000895A8958091C00087FFFCCF80914E -:103FA000C6000895E0E6F0E098E1908380830895EC -:103FB000F1DF803219F088E0F5DFFFCF84E1E2CF56 -:103FC0001F93182FE7DF1150E9F7F2DF1F910895D3 -:0A3FD00080E0E8DFEE27FF270994E8 -:023FFE000204BB +:103F9000C60008958091C00087FFFCCF8091C000CB +:103FA00084FD01C0A8958091C6000895E0E6F0E088 +:103FB00098E1908380830895EDDF803219F088E0E6 +:103FC000F5DFFFCF84E1DECF1F93182FE3DF115021 +:103FD000E9F7F2DF1F91089580E0E8DFEE27FF2781 +:023FE000099442 +:023FFE000304BA :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_diecimila.lst b/bootloaders/optiboot/optiboot_diecimila.lst index 6e0843d..357dc11 100644 --- a/bootloaders/optiboot/optiboot_diecimila.lst +++ b/bootloaders/optiboot/optiboot_diecimila.lst @@ -3,27 +3,27 @@ optiboot_diecimila.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001da 00003e00 00003e00 00000054 2**1 + 0 .text 000001e2 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 0000022e 2**0 + 1 .version 00000002 00003ffe 00003ffe 00000236 2**0 CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000230 2**0 + 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 + 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028d 00000000 00000000 000002b7 2**0 + 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000018a 00000000 00000000 00000544 2**0 + 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000456 00000000 00000000 000006ce 2**0 + 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b24 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000ba4 2**0 + 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ced 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f6b 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 3e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 3e06: 81 ff sbrs r24, 1 - 3e08: e3 d0 rcall .+454 ; 0x3fd0 + 3e08: e7 d0 rcall .+462 ; 0x3fd8 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -77,7 +77,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: bc d0 rcall .+376 ; 0x3fa4 + 3e2a: c0 d0 rcall .+384 ; 0x3fac /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -163,7 +163,7 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: af d0 rcall .+350 ; 0x3fc0 + 3e60: b3 d0 rcall .+358 ; 0x3fc8 putch(0x03); 3e62: 83 e0 ldi r24, 0x03 ; 3 3e64: 1f c0 rjmp .+62 ; 0x3ea4 @@ -182,7 +182,7 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: a5 d0 rcall .+330 ; 0x3fc0 + 3e74: a9 d0 rcall .+338 ; 0x3fc8 3e76: 83 c0 rjmp .+262 ; 0x3f7e } else if(ch == STK_LOAD_ADDRESS) { @@ -211,7 +211,7 @@ void watchdogReset() { 3e92: 11 1f adc r17, r17 address = newAddress; verifySpace(); - 3e94: 8d d0 rcall .+282 ; 0x3fb0 + 3e94: 91 d0 rcall .+290 ; 0x3fb8 3e96: 68 01 movw r12, r16 3e98: 72 c0 rjmp .+228 ; 0x3f7e } @@ -221,7 +221,7 @@ void watchdogReset() { // UNIVERSAL command is ignored getNch(4); 3e9e: 84 e0 ldi r24, 0x04 ; 4 - 3ea0: 8f d0 rcall .+286 ; 0x3fc0 + 3ea0: 93 d0 rcall .+294 ; 0x3fc8 putch(0x00); 3ea2: 80 e0 ldi r24, 0x00 ; 0 3ea4: 6f d0 rcall .+222 ; 0x3f84 @@ -282,7 +282,7 @@ void watchdogReset() { // Read command terminator, start reply verifySpace(); - 3ee6: 64 d0 rcall .+200 ; 0x3fb0 + 3ee6: 68 d0 rcall .+208 ; 0x3fb8 // If only a partial page is to be programmed, the erase might not be complete. // So check that here @@ -370,7 +370,7 @@ int main(void) { 3f3c: 2b d0 rcall .+86 ; 0x3f94 verifySpace(); - 3f3e: 38 d0 rcall .+112 ; 0x3fb0 + 3f3e: 3c d0 rcall .+120 ; 0x3fb8 3f40: f6 01 movw r30, r12 3f42: ef 2c mov r14, r15 putch(result); @@ -411,7 +411,7 @@ int main(void) { 3f64: 39 f4 brne .+14 ; 0x3f74 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 3f66: 24 d0 rcall .+72 ; 0x3fb0 + 3f66: 28 d0 rcall .+80 ; 0x3fb8 putch(SIGNATURE_0); 3f68: 8e e1 ldi r24, 0x1E ; 30 3f6a: 0c d0 rcall .+24 ; 0x3f84 @@ -428,13 +428,13 @@ int main(void) { // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); 3f78: 88 e0 ldi r24, 0x08 ; 8 - 3f7a: 14 d0 rcall .+40 ; 0x3fa4 + 3f7a: 18 d0 rcall .+48 ; 0x3fac verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 3f7c: 19 d0 rcall .+50 ; 0x3fb0 + 3f7c: 1d d0 rcall .+58 ; 0x3fb8 } putch(STK_OK); 3f7e: 80 e1 ldi r24, 0x10 ; 16 @@ -463,99 +463,109 @@ void putch(char ch) { 3f92: 08 95 ret 00003f94 : + [uartBit] "I" (UART_RX_BIT) + : + "r25" +); +#else + while(!(UCSR0A & _BV(RXC0))) + 3f94: 80 91 c0 00 lds r24, 0x00C0 + 3f98: 87 ff sbrs r24, 7 + 3f9a: fc cf rjmp .-8 ; 0x3f94 + ; + if (!(UCSR0A & _BV(FE0))) { + 3f9c: 80 91 c0 00 lds r24, 0x00C0 + 3fa0: 84 fd sbrc r24, 4 + 3fa2: 01 c0 rjmp .+2 ; 0x3fa6 } #endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3f94: a8 95 wdr - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))); - 3f96: 80 91 c0 00 lds r24, 0x00C0 - 3f9a: 87 ff sbrs r24, 7 - 3f9c: fc cf rjmp .-8 ; 0x3f96 + 3fa4: a8 95 wdr + * don't care that an invalid char is returned...) + */ + watchdogReset(); + } + ch = UDR0; - 3f9e: 80 91 c6 00 lds r24, 0x00C6 + 3fa6: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 3fa2: 08 95 ret + 3faa: 08 95 ret -00003fa4 : +00003fac : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 3fa4: e0 e6 ldi r30, 0x60 ; 96 - 3fa6: f0 e0 ldi r31, 0x00 ; 0 - 3fa8: 98 e1 ldi r25, 0x18 ; 24 - 3faa: 90 83 st Z, r25 + 3fac: e0 e6 ldi r30, 0x60 ; 96 + 3fae: f0 e0 ldi r31, 0x00 ; 0 + 3fb0: 98 e1 ldi r25, 0x18 ; 24 + 3fb2: 90 83 st Z, r25 WDTCSR = x; - 3fac: 80 83 st Z, r24 + 3fb4: 80 83 st Z, r24 } - 3fae: 08 95 ret + 3fb6: 08 95 ret -00003fb0 : +00003fb8 : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) { - 3fb0: f1 df rcall .-30 ; 0x3f94 - 3fb2: 80 32 cpi r24, 0x20 ; 32 - 3fb4: 19 f0 breq .+6 ; 0x3fbc + 3fb8: ed df rcall .-38 ; 0x3f94 + 3fba: 80 32 cpi r24, 0x20 ; 32 + 3fbc: 19 f0 breq .+6 ; 0x3fc4 watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fb6: 88 e0 ldi r24, 0x08 ; 8 - 3fb8: f5 df rcall .-22 ; 0x3fa4 - 3fba: ff cf rjmp .-2 ; 0x3fba + 3fbe: 88 e0 ldi r24, 0x08 ; 8 + 3fc0: f5 df rcall .-22 ; 0x3fac + 3fc2: ff cf rjmp .-2 ; 0x3fc2 while (1) // and busy-loop so that WD causes ; // a reset and app start. } putch(STK_INSYNC); - 3fbc: 84 e1 ldi r24, 0x14 ; 20 + 3fc4: 84 e1 ldi r24, 0x14 ; 20 } - 3fbe: e2 cf rjmp .-60 ; 0x3f84 + 3fc6: de cf rjmp .-68 ; 0x3f84 -00003fc0 : +00003fc8 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 3fc0: 1f 93 push r17 - 3fc2: 18 2f mov r17, r24 + 3fc8: 1f 93 push r17 + 3fca: 18 2f mov r17, r24 do getch(); while (--count); - 3fc4: e7 df rcall .-50 ; 0x3f94 - 3fc6: 11 50 subi r17, 0x01 ; 1 - 3fc8: e9 f7 brne .-6 ; 0x3fc4 + 3fcc: e3 df rcall .-58 ; 0x3f94 + 3fce: 11 50 subi r17, 0x01 ; 1 + 3fd0: e9 f7 brne .-6 ; 0x3fcc verifySpace(); - 3fca: f2 df rcall .-28 ; 0x3fb0 + 3fd2: f2 df rcall .-28 ; 0x3fb8 } - 3fcc: 1f 91 pop r17 - 3fce: 08 95 ret + 3fd4: 1f 91 pop r17 + 3fd6: 08 95 ret -00003fd0 : +00003fd8 : WDTCSR = _BV(WDCE) | _BV(WDE); WDTCSR = x; } void appStart() { watchdogConfig(WATCHDOG_OFF); - 3fd0: 80 e0 ldi r24, 0x00 ; 0 - 3fd2: e8 df rcall .-48 ; 0x3fa4 + 3fd8: 80 e0 ldi r24, 0x00 ; 0 + 3fda: e8 df rcall .-48 ; 0x3fac __asm__ __volatile__ ( - 3fd4: ee 27 eor r30, r30 - 3fd6: ff 27 eor r31, r31 - 3fd8: 09 94 ijmp + 3fdc: ee 27 eor r30, r30 + 3fde: ff 27 eor r31, r31 + 3fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_lilypad.hex b/bootloaders/optiboot/optiboot_lilypad.hex index 00f7a38..2c63395 100644 --- a/bootloaders/optiboot/optiboot_lilypad.hex +++ b/bootloaders/optiboot/optiboot_lilypad.hex @@ -1,33 +1,34 @@ -:103E0000112484B714BE81FFE3D085E08093810044 +:103E0000112484B714BE81FFE7D085E08093810040 :103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20088E08093C4008EE0BCD0259A86E072 +:103E2000C20088E08093C4008EE0C0D0259A86E06E :103E300028E13EEF91E0309385002093840096BB0B :103E4000B09BFECF1D9AA8958150A9F79924939411 :103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE -:103E6000AFD083E01FC0823411F484E103C08534F5 -:103E700019F485E0A5D083C0853579F48BD0E82E80 +:103E6000B3D083E01FC0823411F484E103C08534F1 +:103E700019F485E0A9D083C0853579F48BD0E82E7C :103E8000FF2488D0082F10E0102F00270E291F29AB -:103E9000000F111F8DD0680172C0863529F484E0AF -:103EA0008FD080E06FD06BC0843609F042C072D0F2 +:103E9000000F111F91D0680172C0863529F484E0AB +:103EA00093D080E06FD06BC0843609F042C072D0EE :103EB00071D0082F6FD080E0C81688E3D80620F4B0 :103EC00083E0F60187BFE895C0E0D1E063D0899335 :103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF -:103EE000F60187BFE89564D007B600FCFDCFA601B8 +:103EE000F60187BFE89568D007B600FCFDCFA601B4 :103EF000A0E0B1E02C9130E011968C91119790E008 :103F0000982F8827822B932B1296FA010C0197BECB :103F1000E89511244E5F5F4FF1E0A038BF0751F7DD :103F2000F601A7BEE89507B600FCFDCFB7BEE89541 -:103F300026C08437B1F42ED02DD0F82E2BD038D017 +:103F300026C08437B1F42ED02DD0F82E2BD03CD013 :103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 :103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 -:103F60000EC0853739F424D08EE10CD084E90AD014 -:103F700086E098CF813511F488E014D019D080E123 +:103F60000EC0853739F428D08EE10CD084E90AD010 +:103F700086E098CF813511F488E018D01DD080E11B :103F800001D06ACF982F8091C00085FFFCCF90931D -:103F9000C6000895A8958091C00087FFFCCF80914E -:103FA000C6000895E0E6F0E098E1908380830895EC -:103FB000F1DF803219F088E0F5DFFFCF84E1E2CF56 -:103FC0001F93182FE7DF1150E9F7F2DF1F910895D3 -:0A3FD00080E0E8DFEE27FF270994E8 -:023FFE000204BB +:103F9000C60008958091C00087FFFCCF8091C000CB +:103FA00084FD01C0A8958091C6000895E0E6F0E088 +:103FB00098E1908380830895EDDF803219F088E0E6 +:103FC000F5DFFFCF84E1DECF1F93182FE3DF115021 +:103FD000E9F7F2DF1F91089580E0E8DFEE27FF2781 +:023FE000099442 +:023FFE000304BA :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_lilypad.lst b/bootloaders/optiboot/optiboot_lilypad.lst index 4cebc2e..425cbf4 100644 --- a/bootloaders/optiboot/optiboot_lilypad.lst +++ b/bootloaders/optiboot/optiboot_lilypad.lst @@ -3,27 +3,27 @@ optiboot_lilypad.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001da 00003e00 00003e00 00000054 2**1 + 0 .text 000001e2 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 0000022e 2**0 + 1 .version 00000002 00003ffe 00003ffe 00000236 2**0 CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000230 2**0 + 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 + 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028d 00000000 00000000 000002b7 2**0 + 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000018a 00000000 00000000 00000544 2**0 + 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000456 00000000 00000000 000006ce 2**0 + 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b24 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000ba4 2**0 + 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ced 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f6b 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 3e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 3e06: 81 ff sbrs r24, 1 - 3e08: e3 d0 rcall .+454 ; 0x3fd0 + 3e08: e7 d0 rcall .+462 ; 0x3fd8 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -77,7 +77,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: bc d0 rcall .+376 ; 0x3fa4 + 3e2a: c0 d0 rcall .+384 ; 0x3fac /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -163,7 +163,7 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: af d0 rcall .+350 ; 0x3fc0 + 3e60: b3 d0 rcall .+358 ; 0x3fc8 putch(0x03); 3e62: 83 e0 ldi r24, 0x03 ; 3 3e64: 1f c0 rjmp .+62 ; 0x3ea4 @@ -182,7 +182,7 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: a5 d0 rcall .+330 ; 0x3fc0 + 3e74: a9 d0 rcall .+338 ; 0x3fc8 3e76: 83 c0 rjmp .+262 ; 0x3f7e } else if(ch == STK_LOAD_ADDRESS) { @@ -211,7 +211,7 @@ void watchdogReset() { 3e92: 11 1f adc r17, r17 address = newAddress; verifySpace(); - 3e94: 8d d0 rcall .+282 ; 0x3fb0 + 3e94: 91 d0 rcall .+290 ; 0x3fb8 3e96: 68 01 movw r12, r16 3e98: 72 c0 rjmp .+228 ; 0x3f7e } @@ -221,7 +221,7 @@ void watchdogReset() { // UNIVERSAL command is ignored getNch(4); 3e9e: 84 e0 ldi r24, 0x04 ; 4 - 3ea0: 8f d0 rcall .+286 ; 0x3fc0 + 3ea0: 93 d0 rcall .+294 ; 0x3fc8 putch(0x00); 3ea2: 80 e0 ldi r24, 0x00 ; 0 3ea4: 6f d0 rcall .+222 ; 0x3f84 @@ -282,7 +282,7 @@ void watchdogReset() { // Read command terminator, start reply verifySpace(); - 3ee6: 64 d0 rcall .+200 ; 0x3fb0 + 3ee6: 68 d0 rcall .+208 ; 0x3fb8 // If only a partial page is to be programmed, the erase might not be complete. // So check that here @@ -370,7 +370,7 @@ int main(void) { 3f3c: 2b d0 rcall .+86 ; 0x3f94 verifySpace(); - 3f3e: 38 d0 rcall .+112 ; 0x3fb0 + 3f3e: 3c d0 rcall .+120 ; 0x3fb8 3f40: f6 01 movw r30, r12 3f42: ef 2c mov r14, r15 putch(result); @@ -411,7 +411,7 @@ int main(void) { 3f64: 39 f4 brne .+14 ; 0x3f74 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 3f66: 24 d0 rcall .+72 ; 0x3fb0 + 3f66: 28 d0 rcall .+80 ; 0x3fb8 putch(SIGNATURE_0); 3f68: 8e e1 ldi r24, 0x1E ; 30 3f6a: 0c d0 rcall .+24 ; 0x3f84 @@ -428,13 +428,13 @@ int main(void) { // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); 3f78: 88 e0 ldi r24, 0x08 ; 8 - 3f7a: 14 d0 rcall .+40 ; 0x3fa4 + 3f7a: 18 d0 rcall .+48 ; 0x3fac verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 3f7c: 19 d0 rcall .+50 ; 0x3fb0 + 3f7c: 1d d0 rcall .+58 ; 0x3fb8 } putch(STK_OK); 3f7e: 80 e1 ldi r24, 0x10 ; 16 @@ -463,99 +463,109 @@ void putch(char ch) { 3f92: 08 95 ret 00003f94 : + [uartBit] "I" (UART_RX_BIT) + : + "r25" +); +#else + while(!(UCSR0A & _BV(RXC0))) + 3f94: 80 91 c0 00 lds r24, 0x00C0 + 3f98: 87 ff sbrs r24, 7 + 3f9a: fc cf rjmp .-8 ; 0x3f94 + ; + if (!(UCSR0A & _BV(FE0))) { + 3f9c: 80 91 c0 00 lds r24, 0x00C0 + 3fa0: 84 fd sbrc r24, 4 + 3fa2: 01 c0 rjmp .+2 ; 0x3fa6 } #endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3f94: a8 95 wdr - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))); - 3f96: 80 91 c0 00 lds r24, 0x00C0 - 3f9a: 87 ff sbrs r24, 7 - 3f9c: fc cf rjmp .-8 ; 0x3f96 + 3fa4: a8 95 wdr + * don't care that an invalid char is returned...) + */ + watchdogReset(); + } + ch = UDR0; - 3f9e: 80 91 c6 00 lds r24, 0x00C6 + 3fa6: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 3fa2: 08 95 ret + 3faa: 08 95 ret -00003fa4 : +00003fac : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 3fa4: e0 e6 ldi r30, 0x60 ; 96 - 3fa6: f0 e0 ldi r31, 0x00 ; 0 - 3fa8: 98 e1 ldi r25, 0x18 ; 24 - 3faa: 90 83 st Z, r25 + 3fac: e0 e6 ldi r30, 0x60 ; 96 + 3fae: f0 e0 ldi r31, 0x00 ; 0 + 3fb0: 98 e1 ldi r25, 0x18 ; 24 + 3fb2: 90 83 st Z, r25 WDTCSR = x; - 3fac: 80 83 st Z, r24 + 3fb4: 80 83 st Z, r24 } - 3fae: 08 95 ret + 3fb6: 08 95 ret -00003fb0 : +00003fb8 : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) { - 3fb0: f1 df rcall .-30 ; 0x3f94 - 3fb2: 80 32 cpi r24, 0x20 ; 32 - 3fb4: 19 f0 breq .+6 ; 0x3fbc + 3fb8: ed df rcall .-38 ; 0x3f94 + 3fba: 80 32 cpi r24, 0x20 ; 32 + 3fbc: 19 f0 breq .+6 ; 0x3fc4 watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fb6: 88 e0 ldi r24, 0x08 ; 8 - 3fb8: f5 df rcall .-22 ; 0x3fa4 - 3fba: ff cf rjmp .-2 ; 0x3fba + 3fbe: 88 e0 ldi r24, 0x08 ; 8 + 3fc0: f5 df rcall .-22 ; 0x3fac + 3fc2: ff cf rjmp .-2 ; 0x3fc2 while (1) // and busy-loop so that WD causes ; // a reset and app start. } putch(STK_INSYNC); - 3fbc: 84 e1 ldi r24, 0x14 ; 20 + 3fc4: 84 e1 ldi r24, 0x14 ; 20 } - 3fbe: e2 cf rjmp .-60 ; 0x3f84 + 3fc6: de cf rjmp .-68 ; 0x3f84 -00003fc0 : +00003fc8 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 3fc0: 1f 93 push r17 - 3fc2: 18 2f mov r17, r24 + 3fc8: 1f 93 push r17 + 3fca: 18 2f mov r17, r24 do getch(); while (--count); - 3fc4: e7 df rcall .-50 ; 0x3f94 - 3fc6: 11 50 subi r17, 0x01 ; 1 - 3fc8: e9 f7 brne .-6 ; 0x3fc4 + 3fcc: e3 df rcall .-58 ; 0x3f94 + 3fce: 11 50 subi r17, 0x01 ; 1 + 3fd0: e9 f7 brne .-6 ; 0x3fcc verifySpace(); - 3fca: f2 df rcall .-28 ; 0x3fb0 + 3fd2: f2 df rcall .-28 ; 0x3fb8 } - 3fcc: 1f 91 pop r17 - 3fce: 08 95 ret + 3fd4: 1f 91 pop r17 + 3fd6: 08 95 ret -00003fd0 : +00003fd8 : WDTCSR = _BV(WDCE) | _BV(WDE); WDTCSR = x; } void appStart() { watchdogConfig(WATCHDOG_OFF); - 3fd0: 80 e0 ldi r24, 0x00 ; 0 - 3fd2: e8 df rcall .-48 ; 0x3fa4 + 3fd8: 80 e0 ldi r24, 0x00 ; 0 + 3fda: e8 df rcall .-48 ; 0x3fac __asm__ __volatile__ ( - 3fd4: ee 27 eor r30, r30 - 3fd6: ff 27 eor r31, r31 - 3fd8: 09 94 ijmp + 3fdc: ee 27 eor r30, r30 + 3fde: ff 27 eor r31, r31 + 3fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_lilypad_resonator.hex b/bootloaders/optiboot/optiboot_lilypad_resonator.hex index 00f7a38..2c63395 100644 --- a/bootloaders/optiboot/optiboot_lilypad_resonator.hex +++ b/bootloaders/optiboot/optiboot_lilypad_resonator.hex @@ -1,33 +1,34 @@ -:103E0000112484B714BE81FFE3D085E08093810044 +:103E0000112484B714BE81FFE7D085E08093810040 :103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20088E08093C4008EE0BCD0259A86E072 +:103E2000C20088E08093C4008EE0C0D0259A86E06E :103E300028E13EEF91E0309385002093840096BB0B :103E4000B09BFECF1D9AA8958150A9F79924939411 :103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE -:103E6000AFD083E01FC0823411F484E103C08534F5 -:103E700019F485E0A5D083C0853579F48BD0E82E80 +:103E6000B3D083E01FC0823411F484E103C08534F1 +:103E700019F485E0A9D083C0853579F48BD0E82E7C :103E8000FF2488D0082F10E0102F00270E291F29AB -:103E9000000F111F8DD0680172C0863529F484E0AF -:103EA0008FD080E06FD06BC0843609F042C072D0F2 +:103E9000000F111F91D0680172C0863529F484E0AB +:103EA00093D080E06FD06BC0843609F042C072D0EE :103EB00071D0082F6FD080E0C81688E3D80620F4B0 :103EC00083E0F60187BFE895C0E0D1E063D0899335 :103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF -:103EE000F60187BFE89564D007B600FCFDCFA601B8 +:103EE000F60187BFE89568D007B600FCFDCFA601B4 :103EF000A0E0B1E02C9130E011968C91119790E008 :103F0000982F8827822B932B1296FA010C0197BECB :103F1000E89511244E5F5F4FF1E0A038BF0751F7DD :103F2000F601A7BEE89507B600FCFDCFB7BEE89541 -:103F300026C08437B1F42ED02DD0F82E2BD038D017 +:103F300026C08437B1F42ED02DD0F82E2BD03CD013 :103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 :103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 -:103F60000EC0853739F424D08EE10CD084E90AD014 -:103F700086E098CF813511F488E014D019D080E123 +:103F60000EC0853739F428D08EE10CD084E90AD010 +:103F700086E098CF813511F488E018D01DD080E11B :103F800001D06ACF982F8091C00085FFFCCF90931D -:103F9000C6000895A8958091C00087FFFCCF80914E -:103FA000C6000895E0E6F0E098E1908380830895EC -:103FB000F1DF803219F088E0F5DFFFCF84E1E2CF56 -:103FC0001F93182FE7DF1150E9F7F2DF1F910895D3 -:0A3FD00080E0E8DFEE27FF270994E8 -:023FFE000204BB +:103F9000C60008958091C00087FFFCCF8091C000CB +:103FA00084FD01C0A8958091C6000895E0E6F0E088 +:103FB00098E1908380830895EDDF803219F088E0E6 +:103FC000F5DFFFCF84E1DECF1F93182FE3DF115021 +:103FD000E9F7F2DF1F91089580E0E8DFEE27FF2781 +:023FE000099442 +:023FFE000304BA :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_lilypad_resonator.lst b/bootloaders/optiboot/optiboot_lilypad_resonator.lst index c8d0743..cb0ea83 100644 --- a/bootloaders/optiboot/optiboot_lilypad_resonator.lst +++ b/bootloaders/optiboot/optiboot_lilypad_resonator.lst @@ -3,27 +3,27 @@ optiboot_lilypad_resonator.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001da 00003e00 00003e00 00000054 2**1 + 0 .text 000001e2 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 0000022e 2**0 + 1 .version 00000002 00003ffe 00003ffe 00000236 2**0 CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000230 2**0 + 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 + 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028d 00000000 00000000 000002b7 2**0 + 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000018a 00000000 00000000 00000544 2**0 + 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000456 00000000 00000000 000006ce 2**0 + 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b24 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000ba4 2**0 + 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ced 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f6b 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 3e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 3e06: 81 ff sbrs r24, 1 - 3e08: e3 d0 rcall .+454 ; 0x3fd0 + 3e08: e7 d0 rcall .+462 ; 0x3fd8 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -77,7 +77,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: bc d0 rcall .+376 ; 0x3fa4 + 3e2a: c0 d0 rcall .+384 ; 0x3fac /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -163,7 +163,7 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: af d0 rcall .+350 ; 0x3fc0 + 3e60: b3 d0 rcall .+358 ; 0x3fc8 putch(0x03); 3e62: 83 e0 ldi r24, 0x03 ; 3 3e64: 1f c0 rjmp .+62 ; 0x3ea4 @@ -182,7 +182,7 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: a5 d0 rcall .+330 ; 0x3fc0 + 3e74: a9 d0 rcall .+338 ; 0x3fc8 3e76: 83 c0 rjmp .+262 ; 0x3f7e } else if(ch == STK_LOAD_ADDRESS) { @@ -211,7 +211,7 @@ void watchdogReset() { 3e92: 11 1f adc r17, r17 address = newAddress; verifySpace(); - 3e94: 8d d0 rcall .+282 ; 0x3fb0 + 3e94: 91 d0 rcall .+290 ; 0x3fb8 3e96: 68 01 movw r12, r16 3e98: 72 c0 rjmp .+228 ; 0x3f7e } @@ -221,7 +221,7 @@ void watchdogReset() { // UNIVERSAL command is ignored getNch(4); 3e9e: 84 e0 ldi r24, 0x04 ; 4 - 3ea0: 8f d0 rcall .+286 ; 0x3fc0 + 3ea0: 93 d0 rcall .+294 ; 0x3fc8 putch(0x00); 3ea2: 80 e0 ldi r24, 0x00 ; 0 3ea4: 6f d0 rcall .+222 ; 0x3f84 @@ -282,7 +282,7 @@ void watchdogReset() { // Read command terminator, start reply verifySpace(); - 3ee6: 64 d0 rcall .+200 ; 0x3fb0 + 3ee6: 68 d0 rcall .+208 ; 0x3fb8 // If only a partial page is to be programmed, the erase might not be complete. // So check that here @@ -370,7 +370,7 @@ int main(void) { 3f3c: 2b d0 rcall .+86 ; 0x3f94 verifySpace(); - 3f3e: 38 d0 rcall .+112 ; 0x3fb0 + 3f3e: 3c d0 rcall .+120 ; 0x3fb8 3f40: f6 01 movw r30, r12 3f42: ef 2c mov r14, r15 putch(result); @@ -411,7 +411,7 @@ int main(void) { 3f64: 39 f4 brne .+14 ; 0x3f74 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 3f66: 24 d0 rcall .+72 ; 0x3fb0 + 3f66: 28 d0 rcall .+80 ; 0x3fb8 putch(SIGNATURE_0); 3f68: 8e e1 ldi r24, 0x1E ; 30 3f6a: 0c d0 rcall .+24 ; 0x3f84 @@ -428,13 +428,13 @@ int main(void) { // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); 3f78: 88 e0 ldi r24, 0x08 ; 8 - 3f7a: 14 d0 rcall .+40 ; 0x3fa4 + 3f7a: 18 d0 rcall .+48 ; 0x3fac verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 3f7c: 19 d0 rcall .+50 ; 0x3fb0 + 3f7c: 1d d0 rcall .+58 ; 0x3fb8 } putch(STK_OK); 3f7e: 80 e1 ldi r24, 0x10 ; 16 @@ -463,99 +463,109 @@ void putch(char ch) { 3f92: 08 95 ret 00003f94 : + [uartBit] "I" (UART_RX_BIT) + : + "r25" +); +#else + while(!(UCSR0A & _BV(RXC0))) + 3f94: 80 91 c0 00 lds r24, 0x00C0 + 3f98: 87 ff sbrs r24, 7 + 3f9a: fc cf rjmp .-8 ; 0x3f94 + ; + if (!(UCSR0A & _BV(FE0))) { + 3f9c: 80 91 c0 00 lds r24, 0x00C0 + 3fa0: 84 fd sbrc r24, 4 + 3fa2: 01 c0 rjmp .+2 ; 0x3fa6 } #endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3f94: a8 95 wdr - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))); - 3f96: 80 91 c0 00 lds r24, 0x00C0 - 3f9a: 87 ff sbrs r24, 7 - 3f9c: fc cf rjmp .-8 ; 0x3f96 + 3fa4: a8 95 wdr + * don't care that an invalid char is returned...) + */ + watchdogReset(); + } + ch = UDR0; - 3f9e: 80 91 c6 00 lds r24, 0x00C6 + 3fa6: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 3fa2: 08 95 ret + 3faa: 08 95 ret -00003fa4 : +00003fac : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 3fa4: e0 e6 ldi r30, 0x60 ; 96 - 3fa6: f0 e0 ldi r31, 0x00 ; 0 - 3fa8: 98 e1 ldi r25, 0x18 ; 24 - 3faa: 90 83 st Z, r25 + 3fac: e0 e6 ldi r30, 0x60 ; 96 + 3fae: f0 e0 ldi r31, 0x00 ; 0 + 3fb0: 98 e1 ldi r25, 0x18 ; 24 + 3fb2: 90 83 st Z, r25 WDTCSR = x; - 3fac: 80 83 st Z, r24 + 3fb4: 80 83 st Z, r24 } - 3fae: 08 95 ret + 3fb6: 08 95 ret -00003fb0 : +00003fb8 : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) { - 3fb0: f1 df rcall .-30 ; 0x3f94 - 3fb2: 80 32 cpi r24, 0x20 ; 32 - 3fb4: 19 f0 breq .+6 ; 0x3fbc + 3fb8: ed df rcall .-38 ; 0x3f94 + 3fba: 80 32 cpi r24, 0x20 ; 32 + 3fbc: 19 f0 breq .+6 ; 0x3fc4 watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fb6: 88 e0 ldi r24, 0x08 ; 8 - 3fb8: f5 df rcall .-22 ; 0x3fa4 - 3fba: ff cf rjmp .-2 ; 0x3fba + 3fbe: 88 e0 ldi r24, 0x08 ; 8 + 3fc0: f5 df rcall .-22 ; 0x3fac + 3fc2: ff cf rjmp .-2 ; 0x3fc2 while (1) // and busy-loop so that WD causes ; // a reset and app start. } putch(STK_INSYNC); - 3fbc: 84 e1 ldi r24, 0x14 ; 20 + 3fc4: 84 e1 ldi r24, 0x14 ; 20 } - 3fbe: e2 cf rjmp .-60 ; 0x3f84 + 3fc6: de cf rjmp .-68 ; 0x3f84 -00003fc0 : +00003fc8 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 3fc0: 1f 93 push r17 - 3fc2: 18 2f mov r17, r24 + 3fc8: 1f 93 push r17 + 3fca: 18 2f mov r17, r24 do getch(); while (--count); - 3fc4: e7 df rcall .-50 ; 0x3f94 - 3fc6: 11 50 subi r17, 0x01 ; 1 - 3fc8: e9 f7 brne .-6 ; 0x3fc4 + 3fcc: e3 df rcall .-58 ; 0x3f94 + 3fce: 11 50 subi r17, 0x01 ; 1 + 3fd0: e9 f7 brne .-6 ; 0x3fcc verifySpace(); - 3fca: f2 df rcall .-28 ; 0x3fb0 + 3fd2: f2 df rcall .-28 ; 0x3fb8 } - 3fcc: 1f 91 pop r17 - 3fce: 08 95 ret + 3fd4: 1f 91 pop r17 + 3fd6: 08 95 ret -00003fd0 : +00003fd8 : WDTCSR = _BV(WDCE) | _BV(WDE); WDTCSR = x; } void appStart() { watchdogConfig(WATCHDOG_OFF); - 3fd0: 80 e0 ldi r24, 0x00 ; 0 - 3fd2: e8 df rcall .-48 ; 0x3fa4 + 3fd8: 80 e0 ldi r24, 0x00 ; 0 + 3fda: e8 df rcall .-48 ; 0x3fac __asm__ __volatile__ ( - 3fd4: ee 27 eor r30, r30 - 3fd6: ff 27 eor r31, r31 - 3fd8: 09 94 ijmp + 3fdc: ee 27 eor r30, r30 + 3fde: ff 27 eor r31, r31 + 3fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_luminet.hex b/bootloaders/optiboot/optiboot_luminet.hex index 78fdc70..45b4dcd 100644 --- a/bootloaders/optiboot/optiboot_luminet.hex +++ b/bootloaders/optiboot/optiboot_luminet.hex @@ -1,14 +1,14 @@ -:101D0000112484B714BE81FF18D185E08EBD8EE00A -:101D100000D1D49AD29A86E023EC3FEF91E03DBD0A +:101D0000112484B714BE81FF17D185E08EBD8EE00B +:101D1000FFD0D49AD29A86E023EC3FEF91E03DBD0C :101D20002CBD9BB9589BFECFCC9AA8958150B9F792 :101D3000BB24B39425E0A22E9FE7D92E8EECC82EAB -:101D4000D4D0813421F481E0F0D083E0B5C0823476 -:101D500011F484E103C0853419F485E0E6D0B3C002 +:101D4000D4D0813421F481E0EFD083E0B5C0823477 +:101D500011F484E103C0853419F485E0E5D0B3C003 :101D6000853569F4C2D0E82EFF24BFD0082F10E0DB :101D7000102F00270E291F29000F111FA3C0863521 -:101D800021F484E0D2D080E097C0843609F060C0AE +:101D800021F484E0D1D080E097C0843609F060C0AF :101D9000ACD0ABD0F82EA9D0C0E0D1E0A6D08993CA -:101DA000FC16E1F783E0F80187BFE895B6D007B6E7 +:101DA000FC16E1F783E0F80187BFE895B5D007B6E8 :101DB00000FCFDCF0115110511F0A8012AC080918A :101DC00000012091010130E0322F222790E0282BE2 :101DD000392B309385012093840140910801809133 @@ -19,22 +19,22 @@ :101E200090E0982F8827822B932B1296FA010C01B1 :101E3000B7BEE89511244E5F5F4FF1E0A034BF07B5 :101E400051F7F801A7BEE89507B600FCFDCF3BC0EF -:101E5000843751F54AD049D0F82E47D05ED0E801FA +:101E5000843751F54AD049D0F82E47D05DD0E801FB :101E6000EF2C209719F48091840114C0C130D10562 :101E700019F4809185010EC0C830D10519F4809104 :101E8000860108C0C930D10519F48091870102C0CC :101E9000FE01849121961AD0EA9419F70F5F1F4F23 -:101EA000FA940F0D111D0FC0853741F436D08EE125 +:101EA000FA940F0D111D0FC0853741F435D08EE126 :101EB0000DD083E90BD08CE009D005C0813511F439 -:101EC00088E027D02AD080E101D03ACF2AE030E064 -:101ED0008095089410F4DA9802C0DA9A000015D0C0 -:101EE00014D086952A95B1F70895A89529E030E099 -:101EF000CB99FECF0AD009D008D08894CB9908940A -:101F00002A9511F08795F7CF08959EE09A95F1F7FD -:101F1000089598E191BD81BD0895E7DF803219F001 -:101F200088E0F7DFFFCF84E1D1CF1F93182FDDDFEB -:101F30001150E9F7F2DF1F91089580E0EADFE4E055 -:041F4000FF270994DA -:021EFE000204DC +:101EC00088E026D029D080E101D03ACF2AE030E066 +:101ED0008095089410F4DA9802C0DA9A000014D0C1 +:101EE00013D086952A95B1F7089529E030E0CB9973 +:101EF000FECF0AD009D008D08894CB9908942A95AF +:101F000011F08795F7CF08959EE09A95F1F708951F +:101F100098E191BD81BD0895E8DF803219F088E035 +:101F2000F7DFFFCF84E1D2CF1F93182FDEDF1150F0 +:101F3000E9F7F2DF1F91089580E0EADFE4E0FF2790 +:021F4000099402 +:021EFE000304DB :0400000300001D00DC :00000001FF diff --git a/bootloaders/optiboot/optiboot_luminet.lst b/bootloaders/optiboot/optiboot_luminet.lst index 447349d..e40e0ef 100644 --- a/bootloaders/optiboot/optiboot_luminet.lst +++ b/bootloaders/optiboot/optiboot_luminet.lst @@ -3,27 +3,27 @@ optiboot_luminet.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 00000244 00001d00 00001d00 00000054 2**1 + 0 .text 00000242 00001d00 00001d00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00001efe 00001efe 00000298 2**0 + 1 .version 00000002 00001efe 00001efe 00000296 2**0 CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 0000029a 2**0 + 2 .debug_aranges 00000028 00000000 00000000 00000298 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000006d 00000000 00000000 000002c2 2**0 + 3 .debug_pubnames 0000006d 00000000 00000000 000002c0 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 000002b1 00000000 00000000 0000032f 2**0 + 4 .debug_info 000002a2 00000000 00000000 0000032d 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000188 00000000 00000000 000005e0 2**0 + 5 .debug_abbrev 0000016f 00000000 00000000 000005cf 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 000004a7 00000000 00000000 00000768 2**0 + 6 .debug_line 0000049d 00000000 00000000 0000073e 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000090 00000000 00000000 00000c10 2**2 + 7 .debug_frame 00000090 00000000 00000000 00000bdc 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000158 00000000 00000000 00000ca0 2**0 + 8 .debug_str 00000158 00000000 00000000 00000c6c 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 00000268 00000000 00000000 00000df8 2**0 + 9 .debug_loc 00000268 00000000 00000000 00000dc4 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000080 00000000 00000000 00001060 2**0 + 10 .debug_ranges 00000080 00000000 00000000 0000102c 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 1d04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 1d06: 81 ff sbrs r24, 1 - 1d08: 18 d1 rcall .+560 ; 0x1f3a + 1d08: 17 d1 rcall .+558 ; 0x1f38 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -61,7 +61,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); 1d0e: 8e e0 ldi r24, 0x0E ; 14 - 1d10: 00 d1 rcall .+512 ; 0x1f12 + 1d10: ff d0 rcall .+510 ; 0x1f10 /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -156,7 +156,7 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 1d46: 81 e0 ldi r24, 0x01 ; 1 - 1d48: f0 d0 rcall .+480 ; 0x1f2a + 1d48: ef d0 rcall .+478 ; 0x1f28 putch(0x03); 1d4a: 83 e0 ldi r24, 0x03 ; 3 1d4c: b5 c0 rjmp .+362 ; 0x1eb8 @@ -175,7 +175,7 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 1d5a: 85 e0 ldi r24, 0x05 ; 5 - 1d5c: e6 d0 rcall .+460 ; 0x1f2a + 1d5c: e5 d0 rcall .+458 ; 0x1f28 1d5e: b3 c0 rjmp .+358 ; 0x1ec6 } else if(ch == STK_LOAD_ADDRESS) { @@ -212,7 +212,7 @@ void watchdogReset() { // UNIVERSAL command is ignored getNch(4); 1d82: 84 e0 ldi r24, 0x04 ; 4 - 1d84: d2 d0 rcall .+420 ; 0x1f2a + 1d84: d1 d0 rcall .+418 ; 0x1f28 putch(0x00); 1d86: 80 e0 ldi r24, 0x00 ; 0 1d88: 97 c0 rjmp .+302 ; 0x1eb8 @@ -257,7 +257,7 @@ void watchdogReset() { // Read command terminator, start reply verifySpace(); - 1dac: b6 d0 rcall .+364 ; 0x1f1a + 1dac: b5 d0 rcall .+362 ; 0x1f18 // If only a partial page is to be programmed, the erase might not be complete. // So check that here @@ -391,7 +391,7 @@ int main(void) { 1e5a: 47 d0 rcall .+142 ; 0x1eea verifySpace(); - 1e5c: 5e d0 rcall .+188 ; 0x1f1a + 1e5c: 5d d0 rcall .+186 ; 0x1f18 1e5e: e8 01 movw r28, r16 1e60: ef 2c mov r14, r15 #ifdef VIRTUAL_BOOT_PARTITION @@ -452,7 +452,7 @@ int main(void) { 1eaa: 41 f4 brne .+16 ; 0x1ebc // READ SIGN - return what Avrdude wants to hear verifySpace(); - 1eac: 36 d0 rcall .+108 ; 0x1f1a + 1eac: 35 d0 rcall .+106 ; 0x1f18 putch(SIGNATURE_0); 1eae: 8e e1 ldi r24, 0x1E ; 30 1eb0: 0d d0 rcall .+26 ; 0x1ecc @@ -470,13 +470,13 @@ int main(void) { // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); 1ec0: 88 e0 ldi r24, 0x08 ; 8 - 1ec2: 27 d0 rcall .+78 ; 0x1f12 + 1ec2: 26 d0 rcall .+76 ; 0x1f10 verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 1ec4: 2a d0 rcall .+84 ; 0x1f1a + 1ec4: 29 d0 rcall .+82 ; 0x1f18 } putch(STK_OK); 1ec6: 80 e1 ldi r24, 0x10 ; 16 @@ -499,8 +499,8 @@ void putch(char ch) { 1ed8: 02 c0 rjmp .+4 ; 0x1ede 1eda: da 9a sbi 0x1b, 2 ; 27 1edc: 00 00 nop - 1ede: 15 d0 rcall .+42 ; 0x1f0a - 1ee0: 14 d0 rcall .+40 ; 0x1f0a + 1ede: 14 d0 rcall .+40 ; 0x1f08 + 1ee0: 13 d0 rcall .+38 ; 0x1f08 1ee2: 86 95 lsr r24 1ee4: 2a 95 dec r18 1ee6: b1 f7 brne .-20 ; 0x1ed4 @@ -513,112 +513,105 @@ void putch(char ch) { 1ee8: 08 95 ret 00001eea : -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 1eea: a8 95 wdr LED_PIN |= _BV(LED); #endif #endif return ch; } - 1eec: 29 e0 ldi r18, 0x09 ; 9 - 1eee: 30 e0 ldi r19, 0x00 ; 0 - 1ef0: cb 99 sbic 0x19, 3 ; 25 - 1ef2: fe cf rjmp .-4 ; 0x1ef0 - 1ef4: 0a d0 rcall .+20 ; 0x1f0a - 1ef6: 09 d0 rcall .+18 ; 0x1f0a - 1ef8: 08 d0 rcall .+16 ; 0x1f0a - 1efa: 88 94 clc - 1efc: cb 99 sbic 0x19, 3 ; 25 - 1efe: 08 94 sec - 1f00: 2a 95 dec r18 - 1f02: 11 f0 breq .+4 ; 0x1f08 - 1f04: 87 95 ror r24 - 1f06: f7 cf rjmp .-18 ; 0x1ef6 - 1f08: 08 95 ret - -00001f0a : + 1eea: 29 e0 ldi r18, 0x09 ; 9 + 1eec: 30 e0 ldi r19, 0x00 ; 0 + 1eee: cb 99 sbic 0x19, 3 ; 25 + 1ef0: fe cf rjmp .-4 ; 0x1eee + 1ef2: 0a d0 rcall .+20 ; 0x1f08 + 1ef4: 09 d0 rcall .+18 ; 0x1f08 + 1ef6: 08 d0 rcall .+16 ; 0x1f08 + 1ef8: 88 94 clc + 1efa: cb 99 sbic 0x19, 3 ; 25 + 1efc: 08 94 sec + 1efe: 2a 95 dec r18 + 1f00: 11 f0 breq .+4 ; 0x1f06 + 1f02: 87 95 ror r24 + 1f04: f7 cf rjmp .-18 ; 0x1ef4 + 1f06: 08 95 ret + +00001f08 : #if UART_B_VALUE > 255 #error Baud rate too slow for soft UART #endif void uartDelay() { __asm__ __volatile__ ( - 1f0a: 9e e0 ldi r25, 0x0E ; 14 - 1f0c: 9a 95 dec r25 - 1f0e: f1 f7 brne .-4 ; 0x1f0c - 1f10: 08 95 ret + 1f08: 9e e0 ldi r25, 0x0E ; 14 + 1f0a: 9a 95 dec r25 + 1f0c: f1 f7 brne .-4 ; 0x1f0a + 1f0e: 08 95 ret -00001f12 : +00001f10 : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 1f12: 98 e1 ldi r25, 0x18 ; 24 - 1f14: 91 bd out 0x21, r25 ; 33 + 1f10: 98 e1 ldi r25, 0x18 ; 24 + 1f12: 91 bd out 0x21, r25 ; 33 WDTCSR = x; - 1f16: 81 bd out 0x21, r24 ; 33 + 1f14: 81 bd out 0x21, r24 ; 33 } - 1f18: 08 95 ret + 1f16: 08 95 ret -00001f1a : +00001f18 : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) { - 1f1a: e7 df rcall .-50 ; 0x1eea - 1f1c: 80 32 cpi r24, 0x20 ; 32 - 1f1e: 19 f0 breq .+6 ; 0x1f26 + 1f18: e8 df rcall .-48 ; 0x1eea + 1f1a: 80 32 cpi r24, 0x20 ; 32 + 1f1c: 19 f0 breq .+6 ; 0x1f24 watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 1f20: 88 e0 ldi r24, 0x08 ; 8 - 1f22: f7 df rcall .-18 ; 0x1f12 - 1f24: ff cf rjmp .-2 ; 0x1f24 + 1f1e: 88 e0 ldi r24, 0x08 ; 8 + 1f20: f7 df rcall .-18 ; 0x1f10 + 1f22: ff cf rjmp .-2 ; 0x1f22 while (1) // and busy-loop so that WD causes ; // a reset and app start. } putch(STK_INSYNC); - 1f26: 84 e1 ldi r24, 0x14 ; 20 + 1f24: 84 e1 ldi r24, 0x14 ; 20 } - 1f28: d1 cf rjmp .-94 ; 0x1ecc + 1f26: d2 cf rjmp .-92 ; 0x1ecc -00001f2a : +00001f28 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 1f2a: 1f 93 push r17 - 1f2c: 18 2f mov r17, r24 + 1f28: 1f 93 push r17 + 1f2a: 18 2f mov r17, r24 do getch(); while (--count); - 1f2e: dd df rcall .-70 ; 0x1eea - 1f30: 11 50 subi r17, 0x01 ; 1 - 1f32: e9 f7 brne .-6 ; 0x1f2e + 1f2c: de df rcall .-68 ; 0x1eea + 1f2e: 11 50 subi r17, 0x01 ; 1 + 1f30: e9 f7 brne .-6 ; 0x1f2c verifySpace(); - 1f34: f2 df rcall .-28 ; 0x1f1a + 1f32: f2 df rcall .-28 ; 0x1f18 } - 1f36: 1f 91 pop r17 - 1f38: 08 95 ret + 1f34: 1f 91 pop r17 + 1f36: 08 95 ret -00001f3a : +00001f38 : WDTCSR = _BV(WDCE) | _BV(WDE); WDTCSR = x; } void appStart() { watchdogConfig(WATCHDOG_OFF); - 1f3a: 80 e0 ldi r24, 0x00 ; 0 - 1f3c: ea df rcall .-44 ; 0x1f12 + 1f38: 80 e0 ldi r24, 0x00 ; 0 + 1f3a: ea df rcall .-44 ; 0x1f10 __asm__ __volatile__ ( - 1f3e: e4 e0 ldi r30, 0x04 ; 4 - 1f40: ff 27 eor r31, r31 - 1f42: 09 94 ijmp + 1f3c: e4 e0 ldi r30, 0x04 ; 4 + 1f3e: ff 27 eor r31, r31 + 1f40: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_pro_16MHz.hex b/bootloaders/optiboot/optiboot_pro_16MHz.hex index 26bbd4c..b685a4e 100644 --- a/bootloaders/optiboot/optiboot_pro_16MHz.hex +++ b/bootloaders/optiboot/optiboot_pro_16MHz.hex @@ -1,33 +1,34 @@ -:103E0000112484B714BE81FFE3D085E08093810044 +:103E0000112484B714BE81FFE7D085E08093810040 :103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20080E18093C4008EE0BCD0259A86E079 +:103E2000C20080E18093C4008EE0C0D0259A86E075 :103E300020E33CEF91E0309385002093840096BB13 :103E4000B09BFECF1D9AA8958150A9F79924939411 :103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE -:103E6000AFD083E01FC0823411F484E103C08534F5 -:103E700019F485E0A5D083C0853579F48BD0E82E80 +:103E6000B3D083E01FC0823411F484E103C08534F1 +:103E700019F485E0A9D083C0853579F48BD0E82E7C :103E8000FF2488D0082F10E0102F00270E291F29AB -:103E9000000F111F8DD0680172C0863529F484E0AF -:103EA0008FD080E06FD06BC0843609F042C072D0F2 +:103E9000000F111F91D0680172C0863529F484E0AB +:103EA00093D080E06FD06BC0843609F042C072D0EE :103EB00071D0082F6FD080E0C81688E3D80620F4B0 :103EC00083E0F60187BFE895C0E0D1E063D0899335 :103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF -:103EE000F60187BFE89564D007B600FCFDCFA601B8 +:103EE000F60187BFE89568D007B600FCFDCFA601B4 :103EF000A0E0B1E02C9130E011968C91119790E008 :103F0000982F8827822B932B1296FA010C0197BECB :103F1000E89511244E5F5F4FF1E0A038BF0751F7DD :103F2000F601A7BEE89507B600FCFDCFB7BEE89541 -:103F300026C08437B1F42ED02DD0F82E2BD038D017 +:103F300026C08437B1F42ED02DD0F82E2BD03CD013 :103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 :103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 -:103F60000EC0853739F424D08EE10CD084E90AD014 -:103F700086E098CF813511F488E014D019D080E123 +:103F60000EC0853739F428D08EE10CD084E90AD010 +:103F700086E098CF813511F488E018D01DD080E11B :103F800001D06ACF982F8091C00085FFFCCF90931D -:103F9000C6000895A8958091C00087FFFCCF80914E -:103FA000C6000895E0E6F0E098E1908380830895EC -:103FB000F1DF803219F088E0F5DFFFCF84E1E2CF56 -:103FC0001F93182FE7DF1150E9F7F2DF1F910895D3 -:0A3FD00080E0E8DFEE27FF270994E8 -:023FFE000204BB +:103F9000C60008958091C00087FFFCCF8091C000CB +:103FA00084FD01C0A8958091C6000895E0E6F0E088 +:103FB00098E1908380830895EDDF803219F088E0E6 +:103FC000F5DFFFCF84E1DECF1F93182FE3DF115021 +:103FD000E9F7F2DF1F91089580E0E8DFEE27FF2781 +:023FE000099442 +:023FFE000304BA :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_16MHz.lst b/bootloaders/optiboot/optiboot_pro_16MHz.lst index e615a8e..2c6bea1 100644 --- a/bootloaders/optiboot/optiboot_pro_16MHz.lst +++ b/bootloaders/optiboot/optiboot_pro_16MHz.lst @@ -3,27 +3,27 @@ optiboot_pro_16MHz.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001da 00003e00 00003e00 00000054 2**1 + 0 .text 000001e2 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 0000022e 2**0 + 1 .version 00000002 00003ffe 00003ffe 00000236 2**0 CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000230 2**0 + 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 + 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028d 00000000 00000000 000002b7 2**0 + 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000018a 00000000 00000000 00000544 2**0 + 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000456 00000000 00000000 000006ce 2**0 + 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b24 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000ba4 2**0 + 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ced 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f6b 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 3e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 3e06: 81 ff sbrs r24, 1 - 3e08: e3 d0 rcall .+454 ; 0x3fd0 + 3e08: e7 d0 rcall .+462 ; 0x3fd8 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -77,7 +77,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: bc d0 rcall .+376 ; 0x3fa4 + 3e2a: c0 d0 rcall .+384 ; 0x3fac /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -163,7 +163,7 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: af d0 rcall .+350 ; 0x3fc0 + 3e60: b3 d0 rcall .+358 ; 0x3fc8 putch(0x03); 3e62: 83 e0 ldi r24, 0x03 ; 3 3e64: 1f c0 rjmp .+62 ; 0x3ea4 @@ -182,7 +182,7 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: a5 d0 rcall .+330 ; 0x3fc0 + 3e74: a9 d0 rcall .+338 ; 0x3fc8 3e76: 83 c0 rjmp .+262 ; 0x3f7e } else if(ch == STK_LOAD_ADDRESS) { @@ -211,7 +211,7 @@ void watchdogReset() { 3e92: 11 1f adc r17, r17 address = newAddress; verifySpace(); - 3e94: 8d d0 rcall .+282 ; 0x3fb0 + 3e94: 91 d0 rcall .+290 ; 0x3fb8 3e96: 68 01 movw r12, r16 3e98: 72 c0 rjmp .+228 ; 0x3f7e } @@ -221,7 +221,7 @@ void watchdogReset() { // UNIVERSAL command is ignored getNch(4); 3e9e: 84 e0 ldi r24, 0x04 ; 4 - 3ea0: 8f d0 rcall .+286 ; 0x3fc0 + 3ea0: 93 d0 rcall .+294 ; 0x3fc8 putch(0x00); 3ea2: 80 e0 ldi r24, 0x00 ; 0 3ea4: 6f d0 rcall .+222 ; 0x3f84 @@ -282,7 +282,7 @@ void watchdogReset() { // Read command terminator, start reply verifySpace(); - 3ee6: 64 d0 rcall .+200 ; 0x3fb0 + 3ee6: 68 d0 rcall .+208 ; 0x3fb8 // If only a partial page is to be programmed, the erase might not be complete. // So check that here @@ -370,7 +370,7 @@ int main(void) { 3f3c: 2b d0 rcall .+86 ; 0x3f94 verifySpace(); - 3f3e: 38 d0 rcall .+112 ; 0x3fb0 + 3f3e: 3c d0 rcall .+120 ; 0x3fb8 3f40: f6 01 movw r30, r12 3f42: ef 2c mov r14, r15 putch(result); @@ -411,7 +411,7 @@ int main(void) { 3f64: 39 f4 brne .+14 ; 0x3f74 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 3f66: 24 d0 rcall .+72 ; 0x3fb0 + 3f66: 28 d0 rcall .+80 ; 0x3fb8 putch(SIGNATURE_0); 3f68: 8e e1 ldi r24, 0x1E ; 30 3f6a: 0c d0 rcall .+24 ; 0x3f84 @@ -428,13 +428,13 @@ int main(void) { // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); 3f78: 88 e0 ldi r24, 0x08 ; 8 - 3f7a: 14 d0 rcall .+40 ; 0x3fa4 + 3f7a: 18 d0 rcall .+48 ; 0x3fac verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 3f7c: 19 d0 rcall .+50 ; 0x3fb0 + 3f7c: 1d d0 rcall .+58 ; 0x3fb8 } putch(STK_OK); 3f7e: 80 e1 ldi r24, 0x10 ; 16 @@ -463,99 +463,109 @@ void putch(char ch) { 3f92: 08 95 ret 00003f94 : + [uartBit] "I" (UART_RX_BIT) + : + "r25" +); +#else + while(!(UCSR0A & _BV(RXC0))) + 3f94: 80 91 c0 00 lds r24, 0x00C0 + 3f98: 87 ff sbrs r24, 7 + 3f9a: fc cf rjmp .-8 ; 0x3f94 + ; + if (!(UCSR0A & _BV(FE0))) { + 3f9c: 80 91 c0 00 lds r24, 0x00C0 + 3fa0: 84 fd sbrc r24, 4 + 3fa2: 01 c0 rjmp .+2 ; 0x3fa6 } #endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3f94: a8 95 wdr - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))); - 3f96: 80 91 c0 00 lds r24, 0x00C0 - 3f9a: 87 ff sbrs r24, 7 - 3f9c: fc cf rjmp .-8 ; 0x3f96 + 3fa4: a8 95 wdr + * don't care that an invalid char is returned...) + */ + watchdogReset(); + } + ch = UDR0; - 3f9e: 80 91 c6 00 lds r24, 0x00C6 + 3fa6: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 3fa2: 08 95 ret + 3faa: 08 95 ret -00003fa4 : +00003fac : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 3fa4: e0 e6 ldi r30, 0x60 ; 96 - 3fa6: f0 e0 ldi r31, 0x00 ; 0 - 3fa8: 98 e1 ldi r25, 0x18 ; 24 - 3faa: 90 83 st Z, r25 + 3fac: e0 e6 ldi r30, 0x60 ; 96 + 3fae: f0 e0 ldi r31, 0x00 ; 0 + 3fb0: 98 e1 ldi r25, 0x18 ; 24 + 3fb2: 90 83 st Z, r25 WDTCSR = x; - 3fac: 80 83 st Z, r24 + 3fb4: 80 83 st Z, r24 } - 3fae: 08 95 ret + 3fb6: 08 95 ret -00003fb0 : +00003fb8 : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) { - 3fb0: f1 df rcall .-30 ; 0x3f94 - 3fb2: 80 32 cpi r24, 0x20 ; 32 - 3fb4: 19 f0 breq .+6 ; 0x3fbc + 3fb8: ed df rcall .-38 ; 0x3f94 + 3fba: 80 32 cpi r24, 0x20 ; 32 + 3fbc: 19 f0 breq .+6 ; 0x3fc4 watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fb6: 88 e0 ldi r24, 0x08 ; 8 - 3fb8: f5 df rcall .-22 ; 0x3fa4 - 3fba: ff cf rjmp .-2 ; 0x3fba + 3fbe: 88 e0 ldi r24, 0x08 ; 8 + 3fc0: f5 df rcall .-22 ; 0x3fac + 3fc2: ff cf rjmp .-2 ; 0x3fc2 while (1) // and busy-loop so that WD causes ; // a reset and app start. } putch(STK_INSYNC); - 3fbc: 84 e1 ldi r24, 0x14 ; 20 + 3fc4: 84 e1 ldi r24, 0x14 ; 20 } - 3fbe: e2 cf rjmp .-60 ; 0x3f84 + 3fc6: de cf rjmp .-68 ; 0x3f84 -00003fc0 : +00003fc8 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 3fc0: 1f 93 push r17 - 3fc2: 18 2f mov r17, r24 + 3fc8: 1f 93 push r17 + 3fca: 18 2f mov r17, r24 do getch(); while (--count); - 3fc4: e7 df rcall .-50 ; 0x3f94 - 3fc6: 11 50 subi r17, 0x01 ; 1 - 3fc8: e9 f7 brne .-6 ; 0x3fc4 + 3fcc: e3 df rcall .-58 ; 0x3f94 + 3fce: 11 50 subi r17, 0x01 ; 1 + 3fd0: e9 f7 brne .-6 ; 0x3fcc verifySpace(); - 3fca: f2 df rcall .-28 ; 0x3fb0 + 3fd2: f2 df rcall .-28 ; 0x3fb8 } - 3fcc: 1f 91 pop r17 - 3fce: 08 95 ret + 3fd4: 1f 91 pop r17 + 3fd6: 08 95 ret -00003fd0 : +00003fd8 : WDTCSR = _BV(WDCE) | _BV(WDE); WDTCSR = x; } void appStart() { watchdogConfig(WATCHDOG_OFF); - 3fd0: 80 e0 ldi r24, 0x00 ; 0 - 3fd2: e8 df rcall .-48 ; 0x3fa4 + 3fd8: 80 e0 ldi r24, 0x00 ; 0 + 3fda: e8 df rcall .-48 ; 0x3fac __asm__ __volatile__ ( - 3fd4: ee 27 eor r30, r30 - 3fd6: ff 27 eor r31, r31 - 3fd8: 09 94 ijmp + 3fdc: ee 27 eor r30, r30 + 3fde: ff 27 eor r31, r31 + 3fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_pro_20mhz.hex b/bootloaders/optiboot/optiboot_pro_20mhz.hex index dbd29c1..451a99c 100644 --- a/bootloaders/optiboot/optiboot_pro_20mhz.hex +++ b/bootloaders/optiboot/optiboot_pro_20mhz.hex @@ -1,33 +1,34 @@ -:103E0000112484B714BE81FFE3D085E08093810044 +:103E0000112484B714BE81FFE7D085E08093810040 :103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20085E18093C4008EE0BCD0259A86E074 +:103E2000C20085E18093C4008EE0C0D0259A86E070 :103E30002CE33BEF91E0309385002093840096BB08 :103E4000B09BFECF1D9AA8958150A9F79924939411 :103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE -:103E6000AFD083E01FC0823411F484E103C08534F5 -:103E700019F485E0A5D083C0853579F48BD0E82E80 +:103E6000B3D083E01FC0823411F484E103C08534F1 +:103E700019F485E0A9D083C0853579F48BD0E82E7C :103E8000FF2488D0082F10E0102F00270E291F29AB -:103E9000000F111F8DD0680172C0863529F484E0AF -:103EA0008FD080E06FD06BC0843609F042C072D0F2 +:103E9000000F111F91D0680172C0863529F484E0AB +:103EA00093D080E06FD06BC0843609F042C072D0EE :103EB00071D0082F6FD080E0C81688E3D80620F4B0 :103EC00083E0F60187BFE895C0E0D1E063D0899335 :103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF -:103EE000F60187BFE89564D007B600FCFDCFA601B8 +:103EE000F60187BFE89568D007B600FCFDCFA601B4 :103EF000A0E0B1E02C9130E011968C91119790E008 :103F0000982F8827822B932B1296FA010C0197BECB :103F1000E89511244E5F5F4FF1E0A038BF0751F7DD :103F2000F601A7BEE89507B600FCFDCFB7BEE89541 -:103F300026C08437B1F42ED02DD0F82E2BD038D017 +:103F300026C08437B1F42ED02DD0F82E2BD03CD013 :103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 :103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 -:103F60000EC0853739F424D08EE10CD084E90AD014 -:103F700086E098CF813511F488E014D019D080E123 +:103F60000EC0853739F428D08EE10CD084E90AD010 +:103F700086E098CF813511F488E018D01DD080E11B :103F800001D06ACF982F8091C00085FFFCCF90931D -:103F9000C6000895A8958091C00087FFFCCF80914E -:103FA000C6000895E0E6F0E098E1908380830895EC -:103FB000F1DF803219F088E0F5DFFFCF84E1E2CF56 -:103FC0001F93182FE7DF1150E9F7F2DF1F910895D3 -:0A3FD00080E0E8DFEE27FF270994E8 -:023FFE000204BB +:103F9000C60008958091C00087FFFCCF8091C000CB +:103FA00084FD01C0A8958091C6000895E0E6F0E088 +:103FB00098E1908380830895EDDF803219F088E0E6 +:103FC000F5DFFFCF84E1DECF1F93182FE3DF115021 +:103FD000E9F7F2DF1F91089580E0E8DFEE27FF2781 +:023FE000099442 +:023FFE000304BA :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_20mhz.lst b/bootloaders/optiboot/optiboot_pro_20mhz.lst index 20d4db6..8314647 100644 --- a/bootloaders/optiboot/optiboot_pro_20mhz.lst +++ b/bootloaders/optiboot/optiboot_pro_20mhz.lst @@ -3,27 +3,27 @@ optiboot_pro_20mhz.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001da 00003e00 00003e00 00000054 2**1 + 0 .text 000001e2 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 0000022e 2**0 + 1 .version 00000002 00003ffe 00003ffe 00000236 2**0 CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000230 2**0 + 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 + 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028d 00000000 00000000 000002b7 2**0 + 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000018a 00000000 00000000 00000544 2**0 + 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000456 00000000 00000000 000006ce 2**0 + 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b24 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000ba4 2**0 + 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ced 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f6b 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 3e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 3e06: 81 ff sbrs r24, 1 - 3e08: e3 d0 rcall .+454 ; 0x3fd0 + 3e08: e7 d0 rcall .+462 ; 0x3fd8 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -77,7 +77,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: bc d0 rcall .+376 ; 0x3fa4 + 3e2a: c0 d0 rcall .+384 ; 0x3fac /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -163,7 +163,7 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: af d0 rcall .+350 ; 0x3fc0 + 3e60: b3 d0 rcall .+358 ; 0x3fc8 putch(0x03); 3e62: 83 e0 ldi r24, 0x03 ; 3 3e64: 1f c0 rjmp .+62 ; 0x3ea4 @@ -182,7 +182,7 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: a5 d0 rcall .+330 ; 0x3fc0 + 3e74: a9 d0 rcall .+338 ; 0x3fc8 3e76: 83 c0 rjmp .+262 ; 0x3f7e } else if(ch == STK_LOAD_ADDRESS) { @@ -211,7 +211,7 @@ void watchdogReset() { 3e92: 11 1f adc r17, r17 address = newAddress; verifySpace(); - 3e94: 8d d0 rcall .+282 ; 0x3fb0 + 3e94: 91 d0 rcall .+290 ; 0x3fb8 3e96: 68 01 movw r12, r16 3e98: 72 c0 rjmp .+228 ; 0x3f7e } @@ -221,7 +221,7 @@ void watchdogReset() { // UNIVERSAL command is ignored getNch(4); 3e9e: 84 e0 ldi r24, 0x04 ; 4 - 3ea0: 8f d0 rcall .+286 ; 0x3fc0 + 3ea0: 93 d0 rcall .+294 ; 0x3fc8 putch(0x00); 3ea2: 80 e0 ldi r24, 0x00 ; 0 3ea4: 6f d0 rcall .+222 ; 0x3f84 @@ -282,7 +282,7 @@ void watchdogReset() { // Read command terminator, start reply verifySpace(); - 3ee6: 64 d0 rcall .+200 ; 0x3fb0 + 3ee6: 68 d0 rcall .+208 ; 0x3fb8 // If only a partial page is to be programmed, the erase might not be complete. // So check that here @@ -370,7 +370,7 @@ int main(void) { 3f3c: 2b d0 rcall .+86 ; 0x3f94 verifySpace(); - 3f3e: 38 d0 rcall .+112 ; 0x3fb0 + 3f3e: 3c d0 rcall .+120 ; 0x3fb8 3f40: f6 01 movw r30, r12 3f42: ef 2c mov r14, r15 putch(result); @@ -411,7 +411,7 @@ int main(void) { 3f64: 39 f4 brne .+14 ; 0x3f74 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 3f66: 24 d0 rcall .+72 ; 0x3fb0 + 3f66: 28 d0 rcall .+80 ; 0x3fb8 putch(SIGNATURE_0); 3f68: 8e e1 ldi r24, 0x1E ; 30 3f6a: 0c d0 rcall .+24 ; 0x3f84 @@ -428,13 +428,13 @@ int main(void) { // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); 3f78: 88 e0 ldi r24, 0x08 ; 8 - 3f7a: 14 d0 rcall .+40 ; 0x3fa4 + 3f7a: 18 d0 rcall .+48 ; 0x3fac verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 3f7c: 19 d0 rcall .+50 ; 0x3fb0 + 3f7c: 1d d0 rcall .+58 ; 0x3fb8 } putch(STK_OK); 3f7e: 80 e1 ldi r24, 0x10 ; 16 @@ -463,99 +463,109 @@ void putch(char ch) { 3f92: 08 95 ret 00003f94 : + [uartBit] "I" (UART_RX_BIT) + : + "r25" +); +#else + while(!(UCSR0A & _BV(RXC0))) + 3f94: 80 91 c0 00 lds r24, 0x00C0 + 3f98: 87 ff sbrs r24, 7 + 3f9a: fc cf rjmp .-8 ; 0x3f94 + ; + if (!(UCSR0A & _BV(FE0))) { + 3f9c: 80 91 c0 00 lds r24, 0x00C0 + 3fa0: 84 fd sbrc r24, 4 + 3fa2: 01 c0 rjmp .+2 ; 0x3fa6 } #endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3f94: a8 95 wdr - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))); - 3f96: 80 91 c0 00 lds r24, 0x00C0 - 3f9a: 87 ff sbrs r24, 7 - 3f9c: fc cf rjmp .-8 ; 0x3f96 + 3fa4: a8 95 wdr + * don't care that an invalid char is returned...) + */ + watchdogReset(); + } + ch = UDR0; - 3f9e: 80 91 c6 00 lds r24, 0x00C6 + 3fa6: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 3fa2: 08 95 ret + 3faa: 08 95 ret -00003fa4 : +00003fac : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 3fa4: e0 e6 ldi r30, 0x60 ; 96 - 3fa6: f0 e0 ldi r31, 0x00 ; 0 - 3fa8: 98 e1 ldi r25, 0x18 ; 24 - 3faa: 90 83 st Z, r25 + 3fac: e0 e6 ldi r30, 0x60 ; 96 + 3fae: f0 e0 ldi r31, 0x00 ; 0 + 3fb0: 98 e1 ldi r25, 0x18 ; 24 + 3fb2: 90 83 st Z, r25 WDTCSR = x; - 3fac: 80 83 st Z, r24 + 3fb4: 80 83 st Z, r24 } - 3fae: 08 95 ret + 3fb6: 08 95 ret -00003fb0 : +00003fb8 : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) { - 3fb0: f1 df rcall .-30 ; 0x3f94 - 3fb2: 80 32 cpi r24, 0x20 ; 32 - 3fb4: 19 f0 breq .+6 ; 0x3fbc + 3fb8: ed df rcall .-38 ; 0x3f94 + 3fba: 80 32 cpi r24, 0x20 ; 32 + 3fbc: 19 f0 breq .+6 ; 0x3fc4 watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fb6: 88 e0 ldi r24, 0x08 ; 8 - 3fb8: f5 df rcall .-22 ; 0x3fa4 - 3fba: ff cf rjmp .-2 ; 0x3fba + 3fbe: 88 e0 ldi r24, 0x08 ; 8 + 3fc0: f5 df rcall .-22 ; 0x3fac + 3fc2: ff cf rjmp .-2 ; 0x3fc2 while (1) // and busy-loop so that WD causes ; // a reset and app start. } putch(STK_INSYNC); - 3fbc: 84 e1 ldi r24, 0x14 ; 20 + 3fc4: 84 e1 ldi r24, 0x14 ; 20 } - 3fbe: e2 cf rjmp .-60 ; 0x3f84 + 3fc6: de cf rjmp .-68 ; 0x3f84 -00003fc0 : +00003fc8 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 3fc0: 1f 93 push r17 - 3fc2: 18 2f mov r17, r24 + 3fc8: 1f 93 push r17 + 3fca: 18 2f mov r17, r24 do getch(); while (--count); - 3fc4: e7 df rcall .-50 ; 0x3f94 - 3fc6: 11 50 subi r17, 0x01 ; 1 - 3fc8: e9 f7 brne .-6 ; 0x3fc4 + 3fcc: e3 df rcall .-58 ; 0x3f94 + 3fce: 11 50 subi r17, 0x01 ; 1 + 3fd0: e9 f7 brne .-6 ; 0x3fcc verifySpace(); - 3fca: f2 df rcall .-28 ; 0x3fb0 + 3fd2: f2 df rcall .-28 ; 0x3fb8 } - 3fcc: 1f 91 pop r17 - 3fce: 08 95 ret + 3fd4: 1f 91 pop r17 + 3fd6: 08 95 ret -00003fd0 : +00003fd8 : WDTCSR = _BV(WDCE) | _BV(WDE); WDTCSR = x; } void appStart() { watchdogConfig(WATCHDOG_OFF); - 3fd0: 80 e0 ldi r24, 0x00 ; 0 - 3fd2: e8 df rcall .-48 ; 0x3fa4 + 3fd8: 80 e0 ldi r24, 0x00 ; 0 + 3fda: e8 df rcall .-48 ; 0x3fac __asm__ __volatile__ ( - 3fd4: ee 27 eor r30, r30 - 3fd6: ff 27 eor r31, r31 - 3fd8: 09 94 ijmp + 3fdc: ee 27 eor r30, r30 + 3fde: ff 27 eor r31, r31 + 3fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_pro_8MHz.hex b/bootloaders/optiboot/optiboot_pro_8MHz.hex index 00f7a38..2c63395 100644 --- a/bootloaders/optiboot/optiboot_pro_8MHz.hex +++ b/bootloaders/optiboot/optiboot_pro_8MHz.hex @@ -1,33 +1,34 @@ -:103E0000112484B714BE81FFE3D085E08093810044 +:103E0000112484B714BE81FFE7D085E08093810040 :103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20088E08093C4008EE0BCD0259A86E072 +:103E2000C20088E08093C4008EE0C0D0259A86E06E :103E300028E13EEF91E0309385002093840096BB0B :103E4000B09BFECF1D9AA8958150A9F79924939411 :103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE -:103E6000AFD083E01FC0823411F484E103C08534F5 -:103E700019F485E0A5D083C0853579F48BD0E82E80 +:103E6000B3D083E01FC0823411F484E103C08534F1 +:103E700019F485E0A9D083C0853579F48BD0E82E7C :103E8000FF2488D0082F10E0102F00270E291F29AB -:103E9000000F111F8DD0680172C0863529F484E0AF -:103EA0008FD080E06FD06BC0843609F042C072D0F2 +:103E9000000F111F91D0680172C0863529F484E0AB +:103EA00093D080E06FD06BC0843609F042C072D0EE :103EB00071D0082F6FD080E0C81688E3D80620F4B0 :103EC00083E0F60187BFE895C0E0D1E063D0899335 :103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF -:103EE000F60187BFE89564D007B600FCFDCFA601B8 +:103EE000F60187BFE89568D007B600FCFDCFA601B4 :103EF000A0E0B1E02C9130E011968C91119790E008 :103F0000982F8827822B932B1296FA010C0197BECB :103F1000E89511244E5F5F4FF1E0A038BF0751F7DD :103F2000F601A7BEE89507B600FCFDCFB7BEE89541 -:103F300026C08437B1F42ED02DD0F82E2BD038D017 +:103F300026C08437B1F42ED02DD0F82E2BD03CD013 :103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 :103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 -:103F60000EC0853739F424D08EE10CD084E90AD014 -:103F700086E098CF813511F488E014D019D080E123 +:103F60000EC0853739F428D08EE10CD084E90AD010 +:103F700086E098CF813511F488E018D01DD080E11B :103F800001D06ACF982F8091C00085FFFCCF90931D -:103F9000C6000895A8958091C00087FFFCCF80914E -:103FA000C6000895E0E6F0E098E1908380830895EC -:103FB000F1DF803219F088E0F5DFFFCF84E1E2CF56 -:103FC0001F93182FE7DF1150E9F7F2DF1F910895D3 -:0A3FD00080E0E8DFEE27FF270994E8 -:023FFE000204BB +:103F9000C60008958091C00087FFFCCF8091C000CB +:103FA00084FD01C0A8958091C6000895E0E6F0E088 +:103FB00098E1908380830895EDDF803219F088E0E6 +:103FC000F5DFFFCF84E1DECF1F93182FE3DF115021 +:103FD000E9F7F2DF1F91089580E0E8DFEE27FF2781 +:023FE000099442 +:023FFE000304BA :0400000300003E00BB :00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_8MHz.lst b/bootloaders/optiboot/optiboot_pro_8MHz.lst index 6c117ca..1fb903c 100644 --- a/bootloaders/optiboot/optiboot_pro_8MHz.lst +++ b/bootloaders/optiboot/optiboot_pro_8MHz.lst @@ -3,27 +3,27 @@ optiboot_pro_8MHz.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001da 00003e00 00003e00 00000054 2**1 + 0 .text 000001e2 00003e00 00003e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 0000022e 2**0 + 1 .version 00000002 00003ffe 00003ffe 00000236 2**0 CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000230 2**0 + 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000258 2**0 + 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028d 00000000 00000000 000002b7 2**0 + 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000018a 00000000 00000000 00000544 2**0 + 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000456 00000000 00000000 000006ce 2**0 + 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b24 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000ba4 2**0 + 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ced 2**0 + 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f6b 2**0 + 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 3e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 3e06: 81 ff sbrs r24, 1 - 3e08: e3 d0 rcall .+454 ; 0x3fd0 + 3e08: e7 d0 rcall .+462 ; 0x3fd8 #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -77,7 +77,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: bc d0 rcall .+376 ; 0x3fa4 + 3e2a: c0 d0 rcall .+384 ; 0x3fac /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -163,7 +163,7 @@ void watchdogReset() { // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy getNch(1); 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: af d0 rcall .+350 ; 0x3fc0 + 3e60: b3 d0 rcall .+358 ; 0x3fc8 putch(0x03); 3e62: 83 e0 ldi r24, 0x03 ; 3 3e64: 1f c0 rjmp .+62 ; 0x3ea4 @@ -182,7 +182,7 @@ void watchdogReset() { // SET DEVICE EXT is ignored getNch(5); 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: a5 d0 rcall .+330 ; 0x3fc0 + 3e74: a9 d0 rcall .+338 ; 0x3fc8 3e76: 83 c0 rjmp .+262 ; 0x3f7e } else if(ch == STK_LOAD_ADDRESS) { @@ -211,7 +211,7 @@ void watchdogReset() { 3e92: 11 1f adc r17, r17 address = newAddress; verifySpace(); - 3e94: 8d d0 rcall .+282 ; 0x3fb0 + 3e94: 91 d0 rcall .+290 ; 0x3fb8 3e96: 68 01 movw r12, r16 3e98: 72 c0 rjmp .+228 ; 0x3f7e } @@ -221,7 +221,7 @@ void watchdogReset() { // UNIVERSAL command is ignored getNch(4); 3e9e: 84 e0 ldi r24, 0x04 ; 4 - 3ea0: 8f d0 rcall .+286 ; 0x3fc0 + 3ea0: 93 d0 rcall .+294 ; 0x3fc8 putch(0x00); 3ea2: 80 e0 ldi r24, 0x00 ; 0 3ea4: 6f d0 rcall .+222 ; 0x3f84 @@ -282,7 +282,7 @@ void watchdogReset() { // Read command terminator, start reply verifySpace(); - 3ee6: 64 d0 rcall .+200 ; 0x3fb0 + 3ee6: 68 d0 rcall .+208 ; 0x3fb8 // If only a partial page is to be programmed, the erase might not be complete. // So check that here @@ -370,7 +370,7 @@ int main(void) { 3f3c: 2b d0 rcall .+86 ; 0x3f94 verifySpace(); - 3f3e: 38 d0 rcall .+112 ; 0x3fb0 + 3f3e: 3c d0 rcall .+120 ; 0x3fb8 3f40: f6 01 movw r30, r12 3f42: ef 2c mov r14, r15 putch(result); @@ -411,7 +411,7 @@ int main(void) { 3f64: 39 f4 brne .+14 ; 0x3f74 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 3f66: 24 d0 rcall .+72 ; 0x3fb0 + 3f66: 28 d0 rcall .+80 ; 0x3fb8 putch(SIGNATURE_0); 3f68: 8e e1 ldi r24, 0x1E ; 30 3f6a: 0c d0 rcall .+24 ; 0x3f84 @@ -428,13 +428,13 @@ int main(void) { // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); 3f78: 88 e0 ldi r24, 0x08 ; 8 - 3f7a: 14 d0 rcall .+40 ; 0x3fa4 + 3f7a: 18 d0 rcall .+48 ; 0x3fac verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 3f7c: 19 d0 rcall .+50 ; 0x3fb0 + 3f7c: 1d d0 rcall .+58 ; 0x3fb8 } putch(STK_OK); 3f7e: 80 e1 ldi r24, 0x10 ; 16 @@ -463,99 +463,109 @@ void putch(char ch) { 3f92: 08 95 ret 00003f94 : + [uartBit] "I" (UART_RX_BIT) + : + "r25" +); +#else + while(!(UCSR0A & _BV(RXC0))) + 3f94: 80 91 c0 00 lds r24, 0x00C0 + 3f98: 87 ff sbrs r24, 7 + 3f9a: fc cf rjmp .-8 ; 0x3f94 + ; + if (!(UCSR0A & _BV(FE0))) { + 3f9c: 80 91 c0 00 lds r24, 0x00C0 + 3fa0: 84 fd sbrc r24, 4 + 3fa2: 01 c0 rjmp .+2 ; 0x3fa6 } #endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 3f94: a8 95 wdr - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))); - 3f96: 80 91 c0 00 lds r24, 0x00C0 - 3f9a: 87 ff sbrs r24, 7 - 3f9c: fc cf rjmp .-8 ; 0x3f96 + 3fa4: a8 95 wdr + * don't care that an invalid char is returned...) + */ + watchdogReset(); + } + ch = UDR0; - 3f9e: 80 91 c6 00 lds r24, 0x00C6 + 3fa6: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 3fa2: 08 95 ret + 3faa: 08 95 ret -00003fa4 : +00003fac : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 3fa4: e0 e6 ldi r30, 0x60 ; 96 - 3fa6: f0 e0 ldi r31, 0x00 ; 0 - 3fa8: 98 e1 ldi r25, 0x18 ; 24 - 3faa: 90 83 st Z, r25 + 3fac: e0 e6 ldi r30, 0x60 ; 96 + 3fae: f0 e0 ldi r31, 0x00 ; 0 + 3fb0: 98 e1 ldi r25, 0x18 ; 24 + 3fb2: 90 83 st Z, r25 WDTCSR = x; - 3fac: 80 83 st Z, r24 + 3fb4: 80 83 st Z, r24 } - 3fae: 08 95 ret + 3fb6: 08 95 ret -00003fb0 : +00003fb8 : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) { - 3fb0: f1 df rcall .-30 ; 0x3f94 - 3fb2: 80 32 cpi r24, 0x20 ; 32 - 3fb4: 19 f0 breq .+6 ; 0x3fbc + 3fb8: ed df rcall .-38 ; 0x3f94 + 3fba: 80 32 cpi r24, 0x20 ; 32 + 3fbc: 19 f0 breq .+6 ; 0x3fc4 watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fb6: 88 e0 ldi r24, 0x08 ; 8 - 3fb8: f5 df rcall .-22 ; 0x3fa4 - 3fba: ff cf rjmp .-2 ; 0x3fba + 3fbe: 88 e0 ldi r24, 0x08 ; 8 + 3fc0: f5 df rcall .-22 ; 0x3fac + 3fc2: ff cf rjmp .-2 ; 0x3fc2 while (1) // and busy-loop so that WD causes ; // a reset and app start. } putch(STK_INSYNC); - 3fbc: 84 e1 ldi r24, 0x14 ; 20 + 3fc4: 84 e1 ldi r24, 0x14 ; 20 } - 3fbe: e2 cf rjmp .-60 ; 0x3f84 + 3fc6: de cf rjmp .-68 ; 0x3f84 -00003fc0 : +00003fc8 : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 3fc0: 1f 93 push r17 - 3fc2: 18 2f mov r17, r24 + 3fc8: 1f 93 push r17 + 3fca: 18 2f mov r17, r24 do getch(); while (--count); - 3fc4: e7 df rcall .-50 ; 0x3f94 - 3fc6: 11 50 subi r17, 0x01 ; 1 - 3fc8: e9 f7 brne .-6 ; 0x3fc4 + 3fcc: e3 df rcall .-58 ; 0x3f94 + 3fce: 11 50 subi r17, 0x01 ; 1 + 3fd0: e9 f7 brne .-6 ; 0x3fcc verifySpace(); - 3fca: f2 df rcall .-28 ; 0x3fb0 + 3fd2: f2 df rcall .-28 ; 0x3fb8 } - 3fcc: 1f 91 pop r17 - 3fce: 08 95 ret + 3fd4: 1f 91 pop r17 + 3fd6: 08 95 ret -00003fd0 : +00003fd8 : WDTCSR = _BV(WDCE) | _BV(WDE); WDTCSR = x; } void appStart() { watchdogConfig(WATCHDOG_OFF); - 3fd0: 80 e0 ldi r24, 0x00 ; 0 - 3fd2: e8 df rcall .-48 ; 0x3fa4 + 3fd8: 80 e0 ldi r24, 0x00 ; 0 + 3fda: e8 df rcall .-48 ; 0x3fac __asm__ __volatile__ ( - 3fd4: ee 27 eor r30, r30 - 3fd6: ff 27 eor r31, r31 - 3fd8: 09 94 ijmp + 3fdc: ee 27 eor r30, r30 + 3fde: ff 27 eor r31, r31 + 3fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/pin_defs.h b/bootloaders/optiboot/pin_defs.h index 313e453..27d7772 100644 --- a/bootloaders/optiboot/pin_defs.h +++ b/bootloaders/optiboot/pin_defs.h @@ -21,6 +21,7 @@ #define UDR0 UDR #define UDRE0 UDRE #define RXC0 RXC + #define FE0 FE #define TIFR1 TIFR #define WDTCSR WDTCR #endif -- cgit v1.2.3-18-g5258 From e302384d4356f7d98f57e756b2b6f2896f9c868d Mon Sep 17 00:00:00 2001 From: WestfW Date: Tue, 14 Jun 2011 01:13:41 -0700 Subject: Modify Uno "lock" bits in boards.txt to make bootloader readable by sketches. Part of http://code.google.com/p/arduino/issues/detail?id=554 --- boards.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards.txt b/boards.txt index 0ae40d3..c252a75 100644 --- a/boards.txt +++ b/boards.txt @@ -10,7 +10,7 @@ uno.bootloader.extended_fuses=0x05 uno.bootloader.path=optiboot uno.bootloader.file=optiboot_atmega328.hex uno.bootloader.unlock_bits=0x3F -uno.bootloader.lock_bits=0x0F +uno.bootloader.lock_bits=0x2F uno.build.mcu=atmega328p uno.build.f_cpu=16000000L uno.build.core=arduino -- cgit v1.2.3-18-g5258 From 1f01799bbfd17eb04ec6322a123d6d26b21b09a0 Mon Sep 17 00:00:00 2001 From: WestfW Date: Tue, 14 Jun 2011 10:24:27 -0700 Subject: Allow the READ PARAMETER command to return our version number. (significant size impact: 14 bytes!) Initialized "address" to eliminate compiler warning (4 bytes!) Add "atmega168" as a more accurate target name than "diecimila" (keep diecimila as well for backward compatibility) Reduce the .hex and .lst targets that are stored in source control to the three basics: atmega8, atmega168, atmega328. The other targets remain in the makefile and makeall, but will need to be built from source if wanted. Which should be less of a problem now that the source is buildable without installing crosspack. --- bootloaders/optiboot/Makefile | 21 +- bootloaders/optiboot/README.TXT | 11 + bootloaders/optiboot/makeall | 11 +- bootloaders/optiboot/optiboot.c | 28 +- bootloaders/optiboot/optiboot_atmega328.hex | 61 +- bootloaders/optiboot/optiboot_atmega328.lst | 479 ++++++++-------- .../optiboot/optiboot_atmega328_pro_8MHz.hex | 34 -- .../optiboot/optiboot_atmega328_pro_8MHz.lst | 571 ------------------- bootloaders/optiboot/optiboot_diecimila.hex | 34 -- bootloaders/optiboot/optiboot_diecimila.lst | 571 ------------------- bootloaders/optiboot/optiboot_lilypad.hex | 34 -- bootloaders/optiboot/optiboot_lilypad.lst | 571 ------------------- .../optiboot/optiboot_lilypad_resonator.hex | 34 -- .../optiboot/optiboot_lilypad_resonator.lst | 571 ------------------- bootloaders/optiboot/optiboot_luminet.hex | 40 -- bootloaders/optiboot/optiboot_luminet.lst | 617 --------------------- bootloaders/optiboot/optiboot_pro_16MHz.hex | 34 -- bootloaders/optiboot/optiboot_pro_16MHz.lst | 571 ------------------- bootloaders/optiboot/optiboot_pro_20mhz.hex | 34 -- bootloaders/optiboot/optiboot_pro_20mhz.lst | 571 ------------------- bootloaders/optiboot/optiboot_pro_8MHz.hex | 34 -- bootloaders/optiboot/optiboot_pro_8MHz.lst | 571 ------------------- 22 files changed, 346 insertions(+), 5157 deletions(-) delete mode 100644 bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex delete mode 100644 bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst delete mode 100644 bootloaders/optiboot/optiboot_diecimila.hex delete mode 100644 bootloaders/optiboot/optiboot_diecimila.lst delete mode 100644 bootloaders/optiboot/optiboot_lilypad.hex delete mode 100644 bootloaders/optiboot/optiboot_lilypad.lst delete mode 100644 bootloaders/optiboot/optiboot_lilypad_resonator.hex delete mode 100644 bootloaders/optiboot/optiboot_lilypad_resonator.lst delete mode 100644 bootloaders/optiboot/optiboot_luminet.hex delete mode 100644 bootloaders/optiboot/optiboot_luminet.lst delete mode 100644 bootloaders/optiboot/optiboot_pro_16MHz.hex delete mode 100644 bootloaders/optiboot/optiboot_pro_16MHz.lst delete mode 100644 bootloaders/optiboot/optiboot_pro_20mhz.hex delete mode 100644 bootloaders/optiboot/optiboot_pro_20mhz.lst delete mode 100644 bootloaders/optiboot/optiboot_pro_8MHz.hex delete mode 100644 bootloaders/optiboot/optiboot_pro_8MHz.lst diff --git a/bootloaders/optiboot/Makefile b/bootloaders/optiboot/Makefile index f6ba374..c2e03e3 100644 --- a/bootloaders/optiboot/Makefile +++ b/bootloaders/optiboot/Makefile @@ -177,8 +177,27 @@ pro16_isp: LFUSE = C6 pro16_isp: EFUSE = 04 pro16_isp: isp -# Diecimila and NG use identical bootloaders +# Diecimila, Duemilanove with m168, and NG use identical bootloaders +# Call it "atmega168" for generality and clarity, keep "diecimila" for +# backward compatibility of makefile # +atmega168: TARGET = atmega168 +atmega168: MCU_TARGET = atmega168 +atmega168: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' +atmega168: AVR_FREQ = 16000000L +atmega168: $(PROGRAM)_atmega168.hex +atmega168: $(PROGRAM)_atmega168.lst + +atmega168_isp: atmega168 +atmega168_isp: TARGET = atmega168 +# 2.7V brownout +atmega168_isp: HFUSE = DD +# Low power xtal (16MHz) 16KCK/14CK+65ms +atmega168_isp: LFUSE = FF +# 512 byte boot +atmega168_isp: EFUSE = 04 +atmega168_isp: isp + diecimila: TARGET = diecimila diecimila: MCU_TARGET = atmega168 diecimila: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' diff --git a/bootloaders/optiboot/README.TXT b/bootloaders/optiboot/README.TXT index 7e2f46d..cd79cd9 100644 --- a/bootloaders/optiboot/README.TXT +++ b/bootloaders/optiboot/README.TXT @@ -68,3 +68,14 @@ variables when you invoke make: make ISPTOOL=stk500v1 ISPPORT=/dev/tty.usbserial-A20e1eAN \ ISPSPEED=-b19200 atmega328_isp + +The "atmega8_isp" target does not currently work, because the mega8 +doesn't have the "extended" fuse that the generic ISP target wants to +pass on to avrdude. You'll need to run avrdude manually. + + +Standard Targets + +I've reduced the pre-built and source-version-controlled targets +(.hex and .lst files included in the git repository) to just the +three basic 16MHz targets: atmega8, atmega16, atmega328. diff --git a/bootloaders/optiboot/makeall b/bootloaders/optiboot/makeall index b92c56e..f076bc7 100755 --- a/bootloaders/optiboot/makeall +++ b/bootloaders/optiboot/makeall @@ -1,15 +1,20 @@ #!/bin/bash make clean +# +# The "big three" standard bootloaders. +make atmega8 +make atmega168 +make atmega328 +# +# additional buildable platforms of +# somewhat questionable support level make lilypad make lilypad_resonator make pro8 make pro16 make pro20 -make diecimila -make atmega328 make atmega328_pro8 make sanguino make mega -make atmega8 make atmega88 make luminet diff --git a/bootloaders/optiboot/optiboot.c b/bootloaders/optiboot/optiboot.c index 3f4404d..d499d85 100644 --- a/bootloaders/optiboot/optiboot.c +++ b/bootloaders/optiboot/optiboot.c @@ -132,6 +132,9 @@ /**********************************************************/ /* Edit History: */ /* */ +/* 4.4 WestfW: add initialization of address to keep */ +/* the compiler happy. Change SC'ed targets. */ +/* Return the SW version via READ PARAM */ /* 4.3 WestfW: catch framing errors in getch(), so that */ /* AVRISP works without HW kludges. */ /* http://code.google.com/p/arduino/issues/detail?id=368n*/ @@ -141,7 +144,7 @@ /**********************************************************/ #define OPTIBOOT_MAJVER 4 -#define OPTIBOOT_MINVER 3 +#define OPTIBOOT_MINVER 4 #define MAKESTR(a) #a #define MAKEVER(a, b) MAKESTR(a*256+b) @@ -261,8 +264,10 @@ int main(void) { /* * Making these local and in registers prevents the need for initializing * them, and also saves space because code no longer stores to memory. + * (initializing address keeps the compiler happy, but isn't really + * necessary, and uses 4 bytes of flash.) */ - register uint16_t address; + register uint16_t address = 0; register uint8_t length; // After the zero init loop, this is the first code to run. @@ -324,9 +329,22 @@ int main(void) { ch = getch(); if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - putch(0x03); + unsigned char which = getch(); + verifySpace(); + if (which == 0x82) { + /* + * Send optiboot version as "minor SW version" + */ + putch(OPTIBOOT_MINVER); + } else if (which == 0x81) { + putch(OPTIBOOT_MAJVER); + } else { + /* + * GET PARAMETER returns a generic 0x03 reply for + * other parameters - enough to keep Avrdude happy + */ + putch(0x03); + } } else if(ch == STK_SET_DEVICE) { // SET DEVICE is ignored diff --git a/bootloaders/optiboot/optiboot_atmega328.hex b/bootloaders/optiboot/optiboot_atmega328.hex index f147e81..a219f08 100644 --- a/bootloaders/optiboot/optiboot_atmega328.hex +++ b/bootloaders/optiboot/optiboot_atmega328.hex @@ -1,34 +1,35 @@ -:107E0000112484B714BE81FFE7D085E08093810000 +:107E0000112484B714BE81FFF0D085E080938100F7 :107E100082E08093C00088E18093C10086E0809377 -:107E2000C20080E18093C4008EE0C0D0259A86E035 +:107E2000C20080E18093C4008EE0C9D0259A86E02C :107E300020E33CEF91E0309385002093840096BBD3 -:107E4000B09BFECF1D9AA8958150A9F799249394D1 -:107E5000A5E0AA2EF1E1BF2E9DD0813421F481E06E -:107E6000B3D083E01FC0823411F484E103C08534B1 -:107E700019F485E0A9D083C0853579F48BD0E82E3C -:107E8000FF2488D0082F10E0102F00270E291F296B -:107E9000000F111F91D0680172C0863529F484E06B -:107EA00093D080E06FD06BC0843609F042C072D0AE -:107EB00071D0082F6FD080E0C81680E7D80620F474 -:107EC00083E0F60187BFE895C0E0D1E063D08993F5 -:107ED0000C17E1F7F0E0CF16F0E7DF0620F083E0C3 -:107EE000F60187BFE89568D007B600FCFDCFA60174 -:107EF000A0E0B1E02C9130E011968C91119790E0C8 -:107F0000982F8827822B932B1296FA010C0197BE8B -:107F1000E89511244E5F5F4FF1E0A038BF0751F79D -:107F2000F601A7BEE89507B600FCFDCFB7BEE89501 -:107F300026C08437B1F42ED02DD0F82E2BD03CD0D3 -:107F4000F601EF2C8F010F5F1F4F84911BD0EA9435 -:107F5000F801C1F70894C11CD11CFA94CF0CD11CB4 -:107F60000EC0853739F428D08EE10CD085E90AD0CF -:107F70008FE098CF813511F488E018D01DD080E1D2 -:107F800001D06ACF982F8091C00085FFFCCF9093DD -:107F9000C60008958091C00087FFFCCF8091C0008B -:107FA00084FD01C0A8958091C6000895E0E6F0E048 -:107FB00098E1908380830895EDDF803219F088E0A6 -:107FC000F5DFFFCF84E1DECF1F93182FE3DF1150E1 -:107FD000E9F7F2DF1F91089580E0E8DFEE27FF2741 -:027FE000099402 -:027FFE0003047A +:107E4000B09BFECF1D9AA8958150A9F7CC24DD24C4 +:107E500088248394B5E0AB2EA1E19A2EF3E0BF2EE7 +:107E6000A2D0813461F49FD0082FAFD0023811F036 +:107E7000013811F484E001C083E08DD089C08234E0 +:107E800011F484E103C0853419F485E0A6D080C0E4 +:107E9000853579F488D0E82EFF2485D0082F10E0AE +:107EA000102F00270E291F29000F111F8ED06801E7 +:107EB0006FC0863521F484E090D080E0DECF843638 +:107EC00009F040C070D06FD0082F6DD080E0C81688 +:107ED00080E7D80618F4F601B7BEE895C0E0D1E017 +:107EE00062D089930C17E1F7F0E0CF16F0E7DF06D8 +:107EF00018F0F601B7BEE89568D007B600FCFDCFD4 +:107F0000A601A0E0B1E02C9130E011968C91119780 +:107F100090E0982F8827822B932B1296FA010C0160 +:107F200087BEE89511244E5F5F4FF1E0A038BF0790 +:107F300051F7F601A7BEE89507B600FCFDCF97BE46 +:107F4000E89526C08437B1F42ED02DD0F82E2BD052 +:107F50003CD0F601EF2C8F010F5F1F4F84911BD097 +:107F6000EA94F801C1F70894C11CD11CFA94CF0C13 +:107F7000D11C0EC0853739F428D08EE10CD085E9AC +:107F80000AD08FE07ACF813511F488E018D01DD067 +:107F900080E101D065CF982F8091C00085FFFCCF94 +:107FA0009093C60008958091C00087FFFCCF809118 +:107FB000C00084FD01C0A8958091C6000895E0E648 +:107FC000F0E098E1908380830895EDDF803219F02E +:107FD00088E0F5DFFFCF84E1DECF1F93182FE3DFCA +:107FE0001150E9F7F2DF1F91089580E0E8DFEE27F6 +:047FF000FF270994CA +:027FFE00040479 :0400000300007E007B :00000001FF diff --git a/bootloaders/optiboot/optiboot_atmega328.lst b/bootloaders/optiboot/optiboot_atmega328.lst index db45462..d9dd4cc 100644 --- a/bootloaders/optiboot/optiboot_atmega328.lst +++ b/bootloaders/optiboot/optiboot_atmega328.lst @@ -3,27 +3,27 @@ optiboot_atmega328.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001e2 00007e00 00007e00 00000054 2**1 + 0 .text 000001f4 00007e00 00007e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00007ffe 00007ffe 00000236 2**0 + 1 .version 00000002 00007ffe 00007ffe 00000248 2**0 CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 + 2 .debug_aranges 00000028 00000000 00000000 0000024a 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 + 3 .debug_pubnames 0000005f 00000000 00000000 00000272 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 + 4 .debug_info 000002a8 00000000 00000000 000002d1 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 + 5 .debug_abbrev 00000178 00000000 00000000 00000579 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 + 6 .debug_line 00000488 00000000 00000000 000006f1 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b7c 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 + 8 .debug_str 0000014f 00000000 00000000 00000bfc 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 + 9 .debug_loc 000002d8 00000000 00000000 00000d4b 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 + 10 .debug_ranges 00000078 00000000 00000000 00001023 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 7e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 7e06: 81 ff sbrs r24, 1 - 7e08: e7 d0 rcall .+462 ; 0x7fd8 + 7e08: f0 d0 rcall .+480 ; 0x7fea #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -77,7 +77,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); 7e28: 8e e0 ldi r24, 0x0E ; 14 - 7e2a: c0 d0 rcall .+384 ; 0x7fac + 7e2a: c9 d0 rcall .+402 ; 0x7fbe /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -126,446 +126,473 @@ void watchdogReset() { } while (--count); 7e48: 81 50 subi r24, 0x01 ; 1 7e4a: a9 f7 brne .-22 ; 0x7e36 - /* get character from UART */ - ch = getch(); - - if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 7e4c: 99 24 eor r9, r9 - 7e4e: 93 94 inc r9 + 7e4c: cc 24 eor r12, r12 + 7e4e: dd 24 eor r13, r13 + ch = SPM_PAGESIZE / 2; + do { + uint16_t a; + a = *bufPtr++; + a |= (*bufPtr++) << 8; __boot_page_fill_short((uint16_t)(void*)addrPtr,a); + 7e50: 88 24 eor r8, r8 + 7e52: 83 94 inc r8 addrPtr += 2; } while (--ch); // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 7e50: a5 e0 ldi r26, 0x05 ; 5 - 7e52: aa 2e mov r10, r26 + 7e54: b5 e0 ldi r27, 0x05 ; 5 + 7e56: ab 2e mov r10, r27 boot_spm_busy_wait(); #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 7e54: f1 e1 ldi r31, 0x11 ; 17 - 7e56: bf 2e mov r11, r31 + 7e58: a1 e1 ldi r26, 0x11 ; 17 + 7e5a: 9a 2e mov r9, r26 + do *bufPtr++ = getch(); + while (--length); + + // If we are in NRWW section, page erase has to be delayed until now. + // Todo: Take RAMPZ into account + if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 7e5c: f3 e0 ldi r31, 0x03 ; 3 + 7e5e: bf 2e mov r11, r31 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 7e58: 9d d0 rcall .+314 ; 0x7f94 + 7e60: a2 d0 rcall .+324 ; 0x7fa6 if(ch == STK_GET_PARAMETER) { - 7e5a: 81 34 cpi r24, 0x41 ; 65 - 7e5c: 21 f4 brne .+8 ; 0x7e66 - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 7e5e: 81 e0 ldi r24, 0x01 ; 1 - 7e60: b3 d0 rcall .+358 ; 0x7fc8 - putch(0x03); - 7e62: 83 e0 ldi r24, 0x03 ; 3 - 7e64: 1f c0 rjmp .+62 ; 0x7ea4 + 7e62: 81 34 cpi r24, 0x41 ; 65 + 7e64: 61 f4 brne .+24 ; 0x7e7e + unsigned char which = getch(); + 7e66: 9f d0 rcall .+318 ; 0x7fa6 + 7e68: 08 2f mov r16, r24 + verifySpace(); + 7e6a: af d0 rcall .+350 ; 0x7fca + if (which == 0x82) { + 7e6c: 02 38 cpi r16, 0x82 ; 130 + 7e6e: 11 f0 breq .+4 ; 0x7e74 + /* + * Send optiboot version as "minor SW version" + */ + putch(OPTIBOOT_MINVER); + } else if (which == 0x81) { + 7e70: 01 38 cpi r16, 0x81 ; 129 + 7e72: 11 f4 brne .+4 ; 0x7e78 + putch(OPTIBOOT_MAJVER); + 7e74: 84 e0 ldi r24, 0x04 ; 4 + 7e76: 01 c0 rjmp .+2 ; 0x7e7a + } else { + /* + * GET PARAMETER returns a generic 0x03 reply for + * other parameters - enough to keep Avrdude happy + */ + putch(0x03); + 7e78: 83 e0 ldi r24, 0x03 ; 3 + 7e7a: 8d d0 rcall .+282 ; 0x7f96 + 7e7c: 89 c0 rjmp .+274 ; 0x7f90 + } } else if(ch == STK_SET_DEVICE) { - 7e66: 82 34 cpi r24, 0x42 ; 66 - 7e68: 11 f4 brne .+4 ; 0x7e6e + 7e7e: 82 34 cpi r24, 0x42 ; 66 + 7e80: 11 f4 brne .+4 ; 0x7e86 // SET DEVICE is ignored getNch(20); - 7e6a: 84 e1 ldi r24, 0x14 ; 20 - 7e6c: 03 c0 rjmp .+6 ; 0x7e74 + 7e82: 84 e1 ldi r24, 0x14 ; 20 + 7e84: 03 c0 rjmp .+6 ; 0x7e8c } else if(ch == STK_SET_DEVICE_EXT) { - 7e6e: 85 34 cpi r24, 0x45 ; 69 - 7e70: 19 f4 brne .+6 ; 0x7e78 + 7e86: 85 34 cpi r24, 0x45 ; 69 + 7e88: 19 f4 brne .+6 ; 0x7e90 // SET DEVICE EXT is ignored getNch(5); - 7e72: 85 e0 ldi r24, 0x05 ; 5 - 7e74: a9 d0 rcall .+338 ; 0x7fc8 - 7e76: 83 c0 rjmp .+262 ; 0x7f7e + 7e8a: 85 e0 ldi r24, 0x05 ; 5 + 7e8c: a6 d0 rcall .+332 ; 0x7fda + 7e8e: 80 c0 rjmp .+256 ; 0x7f90 } else if(ch == STK_LOAD_ADDRESS) { - 7e78: 85 35 cpi r24, 0x55 ; 85 - 7e7a: 79 f4 brne .+30 ; 0x7e9a + 7e90: 85 35 cpi r24, 0x55 ; 85 + 7e92: 79 f4 brne .+30 ; 0x7eb2 // LOAD ADDRESS uint16_t newAddress; newAddress = getch(); - 7e7c: 8b d0 rcall .+278 ; 0x7f94 + 7e94: 88 d0 rcall .+272 ; 0x7fa6 newAddress = (newAddress & 0xff) | (getch() << 8); - 7e7e: e8 2e mov r14, r24 - 7e80: ff 24 eor r15, r15 - 7e82: 88 d0 rcall .+272 ; 0x7f94 - 7e84: 08 2f mov r16, r24 - 7e86: 10 e0 ldi r17, 0x00 ; 0 - 7e88: 10 2f mov r17, r16 - 7e8a: 00 27 eor r16, r16 - 7e8c: 0e 29 or r16, r14 - 7e8e: 1f 29 or r17, r15 + 7e96: e8 2e mov r14, r24 + 7e98: ff 24 eor r15, r15 + 7e9a: 85 d0 rcall .+266 ; 0x7fa6 + 7e9c: 08 2f mov r16, r24 + 7e9e: 10 e0 ldi r17, 0x00 ; 0 + 7ea0: 10 2f mov r17, r16 + 7ea2: 00 27 eor r16, r16 + 7ea4: 0e 29 or r16, r14 + 7ea6: 1f 29 or r17, r15 #ifdef RAMPZ // Transfer top bit to RAMPZ RAMPZ = (newAddress & 0x8000) ? 1 : 0; #endif newAddress += newAddress; // Convert from word address to byte address - 7e90: 00 0f add r16, r16 - 7e92: 11 1f adc r17, r17 + 7ea8: 00 0f add r16, r16 + 7eaa: 11 1f adc r17, r17 address = newAddress; verifySpace(); - 7e94: 91 d0 rcall .+290 ; 0x7fb8 - 7e96: 68 01 movw r12, r16 - 7e98: 72 c0 rjmp .+228 ; 0x7f7e + 7eac: 8e d0 rcall .+284 ; 0x7fca + 7eae: 68 01 movw r12, r16 + 7eb0: 6f c0 rjmp .+222 ; 0x7f90 } else if(ch == STK_UNIVERSAL) { - 7e9a: 86 35 cpi r24, 0x56 ; 86 - 7e9c: 29 f4 brne .+10 ; 0x7ea8 + 7eb2: 86 35 cpi r24, 0x56 ; 86 + 7eb4: 21 f4 brne .+8 ; 0x7ebe // UNIVERSAL command is ignored getNch(4); - 7e9e: 84 e0 ldi r24, 0x04 ; 4 - 7ea0: 93 d0 rcall .+294 ; 0x7fc8 + 7eb6: 84 e0 ldi r24, 0x04 ; 4 + 7eb8: 90 d0 rcall .+288 ; 0x7fda putch(0x00); - 7ea2: 80 e0 ldi r24, 0x00 ; 0 - 7ea4: 6f d0 rcall .+222 ; 0x7f84 - 7ea6: 6b c0 rjmp .+214 ; 0x7f7e + 7eba: 80 e0 ldi r24, 0x00 ; 0 + 7ebc: de cf rjmp .-68 ; 0x7e7a } /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 7ea8: 84 36 cpi r24, 0x64 ; 100 - 7eaa: 09 f0 breq .+2 ; 0x7eae - 7eac: 42 c0 rjmp .+132 ; 0x7f32 + 7ebe: 84 36 cpi r24, 0x64 ; 100 + 7ec0: 09 f0 breq .+2 ; 0x7ec4 + 7ec2: 40 c0 rjmp .+128 ; 0x7f44 // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; getch(); /* getlen() */ - 7eae: 72 d0 rcall .+228 ; 0x7f94 + 7ec4: 70 d0 rcall .+224 ; 0x7fa6 length = getch(); - 7eb0: 71 d0 rcall .+226 ; 0x7f94 - 7eb2: 08 2f mov r16, r24 + 7ec6: 6f d0 rcall .+222 ; 0x7fa6 + 7ec8: 08 2f mov r16, r24 getch(); - 7eb4: 6f d0 rcall .+222 ; 0x7f94 + 7eca: 6d d0 rcall .+218 ; 0x7fa6 // If we are in RWW section, immediately start page erase if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 7eb6: 80 e0 ldi r24, 0x00 ; 0 - 7eb8: c8 16 cp r12, r24 - 7eba: 80 e7 ldi r24, 0x70 ; 112 - 7ebc: d8 06 cpc r13, r24 - 7ebe: 20 f4 brcc .+8 ; 0x7ec8 - 7ec0: 83 e0 ldi r24, 0x03 ; 3 - 7ec2: f6 01 movw r30, r12 - 7ec4: 87 bf out 0x37, r24 ; 55 - 7ec6: e8 95 spm - 7ec8: c0 e0 ldi r28, 0x00 ; 0 - 7eca: d1 e0 ldi r29, 0x01 ; 1 + 7ecc: 80 e0 ldi r24, 0x00 ; 0 + 7ece: c8 16 cp r12, r24 + 7ed0: 80 e7 ldi r24, 0x70 ; 112 + 7ed2: d8 06 cpc r13, r24 + 7ed4: 18 f4 brcc .+6 ; 0x7edc + 7ed6: f6 01 movw r30, r12 + 7ed8: b7 be out 0x37, r11 ; 55 + 7eda: e8 95 spm + 7edc: c0 e0 ldi r28, 0x00 ; 0 + 7ede: d1 e0 ldi r29, 0x01 ; 1 // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 7ecc: 63 d0 rcall .+198 ; 0x7f94 - 7ece: 89 93 st Y+, r24 + 7ee0: 62 d0 rcall .+196 ; 0x7fa6 + 7ee2: 89 93 st Y+, r24 while (--length); - 7ed0: 0c 17 cp r16, r28 - 7ed2: e1 f7 brne .-8 ; 0x7ecc + 7ee4: 0c 17 cp r16, r28 + 7ee6: e1 f7 brne .-8 ; 0x7ee0 // If we are in NRWW section, page erase has to be delayed until now. // Todo: Take RAMPZ into account if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 7ed4: f0 e0 ldi r31, 0x00 ; 0 - 7ed6: cf 16 cp r12, r31 - 7ed8: f0 e7 ldi r31, 0x70 ; 112 - 7eda: df 06 cpc r13, r31 - 7edc: 20 f0 brcs .+8 ; 0x7ee6 - 7ede: 83 e0 ldi r24, 0x03 ; 3 - 7ee0: f6 01 movw r30, r12 - 7ee2: 87 bf out 0x37, r24 ; 55 - 7ee4: e8 95 spm + 7ee8: f0 e0 ldi r31, 0x00 ; 0 + 7eea: cf 16 cp r12, r31 + 7eec: f0 e7 ldi r31, 0x70 ; 112 + 7eee: df 06 cpc r13, r31 + 7ef0: 18 f0 brcs .+6 ; 0x7ef8 + 7ef2: f6 01 movw r30, r12 + 7ef4: b7 be out 0x37, r11 ; 55 + 7ef6: e8 95 spm // Read command terminator, start reply verifySpace(); - 7ee6: 68 d0 rcall .+208 ; 0x7fb8 + 7ef8: 68 d0 rcall .+208 ; 0x7fca // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 7ee8: 07 b6 in r0, 0x37 ; 55 - 7eea: 00 fc sbrc r0, 0 - 7eec: fd cf rjmp .-6 ; 0x7ee8 - 7eee: a6 01 movw r20, r12 - 7ef0: a0 e0 ldi r26, 0x00 ; 0 - 7ef2: b1 e0 ldi r27, 0x01 ; 1 + 7efa: 07 b6 in r0, 0x37 ; 55 + 7efc: 00 fc sbrc r0, 0 + 7efe: fd cf rjmp .-6 ; 0x7efa + 7f00: a6 01 movw r20, r12 + 7f02: a0 e0 ldi r26, 0x00 ; 0 + 7f04: b1 e0 ldi r27, 0x01 ; 1 bufPtr = buff; addrPtr = (uint16_t)(void*)address; ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 7ef4: 2c 91 ld r18, X - 7ef6: 30 e0 ldi r19, 0x00 ; 0 + 7f06: 2c 91 ld r18, X + 7f08: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 7ef8: 11 96 adiw r26, 0x01 ; 1 - 7efa: 8c 91 ld r24, X - 7efc: 11 97 sbiw r26, 0x01 ; 1 - 7efe: 90 e0 ldi r25, 0x00 ; 0 - 7f00: 98 2f mov r25, r24 - 7f02: 88 27 eor r24, r24 - 7f04: 82 2b or r24, r18 - 7f06: 93 2b or r25, r19 + 7f0a: 11 96 adiw r26, 0x01 ; 1 + 7f0c: 8c 91 ld r24, X + 7f0e: 11 97 sbiw r26, 0x01 ; 1 + 7f10: 90 e0 ldi r25, 0x00 ; 0 + 7f12: 98 2f mov r25, r24 + 7f14: 88 27 eor r24, r24 + 7f16: 82 2b or r24, r18 + 7f18: 93 2b or r25, r19 #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 7f08: 12 96 adiw r26, 0x02 ; 2 + 7f1a: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 7f0a: fa 01 movw r30, r20 - 7f0c: 0c 01 movw r0, r24 - 7f0e: 97 be out 0x37, r9 ; 55 - 7f10: e8 95 spm - 7f12: 11 24 eor r1, r1 + 7f1c: fa 01 movw r30, r20 + 7f1e: 0c 01 movw r0, r24 + 7f20: 87 be out 0x37, r8 ; 55 + 7f22: e8 95 spm + 7f24: 11 24 eor r1, r1 addrPtr += 2; - 7f14: 4e 5f subi r20, 0xFE ; 254 - 7f16: 5f 4f sbci r21, 0xFF ; 255 + 7f26: 4e 5f subi r20, 0xFE ; 254 + 7f28: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 7f18: f1 e0 ldi r31, 0x01 ; 1 - 7f1a: a0 38 cpi r26, 0x80 ; 128 - 7f1c: bf 07 cpc r27, r31 - 7f1e: 51 f7 brne .-44 ; 0x7ef4 + 7f2a: f1 e0 ldi r31, 0x01 ; 1 + 7f2c: a0 38 cpi r26, 0x80 ; 128 + 7f2e: bf 07 cpc r27, r31 + 7f30: 51 f7 brne .-44 ; 0x7f06 // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 7f20: f6 01 movw r30, r12 - 7f22: a7 be out 0x37, r10 ; 55 - 7f24: e8 95 spm + 7f32: f6 01 movw r30, r12 + 7f34: a7 be out 0x37, r10 ; 55 + 7f36: e8 95 spm boot_spm_busy_wait(); - 7f26: 07 b6 in r0, 0x37 ; 55 - 7f28: 00 fc sbrc r0, 0 - 7f2a: fd cf rjmp .-6 ; 0x7f26 + 7f38: 07 b6 in r0, 0x37 ; 55 + 7f3a: 00 fc sbrc r0, 0 + 7f3c: fd cf rjmp .-6 ; 0x7f38 #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 7f2c: b7 be out 0x37, r11 ; 55 - 7f2e: e8 95 spm - 7f30: 26 c0 rjmp .+76 ; 0x7f7e + 7f3e: 97 be out 0x37, r9 ; 55 + 7f40: e8 95 spm + 7f42: 26 c0 rjmp .+76 ; 0x7f90 #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 7f32: 84 37 cpi r24, 0x74 ; 116 - 7f34: b1 f4 brne .+44 ; 0x7f62 + 7f44: 84 37 cpi r24, 0x74 ; 116 + 7f46: b1 f4 brne .+44 ; 0x7f74 // READ PAGE - we only read flash getch(); /* getlen() */ - 7f36: 2e d0 rcall .+92 ; 0x7f94 + 7f48: 2e d0 rcall .+92 ; 0x7fa6 length = getch(); - 7f38: 2d d0 rcall .+90 ; 0x7f94 - 7f3a: f8 2e mov r15, r24 + 7f4a: 2d d0 rcall .+90 ; 0x7fa6 + 7f4c: f8 2e mov r15, r24 getch(); - 7f3c: 2b d0 rcall .+86 ; 0x7f94 + 7f4e: 2b d0 rcall .+86 ; 0x7fa6 verifySpace(); - 7f3e: 3c d0 rcall .+120 ; 0x7fb8 - 7f40: f6 01 movw r30, r12 - 7f42: ef 2c mov r14, r15 + 7f50: 3c d0 rcall .+120 ; 0x7fca + 7f52: f6 01 movw r30, r12 + 7f54: ef 2c mov r14, r15 putch(result); address++; } while (--length); #else do putch(pgm_read_byte_near(address++)); - 7f44: 8f 01 movw r16, r30 - 7f46: 0f 5f subi r16, 0xFF ; 255 - 7f48: 1f 4f sbci r17, 0xFF ; 255 - 7f4a: 84 91 lpm r24, Z+ - 7f4c: 1b d0 rcall .+54 ; 0x7f84 + 7f56: 8f 01 movw r16, r30 + 7f58: 0f 5f subi r16, 0xFF ; 255 + 7f5a: 1f 4f sbci r17, 0xFF ; 255 + 7f5c: 84 91 lpm r24, Z+ + 7f5e: 1b d0 rcall .+54 ; 0x7f96 while (--length); - 7f4e: ea 94 dec r14 - 7f50: f8 01 movw r30, r16 - 7f52: c1 f7 brne .-16 ; 0x7f44 + 7f60: ea 94 dec r14 + 7f62: f8 01 movw r30, r16 + 7f64: c1 f7 brne .-16 ; 0x7f56 #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 7f54: 08 94 sec - 7f56: c1 1c adc r12, r1 - 7f58: d1 1c adc r13, r1 - 7f5a: fa 94 dec r15 - 7f5c: cf 0c add r12, r15 - 7f5e: d1 1c adc r13, r1 - 7f60: 0e c0 rjmp .+28 ; 0x7f7e + 7f66: 08 94 sec + 7f68: c1 1c adc r12, r1 + 7f6a: d1 1c adc r13, r1 + 7f6c: fa 94 dec r15 + 7f6e: cf 0c add r12, r15 + 7f70: d1 1c adc r13, r1 + 7f72: 0e c0 rjmp .+28 ; 0x7f90 #endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 7f62: 85 37 cpi r24, 0x75 ; 117 - 7f64: 39 f4 brne .+14 ; 0x7f74 + 7f74: 85 37 cpi r24, 0x75 ; 117 + 7f76: 39 f4 brne .+14 ; 0x7f86 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 7f66: 28 d0 rcall .+80 ; 0x7fb8 + 7f78: 28 d0 rcall .+80 ; 0x7fca putch(SIGNATURE_0); - 7f68: 8e e1 ldi r24, 0x1E ; 30 - 7f6a: 0c d0 rcall .+24 ; 0x7f84 + 7f7a: 8e e1 ldi r24, 0x1E ; 30 + 7f7c: 0c d0 rcall .+24 ; 0x7f96 putch(SIGNATURE_1); - 7f6c: 85 e9 ldi r24, 0x95 ; 149 - 7f6e: 0a d0 rcall .+20 ; 0x7f84 + 7f7e: 85 e9 ldi r24, 0x95 ; 149 + 7f80: 0a d0 rcall .+20 ; 0x7f96 putch(SIGNATURE_2); - 7f70: 8f e0 ldi r24, 0x0F ; 15 - 7f72: 98 cf rjmp .-208 ; 0x7ea4 + 7f82: 8f e0 ldi r24, 0x0F ; 15 + 7f84: 7a cf rjmp .-268 ; 0x7e7a } else if (ch == 'Q') { - 7f74: 81 35 cpi r24, 0x51 ; 81 - 7f76: 11 f4 brne .+4 ; 0x7f7c + 7f86: 81 35 cpi r24, 0x51 ; 81 + 7f88: 11 f4 brne .+4 ; 0x7f8e // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 7f78: 88 e0 ldi r24, 0x08 ; 8 - 7f7a: 18 d0 rcall .+48 ; 0x7fac + 7f8a: 88 e0 ldi r24, 0x08 ; 8 + 7f8c: 18 d0 rcall .+48 ; 0x7fbe verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 7f7c: 1d d0 rcall .+58 ; 0x7fb8 + 7f8e: 1d d0 rcall .+58 ; 0x7fca } putch(STK_OK); - 7f7e: 80 e1 ldi r24, 0x10 ; 16 - 7f80: 01 d0 rcall .+2 ; 0x7f84 - 7f82: 6a cf rjmp .-300 ; 0x7e58 + 7f90: 80 e1 ldi r24, 0x10 ; 16 + 7f92: 01 d0 rcall .+2 ; 0x7f96 + 7f94: 65 cf rjmp .-310 ; 0x7e60 -00007f84 : +00007f96 : } } void putch(char ch) { - 7f84: 98 2f mov r25, r24 + 7f96: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); - 7f86: 80 91 c0 00 lds r24, 0x00C0 - 7f8a: 85 ff sbrs r24, 5 - 7f8c: fc cf rjmp .-8 ; 0x7f86 + 7f98: 80 91 c0 00 lds r24, 0x00C0 + 7f9c: 85 ff sbrs r24, 5 + 7f9e: fc cf rjmp .-8 ; 0x7f98 UDR0 = ch; - 7f8e: 90 93 c6 00 sts 0x00C6, r25 + 7fa0: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 7f92: 08 95 ret + 7fa4: 08 95 ret -00007f94 : +00007fa6 : [uartBit] "I" (UART_RX_BIT) : "r25" ); #else while(!(UCSR0A & _BV(RXC0))) - 7f94: 80 91 c0 00 lds r24, 0x00C0 - 7f98: 87 ff sbrs r24, 7 - 7f9a: fc cf rjmp .-8 ; 0x7f94 + 7fa6: 80 91 c0 00 lds r24, 0x00C0 + 7faa: 87 ff sbrs r24, 7 + 7fac: fc cf rjmp .-8 ; 0x7fa6 ; if (!(UCSR0A & _BV(FE0))) { - 7f9c: 80 91 c0 00 lds r24, 0x00C0 - 7fa0: 84 fd sbrc r24, 4 - 7fa2: 01 c0 rjmp .+2 ; 0x7fa6 + 7fae: 80 91 c0 00 lds r24, 0x00C0 + 7fb2: 84 fd sbrc r24, 4 + 7fb4: 01 c0 rjmp .+2 ; 0x7fb8 } #endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 7fa4: a8 95 wdr + 7fb6: a8 95 wdr * don't care that an invalid char is returned...) */ watchdogReset(); } ch = UDR0; - 7fa6: 80 91 c6 00 lds r24, 0x00C6 + 7fb8: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 7faa: 08 95 ret + 7fbc: 08 95 ret -00007fac : +00007fbe : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 7fac: e0 e6 ldi r30, 0x60 ; 96 - 7fae: f0 e0 ldi r31, 0x00 ; 0 - 7fb0: 98 e1 ldi r25, 0x18 ; 24 - 7fb2: 90 83 st Z, r25 + 7fbe: e0 e6 ldi r30, 0x60 ; 96 + 7fc0: f0 e0 ldi r31, 0x00 ; 0 + 7fc2: 98 e1 ldi r25, 0x18 ; 24 + 7fc4: 90 83 st Z, r25 WDTCSR = x; - 7fb4: 80 83 st Z, r24 + 7fc6: 80 83 st Z, r24 } - 7fb6: 08 95 ret + 7fc8: 08 95 ret -00007fb8 : +00007fca : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) { - 7fb8: ed df rcall .-38 ; 0x7f94 - 7fba: 80 32 cpi r24, 0x20 ; 32 - 7fbc: 19 f0 breq .+6 ; 0x7fc4 + 7fca: ed df rcall .-38 ; 0x7fa6 + 7fcc: 80 32 cpi r24, 0x20 ; 32 + 7fce: 19 f0 breq .+6 ; 0x7fd6 watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 7fbe: 88 e0 ldi r24, 0x08 ; 8 - 7fc0: f5 df rcall .-22 ; 0x7fac - 7fc2: ff cf rjmp .-2 ; 0x7fc2 + 7fd0: 88 e0 ldi r24, 0x08 ; 8 + 7fd2: f5 df rcall .-22 ; 0x7fbe + 7fd4: ff cf rjmp .-2 ; 0x7fd4 while (1) // and busy-loop so that WD causes ; // a reset and app start. } putch(STK_INSYNC); - 7fc4: 84 e1 ldi r24, 0x14 ; 20 + 7fd6: 84 e1 ldi r24, 0x14 ; 20 } - 7fc6: de cf rjmp .-68 ; 0x7f84 + 7fd8: de cf rjmp .-68 ; 0x7f96 -00007fc8 : +00007fda : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 7fc8: 1f 93 push r17 - 7fca: 18 2f mov r17, r24 + 7fda: 1f 93 push r17 + 7fdc: 18 2f mov r17, r24 do getch(); while (--count); - 7fcc: e3 df rcall .-58 ; 0x7f94 - 7fce: 11 50 subi r17, 0x01 ; 1 - 7fd0: e9 f7 brne .-6 ; 0x7fcc + 7fde: e3 df rcall .-58 ; 0x7fa6 + 7fe0: 11 50 subi r17, 0x01 ; 1 + 7fe2: e9 f7 brne .-6 ; 0x7fde verifySpace(); - 7fd2: f2 df rcall .-28 ; 0x7fb8 + 7fe4: f2 df rcall .-28 ; 0x7fca } - 7fd4: 1f 91 pop r17 - 7fd6: 08 95 ret + 7fe6: 1f 91 pop r17 + 7fe8: 08 95 ret -00007fd8 : +00007fea : WDTCSR = _BV(WDCE) | _BV(WDE); WDTCSR = x; } void appStart() { watchdogConfig(WATCHDOG_OFF); - 7fd8: 80 e0 ldi r24, 0x00 ; 0 - 7fda: e8 df rcall .-48 ; 0x7fac + 7fea: 80 e0 ldi r24, 0x00 ; 0 + 7fec: e8 df rcall .-48 ; 0x7fbe __asm__ __volatile__ ( - 7fdc: ee 27 eor r30, r30 - 7fde: ff 27 eor r31, r31 - 7fe0: 09 94 ijmp + 7fee: ee 27 eor r30, r30 + 7ff0: ff 27 eor r31, r31 + 7ff2: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex deleted file mode 100644 index 499c631..0000000 --- a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex +++ /dev/null @@ -1,34 +0,0 @@ -:107E0000112484B714BE81FFE7D085E08093810000 -:107E100082E08093C00088E18093C10086E0809377 -:107E2000C20088E08093C4008EE0C0D0259A86E02E -:107E300028E13EEF91E0309385002093840096BBCB -:107E4000B09BFECF1D9AA8958150A9F799249394D1 -:107E5000A5E0AA2EF1E1BF2E9DD0813421F481E06E -:107E6000B3D083E01FC0823411F484E103C08534B1 -:107E700019F485E0A9D083C0853579F48BD0E82E3C -:107E8000FF2488D0082F10E0102F00270E291F296B -:107E9000000F111F91D0680172C0863529F484E06B -:107EA00093D080E06FD06BC0843609F042C072D0AE -:107EB00071D0082F6FD080E0C81680E7D80620F474 -:107EC00083E0F60187BFE895C0E0D1E063D08993F5 -:107ED0000C17E1F7F0E0CF16F0E7DF0620F083E0C3 -:107EE000F60187BFE89568D007B600FCFDCFA60174 -:107EF000A0E0B1E02C9130E011968C91119790E0C8 -:107F0000982F8827822B932B1296FA010C0197BE8B -:107F1000E89511244E5F5F4FF1E0A038BF0751F79D -:107F2000F601A7BEE89507B600FCFDCFB7BEE89501 -:107F300026C08437B1F42ED02DD0F82E2BD03CD0D3 -:107F4000F601EF2C8F010F5F1F4F84911BD0EA9435 -:107F5000F801C1F70894C11CD11CFA94CF0CD11CB4 -:107F60000EC0853739F428D08EE10CD085E90AD0CF -:107F70008FE098CF813511F488E018D01DD080E1D2 -:107F800001D06ACF982F8091C00085FFFCCF9093DD -:107F9000C60008958091C00087FFFCCF8091C0008B -:107FA00084FD01C0A8958091C6000895E0E6F0E048 -:107FB00098E1908380830895EDDF803219F088E0A6 -:107FC000F5DFFFCF84E1DECF1F93182FE3DF1150E1 -:107FD000E9F7F2DF1F91089580E0E8DFEE27FF2741 -:027FE000099402 -:027FFE0003047A -:0400000300007E007B -:00000001FF diff --git a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst deleted file mode 100644 index 0577bdc..0000000 --- a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst +++ /dev/null @@ -1,571 +0,0 @@ - -optiboot_atmega328_pro_8MHz.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001e2 00007e00 00007e00 00000054 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00007ffe 00007ffe 00000236 2**0 - CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00007e00
: -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 7e00: 11 24 eor r1, r1 -#ifdef __AVR_ATmega8__ - SP=RAMEND; // This is done by hardware reset -#endif - - // Adaboot no-wait mod - ch = MCUSR; - 7e02: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 7e04: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 7e06: 81 ff sbrs r24, 1 - 7e08: e7 d0 rcall .+462 ; 0x7fd8 - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 7e0a: 85 e0 ldi r24, 0x05 ; 5 - 7e0c: 80 93 81 00 sts 0x0081, r24 - UCSRA = _BV(U2X); //Double speed mode USART - UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx - UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 - UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); -#else - UCSR0A = _BV(U2X0); //Double speed mode USART0 - 7e10: 82 e0 ldi r24, 0x02 ; 2 - 7e12: 80 93 c0 00 sts 0x00C0, r24 - UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 7e16: 88 e1 ldi r24, 0x18 ; 24 - 7e18: 80 93 c1 00 sts 0x00C1, r24 - UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 7e1c: 86 e0 ldi r24, 0x06 ; 6 - 7e1e: 80 93 c2 00 sts 0x00C2, r24 - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 7e22: 88 e0 ldi r24, 0x08 ; 8 - 7e24: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 7e28: 8e e0 ldi r24, 0x0E ; 14 - 7e2a: c0 d0 rcall .+384 ; 0x7fac - - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 7e2c: 25 9a sbi 0x04, 5 ; 4 - 7e2e: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 7e30: 28 e1 ldi r18, 0x18 ; 24 - 7e32: 3e ef ldi r19, 0xFE ; 254 - TIFR1 = _BV(TOV1); - 7e34: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 7e36: 30 93 85 00 sts 0x0085, r19 - 7e3a: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 7e3e: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 7e40: b0 9b sbis 0x16, 0 ; 22 - 7e42: fe cf rjmp .-4 ; 0x7e40 -#ifdef __AVR_ATmega8__ - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 7e44: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 7e46: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 7e48: 81 50 subi r24, 0x01 ; 1 - 7e4a: a9 f7 brne .-22 ; 0x7e36 - /* get character from UART */ - ch = getch(); - - if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 7e4c: 99 24 eor r9, r9 - 7e4e: 93 94 inc r9 - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - addrPtr += 2; - } while (--ch); - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 7e50: a5 e0 ldi r26, 0x05 ; 5 - 7e52: aa 2e mov r10, r26 - boot_spm_busy_wait(); - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 7e54: f1 e1 ldi r31, 0x11 ; 17 - 7e56: bf 2e mov r11, r31 -#endif - - /* Forever loop */ - for (;;) { - /* get character from UART */ - ch = getch(); - 7e58: 9d d0 rcall .+314 ; 0x7f94 - - if(ch == STK_GET_PARAMETER) { - 7e5a: 81 34 cpi r24, 0x41 ; 65 - 7e5c: 21 f4 brne .+8 ; 0x7e66 - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 7e5e: 81 e0 ldi r24, 0x01 ; 1 - 7e60: b3 d0 rcall .+358 ; 0x7fc8 - putch(0x03); - 7e62: 83 e0 ldi r24, 0x03 ; 3 - 7e64: 1f c0 rjmp .+62 ; 0x7ea4 - } - else if(ch == STK_SET_DEVICE) { - 7e66: 82 34 cpi r24, 0x42 ; 66 - 7e68: 11 f4 brne .+4 ; 0x7e6e - // SET DEVICE is ignored - getNch(20); - 7e6a: 84 e1 ldi r24, 0x14 ; 20 - 7e6c: 03 c0 rjmp .+6 ; 0x7e74 - } - else if(ch == STK_SET_DEVICE_EXT) { - 7e6e: 85 34 cpi r24, 0x45 ; 69 - 7e70: 19 f4 brne .+6 ; 0x7e78 - // SET DEVICE EXT is ignored - getNch(5); - 7e72: 85 e0 ldi r24, 0x05 ; 5 - 7e74: a9 d0 rcall .+338 ; 0x7fc8 - 7e76: 83 c0 rjmp .+262 ; 0x7f7e - } - else if(ch == STK_LOAD_ADDRESS) { - 7e78: 85 35 cpi r24, 0x55 ; 85 - 7e7a: 79 f4 brne .+30 ; 0x7e9a - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 7e7c: 8b d0 rcall .+278 ; 0x7f94 - newAddress = (newAddress & 0xff) | (getch() << 8); - 7e7e: e8 2e mov r14, r24 - 7e80: ff 24 eor r15, r15 - 7e82: 88 d0 rcall .+272 ; 0x7f94 - 7e84: 08 2f mov r16, r24 - 7e86: 10 e0 ldi r17, 0x00 ; 0 - 7e88: 10 2f mov r17, r16 - 7e8a: 00 27 eor r16, r16 - 7e8c: 0e 29 or r16, r14 - 7e8e: 1f 29 or r17, r15 -#ifdef RAMPZ - // Transfer top bit to RAMPZ - RAMPZ = (newAddress & 0x8000) ? 1 : 0; -#endif - newAddress += newAddress; // Convert from word address to byte address - 7e90: 00 0f add r16, r16 - 7e92: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 7e94: 91 d0 rcall .+290 ; 0x7fb8 - 7e96: 68 01 movw r12, r16 - 7e98: 72 c0 rjmp .+228 ; 0x7f7e - } - else if(ch == STK_UNIVERSAL) { - 7e9a: 86 35 cpi r24, 0x56 ; 86 - 7e9c: 29 f4 brne .+10 ; 0x7ea8 - // UNIVERSAL command is ignored - getNch(4); - 7e9e: 84 e0 ldi r24, 0x04 ; 4 - 7ea0: 93 d0 rcall .+294 ; 0x7fc8 - putch(0x00); - 7ea2: 80 e0 ldi r24, 0x00 ; 0 - 7ea4: 6f d0 rcall .+222 ; 0x7f84 - 7ea6: 6b c0 rjmp .+214 ; 0x7f7e - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 7ea8: 84 36 cpi r24, 0x64 ; 100 - 7eaa: 09 f0 breq .+2 ; 0x7eae - 7eac: 42 c0 rjmp .+132 ; 0x7f32 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t *bufPtr; - uint16_t addrPtr; - - getch(); /* getlen() */ - 7eae: 72 d0 rcall .+228 ; 0x7f94 - length = getch(); - 7eb0: 71 d0 rcall .+226 ; 0x7f94 - 7eb2: 08 2f mov r16, r24 - getch(); - 7eb4: 6f d0 rcall .+222 ; 0x7f94 - - // If we are in RWW section, immediately start page erase - if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 7eb6: 80 e0 ldi r24, 0x00 ; 0 - 7eb8: c8 16 cp r12, r24 - 7eba: 80 e7 ldi r24, 0x70 ; 112 - 7ebc: d8 06 cpc r13, r24 - 7ebe: 20 f4 brcc .+8 ; 0x7ec8 - 7ec0: 83 e0 ldi r24, 0x03 ; 3 - 7ec2: f6 01 movw r30, r12 - 7ec4: 87 bf out 0x37, r24 ; 55 - 7ec6: e8 95 spm - 7ec8: c0 e0 ldi r28, 0x00 ; 0 - 7eca: d1 e0 ldi r29, 0x01 ; 1 - - // While that is going on, read in page contents - bufPtr = buff; - do *bufPtr++ = getch(); - 7ecc: 63 d0 rcall .+198 ; 0x7f94 - 7ece: 89 93 st Y+, r24 - while (--length); - 7ed0: 0c 17 cp r16, r28 - 7ed2: e1 f7 brne .-8 ; 0x7ecc - - // If we are in NRWW section, page erase has to be delayed until now. - // Todo: Take RAMPZ into account - if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 7ed4: f0 e0 ldi r31, 0x00 ; 0 - 7ed6: cf 16 cp r12, r31 - 7ed8: f0 e7 ldi r31, 0x70 ; 112 - 7eda: df 06 cpc r13, r31 - 7edc: 20 f0 brcs .+8 ; 0x7ee6 - 7ede: 83 e0 ldi r24, 0x03 ; 3 - 7ee0: f6 01 movw r30, r12 - 7ee2: 87 bf out 0x37, r24 ; 55 - 7ee4: e8 95 spm - - // Read command terminator, start reply - verifySpace(); - 7ee6: 68 d0 rcall .+208 ; 0x7fb8 - - // If only a partial page is to be programmed, the erase might not be complete. - // So check that here - boot_spm_busy_wait(); - 7ee8: 07 b6 in r0, 0x37 ; 55 - 7eea: 00 fc sbrc r0, 0 - 7eec: fd cf rjmp .-6 ; 0x7ee8 - 7eee: a6 01 movw r20, r12 - 7ef0: a0 e0 ldi r26, 0x00 ; 0 - 7ef2: b1 e0 ldi r27, 0x01 ; 1 - bufPtr = buff; - addrPtr = (uint16_t)(void*)address; - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - 7ef4: 2c 91 ld r18, X - 7ef6: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 7ef8: 11 96 adiw r26, 0x01 ; 1 - 7efa: 8c 91 ld r24, X - 7efc: 11 97 sbiw r26, 0x01 ; 1 - 7efe: 90 e0 ldi r25, 0x00 ; 0 - 7f00: 98 2f mov r25, r24 - 7f02: 88 27 eor r24, r24 - 7f04: 82 2b or r24, r18 - 7f06: 93 2b or r25, r19 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 7f08: 12 96 adiw r26, 0x02 ; 2 - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 7f0a: fa 01 movw r30, r20 - 7f0c: 0c 01 movw r0, r24 - 7f0e: 97 be out 0x37, r9 ; 55 - 7f10: e8 95 spm - 7f12: 11 24 eor r1, r1 - addrPtr += 2; - 7f14: 4e 5f subi r20, 0xFE ; 254 - 7f16: 5f 4f sbci r21, 0xFF ; 255 - } while (--ch); - 7f18: f1 e0 ldi r31, 0x01 ; 1 - 7f1a: a0 38 cpi r26, 0x80 ; 128 - 7f1c: bf 07 cpc r27, r31 - 7f1e: 51 f7 brne .-44 ; 0x7ef4 - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 7f20: f6 01 movw r30, r12 - 7f22: a7 be out 0x37, r10 ; 55 - 7f24: e8 95 spm - boot_spm_busy_wait(); - 7f26: 07 b6 in r0, 0x37 ; 55 - 7f28: 00 fc sbrc r0, 0 - 7f2a: fd cf rjmp .-6 ; 0x7f26 - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 7f2c: b7 be out 0x37, r11 ; 55 - 7f2e: e8 95 spm - 7f30: 26 c0 rjmp .+76 ; 0x7f7e -#endif - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 7f32: 84 37 cpi r24, 0x74 ; 116 - 7f34: b1 f4 brne .+44 ; 0x7f62 - // READ PAGE - we only read flash - getch(); /* getlen() */ - 7f36: 2e d0 rcall .+92 ; 0x7f94 - length = getch(); - 7f38: 2d d0 rcall .+90 ; 0x7f94 - 7f3a: f8 2e mov r15, r24 - getch(); - 7f3c: 2b d0 rcall .+86 ; 0x7f94 - - verifySpace(); - 7f3e: 3c d0 rcall .+120 ; 0x7fb8 - 7f40: f6 01 movw r30, r12 - 7f42: ef 2c mov r14, r15 - putch(result); - address++; - } - while (--length); -#else - do putch(pgm_read_byte_near(address++)); - 7f44: 8f 01 movw r16, r30 - 7f46: 0f 5f subi r16, 0xFF ; 255 - 7f48: 1f 4f sbci r17, 0xFF ; 255 - 7f4a: 84 91 lpm r24, Z+ - 7f4c: 1b d0 rcall .+54 ; 0x7f84 - while (--length); - 7f4e: ea 94 dec r14 - 7f50: f8 01 movw r30, r16 - 7f52: c1 f7 brne .-16 ; 0x7f44 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 7f54: 08 94 sec - 7f56: c1 1c adc r12, r1 - 7f58: d1 1c adc r13, r1 - 7f5a: fa 94 dec r15 - 7f5c: cf 0c add r12, r15 - 7f5e: d1 1c adc r13, r1 - 7f60: 0e c0 rjmp .+28 ; 0x7f7e -#endif -#endif - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 7f62: 85 37 cpi r24, 0x75 ; 117 - 7f64: 39 f4 brne .+14 ; 0x7f74 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 7f66: 28 d0 rcall .+80 ; 0x7fb8 - putch(SIGNATURE_0); - 7f68: 8e e1 ldi r24, 0x1E ; 30 - 7f6a: 0c d0 rcall .+24 ; 0x7f84 - putch(SIGNATURE_1); - 7f6c: 85 e9 ldi r24, 0x95 ; 149 - 7f6e: 0a d0 rcall .+20 ; 0x7f84 - putch(SIGNATURE_2); - 7f70: 8f e0 ldi r24, 0x0F ; 15 - 7f72: 98 cf rjmp .-208 ; 0x7ea4 - } - else if (ch == 'Q') { - 7f74: 81 35 cpi r24, 0x51 ; 81 - 7f76: 11 f4 brne .+4 ; 0x7f7c - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 7f78: 88 e0 ldi r24, 0x08 ; 8 - 7f7a: 18 d0 rcall .+48 ; 0x7fac - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 7f7c: 1d d0 rcall .+58 ; 0x7fb8 - } - putch(STK_OK); - 7f7e: 80 e1 ldi r24, 0x10 ; 16 - 7f80: 01 d0 rcall .+2 ; 0x7f84 - 7f82: 6a cf rjmp .-300 ; 0x7e58 - -00007f84 : - } -} - -void putch(char ch) { - 7f84: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UCSR0A & _BV(UDRE0))); - 7f86: 80 91 c0 00 lds r24, 0x00C0 - 7f8a: 85 ff sbrs r24, 5 - 7f8c: fc cf rjmp .-8 ; 0x7f86 - UDR0 = ch; - 7f8e: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 7f92: 08 95 ret - -00007f94 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))) - 7f94: 80 91 c0 00 lds r24, 0x00C0 - 7f98: 87 ff sbrs r24, 7 - 7f9a: fc cf rjmp .-8 ; 0x7f94 - ; - if (!(UCSR0A & _BV(FE0))) { - 7f9c: 80 91 c0 00 lds r24, 0x00C0 - 7fa0: 84 fd sbrc r24, 4 - 7fa2: 01 c0 rjmp .+2 ; 0x7fa6 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 7fa4: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UDR0; - 7fa6: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 7faa: 08 95 ret - -00007fac : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 7fac: e0 e6 ldi r30, 0x60 ; 96 - 7fae: f0 e0 ldi r31, 0x00 ; 0 - 7fb0: 98 e1 ldi r25, 0x18 ; 24 - 7fb2: 90 83 st Z, r25 - WDTCSR = x; - 7fb4: 80 83 st Z, r24 -} - 7fb6: 08 95 ret - -00007fb8 : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 7fb8: ed df rcall .-38 ; 0x7f94 - 7fba: 80 32 cpi r24, 0x20 ; 32 - 7fbc: 19 f0 breq .+6 ; 0x7fc4 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 7fbe: 88 e0 ldi r24, 0x08 ; 8 - 7fc0: f5 df rcall .-22 ; 0x7fac - 7fc2: ff cf rjmp .-2 ; 0x7fc2 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 7fc4: 84 e1 ldi r24, 0x14 ; 20 -} - 7fc6: de cf rjmp .-68 ; 0x7f84 - -00007fc8 : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 7fc8: 1f 93 push r17 - 7fca: 18 2f mov r17, r24 - do getch(); while (--count); - 7fcc: e3 df rcall .-58 ; 0x7f94 - 7fce: 11 50 subi r17, 0x01 ; 1 - 7fd0: e9 f7 brne .-6 ; 0x7fcc - verifySpace(); - 7fd2: f2 df rcall .-28 ; 0x7fb8 -} - 7fd4: 1f 91 pop r17 - 7fd6: 08 95 ret - -00007fd8 : - WDTCSR = _BV(WDCE) | _BV(WDE); - WDTCSR = x; -} - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 7fd8: 80 e0 ldi r24, 0x00 ; 0 - 7fda: e8 df rcall .-48 ; 0x7fac - __asm__ __volatile__ ( - 7fdc: ee 27 eor r30, r30 - 7fde: ff 27 eor r31, r31 - 7fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_diecimila.hex b/bootloaders/optiboot/optiboot_diecimila.hex deleted file mode 100644 index b685a4e..0000000 --- a/bootloaders/optiboot/optiboot_diecimila.hex +++ /dev/null @@ -1,34 +0,0 @@ -:103E0000112484B714BE81FFE7D085E08093810040 -:103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20080E18093C4008EE0C0D0259A86E075 -:103E300020E33CEF91E0309385002093840096BB13 -:103E4000B09BFECF1D9AA8958150A9F79924939411 -:103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE -:103E6000B3D083E01FC0823411F484E103C08534F1 -:103E700019F485E0A9D083C0853579F48BD0E82E7C -:103E8000FF2488D0082F10E0102F00270E291F29AB -:103E9000000F111F91D0680172C0863529F484E0AB -:103EA00093D080E06FD06BC0843609F042C072D0EE -:103EB00071D0082F6FD080E0C81688E3D80620F4B0 -:103EC00083E0F60187BFE895C0E0D1E063D0899335 -:103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF -:103EE000F60187BFE89568D007B600FCFDCFA601B4 -:103EF000A0E0B1E02C9130E011968C91119790E008 -:103F0000982F8827822B932B1296FA010C0197BECB -:103F1000E89511244E5F5F4FF1E0A038BF0751F7DD -:103F2000F601A7BEE89507B600FCFDCFB7BEE89541 -:103F300026C08437B1F42ED02DD0F82E2BD03CD013 -:103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 -:103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 -:103F60000EC0853739F428D08EE10CD084E90AD010 -:103F700086E098CF813511F488E018D01DD080E11B -:103F800001D06ACF982F8091C00085FFFCCF90931D -:103F9000C60008958091C00087FFFCCF8091C000CB -:103FA00084FD01C0A8958091C6000895E0E6F0E088 -:103FB00098E1908380830895EDDF803219F088E0E6 -:103FC000F5DFFFCF84E1DECF1F93182FE3DF115021 -:103FD000E9F7F2DF1F91089580E0E8DFEE27FF2781 -:023FE000099442 -:023FFE000304BA -:0400000300003E00BB -:00000001FF diff --git a/bootloaders/optiboot/optiboot_diecimila.lst b/bootloaders/optiboot/optiboot_diecimila.lst deleted file mode 100644 index 357dc11..0000000 --- a/bootloaders/optiboot/optiboot_diecimila.lst +++ /dev/null @@ -1,571 +0,0 @@ - -optiboot_diecimila.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001e2 00003e00 00003e00 00000054 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 00000236 2**0 - CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00003e00
: -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3e00: 11 24 eor r1, r1 -#ifdef __AVR_ATmega8__ - SP=RAMEND; // This is done by hardware reset -#endif - - // Adaboot no-wait mod - ch = MCUSR; - 3e02: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 3e04: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 3e06: 81 ff sbrs r24, 1 - 3e08: e7 d0 rcall .+462 ; 0x3fd8 - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 3e0a: 85 e0 ldi r24, 0x05 ; 5 - 3e0c: 80 93 81 00 sts 0x0081, r24 - UCSRA = _BV(U2X); //Double speed mode USART - UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx - UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 - UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); -#else - UCSR0A = _BV(U2X0); //Double speed mode USART0 - 3e10: 82 e0 ldi r24, 0x02 ; 2 - 3e12: 80 93 c0 00 sts 0x00C0, r24 - UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 3e16: 88 e1 ldi r24, 0x18 ; 24 - 3e18: 80 93 c1 00 sts 0x00C1, r24 - UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 3e1c: 86 e0 ldi r24, 0x06 ; 6 - 3e1e: 80 93 c2 00 sts 0x00C2, r24 - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e22: 80 e1 ldi r24, 0x10 ; 16 - 3e24: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: c0 d0 rcall .+384 ; 0x3fac - - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 3e2c: 25 9a sbi 0x04, 5 ; 4 - 3e2e: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e30: 20 e3 ldi r18, 0x30 ; 48 - 3e32: 3c ef ldi r19, 0xFC ; 252 - TIFR1 = _BV(TOV1); - 3e34: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e36: 30 93 85 00 sts 0x0085, r19 - 3e3a: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 3e3e: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 3e40: b0 9b sbis 0x16, 0 ; 22 - 3e42: fe cf rjmp .-4 ; 0x3e40 -#ifdef __AVR_ATmega8__ - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 3e44: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3e46: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 3e48: 81 50 subi r24, 0x01 ; 1 - 3e4a: a9 f7 brne .-22 ; 0x3e36 - /* get character from UART */ - ch = getch(); - - if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e4c: 99 24 eor r9, r9 - 3e4e: 93 94 inc r9 - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - addrPtr += 2; - } while (--ch); - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3e50: a5 e0 ldi r26, 0x05 ; 5 - 3e52: aa 2e mov r10, r26 - boot_spm_busy_wait(); - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3e54: f1 e1 ldi r31, 0x11 ; 17 - 3e56: bf 2e mov r11, r31 -#endif - - /* Forever loop */ - for (;;) { - /* get character from UART */ - ch = getch(); - 3e58: 9d d0 rcall .+314 ; 0x3f94 - - if(ch == STK_GET_PARAMETER) { - 3e5a: 81 34 cpi r24, 0x41 ; 65 - 3e5c: 21 f4 brne .+8 ; 0x3e66 - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: b3 d0 rcall .+358 ; 0x3fc8 - putch(0x03); - 3e62: 83 e0 ldi r24, 0x03 ; 3 - 3e64: 1f c0 rjmp .+62 ; 0x3ea4 - } - else if(ch == STK_SET_DEVICE) { - 3e66: 82 34 cpi r24, 0x42 ; 66 - 3e68: 11 f4 brne .+4 ; 0x3e6e - // SET DEVICE is ignored - getNch(20); - 3e6a: 84 e1 ldi r24, 0x14 ; 20 - 3e6c: 03 c0 rjmp .+6 ; 0x3e74 - } - else if(ch == STK_SET_DEVICE_EXT) { - 3e6e: 85 34 cpi r24, 0x45 ; 69 - 3e70: 19 f4 brne .+6 ; 0x3e78 - // SET DEVICE EXT is ignored - getNch(5); - 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: a9 d0 rcall .+338 ; 0x3fc8 - 3e76: 83 c0 rjmp .+262 ; 0x3f7e - } - else if(ch == STK_LOAD_ADDRESS) { - 3e78: 85 35 cpi r24, 0x55 ; 85 - 3e7a: 79 f4 brne .+30 ; 0x3e9a - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 3e7c: 8b d0 rcall .+278 ; 0x3f94 - newAddress = (newAddress & 0xff) | (getch() << 8); - 3e7e: e8 2e mov r14, r24 - 3e80: ff 24 eor r15, r15 - 3e82: 88 d0 rcall .+272 ; 0x3f94 - 3e84: 08 2f mov r16, r24 - 3e86: 10 e0 ldi r17, 0x00 ; 0 - 3e88: 10 2f mov r17, r16 - 3e8a: 00 27 eor r16, r16 - 3e8c: 0e 29 or r16, r14 - 3e8e: 1f 29 or r17, r15 -#ifdef RAMPZ - // Transfer top bit to RAMPZ - RAMPZ = (newAddress & 0x8000) ? 1 : 0; -#endif - newAddress += newAddress; // Convert from word address to byte address - 3e90: 00 0f add r16, r16 - 3e92: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 3e94: 91 d0 rcall .+290 ; 0x3fb8 - 3e96: 68 01 movw r12, r16 - 3e98: 72 c0 rjmp .+228 ; 0x3f7e - } - else if(ch == STK_UNIVERSAL) { - 3e9a: 86 35 cpi r24, 0x56 ; 86 - 3e9c: 29 f4 brne .+10 ; 0x3ea8 - // UNIVERSAL command is ignored - getNch(4); - 3e9e: 84 e0 ldi r24, 0x04 ; 4 - 3ea0: 93 d0 rcall .+294 ; 0x3fc8 - putch(0x00); - 3ea2: 80 e0 ldi r24, 0x00 ; 0 - 3ea4: 6f d0 rcall .+222 ; 0x3f84 - 3ea6: 6b c0 rjmp .+214 ; 0x3f7e - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 3ea8: 84 36 cpi r24, 0x64 ; 100 - 3eaa: 09 f0 breq .+2 ; 0x3eae - 3eac: 42 c0 rjmp .+132 ; 0x3f32 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t *bufPtr; - uint16_t addrPtr; - - getch(); /* getlen() */ - 3eae: 72 d0 rcall .+228 ; 0x3f94 - length = getch(); - 3eb0: 71 d0 rcall .+226 ; 0x3f94 - 3eb2: 08 2f mov r16, r24 - getch(); - 3eb4: 6f d0 rcall .+222 ; 0x3f94 - - // If we are in RWW section, immediately start page erase - if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3eb6: 80 e0 ldi r24, 0x00 ; 0 - 3eb8: c8 16 cp r12, r24 - 3eba: 88 e3 ldi r24, 0x38 ; 56 - 3ebc: d8 06 cpc r13, r24 - 3ebe: 20 f4 brcc .+8 ; 0x3ec8 - 3ec0: 83 e0 ldi r24, 0x03 ; 3 - 3ec2: f6 01 movw r30, r12 - 3ec4: 87 bf out 0x37, r24 ; 55 - 3ec6: e8 95 spm - 3ec8: c0 e0 ldi r28, 0x00 ; 0 - 3eca: d1 e0 ldi r29, 0x01 ; 1 - - // While that is going on, read in page contents - bufPtr = buff; - do *bufPtr++ = getch(); - 3ecc: 63 d0 rcall .+198 ; 0x3f94 - 3ece: 89 93 st Y+, r24 - while (--length); - 3ed0: 0c 17 cp r16, r28 - 3ed2: e1 f7 brne .-8 ; 0x3ecc - - // If we are in NRWW section, page erase has to be delayed until now. - // Todo: Take RAMPZ into account - if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3ed4: f0 e0 ldi r31, 0x00 ; 0 - 3ed6: cf 16 cp r12, r31 - 3ed8: f8 e3 ldi r31, 0x38 ; 56 - 3eda: df 06 cpc r13, r31 - 3edc: 20 f0 brcs .+8 ; 0x3ee6 - 3ede: 83 e0 ldi r24, 0x03 ; 3 - 3ee0: f6 01 movw r30, r12 - 3ee2: 87 bf out 0x37, r24 ; 55 - 3ee4: e8 95 spm - - // Read command terminator, start reply - verifySpace(); - 3ee6: 68 d0 rcall .+208 ; 0x3fb8 - - // If only a partial page is to be programmed, the erase might not be complete. - // So check that here - boot_spm_busy_wait(); - 3ee8: 07 b6 in r0, 0x37 ; 55 - 3eea: 00 fc sbrc r0, 0 - 3eec: fd cf rjmp .-6 ; 0x3ee8 - 3eee: a6 01 movw r20, r12 - 3ef0: a0 e0 ldi r26, 0x00 ; 0 - 3ef2: b1 e0 ldi r27, 0x01 ; 1 - bufPtr = buff; - addrPtr = (uint16_t)(void*)address; - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - 3ef4: 2c 91 ld r18, X - 3ef6: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 3ef8: 11 96 adiw r26, 0x01 ; 1 - 3efa: 8c 91 ld r24, X - 3efc: 11 97 sbiw r26, 0x01 ; 1 - 3efe: 90 e0 ldi r25, 0x00 ; 0 - 3f00: 98 2f mov r25, r24 - 3f02: 88 27 eor r24, r24 - 3f04: 82 2b or r24, r18 - 3f06: 93 2b or r25, r19 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f08: 12 96 adiw r26, 0x02 ; 2 - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f0a: fa 01 movw r30, r20 - 3f0c: 0c 01 movw r0, r24 - 3f0e: 97 be out 0x37, r9 ; 55 - 3f10: e8 95 spm - 3f12: 11 24 eor r1, r1 - addrPtr += 2; - 3f14: 4e 5f subi r20, 0xFE ; 254 - 3f16: 5f 4f sbci r21, 0xFF ; 255 - } while (--ch); - 3f18: f1 e0 ldi r31, 0x01 ; 1 - 3f1a: a0 38 cpi r26, 0x80 ; 128 - 3f1c: bf 07 cpc r27, r31 - 3f1e: 51 f7 brne .-44 ; 0x3ef4 - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3f20: f6 01 movw r30, r12 - 3f22: a7 be out 0x37, r10 ; 55 - 3f24: e8 95 spm - boot_spm_busy_wait(); - 3f26: 07 b6 in r0, 0x37 ; 55 - 3f28: 00 fc sbrc r0, 0 - 3f2a: fd cf rjmp .-6 ; 0x3f26 - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3f2c: b7 be out 0x37, r11 ; 55 - 3f2e: e8 95 spm - 3f30: 26 c0 rjmp .+76 ; 0x3f7e -#endif - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 3f32: 84 37 cpi r24, 0x74 ; 116 - 3f34: b1 f4 brne .+44 ; 0x3f62 - // READ PAGE - we only read flash - getch(); /* getlen() */ - 3f36: 2e d0 rcall .+92 ; 0x3f94 - length = getch(); - 3f38: 2d d0 rcall .+90 ; 0x3f94 - 3f3a: f8 2e mov r15, r24 - getch(); - 3f3c: 2b d0 rcall .+86 ; 0x3f94 - - verifySpace(); - 3f3e: 3c d0 rcall .+120 ; 0x3fb8 - 3f40: f6 01 movw r30, r12 - 3f42: ef 2c mov r14, r15 - putch(result); - address++; - } - while (--length); -#else - do putch(pgm_read_byte_near(address++)); - 3f44: 8f 01 movw r16, r30 - 3f46: 0f 5f subi r16, 0xFF ; 255 - 3f48: 1f 4f sbci r17, 0xFF ; 255 - 3f4a: 84 91 lpm r24, Z+ - 3f4c: 1b d0 rcall .+54 ; 0x3f84 - while (--length); - 3f4e: ea 94 dec r14 - 3f50: f8 01 movw r30, r16 - 3f52: c1 f7 brne .-16 ; 0x3f44 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f54: 08 94 sec - 3f56: c1 1c adc r12, r1 - 3f58: d1 1c adc r13, r1 - 3f5a: fa 94 dec r15 - 3f5c: cf 0c add r12, r15 - 3f5e: d1 1c adc r13, r1 - 3f60: 0e c0 rjmp .+28 ; 0x3f7e -#endif -#endif - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 3f62: 85 37 cpi r24, 0x75 ; 117 - 3f64: 39 f4 brne .+14 ; 0x3f74 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 3f66: 28 d0 rcall .+80 ; 0x3fb8 - putch(SIGNATURE_0); - 3f68: 8e e1 ldi r24, 0x1E ; 30 - 3f6a: 0c d0 rcall .+24 ; 0x3f84 - putch(SIGNATURE_1); - 3f6c: 84 e9 ldi r24, 0x94 ; 148 - 3f6e: 0a d0 rcall .+20 ; 0x3f84 - putch(SIGNATURE_2); - 3f70: 86 e0 ldi r24, 0x06 ; 6 - 3f72: 98 cf rjmp .-208 ; 0x3ea4 - } - else if (ch == 'Q') { - 3f74: 81 35 cpi r24, 0x51 ; 81 - 3f76: 11 f4 brne .+4 ; 0x3f7c - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 3f78: 88 e0 ldi r24, 0x08 ; 8 - 3f7a: 18 d0 rcall .+48 ; 0x3fac - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 3f7c: 1d d0 rcall .+58 ; 0x3fb8 - } - putch(STK_OK); - 3f7e: 80 e1 ldi r24, 0x10 ; 16 - 3f80: 01 d0 rcall .+2 ; 0x3f84 - 3f82: 6a cf rjmp .-300 ; 0x3e58 - -00003f84 : - } -} - -void putch(char ch) { - 3f84: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UCSR0A & _BV(UDRE0))); - 3f86: 80 91 c0 00 lds r24, 0x00C0 - 3f8a: 85 ff sbrs r24, 5 - 3f8c: fc cf rjmp .-8 ; 0x3f86 - UDR0 = ch; - 3f8e: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 3f92: 08 95 ret - -00003f94 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))) - 3f94: 80 91 c0 00 lds r24, 0x00C0 - 3f98: 87 ff sbrs r24, 7 - 3f9a: fc cf rjmp .-8 ; 0x3f94 - ; - if (!(UCSR0A & _BV(FE0))) { - 3f9c: 80 91 c0 00 lds r24, 0x00C0 - 3fa0: 84 fd sbrc r24, 4 - 3fa2: 01 c0 rjmp .+2 ; 0x3fa6 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3fa4: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UDR0; - 3fa6: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 3faa: 08 95 ret - -00003fac : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 3fac: e0 e6 ldi r30, 0x60 ; 96 - 3fae: f0 e0 ldi r31, 0x00 ; 0 - 3fb0: 98 e1 ldi r25, 0x18 ; 24 - 3fb2: 90 83 st Z, r25 - WDTCSR = x; - 3fb4: 80 83 st Z, r24 -} - 3fb6: 08 95 ret - -00003fb8 : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 3fb8: ed df rcall .-38 ; 0x3f94 - 3fba: 80 32 cpi r24, 0x20 ; 32 - 3fbc: 19 f0 breq .+6 ; 0x3fc4 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fbe: 88 e0 ldi r24, 0x08 ; 8 - 3fc0: f5 df rcall .-22 ; 0x3fac - 3fc2: ff cf rjmp .-2 ; 0x3fc2 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 3fc4: 84 e1 ldi r24, 0x14 ; 20 -} - 3fc6: de cf rjmp .-68 ; 0x3f84 - -00003fc8 : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 3fc8: 1f 93 push r17 - 3fca: 18 2f mov r17, r24 - do getch(); while (--count); - 3fcc: e3 df rcall .-58 ; 0x3f94 - 3fce: 11 50 subi r17, 0x01 ; 1 - 3fd0: e9 f7 brne .-6 ; 0x3fcc - verifySpace(); - 3fd2: f2 df rcall .-28 ; 0x3fb8 -} - 3fd4: 1f 91 pop r17 - 3fd6: 08 95 ret - -00003fd8 : - WDTCSR = _BV(WDCE) | _BV(WDE); - WDTCSR = x; -} - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 3fd8: 80 e0 ldi r24, 0x00 ; 0 - 3fda: e8 df rcall .-48 ; 0x3fac - __asm__ __volatile__ ( - 3fdc: ee 27 eor r30, r30 - 3fde: ff 27 eor r31, r31 - 3fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_lilypad.hex b/bootloaders/optiboot/optiboot_lilypad.hex deleted file mode 100644 index 2c63395..0000000 --- a/bootloaders/optiboot/optiboot_lilypad.hex +++ /dev/null @@ -1,34 +0,0 @@ -:103E0000112484B714BE81FFE7D085E08093810040 -:103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20088E08093C4008EE0C0D0259A86E06E -:103E300028E13EEF91E0309385002093840096BB0B -:103E4000B09BFECF1D9AA8958150A9F79924939411 -:103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE -:103E6000B3D083E01FC0823411F484E103C08534F1 -:103E700019F485E0A9D083C0853579F48BD0E82E7C -:103E8000FF2488D0082F10E0102F00270E291F29AB -:103E9000000F111F91D0680172C0863529F484E0AB -:103EA00093D080E06FD06BC0843609F042C072D0EE -:103EB00071D0082F6FD080E0C81688E3D80620F4B0 -:103EC00083E0F60187BFE895C0E0D1E063D0899335 -:103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF -:103EE000F60187BFE89568D007B600FCFDCFA601B4 -:103EF000A0E0B1E02C9130E011968C91119790E008 -:103F0000982F8827822B932B1296FA010C0197BECB -:103F1000E89511244E5F5F4FF1E0A038BF0751F7DD -:103F2000F601A7BEE89507B600FCFDCFB7BEE89541 -:103F300026C08437B1F42ED02DD0F82E2BD03CD013 -:103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 -:103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 -:103F60000EC0853739F428D08EE10CD084E90AD010 -:103F700086E098CF813511F488E018D01DD080E11B -:103F800001D06ACF982F8091C00085FFFCCF90931D -:103F9000C60008958091C00087FFFCCF8091C000CB -:103FA00084FD01C0A8958091C6000895E0E6F0E088 -:103FB00098E1908380830895EDDF803219F088E0E6 -:103FC000F5DFFFCF84E1DECF1F93182FE3DF115021 -:103FD000E9F7F2DF1F91089580E0E8DFEE27FF2781 -:023FE000099442 -:023FFE000304BA -:0400000300003E00BB -:00000001FF diff --git a/bootloaders/optiboot/optiboot_lilypad.lst b/bootloaders/optiboot/optiboot_lilypad.lst deleted file mode 100644 index 425cbf4..0000000 --- a/bootloaders/optiboot/optiboot_lilypad.lst +++ /dev/null @@ -1,571 +0,0 @@ - -optiboot_lilypad.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001e2 00003e00 00003e00 00000054 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 00000236 2**0 - CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00003e00
: -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3e00: 11 24 eor r1, r1 -#ifdef __AVR_ATmega8__ - SP=RAMEND; // This is done by hardware reset -#endif - - // Adaboot no-wait mod - ch = MCUSR; - 3e02: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 3e04: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 3e06: 81 ff sbrs r24, 1 - 3e08: e7 d0 rcall .+462 ; 0x3fd8 - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 3e0a: 85 e0 ldi r24, 0x05 ; 5 - 3e0c: 80 93 81 00 sts 0x0081, r24 - UCSRA = _BV(U2X); //Double speed mode USART - UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx - UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 - UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); -#else - UCSR0A = _BV(U2X0); //Double speed mode USART0 - 3e10: 82 e0 ldi r24, 0x02 ; 2 - 3e12: 80 93 c0 00 sts 0x00C0, r24 - UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 3e16: 88 e1 ldi r24, 0x18 ; 24 - 3e18: 80 93 c1 00 sts 0x00C1, r24 - UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 3e1c: 86 e0 ldi r24, 0x06 ; 6 - 3e1e: 80 93 c2 00 sts 0x00C2, r24 - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e22: 88 e0 ldi r24, 0x08 ; 8 - 3e24: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: c0 d0 rcall .+384 ; 0x3fac - - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 3e2c: 25 9a sbi 0x04, 5 ; 4 - 3e2e: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e30: 28 e1 ldi r18, 0x18 ; 24 - 3e32: 3e ef ldi r19, 0xFE ; 254 - TIFR1 = _BV(TOV1); - 3e34: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e36: 30 93 85 00 sts 0x0085, r19 - 3e3a: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 3e3e: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 3e40: b0 9b sbis 0x16, 0 ; 22 - 3e42: fe cf rjmp .-4 ; 0x3e40 -#ifdef __AVR_ATmega8__ - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 3e44: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3e46: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 3e48: 81 50 subi r24, 0x01 ; 1 - 3e4a: a9 f7 brne .-22 ; 0x3e36 - /* get character from UART */ - ch = getch(); - - if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e4c: 99 24 eor r9, r9 - 3e4e: 93 94 inc r9 - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - addrPtr += 2; - } while (--ch); - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3e50: a5 e0 ldi r26, 0x05 ; 5 - 3e52: aa 2e mov r10, r26 - boot_spm_busy_wait(); - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3e54: f1 e1 ldi r31, 0x11 ; 17 - 3e56: bf 2e mov r11, r31 -#endif - - /* Forever loop */ - for (;;) { - /* get character from UART */ - ch = getch(); - 3e58: 9d d0 rcall .+314 ; 0x3f94 - - if(ch == STK_GET_PARAMETER) { - 3e5a: 81 34 cpi r24, 0x41 ; 65 - 3e5c: 21 f4 brne .+8 ; 0x3e66 - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: b3 d0 rcall .+358 ; 0x3fc8 - putch(0x03); - 3e62: 83 e0 ldi r24, 0x03 ; 3 - 3e64: 1f c0 rjmp .+62 ; 0x3ea4 - } - else if(ch == STK_SET_DEVICE) { - 3e66: 82 34 cpi r24, 0x42 ; 66 - 3e68: 11 f4 brne .+4 ; 0x3e6e - // SET DEVICE is ignored - getNch(20); - 3e6a: 84 e1 ldi r24, 0x14 ; 20 - 3e6c: 03 c0 rjmp .+6 ; 0x3e74 - } - else if(ch == STK_SET_DEVICE_EXT) { - 3e6e: 85 34 cpi r24, 0x45 ; 69 - 3e70: 19 f4 brne .+6 ; 0x3e78 - // SET DEVICE EXT is ignored - getNch(5); - 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: a9 d0 rcall .+338 ; 0x3fc8 - 3e76: 83 c0 rjmp .+262 ; 0x3f7e - } - else if(ch == STK_LOAD_ADDRESS) { - 3e78: 85 35 cpi r24, 0x55 ; 85 - 3e7a: 79 f4 brne .+30 ; 0x3e9a - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 3e7c: 8b d0 rcall .+278 ; 0x3f94 - newAddress = (newAddress & 0xff) | (getch() << 8); - 3e7e: e8 2e mov r14, r24 - 3e80: ff 24 eor r15, r15 - 3e82: 88 d0 rcall .+272 ; 0x3f94 - 3e84: 08 2f mov r16, r24 - 3e86: 10 e0 ldi r17, 0x00 ; 0 - 3e88: 10 2f mov r17, r16 - 3e8a: 00 27 eor r16, r16 - 3e8c: 0e 29 or r16, r14 - 3e8e: 1f 29 or r17, r15 -#ifdef RAMPZ - // Transfer top bit to RAMPZ - RAMPZ = (newAddress & 0x8000) ? 1 : 0; -#endif - newAddress += newAddress; // Convert from word address to byte address - 3e90: 00 0f add r16, r16 - 3e92: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 3e94: 91 d0 rcall .+290 ; 0x3fb8 - 3e96: 68 01 movw r12, r16 - 3e98: 72 c0 rjmp .+228 ; 0x3f7e - } - else if(ch == STK_UNIVERSAL) { - 3e9a: 86 35 cpi r24, 0x56 ; 86 - 3e9c: 29 f4 brne .+10 ; 0x3ea8 - // UNIVERSAL command is ignored - getNch(4); - 3e9e: 84 e0 ldi r24, 0x04 ; 4 - 3ea0: 93 d0 rcall .+294 ; 0x3fc8 - putch(0x00); - 3ea2: 80 e0 ldi r24, 0x00 ; 0 - 3ea4: 6f d0 rcall .+222 ; 0x3f84 - 3ea6: 6b c0 rjmp .+214 ; 0x3f7e - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 3ea8: 84 36 cpi r24, 0x64 ; 100 - 3eaa: 09 f0 breq .+2 ; 0x3eae - 3eac: 42 c0 rjmp .+132 ; 0x3f32 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t *bufPtr; - uint16_t addrPtr; - - getch(); /* getlen() */ - 3eae: 72 d0 rcall .+228 ; 0x3f94 - length = getch(); - 3eb0: 71 d0 rcall .+226 ; 0x3f94 - 3eb2: 08 2f mov r16, r24 - getch(); - 3eb4: 6f d0 rcall .+222 ; 0x3f94 - - // If we are in RWW section, immediately start page erase - if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3eb6: 80 e0 ldi r24, 0x00 ; 0 - 3eb8: c8 16 cp r12, r24 - 3eba: 88 e3 ldi r24, 0x38 ; 56 - 3ebc: d8 06 cpc r13, r24 - 3ebe: 20 f4 brcc .+8 ; 0x3ec8 - 3ec0: 83 e0 ldi r24, 0x03 ; 3 - 3ec2: f6 01 movw r30, r12 - 3ec4: 87 bf out 0x37, r24 ; 55 - 3ec6: e8 95 spm - 3ec8: c0 e0 ldi r28, 0x00 ; 0 - 3eca: d1 e0 ldi r29, 0x01 ; 1 - - // While that is going on, read in page contents - bufPtr = buff; - do *bufPtr++ = getch(); - 3ecc: 63 d0 rcall .+198 ; 0x3f94 - 3ece: 89 93 st Y+, r24 - while (--length); - 3ed0: 0c 17 cp r16, r28 - 3ed2: e1 f7 brne .-8 ; 0x3ecc - - // If we are in NRWW section, page erase has to be delayed until now. - // Todo: Take RAMPZ into account - if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3ed4: f0 e0 ldi r31, 0x00 ; 0 - 3ed6: cf 16 cp r12, r31 - 3ed8: f8 e3 ldi r31, 0x38 ; 56 - 3eda: df 06 cpc r13, r31 - 3edc: 20 f0 brcs .+8 ; 0x3ee6 - 3ede: 83 e0 ldi r24, 0x03 ; 3 - 3ee0: f6 01 movw r30, r12 - 3ee2: 87 bf out 0x37, r24 ; 55 - 3ee4: e8 95 spm - - // Read command terminator, start reply - verifySpace(); - 3ee6: 68 d0 rcall .+208 ; 0x3fb8 - - // If only a partial page is to be programmed, the erase might not be complete. - // So check that here - boot_spm_busy_wait(); - 3ee8: 07 b6 in r0, 0x37 ; 55 - 3eea: 00 fc sbrc r0, 0 - 3eec: fd cf rjmp .-6 ; 0x3ee8 - 3eee: a6 01 movw r20, r12 - 3ef0: a0 e0 ldi r26, 0x00 ; 0 - 3ef2: b1 e0 ldi r27, 0x01 ; 1 - bufPtr = buff; - addrPtr = (uint16_t)(void*)address; - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - 3ef4: 2c 91 ld r18, X - 3ef6: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 3ef8: 11 96 adiw r26, 0x01 ; 1 - 3efa: 8c 91 ld r24, X - 3efc: 11 97 sbiw r26, 0x01 ; 1 - 3efe: 90 e0 ldi r25, 0x00 ; 0 - 3f00: 98 2f mov r25, r24 - 3f02: 88 27 eor r24, r24 - 3f04: 82 2b or r24, r18 - 3f06: 93 2b or r25, r19 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f08: 12 96 adiw r26, 0x02 ; 2 - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f0a: fa 01 movw r30, r20 - 3f0c: 0c 01 movw r0, r24 - 3f0e: 97 be out 0x37, r9 ; 55 - 3f10: e8 95 spm - 3f12: 11 24 eor r1, r1 - addrPtr += 2; - 3f14: 4e 5f subi r20, 0xFE ; 254 - 3f16: 5f 4f sbci r21, 0xFF ; 255 - } while (--ch); - 3f18: f1 e0 ldi r31, 0x01 ; 1 - 3f1a: a0 38 cpi r26, 0x80 ; 128 - 3f1c: bf 07 cpc r27, r31 - 3f1e: 51 f7 brne .-44 ; 0x3ef4 - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3f20: f6 01 movw r30, r12 - 3f22: a7 be out 0x37, r10 ; 55 - 3f24: e8 95 spm - boot_spm_busy_wait(); - 3f26: 07 b6 in r0, 0x37 ; 55 - 3f28: 00 fc sbrc r0, 0 - 3f2a: fd cf rjmp .-6 ; 0x3f26 - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3f2c: b7 be out 0x37, r11 ; 55 - 3f2e: e8 95 spm - 3f30: 26 c0 rjmp .+76 ; 0x3f7e -#endif - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 3f32: 84 37 cpi r24, 0x74 ; 116 - 3f34: b1 f4 brne .+44 ; 0x3f62 - // READ PAGE - we only read flash - getch(); /* getlen() */ - 3f36: 2e d0 rcall .+92 ; 0x3f94 - length = getch(); - 3f38: 2d d0 rcall .+90 ; 0x3f94 - 3f3a: f8 2e mov r15, r24 - getch(); - 3f3c: 2b d0 rcall .+86 ; 0x3f94 - - verifySpace(); - 3f3e: 3c d0 rcall .+120 ; 0x3fb8 - 3f40: f6 01 movw r30, r12 - 3f42: ef 2c mov r14, r15 - putch(result); - address++; - } - while (--length); -#else - do putch(pgm_read_byte_near(address++)); - 3f44: 8f 01 movw r16, r30 - 3f46: 0f 5f subi r16, 0xFF ; 255 - 3f48: 1f 4f sbci r17, 0xFF ; 255 - 3f4a: 84 91 lpm r24, Z+ - 3f4c: 1b d0 rcall .+54 ; 0x3f84 - while (--length); - 3f4e: ea 94 dec r14 - 3f50: f8 01 movw r30, r16 - 3f52: c1 f7 brne .-16 ; 0x3f44 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f54: 08 94 sec - 3f56: c1 1c adc r12, r1 - 3f58: d1 1c adc r13, r1 - 3f5a: fa 94 dec r15 - 3f5c: cf 0c add r12, r15 - 3f5e: d1 1c adc r13, r1 - 3f60: 0e c0 rjmp .+28 ; 0x3f7e -#endif -#endif - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 3f62: 85 37 cpi r24, 0x75 ; 117 - 3f64: 39 f4 brne .+14 ; 0x3f74 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 3f66: 28 d0 rcall .+80 ; 0x3fb8 - putch(SIGNATURE_0); - 3f68: 8e e1 ldi r24, 0x1E ; 30 - 3f6a: 0c d0 rcall .+24 ; 0x3f84 - putch(SIGNATURE_1); - 3f6c: 84 e9 ldi r24, 0x94 ; 148 - 3f6e: 0a d0 rcall .+20 ; 0x3f84 - putch(SIGNATURE_2); - 3f70: 86 e0 ldi r24, 0x06 ; 6 - 3f72: 98 cf rjmp .-208 ; 0x3ea4 - } - else if (ch == 'Q') { - 3f74: 81 35 cpi r24, 0x51 ; 81 - 3f76: 11 f4 brne .+4 ; 0x3f7c - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 3f78: 88 e0 ldi r24, 0x08 ; 8 - 3f7a: 18 d0 rcall .+48 ; 0x3fac - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 3f7c: 1d d0 rcall .+58 ; 0x3fb8 - } - putch(STK_OK); - 3f7e: 80 e1 ldi r24, 0x10 ; 16 - 3f80: 01 d0 rcall .+2 ; 0x3f84 - 3f82: 6a cf rjmp .-300 ; 0x3e58 - -00003f84 : - } -} - -void putch(char ch) { - 3f84: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UCSR0A & _BV(UDRE0))); - 3f86: 80 91 c0 00 lds r24, 0x00C0 - 3f8a: 85 ff sbrs r24, 5 - 3f8c: fc cf rjmp .-8 ; 0x3f86 - UDR0 = ch; - 3f8e: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 3f92: 08 95 ret - -00003f94 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))) - 3f94: 80 91 c0 00 lds r24, 0x00C0 - 3f98: 87 ff sbrs r24, 7 - 3f9a: fc cf rjmp .-8 ; 0x3f94 - ; - if (!(UCSR0A & _BV(FE0))) { - 3f9c: 80 91 c0 00 lds r24, 0x00C0 - 3fa0: 84 fd sbrc r24, 4 - 3fa2: 01 c0 rjmp .+2 ; 0x3fa6 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3fa4: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UDR0; - 3fa6: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 3faa: 08 95 ret - -00003fac : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 3fac: e0 e6 ldi r30, 0x60 ; 96 - 3fae: f0 e0 ldi r31, 0x00 ; 0 - 3fb0: 98 e1 ldi r25, 0x18 ; 24 - 3fb2: 90 83 st Z, r25 - WDTCSR = x; - 3fb4: 80 83 st Z, r24 -} - 3fb6: 08 95 ret - -00003fb8 : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 3fb8: ed df rcall .-38 ; 0x3f94 - 3fba: 80 32 cpi r24, 0x20 ; 32 - 3fbc: 19 f0 breq .+6 ; 0x3fc4 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fbe: 88 e0 ldi r24, 0x08 ; 8 - 3fc0: f5 df rcall .-22 ; 0x3fac - 3fc2: ff cf rjmp .-2 ; 0x3fc2 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 3fc4: 84 e1 ldi r24, 0x14 ; 20 -} - 3fc6: de cf rjmp .-68 ; 0x3f84 - -00003fc8 : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 3fc8: 1f 93 push r17 - 3fca: 18 2f mov r17, r24 - do getch(); while (--count); - 3fcc: e3 df rcall .-58 ; 0x3f94 - 3fce: 11 50 subi r17, 0x01 ; 1 - 3fd0: e9 f7 brne .-6 ; 0x3fcc - verifySpace(); - 3fd2: f2 df rcall .-28 ; 0x3fb8 -} - 3fd4: 1f 91 pop r17 - 3fd6: 08 95 ret - -00003fd8 : - WDTCSR = _BV(WDCE) | _BV(WDE); - WDTCSR = x; -} - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 3fd8: 80 e0 ldi r24, 0x00 ; 0 - 3fda: e8 df rcall .-48 ; 0x3fac - __asm__ __volatile__ ( - 3fdc: ee 27 eor r30, r30 - 3fde: ff 27 eor r31, r31 - 3fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_lilypad_resonator.hex b/bootloaders/optiboot/optiboot_lilypad_resonator.hex deleted file mode 100644 index 2c63395..0000000 --- a/bootloaders/optiboot/optiboot_lilypad_resonator.hex +++ /dev/null @@ -1,34 +0,0 @@ -:103E0000112484B714BE81FFE7D085E08093810040 -:103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20088E08093C4008EE0C0D0259A86E06E -:103E300028E13EEF91E0309385002093840096BB0B -:103E4000B09BFECF1D9AA8958150A9F79924939411 -:103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE -:103E6000B3D083E01FC0823411F484E103C08534F1 -:103E700019F485E0A9D083C0853579F48BD0E82E7C -:103E8000FF2488D0082F10E0102F00270E291F29AB -:103E9000000F111F91D0680172C0863529F484E0AB -:103EA00093D080E06FD06BC0843609F042C072D0EE -:103EB00071D0082F6FD080E0C81688E3D80620F4B0 -:103EC00083E0F60187BFE895C0E0D1E063D0899335 -:103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF -:103EE000F60187BFE89568D007B600FCFDCFA601B4 -:103EF000A0E0B1E02C9130E011968C91119790E008 -:103F0000982F8827822B932B1296FA010C0197BECB -:103F1000E89511244E5F5F4FF1E0A038BF0751F7DD -:103F2000F601A7BEE89507B600FCFDCFB7BEE89541 -:103F300026C08437B1F42ED02DD0F82E2BD03CD013 -:103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 -:103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 -:103F60000EC0853739F428D08EE10CD084E90AD010 -:103F700086E098CF813511F488E018D01DD080E11B -:103F800001D06ACF982F8091C00085FFFCCF90931D -:103F9000C60008958091C00087FFFCCF8091C000CB -:103FA00084FD01C0A8958091C6000895E0E6F0E088 -:103FB00098E1908380830895EDDF803219F088E0E6 -:103FC000F5DFFFCF84E1DECF1F93182FE3DF115021 -:103FD000E9F7F2DF1F91089580E0E8DFEE27FF2781 -:023FE000099442 -:023FFE000304BA -:0400000300003E00BB -:00000001FF diff --git a/bootloaders/optiboot/optiboot_lilypad_resonator.lst b/bootloaders/optiboot/optiboot_lilypad_resonator.lst deleted file mode 100644 index cb0ea83..0000000 --- a/bootloaders/optiboot/optiboot_lilypad_resonator.lst +++ /dev/null @@ -1,571 +0,0 @@ - -optiboot_lilypad_resonator.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001e2 00003e00 00003e00 00000054 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 00000236 2**0 - CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00003e00
: -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3e00: 11 24 eor r1, r1 -#ifdef __AVR_ATmega8__ - SP=RAMEND; // This is done by hardware reset -#endif - - // Adaboot no-wait mod - ch = MCUSR; - 3e02: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 3e04: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 3e06: 81 ff sbrs r24, 1 - 3e08: e7 d0 rcall .+462 ; 0x3fd8 - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 3e0a: 85 e0 ldi r24, 0x05 ; 5 - 3e0c: 80 93 81 00 sts 0x0081, r24 - UCSRA = _BV(U2X); //Double speed mode USART - UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx - UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 - UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); -#else - UCSR0A = _BV(U2X0); //Double speed mode USART0 - 3e10: 82 e0 ldi r24, 0x02 ; 2 - 3e12: 80 93 c0 00 sts 0x00C0, r24 - UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 3e16: 88 e1 ldi r24, 0x18 ; 24 - 3e18: 80 93 c1 00 sts 0x00C1, r24 - UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 3e1c: 86 e0 ldi r24, 0x06 ; 6 - 3e1e: 80 93 c2 00 sts 0x00C2, r24 - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e22: 88 e0 ldi r24, 0x08 ; 8 - 3e24: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: c0 d0 rcall .+384 ; 0x3fac - - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 3e2c: 25 9a sbi 0x04, 5 ; 4 - 3e2e: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e30: 28 e1 ldi r18, 0x18 ; 24 - 3e32: 3e ef ldi r19, 0xFE ; 254 - TIFR1 = _BV(TOV1); - 3e34: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e36: 30 93 85 00 sts 0x0085, r19 - 3e3a: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 3e3e: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 3e40: b0 9b sbis 0x16, 0 ; 22 - 3e42: fe cf rjmp .-4 ; 0x3e40 -#ifdef __AVR_ATmega8__ - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 3e44: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3e46: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 3e48: 81 50 subi r24, 0x01 ; 1 - 3e4a: a9 f7 brne .-22 ; 0x3e36 - /* get character from UART */ - ch = getch(); - - if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e4c: 99 24 eor r9, r9 - 3e4e: 93 94 inc r9 - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - addrPtr += 2; - } while (--ch); - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3e50: a5 e0 ldi r26, 0x05 ; 5 - 3e52: aa 2e mov r10, r26 - boot_spm_busy_wait(); - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3e54: f1 e1 ldi r31, 0x11 ; 17 - 3e56: bf 2e mov r11, r31 -#endif - - /* Forever loop */ - for (;;) { - /* get character from UART */ - ch = getch(); - 3e58: 9d d0 rcall .+314 ; 0x3f94 - - if(ch == STK_GET_PARAMETER) { - 3e5a: 81 34 cpi r24, 0x41 ; 65 - 3e5c: 21 f4 brne .+8 ; 0x3e66 - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: b3 d0 rcall .+358 ; 0x3fc8 - putch(0x03); - 3e62: 83 e0 ldi r24, 0x03 ; 3 - 3e64: 1f c0 rjmp .+62 ; 0x3ea4 - } - else if(ch == STK_SET_DEVICE) { - 3e66: 82 34 cpi r24, 0x42 ; 66 - 3e68: 11 f4 brne .+4 ; 0x3e6e - // SET DEVICE is ignored - getNch(20); - 3e6a: 84 e1 ldi r24, 0x14 ; 20 - 3e6c: 03 c0 rjmp .+6 ; 0x3e74 - } - else if(ch == STK_SET_DEVICE_EXT) { - 3e6e: 85 34 cpi r24, 0x45 ; 69 - 3e70: 19 f4 brne .+6 ; 0x3e78 - // SET DEVICE EXT is ignored - getNch(5); - 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: a9 d0 rcall .+338 ; 0x3fc8 - 3e76: 83 c0 rjmp .+262 ; 0x3f7e - } - else if(ch == STK_LOAD_ADDRESS) { - 3e78: 85 35 cpi r24, 0x55 ; 85 - 3e7a: 79 f4 brne .+30 ; 0x3e9a - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 3e7c: 8b d0 rcall .+278 ; 0x3f94 - newAddress = (newAddress & 0xff) | (getch() << 8); - 3e7e: e8 2e mov r14, r24 - 3e80: ff 24 eor r15, r15 - 3e82: 88 d0 rcall .+272 ; 0x3f94 - 3e84: 08 2f mov r16, r24 - 3e86: 10 e0 ldi r17, 0x00 ; 0 - 3e88: 10 2f mov r17, r16 - 3e8a: 00 27 eor r16, r16 - 3e8c: 0e 29 or r16, r14 - 3e8e: 1f 29 or r17, r15 -#ifdef RAMPZ - // Transfer top bit to RAMPZ - RAMPZ = (newAddress & 0x8000) ? 1 : 0; -#endif - newAddress += newAddress; // Convert from word address to byte address - 3e90: 00 0f add r16, r16 - 3e92: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 3e94: 91 d0 rcall .+290 ; 0x3fb8 - 3e96: 68 01 movw r12, r16 - 3e98: 72 c0 rjmp .+228 ; 0x3f7e - } - else if(ch == STK_UNIVERSAL) { - 3e9a: 86 35 cpi r24, 0x56 ; 86 - 3e9c: 29 f4 brne .+10 ; 0x3ea8 - // UNIVERSAL command is ignored - getNch(4); - 3e9e: 84 e0 ldi r24, 0x04 ; 4 - 3ea0: 93 d0 rcall .+294 ; 0x3fc8 - putch(0x00); - 3ea2: 80 e0 ldi r24, 0x00 ; 0 - 3ea4: 6f d0 rcall .+222 ; 0x3f84 - 3ea6: 6b c0 rjmp .+214 ; 0x3f7e - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 3ea8: 84 36 cpi r24, 0x64 ; 100 - 3eaa: 09 f0 breq .+2 ; 0x3eae - 3eac: 42 c0 rjmp .+132 ; 0x3f32 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t *bufPtr; - uint16_t addrPtr; - - getch(); /* getlen() */ - 3eae: 72 d0 rcall .+228 ; 0x3f94 - length = getch(); - 3eb0: 71 d0 rcall .+226 ; 0x3f94 - 3eb2: 08 2f mov r16, r24 - getch(); - 3eb4: 6f d0 rcall .+222 ; 0x3f94 - - // If we are in RWW section, immediately start page erase - if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3eb6: 80 e0 ldi r24, 0x00 ; 0 - 3eb8: c8 16 cp r12, r24 - 3eba: 88 e3 ldi r24, 0x38 ; 56 - 3ebc: d8 06 cpc r13, r24 - 3ebe: 20 f4 brcc .+8 ; 0x3ec8 - 3ec0: 83 e0 ldi r24, 0x03 ; 3 - 3ec2: f6 01 movw r30, r12 - 3ec4: 87 bf out 0x37, r24 ; 55 - 3ec6: e8 95 spm - 3ec8: c0 e0 ldi r28, 0x00 ; 0 - 3eca: d1 e0 ldi r29, 0x01 ; 1 - - // While that is going on, read in page contents - bufPtr = buff; - do *bufPtr++ = getch(); - 3ecc: 63 d0 rcall .+198 ; 0x3f94 - 3ece: 89 93 st Y+, r24 - while (--length); - 3ed0: 0c 17 cp r16, r28 - 3ed2: e1 f7 brne .-8 ; 0x3ecc - - // If we are in NRWW section, page erase has to be delayed until now. - // Todo: Take RAMPZ into account - if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3ed4: f0 e0 ldi r31, 0x00 ; 0 - 3ed6: cf 16 cp r12, r31 - 3ed8: f8 e3 ldi r31, 0x38 ; 56 - 3eda: df 06 cpc r13, r31 - 3edc: 20 f0 brcs .+8 ; 0x3ee6 - 3ede: 83 e0 ldi r24, 0x03 ; 3 - 3ee0: f6 01 movw r30, r12 - 3ee2: 87 bf out 0x37, r24 ; 55 - 3ee4: e8 95 spm - - // Read command terminator, start reply - verifySpace(); - 3ee6: 68 d0 rcall .+208 ; 0x3fb8 - - // If only a partial page is to be programmed, the erase might not be complete. - // So check that here - boot_spm_busy_wait(); - 3ee8: 07 b6 in r0, 0x37 ; 55 - 3eea: 00 fc sbrc r0, 0 - 3eec: fd cf rjmp .-6 ; 0x3ee8 - 3eee: a6 01 movw r20, r12 - 3ef0: a0 e0 ldi r26, 0x00 ; 0 - 3ef2: b1 e0 ldi r27, 0x01 ; 1 - bufPtr = buff; - addrPtr = (uint16_t)(void*)address; - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - 3ef4: 2c 91 ld r18, X - 3ef6: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 3ef8: 11 96 adiw r26, 0x01 ; 1 - 3efa: 8c 91 ld r24, X - 3efc: 11 97 sbiw r26, 0x01 ; 1 - 3efe: 90 e0 ldi r25, 0x00 ; 0 - 3f00: 98 2f mov r25, r24 - 3f02: 88 27 eor r24, r24 - 3f04: 82 2b or r24, r18 - 3f06: 93 2b or r25, r19 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f08: 12 96 adiw r26, 0x02 ; 2 - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f0a: fa 01 movw r30, r20 - 3f0c: 0c 01 movw r0, r24 - 3f0e: 97 be out 0x37, r9 ; 55 - 3f10: e8 95 spm - 3f12: 11 24 eor r1, r1 - addrPtr += 2; - 3f14: 4e 5f subi r20, 0xFE ; 254 - 3f16: 5f 4f sbci r21, 0xFF ; 255 - } while (--ch); - 3f18: f1 e0 ldi r31, 0x01 ; 1 - 3f1a: a0 38 cpi r26, 0x80 ; 128 - 3f1c: bf 07 cpc r27, r31 - 3f1e: 51 f7 brne .-44 ; 0x3ef4 - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3f20: f6 01 movw r30, r12 - 3f22: a7 be out 0x37, r10 ; 55 - 3f24: e8 95 spm - boot_spm_busy_wait(); - 3f26: 07 b6 in r0, 0x37 ; 55 - 3f28: 00 fc sbrc r0, 0 - 3f2a: fd cf rjmp .-6 ; 0x3f26 - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3f2c: b7 be out 0x37, r11 ; 55 - 3f2e: e8 95 spm - 3f30: 26 c0 rjmp .+76 ; 0x3f7e -#endif - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 3f32: 84 37 cpi r24, 0x74 ; 116 - 3f34: b1 f4 brne .+44 ; 0x3f62 - // READ PAGE - we only read flash - getch(); /* getlen() */ - 3f36: 2e d0 rcall .+92 ; 0x3f94 - length = getch(); - 3f38: 2d d0 rcall .+90 ; 0x3f94 - 3f3a: f8 2e mov r15, r24 - getch(); - 3f3c: 2b d0 rcall .+86 ; 0x3f94 - - verifySpace(); - 3f3e: 3c d0 rcall .+120 ; 0x3fb8 - 3f40: f6 01 movw r30, r12 - 3f42: ef 2c mov r14, r15 - putch(result); - address++; - } - while (--length); -#else - do putch(pgm_read_byte_near(address++)); - 3f44: 8f 01 movw r16, r30 - 3f46: 0f 5f subi r16, 0xFF ; 255 - 3f48: 1f 4f sbci r17, 0xFF ; 255 - 3f4a: 84 91 lpm r24, Z+ - 3f4c: 1b d0 rcall .+54 ; 0x3f84 - while (--length); - 3f4e: ea 94 dec r14 - 3f50: f8 01 movw r30, r16 - 3f52: c1 f7 brne .-16 ; 0x3f44 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f54: 08 94 sec - 3f56: c1 1c adc r12, r1 - 3f58: d1 1c adc r13, r1 - 3f5a: fa 94 dec r15 - 3f5c: cf 0c add r12, r15 - 3f5e: d1 1c adc r13, r1 - 3f60: 0e c0 rjmp .+28 ; 0x3f7e -#endif -#endif - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 3f62: 85 37 cpi r24, 0x75 ; 117 - 3f64: 39 f4 brne .+14 ; 0x3f74 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 3f66: 28 d0 rcall .+80 ; 0x3fb8 - putch(SIGNATURE_0); - 3f68: 8e e1 ldi r24, 0x1E ; 30 - 3f6a: 0c d0 rcall .+24 ; 0x3f84 - putch(SIGNATURE_1); - 3f6c: 84 e9 ldi r24, 0x94 ; 148 - 3f6e: 0a d0 rcall .+20 ; 0x3f84 - putch(SIGNATURE_2); - 3f70: 86 e0 ldi r24, 0x06 ; 6 - 3f72: 98 cf rjmp .-208 ; 0x3ea4 - } - else if (ch == 'Q') { - 3f74: 81 35 cpi r24, 0x51 ; 81 - 3f76: 11 f4 brne .+4 ; 0x3f7c - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 3f78: 88 e0 ldi r24, 0x08 ; 8 - 3f7a: 18 d0 rcall .+48 ; 0x3fac - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 3f7c: 1d d0 rcall .+58 ; 0x3fb8 - } - putch(STK_OK); - 3f7e: 80 e1 ldi r24, 0x10 ; 16 - 3f80: 01 d0 rcall .+2 ; 0x3f84 - 3f82: 6a cf rjmp .-300 ; 0x3e58 - -00003f84 : - } -} - -void putch(char ch) { - 3f84: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UCSR0A & _BV(UDRE0))); - 3f86: 80 91 c0 00 lds r24, 0x00C0 - 3f8a: 85 ff sbrs r24, 5 - 3f8c: fc cf rjmp .-8 ; 0x3f86 - UDR0 = ch; - 3f8e: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 3f92: 08 95 ret - -00003f94 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))) - 3f94: 80 91 c0 00 lds r24, 0x00C0 - 3f98: 87 ff sbrs r24, 7 - 3f9a: fc cf rjmp .-8 ; 0x3f94 - ; - if (!(UCSR0A & _BV(FE0))) { - 3f9c: 80 91 c0 00 lds r24, 0x00C0 - 3fa0: 84 fd sbrc r24, 4 - 3fa2: 01 c0 rjmp .+2 ; 0x3fa6 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3fa4: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UDR0; - 3fa6: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 3faa: 08 95 ret - -00003fac : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 3fac: e0 e6 ldi r30, 0x60 ; 96 - 3fae: f0 e0 ldi r31, 0x00 ; 0 - 3fb0: 98 e1 ldi r25, 0x18 ; 24 - 3fb2: 90 83 st Z, r25 - WDTCSR = x; - 3fb4: 80 83 st Z, r24 -} - 3fb6: 08 95 ret - -00003fb8 : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 3fb8: ed df rcall .-38 ; 0x3f94 - 3fba: 80 32 cpi r24, 0x20 ; 32 - 3fbc: 19 f0 breq .+6 ; 0x3fc4 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fbe: 88 e0 ldi r24, 0x08 ; 8 - 3fc0: f5 df rcall .-22 ; 0x3fac - 3fc2: ff cf rjmp .-2 ; 0x3fc2 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 3fc4: 84 e1 ldi r24, 0x14 ; 20 -} - 3fc6: de cf rjmp .-68 ; 0x3f84 - -00003fc8 : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 3fc8: 1f 93 push r17 - 3fca: 18 2f mov r17, r24 - do getch(); while (--count); - 3fcc: e3 df rcall .-58 ; 0x3f94 - 3fce: 11 50 subi r17, 0x01 ; 1 - 3fd0: e9 f7 brne .-6 ; 0x3fcc - verifySpace(); - 3fd2: f2 df rcall .-28 ; 0x3fb8 -} - 3fd4: 1f 91 pop r17 - 3fd6: 08 95 ret - -00003fd8 : - WDTCSR = _BV(WDCE) | _BV(WDE); - WDTCSR = x; -} - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 3fd8: 80 e0 ldi r24, 0x00 ; 0 - 3fda: e8 df rcall .-48 ; 0x3fac - __asm__ __volatile__ ( - 3fdc: ee 27 eor r30, r30 - 3fde: ff 27 eor r31, r31 - 3fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_luminet.hex b/bootloaders/optiboot/optiboot_luminet.hex deleted file mode 100644 index 45b4dcd..0000000 --- a/bootloaders/optiboot/optiboot_luminet.hex +++ /dev/null @@ -1,40 +0,0 @@ -:101D0000112484B714BE81FF17D185E08EBD8EE00B -:101D1000FFD0D49AD29A86E023EC3FEF91E03DBD0C -:101D20002CBD9BB9589BFECFCC9AA8958150B9F792 -:101D3000BB24B39425E0A22E9FE7D92E8EECC82EAB -:101D4000D4D0813421F481E0EFD083E0B5C0823477 -:101D500011F484E103C0853419F485E0E5D0B3C003 -:101D6000853569F4C2D0E82EFF24BFD0082F10E0DB -:101D7000102F00270E291F29000F111FA3C0863521 -:101D800021F484E0D1D080E097C0843609F060C0AF -:101D9000ACD0ABD0F82EA9D0C0E0D1E0A6D08993CA -:101DA000FC16E1F783E0F80187BFE895B5D007B6E8 -:101DB00000FCFDCF0115110511F0A8012AC080918A -:101DC00000012091010130E0322F222790E0282BE2 -:101DD000392B309385012093840140910801809133 -:101DE000090190E0982F882750E0842B952B909341 -:101DF0008701809386012450304020930801232FCF -:101E0000332720930901D0920001C092010140E0E4 -:101E100050E0A0E0B1E02C9130E011968C91119748 -:101E200090E0982F8827822B932B1296FA010C01B1 -:101E3000B7BEE89511244E5F5F4FF1E0A034BF07B5 -:101E400051F7F801A7BEE89507B600FCFDCF3BC0EF -:101E5000843751F54AD049D0F82E47D05DD0E801FB -:101E6000EF2C209719F48091840114C0C130D10562 -:101E700019F4809185010EC0C830D10519F4809104 -:101E8000860108C0C930D10519F48091870102C0CC -:101E9000FE01849121961AD0EA9419F70F5F1F4F23 -:101EA000FA940F0D111D0FC0853741F435D08EE126 -:101EB0000DD083E90BD08CE009D005C0813511F439 -:101EC00088E026D029D080E101D03ACF2AE030E066 -:101ED0008095089410F4DA9802C0DA9A000014D0C1 -:101EE00013D086952A95B1F7089529E030E0CB9973 -:101EF000FECF0AD009D008D08894CB9908942A95AF -:101F000011F08795F7CF08959EE09A95F1F708951F -:101F100098E191BD81BD0895E8DF803219F088E035 -:101F2000F7DFFFCF84E1D2CF1F93182FDEDF1150F0 -:101F3000E9F7F2DF1F91089580E0EADFE4E0FF2790 -:021F4000099402 -:021EFE000304DB -:0400000300001D00DC -:00000001FF diff --git a/bootloaders/optiboot/optiboot_luminet.lst b/bootloaders/optiboot/optiboot_luminet.lst deleted file mode 100644 index e40e0ef..0000000 --- a/bootloaders/optiboot/optiboot_luminet.lst +++ /dev/null @@ -1,617 +0,0 @@ - -optiboot_luminet.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 00000242 00001d00 00001d00 00000054 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00001efe 00001efe 00000296 2**0 - CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000298 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000006d 00000000 00000000 000002c0 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 000002a2 00000000 00000000 0000032d 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000016f 00000000 00000000 000005cf 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000049d 00000000 00000000 0000073e 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000090 00000000 00000000 00000bdc 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000158 00000000 00000000 00000c6c 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 00000268 00000000 00000000 00000dc4 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000080 00000000 00000000 0000102c 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00001d00
: -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 1d00: 11 24 eor r1, r1 -#ifdef __AVR_ATmega8__ - SP=RAMEND; // This is done by hardware reset -#endif - - // Adaboot no-wait mod - ch = MCUSR; - 1d02: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 1d04: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 1d06: 81 ff sbrs r24, 1 - 1d08: 17 d1 rcall .+558 ; 0x1f38 - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 1d0a: 85 e0 ldi r24, 0x05 ; 5 - 1d0c: 8e bd out 0x2e, r24 ; 46 - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 1d0e: 8e e0 ldi r24, 0x0E ; 14 - 1d10: ff d0 rcall .+510 ; 0x1f10 - - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 1d12: d4 9a sbi 0x1a, 4 ; 26 - -#ifdef SOFT_UART - /* Set TX pin as output */ - UART_DDR |= _BV(UART_TX_BIT); - 1d14: d2 9a sbi 0x1a, 2 ; 26 - 1d16: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 1d18: 23 ec ldi r18, 0xC3 ; 195 - 1d1a: 3f ef ldi r19, 0xFF ; 255 - TIFR1 = _BV(TOV1); - 1d1c: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 1d1e: 3d bd out 0x2d, r19 ; 45 - 1d20: 2c bd out 0x2c, r18 ; 44 - TIFR1 = _BV(TOV1); - 1d22: 9b b9 out 0x0b, r25 ; 11 - while(!(TIFR1 & _BV(TOV1))); - 1d24: 58 9b sbis 0x0b, 0 ; 11 - 1d26: fe cf rjmp .-4 ; 0x1d24 -#ifdef __AVR_ATmega8__ - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 1d28: cc 9a sbi 0x19, 4 ; 25 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 1d2a: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 1d2c: 81 50 subi r24, 0x01 ; 1 - 1d2e: b9 f7 brne .-18 ; 0x1d1e - /* get character from UART */ - ch = getch(); - - if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 1d30: bb 24 eor r11, r11 - 1d32: b3 94 inc r11 - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - addrPtr += 2; - } while (--ch); - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 1d34: 25 e0 ldi r18, 0x05 ; 5 - 1d36: a2 2e mov r10, r18 - vect -= 4; // Instruction is a relative jump (rjmp), so recalculate. - buff[8] = vect & 0xff; - buff[9] = vect >> 8; - - // Add jump to bootloader at RESET vector - buff[0] = 0x7f; - 1d38: 9f e7 ldi r25, 0x7F ; 127 - 1d3a: d9 2e mov r13, r25 - buff[1] = 0xce; // rjmp 0x1d00 instruction - 1d3c: 8e ec ldi r24, 0xCE ; 206 - 1d3e: c8 2e mov r12, r24 -#endif - - /* Forever loop */ - for (;;) { - /* get character from UART */ - ch = getch(); - 1d40: d4 d0 rcall .+424 ; 0x1eea - - if(ch == STK_GET_PARAMETER) { - 1d42: 81 34 cpi r24, 0x41 ; 65 - 1d44: 21 f4 brne .+8 ; 0x1d4e - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 1d46: 81 e0 ldi r24, 0x01 ; 1 - 1d48: ef d0 rcall .+478 ; 0x1f28 - putch(0x03); - 1d4a: 83 e0 ldi r24, 0x03 ; 3 - 1d4c: b5 c0 rjmp .+362 ; 0x1eb8 - } - else if(ch == STK_SET_DEVICE) { - 1d4e: 82 34 cpi r24, 0x42 ; 66 - 1d50: 11 f4 brne .+4 ; 0x1d56 - // SET DEVICE is ignored - getNch(20); - 1d52: 84 e1 ldi r24, 0x14 ; 20 - 1d54: 03 c0 rjmp .+6 ; 0x1d5c - } - else if(ch == STK_SET_DEVICE_EXT) { - 1d56: 85 34 cpi r24, 0x45 ; 69 - 1d58: 19 f4 brne .+6 ; 0x1d60 - // SET DEVICE EXT is ignored - getNch(5); - 1d5a: 85 e0 ldi r24, 0x05 ; 5 - 1d5c: e5 d0 rcall .+458 ; 0x1f28 - 1d5e: b3 c0 rjmp .+358 ; 0x1ec6 - } - else if(ch == STK_LOAD_ADDRESS) { - 1d60: 85 35 cpi r24, 0x55 ; 85 - 1d62: 69 f4 brne .+26 ; 0x1d7e - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 1d64: c2 d0 rcall .+388 ; 0x1eea - newAddress = (newAddress & 0xff) | (getch() << 8); - 1d66: e8 2e mov r14, r24 - 1d68: ff 24 eor r15, r15 - 1d6a: bf d0 rcall .+382 ; 0x1eea - 1d6c: 08 2f mov r16, r24 - 1d6e: 10 e0 ldi r17, 0x00 ; 0 - 1d70: 10 2f mov r17, r16 - 1d72: 00 27 eor r16, r16 - 1d74: 0e 29 or r16, r14 - 1d76: 1f 29 or r17, r15 -#ifdef RAMPZ - // Transfer top bit to RAMPZ - RAMPZ = (newAddress & 0x8000) ? 1 : 0; -#endif - newAddress += newAddress; // Convert from word address to byte address - 1d78: 00 0f add r16, r16 - 1d7a: 11 1f adc r17, r17 - 1d7c: a3 c0 rjmp .+326 ; 0x1ec4 - address = newAddress; - verifySpace(); - } - else if(ch == STK_UNIVERSAL) { - 1d7e: 86 35 cpi r24, 0x56 ; 86 - 1d80: 21 f4 brne .+8 ; 0x1d8a - // UNIVERSAL command is ignored - getNch(4); - 1d82: 84 e0 ldi r24, 0x04 ; 4 - 1d84: d1 d0 rcall .+418 ; 0x1f28 - putch(0x00); - 1d86: 80 e0 ldi r24, 0x00 ; 0 - 1d88: 97 c0 rjmp .+302 ; 0x1eb8 - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 1d8a: 84 36 cpi r24, 0x64 ; 100 - 1d8c: 09 f0 breq .+2 ; 0x1d90 - 1d8e: 60 c0 rjmp .+192 ; 0x1e50 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t *bufPtr; - uint16_t addrPtr; - - getch(); /* getlen() */ - 1d90: ac d0 rcall .+344 ; 0x1eea - length = getch(); - 1d92: ab d0 rcall .+342 ; 0x1eea - 1d94: f8 2e mov r15, r24 - getch(); - 1d96: a9 d0 rcall .+338 ; 0x1eea - 1d98: c0 e0 ldi r28, 0x00 ; 0 - 1d9a: d1 e0 ldi r29, 0x01 ; 1 - // If we are in RWW section, immediately start page erase - if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - - // While that is going on, read in page contents - bufPtr = buff; - do *bufPtr++ = getch(); - 1d9c: a6 d0 rcall .+332 ; 0x1eea - 1d9e: 89 93 st Y+, r24 - while (--length); - 1da0: fc 16 cp r15, r28 - 1da2: e1 f7 brne .-8 ; 0x1d9c - - // If we are in NRWW section, page erase has to be delayed until now. - // Todo: Take RAMPZ into account - if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 1da4: 83 e0 ldi r24, 0x03 ; 3 - 1da6: f8 01 movw r30, r16 - 1da8: 87 bf out 0x37, r24 ; 55 - 1daa: e8 95 spm - - // Read command terminator, start reply - verifySpace(); - 1dac: b5 d0 rcall .+362 ; 0x1f18 - - // If only a partial page is to be programmed, the erase might not be complete. - // So check that here - boot_spm_busy_wait(); - 1dae: 07 b6 in r0, 0x37 ; 55 - 1db0: 00 fc sbrc r0, 0 - 1db2: fd cf rjmp .-6 ; 0x1dae - -#ifdef VIRTUAL_BOOT_PARTITION - if ((uint16_t)(void*)address == 0) { - 1db4: 01 15 cp r16, r1 - 1db6: 11 05 cpc r17, r1 - 1db8: 11 f0 breq .+4 ; 0x1dbe - 1dba: a8 01 movw r20, r16 - 1dbc: 2a c0 rjmp .+84 ; 0x1e12 - // This is the reset vector page. We need to live-patch the code so the - // bootloader runs. - // - // Move RESET vector to WDT vector - uint16_t vect = buff[0] | (buff[1]<<8); - 1dbe: 80 91 00 01 lds r24, 0x0100 - 1dc2: 20 91 01 01 lds r18, 0x0101 - 1dc6: 30 e0 ldi r19, 0x00 ; 0 - 1dc8: 32 2f mov r19, r18 - 1dca: 22 27 eor r18, r18 - 1dcc: 90 e0 ldi r25, 0x00 ; 0 - 1dce: 28 2b or r18, r24 - 1dd0: 39 2b or r19, r25 - rstVect = vect; - 1dd2: 30 93 85 01 sts 0x0185, r19 - 1dd6: 20 93 84 01 sts 0x0184, r18 - wdtVect = buff[8] | (buff[9]<<8); - 1dda: 40 91 08 01 lds r20, 0x0108 - 1dde: 80 91 09 01 lds r24, 0x0109 - 1de2: 90 e0 ldi r25, 0x00 ; 0 - 1de4: 98 2f mov r25, r24 - 1de6: 88 27 eor r24, r24 - 1de8: 50 e0 ldi r21, 0x00 ; 0 - 1dea: 84 2b or r24, r20 - 1dec: 95 2b or r25, r21 - 1dee: 90 93 87 01 sts 0x0187, r25 - 1df2: 80 93 86 01 sts 0x0186, r24 - vect -= 4; // Instruction is a relative jump (rjmp), so recalculate. - 1df6: 24 50 subi r18, 0x04 ; 4 - 1df8: 30 40 sbci r19, 0x00 ; 0 - buff[8] = vect & 0xff; - 1dfa: 20 93 08 01 sts 0x0108, r18 - buff[9] = vect >> 8; - 1dfe: 23 2f mov r18, r19 - 1e00: 33 27 eor r19, r19 - 1e02: 20 93 09 01 sts 0x0109, r18 - - // Add jump to bootloader at RESET vector - buff[0] = 0x7f; - 1e06: d0 92 00 01 sts 0x0100, r13 - buff[1] = 0xce; // rjmp 0x1d00 instruction - 1e0a: c0 92 01 01 sts 0x0101, r12 - 1e0e: 40 e0 ldi r20, 0x00 ; 0 - 1e10: 50 e0 ldi r21, 0x00 ; 0 - 1e12: a0 e0 ldi r26, 0x00 ; 0 - 1e14: b1 e0 ldi r27, 0x01 ; 1 - bufPtr = buff; - addrPtr = (uint16_t)(void*)address; - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - 1e16: 2c 91 ld r18, X - 1e18: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 1e1a: 11 96 adiw r26, 0x01 ; 1 - 1e1c: 8c 91 ld r24, X - 1e1e: 11 97 sbiw r26, 0x01 ; 1 - 1e20: 90 e0 ldi r25, 0x00 ; 0 - 1e22: 98 2f mov r25, r24 - 1e24: 88 27 eor r24, r24 - 1e26: 82 2b or r24, r18 - 1e28: 93 2b or r25, r19 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 1e2a: 12 96 adiw r26, 0x02 ; 2 - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 1e2c: fa 01 movw r30, r20 - 1e2e: 0c 01 movw r0, r24 - 1e30: b7 be out 0x37, r11 ; 55 - 1e32: e8 95 spm - 1e34: 11 24 eor r1, r1 - addrPtr += 2; - 1e36: 4e 5f subi r20, 0xFE ; 254 - 1e38: 5f 4f sbci r21, 0xFF ; 255 - } while (--ch); - 1e3a: f1 e0 ldi r31, 0x01 ; 1 - 1e3c: a0 34 cpi r26, 0x40 ; 64 - 1e3e: bf 07 cpc r27, r31 - 1e40: 51 f7 brne .-44 ; 0x1e16 - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 1e42: f8 01 movw r30, r16 - 1e44: a7 be out 0x37, r10 ; 55 - 1e46: e8 95 spm - boot_spm_busy_wait(); - 1e48: 07 b6 in r0, 0x37 ; 55 - 1e4a: 00 fc sbrc r0, 0 - 1e4c: fd cf rjmp .-6 ; 0x1e48 - 1e4e: 3b c0 rjmp .+118 ; 0x1ec6 - boot_rww_enable(); -#endif - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 1e50: 84 37 cpi r24, 0x74 ; 116 - 1e52: 51 f5 brne .+84 ; 0x1ea8 - // READ PAGE - we only read flash - getch(); /* getlen() */ - 1e54: 4a d0 rcall .+148 ; 0x1eea - length = getch(); - 1e56: 49 d0 rcall .+146 ; 0x1eea - 1e58: f8 2e mov r15, r24 - getch(); - 1e5a: 47 d0 rcall .+142 ; 0x1eea - - verifySpace(); - 1e5c: 5d d0 rcall .+186 ; 0x1f18 - 1e5e: e8 01 movw r28, r16 - 1e60: ef 2c mov r14, r15 -#ifdef VIRTUAL_BOOT_PARTITION - do { - // Undo vector patch in bottom page so verify passes - if (address == 0) ch=rstVect & 0xff; - 1e62: 20 97 sbiw r28, 0x00 ; 0 - 1e64: 19 f4 brne .+6 ; 0x1e6c - 1e66: 80 91 84 01 lds r24, 0x0184 - 1e6a: 14 c0 rjmp .+40 ; 0x1e94 - else if (address == 1) ch=rstVect >> 8; - 1e6c: c1 30 cpi r28, 0x01 ; 1 - 1e6e: d1 05 cpc r29, r1 - 1e70: 19 f4 brne .+6 ; 0x1e78 - 1e72: 80 91 85 01 lds r24, 0x0185 - 1e76: 0e c0 rjmp .+28 ; 0x1e94 - else if (address == 8) ch=wdtVect & 0xff; - 1e78: c8 30 cpi r28, 0x08 ; 8 - 1e7a: d1 05 cpc r29, r1 - 1e7c: 19 f4 brne .+6 ; 0x1e84 - 1e7e: 80 91 86 01 lds r24, 0x0186 - 1e82: 08 c0 rjmp .+16 ; 0x1e94 - else if (address == 9) ch=wdtVect >> 8; - 1e84: c9 30 cpi r28, 0x09 ; 9 - 1e86: d1 05 cpc r29, r1 - 1e88: 19 f4 brne .+6 ; 0x1e90 - 1e8a: 80 91 87 01 lds r24, 0x0187 - 1e8e: 02 c0 rjmp .+4 ; 0x1e94 - else ch = pgm_read_byte_near(address); - 1e90: fe 01 movw r30, r28 - 1e92: 84 91 lpm r24, Z+ - address++; - 1e94: 21 96 adiw r28, 0x01 ; 1 - putch(ch); - 1e96: 1a d0 rcall .+52 ; 0x1ecc - } while (--length); - 1e98: ea 94 dec r14 - 1e9a: 19 f7 brne .-58 ; 0x1e62 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 1e9c: 0f 5f subi r16, 0xFF ; 255 - 1e9e: 1f 4f sbci r17, 0xFF ; 255 - 1ea0: fa 94 dec r15 - 1ea2: 0f 0d add r16, r15 - 1ea4: 11 1d adc r17, r1 - 1ea6: 0f c0 rjmp .+30 ; 0x1ec6 -#endif -#endif - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 1ea8: 85 37 cpi r24, 0x75 ; 117 - 1eaa: 41 f4 brne .+16 ; 0x1ebc - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 1eac: 35 d0 rcall .+106 ; 0x1f18 - putch(SIGNATURE_0); - 1eae: 8e e1 ldi r24, 0x1E ; 30 - 1eb0: 0d d0 rcall .+26 ; 0x1ecc - putch(SIGNATURE_1); - 1eb2: 83 e9 ldi r24, 0x93 ; 147 - 1eb4: 0b d0 rcall .+22 ; 0x1ecc - putch(SIGNATURE_2); - 1eb6: 8c e0 ldi r24, 0x0C ; 12 - 1eb8: 09 d0 rcall .+18 ; 0x1ecc - 1eba: 05 c0 rjmp .+10 ; 0x1ec6 - } - else if (ch == 'Q') { - 1ebc: 81 35 cpi r24, 0x51 ; 81 - 1ebe: 11 f4 brne .+4 ; 0x1ec4 - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 1ec0: 88 e0 ldi r24, 0x08 ; 8 - 1ec2: 26 d0 rcall .+76 ; 0x1f10 - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 1ec4: 29 d0 rcall .+82 ; 0x1f18 - } - putch(STK_OK); - 1ec6: 80 e1 ldi r24, 0x10 ; 16 - 1ec8: 01 d0 rcall .+2 ; 0x1ecc - 1eca: 3a cf rjmp .-396 ; 0x1d40 - -00001ecc : -void putch(char ch) { -#ifndef SOFT_UART - while (!(UCSR0A & _BV(UDRE0))); - UDR0 = ch; -#else - __asm__ __volatile__ ( - 1ecc: 2a e0 ldi r18, 0x0A ; 10 - 1ece: 30 e0 ldi r19, 0x00 ; 0 - 1ed0: 80 95 com r24 - 1ed2: 08 94 sec - 1ed4: 10 f4 brcc .+4 ; 0x1eda - 1ed6: da 98 cbi 0x1b, 2 ; 27 - 1ed8: 02 c0 rjmp .+4 ; 0x1ede - 1eda: da 9a sbi 0x1b, 2 ; 27 - 1edc: 00 00 nop - 1ede: 14 d0 rcall .+40 ; 0x1f08 - 1ee0: 13 d0 rcall .+38 ; 0x1f08 - 1ee2: 86 95 lsr r24 - 1ee4: 2a 95 dec r18 - 1ee6: b1 f7 brne .-20 ; 0x1ed4 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 1ee8: 08 95 ret - -00001eea : - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 1eea: 29 e0 ldi r18, 0x09 ; 9 - 1eec: 30 e0 ldi r19, 0x00 ; 0 - 1eee: cb 99 sbic 0x19, 3 ; 25 - 1ef0: fe cf rjmp .-4 ; 0x1eee - 1ef2: 0a d0 rcall .+20 ; 0x1f08 - 1ef4: 09 d0 rcall .+18 ; 0x1f08 - 1ef6: 08 d0 rcall .+16 ; 0x1f08 - 1ef8: 88 94 clc - 1efa: cb 99 sbic 0x19, 3 ; 25 - 1efc: 08 94 sec - 1efe: 2a 95 dec r18 - 1f00: 11 f0 breq .+4 ; 0x1f06 - 1f02: 87 95 ror r24 - 1f04: f7 cf rjmp .-18 ; 0x1ef4 - 1f06: 08 95 ret - -00001f08 : -#if UART_B_VALUE > 255 -#error Baud rate too slow for soft UART -#endif - -void uartDelay() { - __asm__ __volatile__ ( - 1f08: 9e e0 ldi r25, 0x0E ; 14 - 1f0a: 9a 95 dec r25 - 1f0c: f1 f7 brne .-4 ; 0x1f0a - 1f0e: 08 95 ret - -00001f10 : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 1f10: 98 e1 ldi r25, 0x18 ; 24 - 1f12: 91 bd out 0x21, r25 ; 33 - WDTCSR = x; - 1f14: 81 bd out 0x21, r24 ; 33 -} - 1f16: 08 95 ret - -00001f18 : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 1f18: e8 df rcall .-48 ; 0x1eea - 1f1a: 80 32 cpi r24, 0x20 ; 32 - 1f1c: 19 f0 breq .+6 ; 0x1f24 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 1f1e: 88 e0 ldi r24, 0x08 ; 8 - 1f20: f7 df rcall .-18 ; 0x1f10 - 1f22: ff cf rjmp .-2 ; 0x1f22 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 1f24: 84 e1 ldi r24, 0x14 ; 20 -} - 1f26: d2 cf rjmp .-92 ; 0x1ecc - -00001f28 : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 1f28: 1f 93 push r17 - 1f2a: 18 2f mov r17, r24 - do getch(); while (--count); - 1f2c: de df rcall .-68 ; 0x1eea - 1f2e: 11 50 subi r17, 0x01 ; 1 - 1f30: e9 f7 brne .-6 ; 0x1f2c - verifySpace(); - 1f32: f2 df rcall .-28 ; 0x1f18 -} - 1f34: 1f 91 pop r17 - 1f36: 08 95 ret - -00001f38 : - WDTCSR = _BV(WDCE) | _BV(WDE); - WDTCSR = x; -} - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 1f38: 80 e0 ldi r24, 0x00 ; 0 - 1f3a: ea df rcall .-44 ; 0x1f10 - __asm__ __volatile__ ( - 1f3c: e4 e0 ldi r30, 0x04 ; 4 - 1f3e: ff 27 eor r31, r31 - 1f40: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_pro_16MHz.hex b/bootloaders/optiboot/optiboot_pro_16MHz.hex deleted file mode 100644 index b685a4e..0000000 --- a/bootloaders/optiboot/optiboot_pro_16MHz.hex +++ /dev/null @@ -1,34 +0,0 @@ -:103E0000112484B714BE81FFE7D085E08093810040 -:103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20080E18093C4008EE0C0D0259A86E075 -:103E300020E33CEF91E0309385002093840096BB13 -:103E4000B09BFECF1D9AA8958150A9F79924939411 -:103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE -:103E6000B3D083E01FC0823411F484E103C08534F1 -:103E700019F485E0A9D083C0853579F48BD0E82E7C -:103E8000FF2488D0082F10E0102F00270E291F29AB -:103E9000000F111F91D0680172C0863529F484E0AB -:103EA00093D080E06FD06BC0843609F042C072D0EE -:103EB00071D0082F6FD080E0C81688E3D80620F4B0 -:103EC00083E0F60187BFE895C0E0D1E063D0899335 -:103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF -:103EE000F60187BFE89568D007B600FCFDCFA601B4 -:103EF000A0E0B1E02C9130E011968C91119790E008 -:103F0000982F8827822B932B1296FA010C0197BECB -:103F1000E89511244E5F5F4FF1E0A038BF0751F7DD -:103F2000F601A7BEE89507B600FCFDCFB7BEE89541 -:103F300026C08437B1F42ED02DD0F82E2BD03CD013 -:103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 -:103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 -:103F60000EC0853739F428D08EE10CD084E90AD010 -:103F700086E098CF813511F488E018D01DD080E11B -:103F800001D06ACF982F8091C00085FFFCCF90931D -:103F9000C60008958091C00087FFFCCF8091C000CB -:103FA00084FD01C0A8958091C6000895E0E6F0E088 -:103FB00098E1908380830895EDDF803219F088E0E6 -:103FC000F5DFFFCF84E1DECF1F93182FE3DF115021 -:103FD000E9F7F2DF1F91089580E0E8DFEE27FF2781 -:023FE000099442 -:023FFE000304BA -:0400000300003E00BB -:00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_16MHz.lst b/bootloaders/optiboot/optiboot_pro_16MHz.lst deleted file mode 100644 index 2c6bea1..0000000 --- a/bootloaders/optiboot/optiboot_pro_16MHz.lst +++ /dev/null @@ -1,571 +0,0 @@ - -optiboot_pro_16MHz.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001e2 00003e00 00003e00 00000054 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 00000236 2**0 - CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00003e00
: -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3e00: 11 24 eor r1, r1 -#ifdef __AVR_ATmega8__ - SP=RAMEND; // This is done by hardware reset -#endif - - // Adaboot no-wait mod - ch = MCUSR; - 3e02: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 3e04: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 3e06: 81 ff sbrs r24, 1 - 3e08: e7 d0 rcall .+462 ; 0x3fd8 - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 3e0a: 85 e0 ldi r24, 0x05 ; 5 - 3e0c: 80 93 81 00 sts 0x0081, r24 - UCSRA = _BV(U2X); //Double speed mode USART - UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx - UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 - UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); -#else - UCSR0A = _BV(U2X0); //Double speed mode USART0 - 3e10: 82 e0 ldi r24, 0x02 ; 2 - 3e12: 80 93 c0 00 sts 0x00C0, r24 - UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 3e16: 88 e1 ldi r24, 0x18 ; 24 - 3e18: 80 93 c1 00 sts 0x00C1, r24 - UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 3e1c: 86 e0 ldi r24, 0x06 ; 6 - 3e1e: 80 93 c2 00 sts 0x00C2, r24 - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e22: 80 e1 ldi r24, 0x10 ; 16 - 3e24: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: c0 d0 rcall .+384 ; 0x3fac - - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 3e2c: 25 9a sbi 0x04, 5 ; 4 - 3e2e: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e30: 20 e3 ldi r18, 0x30 ; 48 - 3e32: 3c ef ldi r19, 0xFC ; 252 - TIFR1 = _BV(TOV1); - 3e34: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e36: 30 93 85 00 sts 0x0085, r19 - 3e3a: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 3e3e: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 3e40: b0 9b sbis 0x16, 0 ; 22 - 3e42: fe cf rjmp .-4 ; 0x3e40 -#ifdef __AVR_ATmega8__ - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 3e44: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3e46: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 3e48: 81 50 subi r24, 0x01 ; 1 - 3e4a: a9 f7 brne .-22 ; 0x3e36 - /* get character from UART */ - ch = getch(); - - if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e4c: 99 24 eor r9, r9 - 3e4e: 93 94 inc r9 - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - addrPtr += 2; - } while (--ch); - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3e50: a5 e0 ldi r26, 0x05 ; 5 - 3e52: aa 2e mov r10, r26 - boot_spm_busy_wait(); - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3e54: f1 e1 ldi r31, 0x11 ; 17 - 3e56: bf 2e mov r11, r31 -#endif - - /* Forever loop */ - for (;;) { - /* get character from UART */ - ch = getch(); - 3e58: 9d d0 rcall .+314 ; 0x3f94 - - if(ch == STK_GET_PARAMETER) { - 3e5a: 81 34 cpi r24, 0x41 ; 65 - 3e5c: 21 f4 brne .+8 ; 0x3e66 - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: b3 d0 rcall .+358 ; 0x3fc8 - putch(0x03); - 3e62: 83 e0 ldi r24, 0x03 ; 3 - 3e64: 1f c0 rjmp .+62 ; 0x3ea4 - } - else if(ch == STK_SET_DEVICE) { - 3e66: 82 34 cpi r24, 0x42 ; 66 - 3e68: 11 f4 brne .+4 ; 0x3e6e - // SET DEVICE is ignored - getNch(20); - 3e6a: 84 e1 ldi r24, 0x14 ; 20 - 3e6c: 03 c0 rjmp .+6 ; 0x3e74 - } - else if(ch == STK_SET_DEVICE_EXT) { - 3e6e: 85 34 cpi r24, 0x45 ; 69 - 3e70: 19 f4 brne .+6 ; 0x3e78 - // SET DEVICE EXT is ignored - getNch(5); - 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: a9 d0 rcall .+338 ; 0x3fc8 - 3e76: 83 c0 rjmp .+262 ; 0x3f7e - } - else if(ch == STK_LOAD_ADDRESS) { - 3e78: 85 35 cpi r24, 0x55 ; 85 - 3e7a: 79 f4 brne .+30 ; 0x3e9a - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 3e7c: 8b d0 rcall .+278 ; 0x3f94 - newAddress = (newAddress & 0xff) | (getch() << 8); - 3e7e: e8 2e mov r14, r24 - 3e80: ff 24 eor r15, r15 - 3e82: 88 d0 rcall .+272 ; 0x3f94 - 3e84: 08 2f mov r16, r24 - 3e86: 10 e0 ldi r17, 0x00 ; 0 - 3e88: 10 2f mov r17, r16 - 3e8a: 00 27 eor r16, r16 - 3e8c: 0e 29 or r16, r14 - 3e8e: 1f 29 or r17, r15 -#ifdef RAMPZ - // Transfer top bit to RAMPZ - RAMPZ = (newAddress & 0x8000) ? 1 : 0; -#endif - newAddress += newAddress; // Convert from word address to byte address - 3e90: 00 0f add r16, r16 - 3e92: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 3e94: 91 d0 rcall .+290 ; 0x3fb8 - 3e96: 68 01 movw r12, r16 - 3e98: 72 c0 rjmp .+228 ; 0x3f7e - } - else if(ch == STK_UNIVERSAL) { - 3e9a: 86 35 cpi r24, 0x56 ; 86 - 3e9c: 29 f4 brne .+10 ; 0x3ea8 - // UNIVERSAL command is ignored - getNch(4); - 3e9e: 84 e0 ldi r24, 0x04 ; 4 - 3ea0: 93 d0 rcall .+294 ; 0x3fc8 - putch(0x00); - 3ea2: 80 e0 ldi r24, 0x00 ; 0 - 3ea4: 6f d0 rcall .+222 ; 0x3f84 - 3ea6: 6b c0 rjmp .+214 ; 0x3f7e - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 3ea8: 84 36 cpi r24, 0x64 ; 100 - 3eaa: 09 f0 breq .+2 ; 0x3eae - 3eac: 42 c0 rjmp .+132 ; 0x3f32 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t *bufPtr; - uint16_t addrPtr; - - getch(); /* getlen() */ - 3eae: 72 d0 rcall .+228 ; 0x3f94 - length = getch(); - 3eb0: 71 d0 rcall .+226 ; 0x3f94 - 3eb2: 08 2f mov r16, r24 - getch(); - 3eb4: 6f d0 rcall .+222 ; 0x3f94 - - // If we are in RWW section, immediately start page erase - if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3eb6: 80 e0 ldi r24, 0x00 ; 0 - 3eb8: c8 16 cp r12, r24 - 3eba: 88 e3 ldi r24, 0x38 ; 56 - 3ebc: d8 06 cpc r13, r24 - 3ebe: 20 f4 brcc .+8 ; 0x3ec8 - 3ec0: 83 e0 ldi r24, 0x03 ; 3 - 3ec2: f6 01 movw r30, r12 - 3ec4: 87 bf out 0x37, r24 ; 55 - 3ec6: e8 95 spm - 3ec8: c0 e0 ldi r28, 0x00 ; 0 - 3eca: d1 e0 ldi r29, 0x01 ; 1 - - // While that is going on, read in page contents - bufPtr = buff; - do *bufPtr++ = getch(); - 3ecc: 63 d0 rcall .+198 ; 0x3f94 - 3ece: 89 93 st Y+, r24 - while (--length); - 3ed0: 0c 17 cp r16, r28 - 3ed2: e1 f7 brne .-8 ; 0x3ecc - - // If we are in NRWW section, page erase has to be delayed until now. - // Todo: Take RAMPZ into account - if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3ed4: f0 e0 ldi r31, 0x00 ; 0 - 3ed6: cf 16 cp r12, r31 - 3ed8: f8 e3 ldi r31, 0x38 ; 56 - 3eda: df 06 cpc r13, r31 - 3edc: 20 f0 brcs .+8 ; 0x3ee6 - 3ede: 83 e0 ldi r24, 0x03 ; 3 - 3ee0: f6 01 movw r30, r12 - 3ee2: 87 bf out 0x37, r24 ; 55 - 3ee4: e8 95 spm - - // Read command terminator, start reply - verifySpace(); - 3ee6: 68 d0 rcall .+208 ; 0x3fb8 - - // If only a partial page is to be programmed, the erase might not be complete. - // So check that here - boot_spm_busy_wait(); - 3ee8: 07 b6 in r0, 0x37 ; 55 - 3eea: 00 fc sbrc r0, 0 - 3eec: fd cf rjmp .-6 ; 0x3ee8 - 3eee: a6 01 movw r20, r12 - 3ef0: a0 e0 ldi r26, 0x00 ; 0 - 3ef2: b1 e0 ldi r27, 0x01 ; 1 - bufPtr = buff; - addrPtr = (uint16_t)(void*)address; - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - 3ef4: 2c 91 ld r18, X - 3ef6: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 3ef8: 11 96 adiw r26, 0x01 ; 1 - 3efa: 8c 91 ld r24, X - 3efc: 11 97 sbiw r26, 0x01 ; 1 - 3efe: 90 e0 ldi r25, 0x00 ; 0 - 3f00: 98 2f mov r25, r24 - 3f02: 88 27 eor r24, r24 - 3f04: 82 2b or r24, r18 - 3f06: 93 2b or r25, r19 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f08: 12 96 adiw r26, 0x02 ; 2 - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f0a: fa 01 movw r30, r20 - 3f0c: 0c 01 movw r0, r24 - 3f0e: 97 be out 0x37, r9 ; 55 - 3f10: e8 95 spm - 3f12: 11 24 eor r1, r1 - addrPtr += 2; - 3f14: 4e 5f subi r20, 0xFE ; 254 - 3f16: 5f 4f sbci r21, 0xFF ; 255 - } while (--ch); - 3f18: f1 e0 ldi r31, 0x01 ; 1 - 3f1a: a0 38 cpi r26, 0x80 ; 128 - 3f1c: bf 07 cpc r27, r31 - 3f1e: 51 f7 brne .-44 ; 0x3ef4 - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3f20: f6 01 movw r30, r12 - 3f22: a7 be out 0x37, r10 ; 55 - 3f24: e8 95 spm - boot_spm_busy_wait(); - 3f26: 07 b6 in r0, 0x37 ; 55 - 3f28: 00 fc sbrc r0, 0 - 3f2a: fd cf rjmp .-6 ; 0x3f26 - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3f2c: b7 be out 0x37, r11 ; 55 - 3f2e: e8 95 spm - 3f30: 26 c0 rjmp .+76 ; 0x3f7e -#endif - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 3f32: 84 37 cpi r24, 0x74 ; 116 - 3f34: b1 f4 brne .+44 ; 0x3f62 - // READ PAGE - we only read flash - getch(); /* getlen() */ - 3f36: 2e d0 rcall .+92 ; 0x3f94 - length = getch(); - 3f38: 2d d0 rcall .+90 ; 0x3f94 - 3f3a: f8 2e mov r15, r24 - getch(); - 3f3c: 2b d0 rcall .+86 ; 0x3f94 - - verifySpace(); - 3f3e: 3c d0 rcall .+120 ; 0x3fb8 - 3f40: f6 01 movw r30, r12 - 3f42: ef 2c mov r14, r15 - putch(result); - address++; - } - while (--length); -#else - do putch(pgm_read_byte_near(address++)); - 3f44: 8f 01 movw r16, r30 - 3f46: 0f 5f subi r16, 0xFF ; 255 - 3f48: 1f 4f sbci r17, 0xFF ; 255 - 3f4a: 84 91 lpm r24, Z+ - 3f4c: 1b d0 rcall .+54 ; 0x3f84 - while (--length); - 3f4e: ea 94 dec r14 - 3f50: f8 01 movw r30, r16 - 3f52: c1 f7 brne .-16 ; 0x3f44 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f54: 08 94 sec - 3f56: c1 1c adc r12, r1 - 3f58: d1 1c adc r13, r1 - 3f5a: fa 94 dec r15 - 3f5c: cf 0c add r12, r15 - 3f5e: d1 1c adc r13, r1 - 3f60: 0e c0 rjmp .+28 ; 0x3f7e -#endif -#endif - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 3f62: 85 37 cpi r24, 0x75 ; 117 - 3f64: 39 f4 brne .+14 ; 0x3f74 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 3f66: 28 d0 rcall .+80 ; 0x3fb8 - putch(SIGNATURE_0); - 3f68: 8e e1 ldi r24, 0x1E ; 30 - 3f6a: 0c d0 rcall .+24 ; 0x3f84 - putch(SIGNATURE_1); - 3f6c: 84 e9 ldi r24, 0x94 ; 148 - 3f6e: 0a d0 rcall .+20 ; 0x3f84 - putch(SIGNATURE_2); - 3f70: 86 e0 ldi r24, 0x06 ; 6 - 3f72: 98 cf rjmp .-208 ; 0x3ea4 - } - else if (ch == 'Q') { - 3f74: 81 35 cpi r24, 0x51 ; 81 - 3f76: 11 f4 brne .+4 ; 0x3f7c - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 3f78: 88 e0 ldi r24, 0x08 ; 8 - 3f7a: 18 d0 rcall .+48 ; 0x3fac - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 3f7c: 1d d0 rcall .+58 ; 0x3fb8 - } - putch(STK_OK); - 3f7e: 80 e1 ldi r24, 0x10 ; 16 - 3f80: 01 d0 rcall .+2 ; 0x3f84 - 3f82: 6a cf rjmp .-300 ; 0x3e58 - -00003f84 : - } -} - -void putch(char ch) { - 3f84: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UCSR0A & _BV(UDRE0))); - 3f86: 80 91 c0 00 lds r24, 0x00C0 - 3f8a: 85 ff sbrs r24, 5 - 3f8c: fc cf rjmp .-8 ; 0x3f86 - UDR0 = ch; - 3f8e: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 3f92: 08 95 ret - -00003f94 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))) - 3f94: 80 91 c0 00 lds r24, 0x00C0 - 3f98: 87 ff sbrs r24, 7 - 3f9a: fc cf rjmp .-8 ; 0x3f94 - ; - if (!(UCSR0A & _BV(FE0))) { - 3f9c: 80 91 c0 00 lds r24, 0x00C0 - 3fa0: 84 fd sbrc r24, 4 - 3fa2: 01 c0 rjmp .+2 ; 0x3fa6 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3fa4: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UDR0; - 3fa6: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 3faa: 08 95 ret - -00003fac : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 3fac: e0 e6 ldi r30, 0x60 ; 96 - 3fae: f0 e0 ldi r31, 0x00 ; 0 - 3fb0: 98 e1 ldi r25, 0x18 ; 24 - 3fb2: 90 83 st Z, r25 - WDTCSR = x; - 3fb4: 80 83 st Z, r24 -} - 3fb6: 08 95 ret - -00003fb8 : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 3fb8: ed df rcall .-38 ; 0x3f94 - 3fba: 80 32 cpi r24, 0x20 ; 32 - 3fbc: 19 f0 breq .+6 ; 0x3fc4 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fbe: 88 e0 ldi r24, 0x08 ; 8 - 3fc0: f5 df rcall .-22 ; 0x3fac - 3fc2: ff cf rjmp .-2 ; 0x3fc2 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 3fc4: 84 e1 ldi r24, 0x14 ; 20 -} - 3fc6: de cf rjmp .-68 ; 0x3f84 - -00003fc8 : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 3fc8: 1f 93 push r17 - 3fca: 18 2f mov r17, r24 - do getch(); while (--count); - 3fcc: e3 df rcall .-58 ; 0x3f94 - 3fce: 11 50 subi r17, 0x01 ; 1 - 3fd0: e9 f7 brne .-6 ; 0x3fcc - verifySpace(); - 3fd2: f2 df rcall .-28 ; 0x3fb8 -} - 3fd4: 1f 91 pop r17 - 3fd6: 08 95 ret - -00003fd8 : - WDTCSR = _BV(WDCE) | _BV(WDE); - WDTCSR = x; -} - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 3fd8: 80 e0 ldi r24, 0x00 ; 0 - 3fda: e8 df rcall .-48 ; 0x3fac - __asm__ __volatile__ ( - 3fdc: ee 27 eor r30, r30 - 3fde: ff 27 eor r31, r31 - 3fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_pro_20mhz.hex b/bootloaders/optiboot/optiboot_pro_20mhz.hex deleted file mode 100644 index 451a99c..0000000 --- a/bootloaders/optiboot/optiboot_pro_20mhz.hex +++ /dev/null @@ -1,34 +0,0 @@ -:103E0000112484B714BE81FFE7D085E08093810040 -:103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20085E18093C4008EE0C0D0259A86E070 -:103E30002CE33BEF91E0309385002093840096BB08 -:103E4000B09BFECF1D9AA8958150A9F79924939411 -:103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE -:103E6000B3D083E01FC0823411F484E103C08534F1 -:103E700019F485E0A9D083C0853579F48BD0E82E7C -:103E8000FF2488D0082F10E0102F00270E291F29AB -:103E9000000F111F91D0680172C0863529F484E0AB -:103EA00093D080E06FD06BC0843609F042C072D0EE -:103EB00071D0082F6FD080E0C81688E3D80620F4B0 -:103EC00083E0F60187BFE895C0E0D1E063D0899335 -:103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF -:103EE000F60187BFE89568D007B600FCFDCFA601B4 -:103EF000A0E0B1E02C9130E011968C91119790E008 -:103F0000982F8827822B932B1296FA010C0197BECB -:103F1000E89511244E5F5F4FF1E0A038BF0751F7DD -:103F2000F601A7BEE89507B600FCFDCFB7BEE89541 -:103F300026C08437B1F42ED02DD0F82E2BD03CD013 -:103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 -:103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 -:103F60000EC0853739F428D08EE10CD084E90AD010 -:103F700086E098CF813511F488E018D01DD080E11B -:103F800001D06ACF982F8091C00085FFFCCF90931D -:103F9000C60008958091C00087FFFCCF8091C000CB -:103FA00084FD01C0A8958091C6000895E0E6F0E088 -:103FB00098E1908380830895EDDF803219F088E0E6 -:103FC000F5DFFFCF84E1DECF1F93182FE3DF115021 -:103FD000E9F7F2DF1F91089580E0E8DFEE27FF2781 -:023FE000099442 -:023FFE000304BA -:0400000300003E00BB -:00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_20mhz.lst b/bootloaders/optiboot/optiboot_pro_20mhz.lst deleted file mode 100644 index 8314647..0000000 --- a/bootloaders/optiboot/optiboot_pro_20mhz.lst +++ /dev/null @@ -1,571 +0,0 @@ - -optiboot_pro_20mhz.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001e2 00003e00 00003e00 00000054 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 00000236 2**0 - CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00003e00
: -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3e00: 11 24 eor r1, r1 -#ifdef __AVR_ATmega8__ - SP=RAMEND; // This is done by hardware reset -#endif - - // Adaboot no-wait mod - ch = MCUSR; - 3e02: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 3e04: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 3e06: 81 ff sbrs r24, 1 - 3e08: e7 d0 rcall .+462 ; 0x3fd8 - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 3e0a: 85 e0 ldi r24, 0x05 ; 5 - 3e0c: 80 93 81 00 sts 0x0081, r24 - UCSRA = _BV(U2X); //Double speed mode USART - UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx - UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 - UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); -#else - UCSR0A = _BV(U2X0); //Double speed mode USART0 - 3e10: 82 e0 ldi r24, 0x02 ; 2 - 3e12: 80 93 c0 00 sts 0x00C0, r24 - UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 3e16: 88 e1 ldi r24, 0x18 ; 24 - 3e18: 80 93 c1 00 sts 0x00C1, r24 - UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 3e1c: 86 e0 ldi r24, 0x06 ; 6 - 3e1e: 80 93 c2 00 sts 0x00C2, r24 - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e22: 85 e1 ldi r24, 0x15 ; 21 - 3e24: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: c0 d0 rcall .+384 ; 0x3fac - - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 3e2c: 25 9a sbi 0x04, 5 ; 4 - 3e2e: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e30: 2c e3 ldi r18, 0x3C ; 60 - 3e32: 3b ef ldi r19, 0xFB ; 251 - TIFR1 = _BV(TOV1); - 3e34: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e36: 30 93 85 00 sts 0x0085, r19 - 3e3a: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 3e3e: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 3e40: b0 9b sbis 0x16, 0 ; 22 - 3e42: fe cf rjmp .-4 ; 0x3e40 -#ifdef __AVR_ATmega8__ - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 3e44: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3e46: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 3e48: 81 50 subi r24, 0x01 ; 1 - 3e4a: a9 f7 brne .-22 ; 0x3e36 - /* get character from UART */ - ch = getch(); - - if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e4c: 99 24 eor r9, r9 - 3e4e: 93 94 inc r9 - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - addrPtr += 2; - } while (--ch); - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3e50: a5 e0 ldi r26, 0x05 ; 5 - 3e52: aa 2e mov r10, r26 - boot_spm_busy_wait(); - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3e54: f1 e1 ldi r31, 0x11 ; 17 - 3e56: bf 2e mov r11, r31 -#endif - - /* Forever loop */ - for (;;) { - /* get character from UART */ - ch = getch(); - 3e58: 9d d0 rcall .+314 ; 0x3f94 - - if(ch == STK_GET_PARAMETER) { - 3e5a: 81 34 cpi r24, 0x41 ; 65 - 3e5c: 21 f4 brne .+8 ; 0x3e66 - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: b3 d0 rcall .+358 ; 0x3fc8 - putch(0x03); - 3e62: 83 e0 ldi r24, 0x03 ; 3 - 3e64: 1f c0 rjmp .+62 ; 0x3ea4 - } - else if(ch == STK_SET_DEVICE) { - 3e66: 82 34 cpi r24, 0x42 ; 66 - 3e68: 11 f4 brne .+4 ; 0x3e6e - // SET DEVICE is ignored - getNch(20); - 3e6a: 84 e1 ldi r24, 0x14 ; 20 - 3e6c: 03 c0 rjmp .+6 ; 0x3e74 - } - else if(ch == STK_SET_DEVICE_EXT) { - 3e6e: 85 34 cpi r24, 0x45 ; 69 - 3e70: 19 f4 brne .+6 ; 0x3e78 - // SET DEVICE EXT is ignored - getNch(5); - 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: a9 d0 rcall .+338 ; 0x3fc8 - 3e76: 83 c0 rjmp .+262 ; 0x3f7e - } - else if(ch == STK_LOAD_ADDRESS) { - 3e78: 85 35 cpi r24, 0x55 ; 85 - 3e7a: 79 f4 brne .+30 ; 0x3e9a - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 3e7c: 8b d0 rcall .+278 ; 0x3f94 - newAddress = (newAddress & 0xff) | (getch() << 8); - 3e7e: e8 2e mov r14, r24 - 3e80: ff 24 eor r15, r15 - 3e82: 88 d0 rcall .+272 ; 0x3f94 - 3e84: 08 2f mov r16, r24 - 3e86: 10 e0 ldi r17, 0x00 ; 0 - 3e88: 10 2f mov r17, r16 - 3e8a: 00 27 eor r16, r16 - 3e8c: 0e 29 or r16, r14 - 3e8e: 1f 29 or r17, r15 -#ifdef RAMPZ - // Transfer top bit to RAMPZ - RAMPZ = (newAddress & 0x8000) ? 1 : 0; -#endif - newAddress += newAddress; // Convert from word address to byte address - 3e90: 00 0f add r16, r16 - 3e92: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 3e94: 91 d0 rcall .+290 ; 0x3fb8 - 3e96: 68 01 movw r12, r16 - 3e98: 72 c0 rjmp .+228 ; 0x3f7e - } - else if(ch == STK_UNIVERSAL) { - 3e9a: 86 35 cpi r24, 0x56 ; 86 - 3e9c: 29 f4 brne .+10 ; 0x3ea8 - // UNIVERSAL command is ignored - getNch(4); - 3e9e: 84 e0 ldi r24, 0x04 ; 4 - 3ea0: 93 d0 rcall .+294 ; 0x3fc8 - putch(0x00); - 3ea2: 80 e0 ldi r24, 0x00 ; 0 - 3ea4: 6f d0 rcall .+222 ; 0x3f84 - 3ea6: 6b c0 rjmp .+214 ; 0x3f7e - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 3ea8: 84 36 cpi r24, 0x64 ; 100 - 3eaa: 09 f0 breq .+2 ; 0x3eae - 3eac: 42 c0 rjmp .+132 ; 0x3f32 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t *bufPtr; - uint16_t addrPtr; - - getch(); /* getlen() */ - 3eae: 72 d0 rcall .+228 ; 0x3f94 - length = getch(); - 3eb0: 71 d0 rcall .+226 ; 0x3f94 - 3eb2: 08 2f mov r16, r24 - getch(); - 3eb4: 6f d0 rcall .+222 ; 0x3f94 - - // If we are in RWW section, immediately start page erase - if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3eb6: 80 e0 ldi r24, 0x00 ; 0 - 3eb8: c8 16 cp r12, r24 - 3eba: 88 e3 ldi r24, 0x38 ; 56 - 3ebc: d8 06 cpc r13, r24 - 3ebe: 20 f4 brcc .+8 ; 0x3ec8 - 3ec0: 83 e0 ldi r24, 0x03 ; 3 - 3ec2: f6 01 movw r30, r12 - 3ec4: 87 bf out 0x37, r24 ; 55 - 3ec6: e8 95 spm - 3ec8: c0 e0 ldi r28, 0x00 ; 0 - 3eca: d1 e0 ldi r29, 0x01 ; 1 - - // While that is going on, read in page contents - bufPtr = buff; - do *bufPtr++ = getch(); - 3ecc: 63 d0 rcall .+198 ; 0x3f94 - 3ece: 89 93 st Y+, r24 - while (--length); - 3ed0: 0c 17 cp r16, r28 - 3ed2: e1 f7 brne .-8 ; 0x3ecc - - // If we are in NRWW section, page erase has to be delayed until now. - // Todo: Take RAMPZ into account - if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3ed4: f0 e0 ldi r31, 0x00 ; 0 - 3ed6: cf 16 cp r12, r31 - 3ed8: f8 e3 ldi r31, 0x38 ; 56 - 3eda: df 06 cpc r13, r31 - 3edc: 20 f0 brcs .+8 ; 0x3ee6 - 3ede: 83 e0 ldi r24, 0x03 ; 3 - 3ee0: f6 01 movw r30, r12 - 3ee2: 87 bf out 0x37, r24 ; 55 - 3ee4: e8 95 spm - - // Read command terminator, start reply - verifySpace(); - 3ee6: 68 d0 rcall .+208 ; 0x3fb8 - - // If only a partial page is to be programmed, the erase might not be complete. - // So check that here - boot_spm_busy_wait(); - 3ee8: 07 b6 in r0, 0x37 ; 55 - 3eea: 00 fc sbrc r0, 0 - 3eec: fd cf rjmp .-6 ; 0x3ee8 - 3eee: a6 01 movw r20, r12 - 3ef0: a0 e0 ldi r26, 0x00 ; 0 - 3ef2: b1 e0 ldi r27, 0x01 ; 1 - bufPtr = buff; - addrPtr = (uint16_t)(void*)address; - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - 3ef4: 2c 91 ld r18, X - 3ef6: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 3ef8: 11 96 adiw r26, 0x01 ; 1 - 3efa: 8c 91 ld r24, X - 3efc: 11 97 sbiw r26, 0x01 ; 1 - 3efe: 90 e0 ldi r25, 0x00 ; 0 - 3f00: 98 2f mov r25, r24 - 3f02: 88 27 eor r24, r24 - 3f04: 82 2b or r24, r18 - 3f06: 93 2b or r25, r19 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f08: 12 96 adiw r26, 0x02 ; 2 - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f0a: fa 01 movw r30, r20 - 3f0c: 0c 01 movw r0, r24 - 3f0e: 97 be out 0x37, r9 ; 55 - 3f10: e8 95 spm - 3f12: 11 24 eor r1, r1 - addrPtr += 2; - 3f14: 4e 5f subi r20, 0xFE ; 254 - 3f16: 5f 4f sbci r21, 0xFF ; 255 - } while (--ch); - 3f18: f1 e0 ldi r31, 0x01 ; 1 - 3f1a: a0 38 cpi r26, 0x80 ; 128 - 3f1c: bf 07 cpc r27, r31 - 3f1e: 51 f7 brne .-44 ; 0x3ef4 - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3f20: f6 01 movw r30, r12 - 3f22: a7 be out 0x37, r10 ; 55 - 3f24: e8 95 spm - boot_spm_busy_wait(); - 3f26: 07 b6 in r0, 0x37 ; 55 - 3f28: 00 fc sbrc r0, 0 - 3f2a: fd cf rjmp .-6 ; 0x3f26 - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3f2c: b7 be out 0x37, r11 ; 55 - 3f2e: e8 95 spm - 3f30: 26 c0 rjmp .+76 ; 0x3f7e -#endif - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 3f32: 84 37 cpi r24, 0x74 ; 116 - 3f34: b1 f4 brne .+44 ; 0x3f62 - // READ PAGE - we only read flash - getch(); /* getlen() */ - 3f36: 2e d0 rcall .+92 ; 0x3f94 - length = getch(); - 3f38: 2d d0 rcall .+90 ; 0x3f94 - 3f3a: f8 2e mov r15, r24 - getch(); - 3f3c: 2b d0 rcall .+86 ; 0x3f94 - - verifySpace(); - 3f3e: 3c d0 rcall .+120 ; 0x3fb8 - 3f40: f6 01 movw r30, r12 - 3f42: ef 2c mov r14, r15 - putch(result); - address++; - } - while (--length); -#else - do putch(pgm_read_byte_near(address++)); - 3f44: 8f 01 movw r16, r30 - 3f46: 0f 5f subi r16, 0xFF ; 255 - 3f48: 1f 4f sbci r17, 0xFF ; 255 - 3f4a: 84 91 lpm r24, Z+ - 3f4c: 1b d0 rcall .+54 ; 0x3f84 - while (--length); - 3f4e: ea 94 dec r14 - 3f50: f8 01 movw r30, r16 - 3f52: c1 f7 brne .-16 ; 0x3f44 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f54: 08 94 sec - 3f56: c1 1c adc r12, r1 - 3f58: d1 1c adc r13, r1 - 3f5a: fa 94 dec r15 - 3f5c: cf 0c add r12, r15 - 3f5e: d1 1c adc r13, r1 - 3f60: 0e c0 rjmp .+28 ; 0x3f7e -#endif -#endif - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 3f62: 85 37 cpi r24, 0x75 ; 117 - 3f64: 39 f4 brne .+14 ; 0x3f74 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 3f66: 28 d0 rcall .+80 ; 0x3fb8 - putch(SIGNATURE_0); - 3f68: 8e e1 ldi r24, 0x1E ; 30 - 3f6a: 0c d0 rcall .+24 ; 0x3f84 - putch(SIGNATURE_1); - 3f6c: 84 e9 ldi r24, 0x94 ; 148 - 3f6e: 0a d0 rcall .+20 ; 0x3f84 - putch(SIGNATURE_2); - 3f70: 86 e0 ldi r24, 0x06 ; 6 - 3f72: 98 cf rjmp .-208 ; 0x3ea4 - } - else if (ch == 'Q') { - 3f74: 81 35 cpi r24, 0x51 ; 81 - 3f76: 11 f4 brne .+4 ; 0x3f7c - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 3f78: 88 e0 ldi r24, 0x08 ; 8 - 3f7a: 18 d0 rcall .+48 ; 0x3fac - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 3f7c: 1d d0 rcall .+58 ; 0x3fb8 - } - putch(STK_OK); - 3f7e: 80 e1 ldi r24, 0x10 ; 16 - 3f80: 01 d0 rcall .+2 ; 0x3f84 - 3f82: 6a cf rjmp .-300 ; 0x3e58 - -00003f84 : - } -} - -void putch(char ch) { - 3f84: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UCSR0A & _BV(UDRE0))); - 3f86: 80 91 c0 00 lds r24, 0x00C0 - 3f8a: 85 ff sbrs r24, 5 - 3f8c: fc cf rjmp .-8 ; 0x3f86 - UDR0 = ch; - 3f8e: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 3f92: 08 95 ret - -00003f94 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))) - 3f94: 80 91 c0 00 lds r24, 0x00C0 - 3f98: 87 ff sbrs r24, 7 - 3f9a: fc cf rjmp .-8 ; 0x3f94 - ; - if (!(UCSR0A & _BV(FE0))) { - 3f9c: 80 91 c0 00 lds r24, 0x00C0 - 3fa0: 84 fd sbrc r24, 4 - 3fa2: 01 c0 rjmp .+2 ; 0x3fa6 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3fa4: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UDR0; - 3fa6: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 3faa: 08 95 ret - -00003fac : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 3fac: e0 e6 ldi r30, 0x60 ; 96 - 3fae: f0 e0 ldi r31, 0x00 ; 0 - 3fb0: 98 e1 ldi r25, 0x18 ; 24 - 3fb2: 90 83 st Z, r25 - WDTCSR = x; - 3fb4: 80 83 st Z, r24 -} - 3fb6: 08 95 ret - -00003fb8 : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 3fb8: ed df rcall .-38 ; 0x3f94 - 3fba: 80 32 cpi r24, 0x20 ; 32 - 3fbc: 19 f0 breq .+6 ; 0x3fc4 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fbe: 88 e0 ldi r24, 0x08 ; 8 - 3fc0: f5 df rcall .-22 ; 0x3fac - 3fc2: ff cf rjmp .-2 ; 0x3fc2 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 3fc4: 84 e1 ldi r24, 0x14 ; 20 -} - 3fc6: de cf rjmp .-68 ; 0x3f84 - -00003fc8 : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 3fc8: 1f 93 push r17 - 3fca: 18 2f mov r17, r24 - do getch(); while (--count); - 3fcc: e3 df rcall .-58 ; 0x3f94 - 3fce: 11 50 subi r17, 0x01 ; 1 - 3fd0: e9 f7 brne .-6 ; 0x3fcc - verifySpace(); - 3fd2: f2 df rcall .-28 ; 0x3fb8 -} - 3fd4: 1f 91 pop r17 - 3fd6: 08 95 ret - -00003fd8 : - WDTCSR = _BV(WDCE) | _BV(WDE); - WDTCSR = x; -} - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 3fd8: 80 e0 ldi r24, 0x00 ; 0 - 3fda: e8 df rcall .-48 ; 0x3fac - __asm__ __volatile__ ( - 3fdc: ee 27 eor r30, r30 - 3fde: ff 27 eor r31, r31 - 3fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_pro_8MHz.hex b/bootloaders/optiboot/optiboot_pro_8MHz.hex deleted file mode 100644 index 2c63395..0000000 --- a/bootloaders/optiboot/optiboot_pro_8MHz.hex +++ /dev/null @@ -1,34 +0,0 @@ -:103E0000112484B714BE81FFE7D085E08093810040 -:103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20088E08093C4008EE0C0D0259A86E06E -:103E300028E13EEF91E0309385002093840096BB0B -:103E4000B09BFECF1D9AA8958150A9F79924939411 -:103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE -:103E6000B3D083E01FC0823411F484E103C08534F1 -:103E700019F485E0A9D083C0853579F48BD0E82E7C -:103E8000FF2488D0082F10E0102F00270E291F29AB -:103E9000000F111F91D0680172C0863529F484E0AB -:103EA00093D080E06FD06BC0843609F042C072D0EE -:103EB00071D0082F6FD080E0C81688E3D80620F4B0 -:103EC00083E0F60187BFE895C0E0D1E063D0899335 -:103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF -:103EE000F60187BFE89568D007B600FCFDCFA601B4 -:103EF000A0E0B1E02C9130E011968C91119790E008 -:103F0000982F8827822B932B1296FA010C0197BECB -:103F1000E89511244E5F5F4FF1E0A038BF0751F7DD -:103F2000F601A7BEE89507B600FCFDCFB7BEE89541 -:103F300026C08437B1F42ED02DD0F82E2BD03CD013 -:103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 -:103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 -:103F60000EC0853739F428D08EE10CD084E90AD010 -:103F700086E098CF813511F488E018D01DD080E11B -:103F800001D06ACF982F8091C00085FFFCCF90931D -:103F9000C60008958091C00087FFFCCF8091C000CB -:103FA00084FD01C0A8958091C6000895E0E6F0E088 -:103FB00098E1908380830895EDDF803219F088E0E6 -:103FC000F5DFFFCF84E1DECF1F93182FE3DF115021 -:103FD000E9F7F2DF1F91089580E0E8DFEE27FF2781 -:023FE000099442 -:023FFE000304BA -:0400000300003E00BB -:00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_8MHz.lst b/bootloaders/optiboot/optiboot_pro_8MHz.lst deleted file mode 100644 index 1fb903c..0000000 --- a/bootloaders/optiboot/optiboot_pro_8MHz.lst +++ /dev/null @@ -1,571 +0,0 @@ - -optiboot_pro_8MHz.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001e2 00003e00 00003e00 00000054 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 00000236 2**0 - CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00003e00
: -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3e00: 11 24 eor r1, r1 -#ifdef __AVR_ATmega8__ - SP=RAMEND; // This is done by hardware reset -#endif - - // Adaboot no-wait mod - ch = MCUSR; - 3e02: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 3e04: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 3e06: 81 ff sbrs r24, 1 - 3e08: e7 d0 rcall .+462 ; 0x3fd8 - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 3e0a: 85 e0 ldi r24, 0x05 ; 5 - 3e0c: 80 93 81 00 sts 0x0081, r24 - UCSRA = _BV(U2X); //Double speed mode USART - UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx - UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 - UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); -#else - UCSR0A = _BV(U2X0); //Double speed mode USART0 - 3e10: 82 e0 ldi r24, 0x02 ; 2 - 3e12: 80 93 c0 00 sts 0x00C0, r24 - UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 3e16: 88 e1 ldi r24, 0x18 ; 24 - 3e18: 80 93 c1 00 sts 0x00C1, r24 - UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 3e1c: 86 e0 ldi r24, 0x06 ; 6 - 3e1e: 80 93 c2 00 sts 0x00C2, r24 - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e22: 88 e0 ldi r24, 0x08 ; 8 - 3e24: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: c0 d0 rcall .+384 ; 0x3fac - - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 3e2c: 25 9a sbi 0x04, 5 ; 4 - 3e2e: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e30: 28 e1 ldi r18, 0x18 ; 24 - 3e32: 3e ef ldi r19, 0xFE ; 254 - TIFR1 = _BV(TOV1); - 3e34: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e36: 30 93 85 00 sts 0x0085, r19 - 3e3a: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 3e3e: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 3e40: b0 9b sbis 0x16, 0 ; 22 - 3e42: fe cf rjmp .-4 ; 0x3e40 -#ifdef __AVR_ATmega8__ - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 3e44: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3e46: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 3e48: 81 50 subi r24, 0x01 ; 1 - 3e4a: a9 f7 brne .-22 ; 0x3e36 - /* get character from UART */ - ch = getch(); - - if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e4c: 99 24 eor r9, r9 - 3e4e: 93 94 inc r9 - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - addrPtr += 2; - } while (--ch); - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3e50: a5 e0 ldi r26, 0x05 ; 5 - 3e52: aa 2e mov r10, r26 - boot_spm_busy_wait(); - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3e54: f1 e1 ldi r31, 0x11 ; 17 - 3e56: bf 2e mov r11, r31 -#endif - - /* Forever loop */ - for (;;) { - /* get character from UART */ - ch = getch(); - 3e58: 9d d0 rcall .+314 ; 0x3f94 - - if(ch == STK_GET_PARAMETER) { - 3e5a: 81 34 cpi r24, 0x41 ; 65 - 3e5c: 21 f4 brne .+8 ; 0x3e66 - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: b3 d0 rcall .+358 ; 0x3fc8 - putch(0x03); - 3e62: 83 e0 ldi r24, 0x03 ; 3 - 3e64: 1f c0 rjmp .+62 ; 0x3ea4 - } - else if(ch == STK_SET_DEVICE) { - 3e66: 82 34 cpi r24, 0x42 ; 66 - 3e68: 11 f4 brne .+4 ; 0x3e6e - // SET DEVICE is ignored - getNch(20); - 3e6a: 84 e1 ldi r24, 0x14 ; 20 - 3e6c: 03 c0 rjmp .+6 ; 0x3e74 - } - else if(ch == STK_SET_DEVICE_EXT) { - 3e6e: 85 34 cpi r24, 0x45 ; 69 - 3e70: 19 f4 brne .+6 ; 0x3e78 - // SET DEVICE EXT is ignored - getNch(5); - 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: a9 d0 rcall .+338 ; 0x3fc8 - 3e76: 83 c0 rjmp .+262 ; 0x3f7e - } - else if(ch == STK_LOAD_ADDRESS) { - 3e78: 85 35 cpi r24, 0x55 ; 85 - 3e7a: 79 f4 brne .+30 ; 0x3e9a - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 3e7c: 8b d0 rcall .+278 ; 0x3f94 - newAddress = (newAddress & 0xff) | (getch() << 8); - 3e7e: e8 2e mov r14, r24 - 3e80: ff 24 eor r15, r15 - 3e82: 88 d0 rcall .+272 ; 0x3f94 - 3e84: 08 2f mov r16, r24 - 3e86: 10 e0 ldi r17, 0x00 ; 0 - 3e88: 10 2f mov r17, r16 - 3e8a: 00 27 eor r16, r16 - 3e8c: 0e 29 or r16, r14 - 3e8e: 1f 29 or r17, r15 -#ifdef RAMPZ - // Transfer top bit to RAMPZ - RAMPZ = (newAddress & 0x8000) ? 1 : 0; -#endif - newAddress += newAddress; // Convert from word address to byte address - 3e90: 00 0f add r16, r16 - 3e92: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 3e94: 91 d0 rcall .+290 ; 0x3fb8 - 3e96: 68 01 movw r12, r16 - 3e98: 72 c0 rjmp .+228 ; 0x3f7e - } - else if(ch == STK_UNIVERSAL) { - 3e9a: 86 35 cpi r24, 0x56 ; 86 - 3e9c: 29 f4 brne .+10 ; 0x3ea8 - // UNIVERSAL command is ignored - getNch(4); - 3e9e: 84 e0 ldi r24, 0x04 ; 4 - 3ea0: 93 d0 rcall .+294 ; 0x3fc8 - putch(0x00); - 3ea2: 80 e0 ldi r24, 0x00 ; 0 - 3ea4: 6f d0 rcall .+222 ; 0x3f84 - 3ea6: 6b c0 rjmp .+214 ; 0x3f7e - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 3ea8: 84 36 cpi r24, 0x64 ; 100 - 3eaa: 09 f0 breq .+2 ; 0x3eae - 3eac: 42 c0 rjmp .+132 ; 0x3f32 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t *bufPtr; - uint16_t addrPtr; - - getch(); /* getlen() */ - 3eae: 72 d0 rcall .+228 ; 0x3f94 - length = getch(); - 3eb0: 71 d0 rcall .+226 ; 0x3f94 - 3eb2: 08 2f mov r16, r24 - getch(); - 3eb4: 6f d0 rcall .+222 ; 0x3f94 - - // If we are in RWW section, immediately start page erase - if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3eb6: 80 e0 ldi r24, 0x00 ; 0 - 3eb8: c8 16 cp r12, r24 - 3eba: 88 e3 ldi r24, 0x38 ; 56 - 3ebc: d8 06 cpc r13, r24 - 3ebe: 20 f4 brcc .+8 ; 0x3ec8 - 3ec0: 83 e0 ldi r24, 0x03 ; 3 - 3ec2: f6 01 movw r30, r12 - 3ec4: 87 bf out 0x37, r24 ; 55 - 3ec6: e8 95 spm - 3ec8: c0 e0 ldi r28, 0x00 ; 0 - 3eca: d1 e0 ldi r29, 0x01 ; 1 - - // While that is going on, read in page contents - bufPtr = buff; - do *bufPtr++ = getch(); - 3ecc: 63 d0 rcall .+198 ; 0x3f94 - 3ece: 89 93 st Y+, r24 - while (--length); - 3ed0: 0c 17 cp r16, r28 - 3ed2: e1 f7 brne .-8 ; 0x3ecc - - // If we are in NRWW section, page erase has to be delayed until now. - // Todo: Take RAMPZ into account - if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3ed4: f0 e0 ldi r31, 0x00 ; 0 - 3ed6: cf 16 cp r12, r31 - 3ed8: f8 e3 ldi r31, 0x38 ; 56 - 3eda: df 06 cpc r13, r31 - 3edc: 20 f0 brcs .+8 ; 0x3ee6 - 3ede: 83 e0 ldi r24, 0x03 ; 3 - 3ee0: f6 01 movw r30, r12 - 3ee2: 87 bf out 0x37, r24 ; 55 - 3ee4: e8 95 spm - - // Read command terminator, start reply - verifySpace(); - 3ee6: 68 d0 rcall .+208 ; 0x3fb8 - - // If only a partial page is to be programmed, the erase might not be complete. - // So check that here - boot_spm_busy_wait(); - 3ee8: 07 b6 in r0, 0x37 ; 55 - 3eea: 00 fc sbrc r0, 0 - 3eec: fd cf rjmp .-6 ; 0x3ee8 - 3eee: a6 01 movw r20, r12 - 3ef0: a0 e0 ldi r26, 0x00 ; 0 - 3ef2: b1 e0 ldi r27, 0x01 ; 1 - bufPtr = buff; - addrPtr = (uint16_t)(void*)address; - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - 3ef4: 2c 91 ld r18, X - 3ef6: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 3ef8: 11 96 adiw r26, 0x01 ; 1 - 3efa: 8c 91 ld r24, X - 3efc: 11 97 sbiw r26, 0x01 ; 1 - 3efe: 90 e0 ldi r25, 0x00 ; 0 - 3f00: 98 2f mov r25, r24 - 3f02: 88 27 eor r24, r24 - 3f04: 82 2b or r24, r18 - 3f06: 93 2b or r25, r19 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f08: 12 96 adiw r26, 0x02 ; 2 - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f0a: fa 01 movw r30, r20 - 3f0c: 0c 01 movw r0, r24 - 3f0e: 97 be out 0x37, r9 ; 55 - 3f10: e8 95 spm - 3f12: 11 24 eor r1, r1 - addrPtr += 2; - 3f14: 4e 5f subi r20, 0xFE ; 254 - 3f16: 5f 4f sbci r21, 0xFF ; 255 - } while (--ch); - 3f18: f1 e0 ldi r31, 0x01 ; 1 - 3f1a: a0 38 cpi r26, 0x80 ; 128 - 3f1c: bf 07 cpc r27, r31 - 3f1e: 51 f7 brne .-44 ; 0x3ef4 - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3f20: f6 01 movw r30, r12 - 3f22: a7 be out 0x37, r10 ; 55 - 3f24: e8 95 spm - boot_spm_busy_wait(); - 3f26: 07 b6 in r0, 0x37 ; 55 - 3f28: 00 fc sbrc r0, 0 - 3f2a: fd cf rjmp .-6 ; 0x3f26 - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3f2c: b7 be out 0x37, r11 ; 55 - 3f2e: e8 95 spm - 3f30: 26 c0 rjmp .+76 ; 0x3f7e -#endif - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 3f32: 84 37 cpi r24, 0x74 ; 116 - 3f34: b1 f4 brne .+44 ; 0x3f62 - // READ PAGE - we only read flash - getch(); /* getlen() */ - 3f36: 2e d0 rcall .+92 ; 0x3f94 - length = getch(); - 3f38: 2d d0 rcall .+90 ; 0x3f94 - 3f3a: f8 2e mov r15, r24 - getch(); - 3f3c: 2b d0 rcall .+86 ; 0x3f94 - - verifySpace(); - 3f3e: 3c d0 rcall .+120 ; 0x3fb8 - 3f40: f6 01 movw r30, r12 - 3f42: ef 2c mov r14, r15 - putch(result); - address++; - } - while (--length); -#else - do putch(pgm_read_byte_near(address++)); - 3f44: 8f 01 movw r16, r30 - 3f46: 0f 5f subi r16, 0xFF ; 255 - 3f48: 1f 4f sbci r17, 0xFF ; 255 - 3f4a: 84 91 lpm r24, Z+ - 3f4c: 1b d0 rcall .+54 ; 0x3f84 - while (--length); - 3f4e: ea 94 dec r14 - 3f50: f8 01 movw r30, r16 - 3f52: c1 f7 brne .-16 ; 0x3f44 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f54: 08 94 sec - 3f56: c1 1c adc r12, r1 - 3f58: d1 1c adc r13, r1 - 3f5a: fa 94 dec r15 - 3f5c: cf 0c add r12, r15 - 3f5e: d1 1c adc r13, r1 - 3f60: 0e c0 rjmp .+28 ; 0x3f7e -#endif -#endif - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 3f62: 85 37 cpi r24, 0x75 ; 117 - 3f64: 39 f4 brne .+14 ; 0x3f74 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 3f66: 28 d0 rcall .+80 ; 0x3fb8 - putch(SIGNATURE_0); - 3f68: 8e e1 ldi r24, 0x1E ; 30 - 3f6a: 0c d0 rcall .+24 ; 0x3f84 - putch(SIGNATURE_1); - 3f6c: 84 e9 ldi r24, 0x94 ; 148 - 3f6e: 0a d0 rcall .+20 ; 0x3f84 - putch(SIGNATURE_2); - 3f70: 86 e0 ldi r24, 0x06 ; 6 - 3f72: 98 cf rjmp .-208 ; 0x3ea4 - } - else if (ch == 'Q') { - 3f74: 81 35 cpi r24, 0x51 ; 81 - 3f76: 11 f4 brne .+4 ; 0x3f7c - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 3f78: 88 e0 ldi r24, 0x08 ; 8 - 3f7a: 18 d0 rcall .+48 ; 0x3fac - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 3f7c: 1d d0 rcall .+58 ; 0x3fb8 - } - putch(STK_OK); - 3f7e: 80 e1 ldi r24, 0x10 ; 16 - 3f80: 01 d0 rcall .+2 ; 0x3f84 - 3f82: 6a cf rjmp .-300 ; 0x3e58 - -00003f84 : - } -} - -void putch(char ch) { - 3f84: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UCSR0A & _BV(UDRE0))); - 3f86: 80 91 c0 00 lds r24, 0x00C0 - 3f8a: 85 ff sbrs r24, 5 - 3f8c: fc cf rjmp .-8 ; 0x3f86 - UDR0 = ch; - 3f8e: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 3f92: 08 95 ret - -00003f94 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))) - 3f94: 80 91 c0 00 lds r24, 0x00C0 - 3f98: 87 ff sbrs r24, 7 - 3f9a: fc cf rjmp .-8 ; 0x3f94 - ; - if (!(UCSR0A & _BV(FE0))) { - 3f9c: 80 91 c0 00 lds r24, 0x00C0 - 3fa0: 84 fd sbrc r24, 4 - 3fa2: 01 c0 rjmp .+2 ; 0x3fa6 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3fa4: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UDR0; - 3fa6: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 3faa: 08 95 ret - -00003fac : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 3fac: e0 e6 ldi r30, 0x60 ; 96 - 3fae: f0 e0 ldi r31, 0x00 ; 0 - 3fb0: 98 e1 ldi r25, 0x18 ; 24 - 3fb2: 90 83 st Z, r25 - WDTCSR = x; - 3fb4: 80 83 st Z, r24 -} - 3fb6: 08 95 ret - -00003fb8 : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 3fb8: ed df rcall .-38 ; 0x3f94 - 3fba: 80 32 cpi r24, 0x20 ; 32 - 3fbc: 19 f0 breq .+6 ; 0x3fc4 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fbe: 88 e0 ldi r24, 0x08 ; 8 - 3fc0: f5 df rcall .-22 ; 0x3fac - 3fc2: ff cf rjmp .-2 ; 0x3fc2 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 3fc4: 84 e1 ldi r24, 0x14 ; 20 -} - 3fc6: de cf rjmp .-68 ; 0x3f84 - -00003fc8 : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 3fc8: 1f 93 push r17 - 3fca: 18 2f mov r17, r24 - do getch(); while (--count); - 3fcc: e3 df rcall .-58 ; 0x3f94 - 3fce: 11 50 subi r17, 0x01 ; 1 - 3fd0: e9 f7 brne .-6 ; 0x3fcc - verifySpace(); - 3fd2: f2 df rcall .-28 ; 0x3fb8 -} - 3fd4: 1f 91 pop r17 - 3fd6: 08 95 ret - -00003fd8 : - WDTCSR = _BV(WDCE) | _BV(WDE); - WDTCSR = x; -} - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 3fd8: 80 e0 ldi r24, 0x00 ; 0 - 3fda: e8 df rcall .-48 ; 0x3fac - __asm__ __volatile__ ( - 3fdc: ee 27 eor r30, r30 - 3fde: ff 27 eor r31, r31 - 3fe0: 09 94 ijmp -- cgit v1.2.3-18-g5258 From 8628479d7039247395bea6ea6f0c8bdab8f696bc Mon Sep 17 00:00:00 2001 From: WestfW Date: Tue, 14 Jun 2011 23:57:41 -0700 Subject: Oops. Add atmega8.lst/hex and atmega168.lst/hex to controlled files. --- bootloaders/optiboot/optiboot_atmega168.hex | 35 ++ bootloaders/optiboot/optiboot_atmega168.lst | 598 +++++++++++++++++++++++++++ bootloaders/optiboot/optiboot_atmega8.hex | 33 ++ bootloaders/optiboot/optiboot_atmega8.lst | 604 ++++++++++++++++++++++++++++ 4 files changed, 1270 insertions(+) create mode 100644 bootloaders/optiboot/optiboot_atmega168.hex create mode 100644 bootloaders/optiboot/optiboot_atmega168.lst create mode 100644 bootloaders/optiboot/optiboot_atmega8.hex create mode 100644 bootloaders/optiboot/optiboot_atmega8.lst diff --git a/bootloaders/optiboot/optiboot_atmega168.hex b/bootloaders/optiboot/optiboot_atmega168.hex new file mode 100644 index 0000000..c2f2b5b --- /dev/null +++ b/bootloaders/optiboot/optiboot_atmega168.hex @@ -0,0 +1,35 @@ +:103E0000112484B714BE81FFF0D085E08093810037 +:103E100082E08093C00088E18093C10086E08093B7 +:103E2000C20080E18093C4008EE0C9D0259A86E06C +:103E300020E33CEF91E0309385002093840096BB13 +:103E4000B09BFECF1D9AA8958150A9F7CC24DD2404 +:103E500088248394B5E0AB2EA1E19A2EF3E0BF2E27 +:103E6000A2D0813461F49FD0082FAFD0023811F076 +:103E7000013811F484E001C083E08DD089C0823420 +:103E800011F484E103C0853419F485E0A6D080C024 +:103E9000853579F488D0E82EFF2485D0082F10E0EE +:103EA000102F00270E291F29000F111F8ED0680127 +:103EB0006FC0863521F484E090D080E0DECF843678 +:103EC00009F040C070D06FD0082F6DD080E0C816C8 +:103ED00088E3D80618F4F601B7BEE895C0E0D1E053 +:103EE00062D089930C17E1F7F0E0CF16F8E3DF0614 +:103EF00018F0F601B7BEE89568D007B600FCFDCF14 +:103F0000A601A0E0B1E02C9130E011968C911197C0 +:103F100090E0982F8827822B932B1296FA010C01A0 +:103F200087BEE89511244E5F5F4FF1E0A038BF07D0 +:103F300051F7F601A7BEE89507B600FCFDCF97BE86 +:103F4000E89526C08437B1F42ED02DD0F82E2BD092 +:103F50003CD0F601EF2C8F010F5F1F4F84911BD0D7 +:103F6000EA94F801C1F70894C11CD11CFA94CF0C53 +:103F7000D11C0EC0853739F428D08EE10CD084E9ED +:103F80000AD086E07ACF813511F488E018D01DD0B0 +:103F900080E101D065CF982F8091C00085FFFCCFD4 +:103FA0009093C60008958091C00087FFFCCF809158 +:103FB000C00084FD01C0A8958091C6000895E0E688 +:103FC000F0E098E1908380830895EDDF803219F06E +:103FD00088E0F5DFFFCF84E1DECF1F93182FE3DF0A +:103FE0001150E9F7F2DF1F91089580E0E8DFEE2736 +:043FF000FF2709940A +:023FFE000404B9 +:0400000300003E00BB +:00000001FF diff --git a/bootloaders/optiboot/optiboot_atmega168.lst b/bootloaders/optiboot/optiboot_atmega168.lst new file mode 100644 index 0000000..06316db --- /dev/null +++ b/bootloaders/optiboot/optiboot_atmega168.lst @@ -0,0 +1,598 @@ + +optiboot_atmega168.elf: file format elf32-avr + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .text 000001f4 00003e00 00003e00 00000054 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 1 .version 00000002 00003ffe 00003ffe 00000248 2**0 + CONTENTS, READONLY + 2 .debug_aranges 00000028 00000000 00000000 0000024a 2**0 + CONTENTS, READONLY, DEBUGGING + 3 .debug_pubnames 0000005f 00000000 00000000 00000272 2**0 + CONTENTS, READONLY, DEBUGGING + 4 .debug_info 000002a8 00000000 00000000 000002d1 2**0 + CONTENTS, READONLY, DEBUGGING + 5 .debug_abbrev 00000178 00000000 00000000 00000579 2**0 + CONTENTS, READONLY, DEBUGGING + 6 .debug_line 00000488 00000000 00000000 000006f1 2**0 + CONTENTS, READONLY, DEBUGGING + 7 .debug_frame 00000080 00000000 00000000 00000b7c 2**2 + CONTENTS, READONLY, DEBUGGING + 8 .debug_str 0000014f 00000000 00000000 00000bfc 2**0 + CONTENTS, READONLY, DEBUGGING + 9 .debug_loc 000002d8 00000000 00000000 00000d4b 2**0 + CONTENTS, READONLY, DEBUGGING + 10 .debug_ranges 00000078 00000000 00000000 00001023 2**0 + CONTENTS, READONLY, DEBUGGING + +Disassembly of section .text: + +00003e00
: +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) +#endif + +/* main program starts here */ +int main(void) { + 3e00: 11 24 eor r1, r1 +#ifdef __AVR_ATmega8__ + SP=RAMEND; // This is done by hardware reset +#endif + + // Adaboot no-wait mod + ch = MCUSR; + 3e02: 84 b7 in r24, 0x34 ; 52 + MCUSR = 0; + 3e04: 14 be out 0x34, r1 ; 52 + if (!(ch & _BV(EXTRF))) appStart(); + 3e06: 81 ff sbrs r24, 1 + 3e08: f0 d0 rcall .+480 ; 0x3fea + +#if LED_START_FLASHES > 0 + // Set up Timer 1 for timeout counter + TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 + 3e0a: 85 e0 ldi r24, 0x05 ; 5 + 3e0c: 80 93 81 00 sts 0x0081, r24 + UCSRA = _BV(U2X); //Double speed mode USART + UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx + UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 + UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); +#else + UCSR0A = _BV(U2X0); //Double speed mode USART0 + 3e10: 82 e0 ldi r24, 0x02 ; 2 + 3e12: 80 93 c0 00 sts 0x00C0, r24 + UCSR0B = _BV(RXEN0) | _BV(TXEN0); + 3e16: 88 e1 ldi r24, 0x18 ; 24 + 3e18: 80 93 c1 00 sts 0x00C1, r24 + UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); + 3e1c: 86 e0 ldi r24, 0x06 ; 6 + 3e1e: 80 93 c2 00 sts 0x00C2, r24 + UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); + 3e22: 80 e1 ldi r24, 0x10 ; 16 + 3e24: 80 93 c4 00 sts 0x00C4, r24 +#endif +#endif + + // Set up watchdog to trigger after 500ms + watchdogConfig(WATCHDOG_1S); + 3e28: 8e e0 ldi r24, 0x0E ; 14 + 3e2a: c9 d0 rcall .+402 ; 0x3fbe + + /* Set LED pin as output */ + LED_DDR |= _BV(LED); + 3e2c: 25 9a sbi 0x04, 5 ; 4 + 3e2e: 86 e0 ldi r24, 0x06 ; 6 +} + +#if LED_START_FLASHES > 0 +void flash_led(uint8_t count) { + do { + TCNT1 = -(F_CPU/(1024*16)); + 3e30: 20 e3 ldi r18, 0x30 ; 48 + 3e32: 3c ef ldi r19, 0xFC ; 252 + TIFR1 = _BV(TOV1); + 3e34: 91 e0 ldi r25, 0x01 ; 1 +} + +#if LED_START_FLASHES > 0 +void flash_led(uint8_t count) { + do { + TCNT1 = -(F_CPU/(1024*16)); + 3e36: 30 93 85 00 sts 0x0085, r19 + 3e3a: 20 93 84 00 sts 0x0084, r18 + TIFR1 = _BV(TOV1); + 3e3e: 96 bb out 0x16, r25 ; 22 + while(!(TIFR1 & _BV(TOV1))); + 3e40: b0 9b sbis 0x16, 0 ; 22 + 3e42: fe cf rjmp .-4 ; 0x3e40 +#ifdef __AVR_ATmega8__ + LED_PORT ^= _BV(LED); +#else + LED_PIN |= _BV(LED); + 3e44: 1d 9a sbi 0x03, 5 ; 3 +} +#endif + +// Watchdog functions. These are only safe with interrupts turned off. +void watchdogReset() { + __asm__ __volatile__ ( + 3e46: a8 95 wdr + LED_PORT ^= _BV(LED); +#else + LED_PIN |= _BV(LED); +#endif + watchdogReset(); + } while (--count); + 3e48: 81 50 subi r24, 0x01 ; 1 + 3e4a: a9 f7 brne .-22 ; 0x3e36 + 3e4c: cc 24 eor r12, r12 + 3e4e: dd 24 eor r13, r13 + ch = SPM_PAGESIZE / 2; + do { + uint16_t a; + a = *bufPtr++; + a |= (*bufPtr++) << 8; + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); + 3e50: 88 24 eor r8, r8 + 3e52: 83 94 inc r8 + addrPtr += 2; + } while (--ch); + + // Write from programming buffer + __boot_page_write_short((uint16_t)(void*)address); + 3e54: b5 e0 ldi r27, 0x05 ; 5 + 3e56: ab 2e mov r10, r27 + boot_spm_busy_wait(); + +#if defined(RWWSRE) + // Reenable read access to flash + boot_rww_enable(); + 3e58: a1 e1 ldi r26, 0x11 ; 17 + 3e5a: 9a 2e mov r9, r26 + do *bufPtr++ = getch(); + while (--length); + + // If we are in NRWW section, page erase has to be delayed until now. + // Todo: Take RAMPZ into account + if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 3e5c: f3 e0 ldi r31, 0x03 ; 3 + 3e5e: bf 2e mov r11, r31 +#endif + + /* Forever loop */ + for (;;) { + /* get character from UART */ + ch = getch(); + 3e60: a2 d0 rcall .+324 ; 0x3fa6 + + if(ch == STK_GET_PARAMETER) { + 3e62: 81 34 cpi r24, 0x41 ; 65 + 3e64: 61 f4 brne .+24 ; 0x3e7e + unsigned char which = getch(); + 3e66: 9f d0 rcall .+318 ; 0x3fa6 + 3e68: 08 2f mov r16, r24 + verifySpace(); + 3e6a: af d0 rcall .+350 ; 0x3fca + if (which == 0x82) { + 3e6c: 02 38 cpi r16, 0x82 ; 130 + 3e6e: 11 f0 breq .+4 ; 0x3e74 + /* + * Send optiboot version as "minor SW version" + */ + putch(OPTIBOOT_MINVER); + } else if (which == 0x81) { + 3e70: 01 38 cpi r16, 0x81 ; 129 + 3e72: 11 f4 brne .+4 ; 0x3e78 + putch(OPTIBOOT_MAJVER); + 3e74: 84 e0 ldi r24, 0x04 ; 4 + 3e76: 01 c0 rjmp .+2 ; 0x3e7a + } else { + /* + * GET PARAMETER returns a generic 0x03 reply for + * other parameters - enough to keep Avrdude happy + */ + putch(0x03); + 3e78: 83 e0 ldi r24, 0x03 ; 3 + 3e7a: 8d d0 rcall .+282 ; 0x3f96 + 3e7c: 89 c0 rjmp .+274 ; 0x3f90 + } + } + else if(ch == STK_SET_DEVICE) { + 3e7e: 82 34 cpi r24, 0x42 ; 66 + 3e80: 11 f4 brne .+4 ; 0x3e86 + // SET DEVICE is ignored + getNch(20); + 3e82: 84 e1 ldi r24, 0x14 ; 20 + 3e84: 03 c0 rjmp .+6 ; 0x3e8c + } + else if(ch == STK_SET_DEVICE_EXT) { + 3e86: 85 34 cpi r24, 0x45 ; 69 + 3e88: 19 f4 brne .+6 ; 0x3e90 + // SET DEVICE EXT is ignored + getNch(5); + 3e8a: 85 e0 ldi r24, 0x05 ; 5 + 3e8c: a6 d0 rcall .+332 ; 0x3fda + 3e8e: 80 c0 rjmp .+256 ; 0x3f90 + } + else if(ch == STK_LOAD_ADDRESS) { + 3e90: 85 35 cpi r24, 0x55 ; 85 + 3e92: 79 f4 brne .+30 ; 0x3eb2 + // LOAD ADDRESS + uint16_t newAddress; + newAddress = getch(); + 3e94: 88 d0 rcall .+272 ; 0x3fa6 + newAddress = (newAddress & 0xff) | (getch() << 8); + 3e96: e8 2e mov r14, r24 + 3e98: ff 24 eor r15, r15 + 3e9a: 85 d0 rcall .+266 ; 0x3fa6 + 3e9c: 08 2f mov r16, r24 + 3e9e: 10 e0 ldi r17, 0x00 ; 0 + 3ea0: 10 2f mov r17, r16 + 3ea2: 00 27 eor r16, r16 + 3ea4: 0e 29 or r16, r14 + 3ea6: 1f 29 or r17, r15 +#ifdef RAMPZ + // Transfer top bit to RAMPZ + RAMPZ = (newAddress & 0x8000) ? 1 : 0; +#endif + newAddress += newAddress; // Convert from word address to byte address + 3ea8: 00 0f add r16, r16 + 3eaa: 11 1f adc r17, r17 + address = newAddress; + verifySpace(); + 3eac: 8e d0 rcall .+284 ; 0x3fca + 3eae: 68 01 movw r12, r16 + 3eb0: 6f c0 rjmp .+222 ; 0x3f90 + } + else if(ch == STK_UNIVERSAL) { + 3eb2: 86 35 cpi r24, 0x56 ; 86 + 3eb4: 21 f4 brne .+8 ; 0x3ebe + // UNIVERSAL command is ignored + getNch(4); + 3eb6: 84 e0 ldi r24, 0x04 ; 4 + 3eb8: 90 d0 rcall .+288 ; 0x3fda + putch(0x00); + 3eba: 80 e0 ldi r24, 0x00 ; 0 + 3ebc: de cf rjmp .-68 ; 0x3e7a + } + /* Write memory, length is big endian and is in bytes */ + else if(ch == STK_PROG_PAGE) { + 3ebe: 84 36 cpi r24, 0x64 ; 100 + 3ec0: 09 f0 breq .+2 ; 0x3ec4 + 3ec2: 40 c0 rjmp .+128 ; 0x3f44 + // PROGRAM PAGE - we support flash programming only, not EEPROM + uint8_t *bufPtr; + uint16_t addrPtr; + + getch(); /* getlen() */ + 3ec4: 70 d0 rcall .+224 ; 0x3fa6 + length = getch(); + 3ec6: 6f d0 rcall .+222 ; 0x3fa6 + 3ec8: 08 2f mov r16, r24 + getch(); + 3eca: 6d d0 rcall .+218 ; 0x3fa6 + + // If we are in RWW section, immediately start page erase + if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 3ecc: 80 e0 ldi r24, 0x00 ; 0 + 3ece: c8 16 cp r12, r24 + 3ed0: 88 e3 ldi r24, 0x38 ; 56 + 3ed2: d8 06 cpc r13, r24 + 3ed4: 18 f4 brcc .+6 ; 0x3edc + 3ed6: f6 01 movw r30, r12 + 3ed8: b7 be out 0x37, r11 ; 55 + 3eda: e8 95 spm + 3edc: c0 e0 ldi r28, 0x00 ; 0 + 3ede: d1 e0 ldi r29, 0x01 ; 1 + + // While that is going on, read in page contents + bufPtr = buff; + do *bufPtr++ = getch(); + 3ee0: 62 d0 rcall .+196 ; 0x3fa6 + 3ee2: 89 93 st Y+, r24 + while (--length); + 3ee4: 0c 17 cp r16, r28 + 3ee6: e1 f7 brne .-8 ; 0x3ee0 + + // If we are in NRWW section, page erase has to be delayed until now. + // Todo: Take RAMPZ into account + if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 3ee8: f0 e0 ldi r31, 0x00 ; 0 + 3eea: cf 16 cp r12, r31 + 3eec: f8 e3 ldi r31, 0x38 ; 56 + 3eee: df 06 cpc r13, r31 + 3ef0: 18 f0 brcs .+6 ; 0x3ef8 + 3ef2: f6 01 movw r30, r12 + 3ef4: b7 be out 0x37, r11 ; 55 + 3ef6: e8 95 spm + + // Read command terminator, start reply + verifySpace(); + 3ef8: 68 d0 rcall .+208 ; 0x3fca + + // If only a partial page is to be programmed, the erase might not be complete. + // So check that here + boot_spm_busy_wait(); + 3efa: 07 b6 in r0, 0x37 ; 55 + 3efc: 00 fc sbrc r0, 0 + 3efe: fd cf rjmp .-6 ; 0x3efa + 3f00: a6 01 movw r20, r12 + 3f02: a0 e0 ldi r26, 0x00 ; 0 + 3f04: b1 e0 ldi r27, 0x01 ; 1 + bufPtr = buff; + addrPtr = (uint16_t)(void*)address; + ch = SPM_PAGESIZE / 2; + do { + uint16_t a; + a = *bufPtr++; + 3f06: 2c 91 ld r18, X + 3f08: 30 e0 ldi r19, 0x00 ; 0 + a |= (*bufPtr++) << 8; + 3f0a: 11 96 adiw r26, 0x01 ; 1 + 3f0c: 8c 91 ld r24, X + 3f0e: 11 97 sbiw r26, 0x01 ; 1 + 3f10: 90 e0 ldi r25, 0x00 ; 0 + 3f12: 98 2f mov r25, r24 + 3f14: 88 27 eor r24, r24 + 3f16: 82 2b or r24, r18 + 3f18: 93 2b or r25, r19 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) +#endif + +/* main program starts here */ +int main(void) { + 3f1a: 12 96 adiw r26, 0x02 ; 2 + ch = SPM_PAGESIZE / 2; + do { + uint16_t a; + a = *bufPtr++; + a |= (*bufPtr++) << 8; + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); + 3f1c: fa 01 movw r30, r20 + 3f1e: 0c 01 movw r0, r24 + 3f20: 87 be out 0x37, r8 ; 55 + 3f22: e8 95 spm + 3f24: 11 24 eor r1, r1 + addrPtr += 2; + 3f26: 4e 5f subi r20, 0xFE ; 254 + 3f28: 5f 4f sbci r21, 0xFF ; 255 + } while (--ch); + 3f2a: f1 e0 ldi r31, 0x01 ; 1 + 3f2c: a0 38 cpi r26, 0x80 ; 128 + 3f2e: bf 07 cpc r27, r31 + 3f30: 51 f7 brne .-44 ; 0x3f06 + + // Write from programming buffer + __boot_page_write_short((uint16_t)(void*)address); + 3f32: f6 01 movw r30, r12 + 3f34: a7 be out 0x37, r10 ; 55 + 3f36: e8 95 spm + boot_spm_busy_wait(); + 3f38: 07 b6 in r0, 0x37 ; 55 + 3f3a: 00 fc sbrc r0, 0 + 3f3c: fd cf rjmp .-6 ; 0x3f38 + +#if defined(RWWSRE) + // Reenable read access to flash + boot_rww_enable(); + 3f3e: 97 be out 0x37, r9 ; 55 + 3f40: e8 95 spm + 3f42: 26 c0 rjmp .+76 ; 0x3f90 +#endif + + } + /* Read memory block mode, length is big endian. */ + else if(ch == STK_READ_PAGE) { + 3f44: 84 37 cpi r24, 0x74 ; 116 + 3f46: b1 f4 brne .+44 ; 0x3f74 + // READ PAGE - we only read flash + getch(); /* getlen() */ + 3f48: 2e d0 rcall .+92 ; 0x3fa6 + length = getch(); + 3f4a: 2d d0 rcall .+90 ; 0x3fa6 + 3f4c: f8 2e mov r15, r24 + getch(); + 3f4e: 2b d0 rcall .+86 ; 0x3fa6 + + verifySpace(); + 3f50: 3c d0 rcall .+120 ; 0x3fca + 3f52: f6 01 movw r30, r12 + 3f54: ef 2c mov r14, r15 + putch(result); + address++; + } + while (--length); +#else + do putch(pgm_read_byte_near(address++)); + 3f56: 8f 01 movw r16, r30 + 3f58: 0f 5f subi r16, 0xFF ; 255 + 3f5a: 1f 4f sbci r17, 0xFF ; 255 + 3f5c: 84 91 lpm r24, Z+ + 3f5e: 1b d0 rcall .+54 ; 0x3f96 + while (--length); + 3f60: ea 94 dec r14 + 3f62: f8 01 movw r30, r16 + 3f64: c1 f7 brne .-16 ; 0x3f56 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) +#endif + +/* main program starts here */ +int main(void) { + 3f66: 08 94 sec + 3f68: c1 1c adc r12, r1 + 3f6a: d1 1c adc r13, r1 + 3f6c: fa 94 dec r15 + 3f6e: cf 0c add r12, r15 + 3f70: d1 1c adc r13, r1 + 3f72: 0e c0 rjmp .+28 ; 0x3f90 +#endif +#endif + } + + /* Get device signature bytes */ + else if(ch == STK_READ_SIGN) { + 3f74: 85 37 cpi r24, 0x75 ; 117 + 3f76: 39 f4 brne .+14 ; 0x3f86 + // READ SIGN - return what Avrdude wants to hear + verifySpace(); + 3f78: 28 d0 rcall .+80 ; 0x3fca + putch(SIGNATURE_0); + 3f7a: 8e e1 ldi r24, 0x1E ; 30 + 3f7c: 0c d0 rcall .+24 ; 0x3f96 + putch(SIGNATURE_1); + 3f7e: 84 e9 ldi r24, 0x94 ; 148 + 3f80: 0a d0 rcall .+20 ; 0x3f96 + putch(SIGNATURE_2); + 3f82: 86 e0 ldi r24, 0x06 ; 6 + 3f84: 7a cf rjmp .-268 ; 0x3e7a + } + else if (ch == 'Q') { + 3f86: 81 35 cpi r24, 0x51 ; 81 + 3f88: 11 f4 brne .+4 ; 0x3f8e + // Adaboot no-wait mod + watchdogConfig(WATCHDOG_16MS); + 3f8a: 88 e0 ldi r24, 0x08 ; 8 + 3f8c: 18 d0 rcall .+48 ; 0x3fbe + verifySpace(); + } + else { + // This covers the response to commands like STK_ENTER_PROGMODE + verifySpace(); + 3f8e: 1d d0 rcall .+58 ; 0x3fca + } + putch(STK_OK); + 3f90: 80 e1 ldi r24, 0x10 ; 16 + 3f92: 01 d0 rcall .+2 ; 0x3f96 + 3f94: 65 cf rjmp .-310 ; 0x3e60 + +00003f96 : + } +} + +void putch(char ch) { + 3f96: 98 2f mov r25, r24 +#ifndef SOFT_UART + while (!(UCSR0A & _BV(UDRE0))); + 3f98: 80 91 c0 00 lds r24, 0x00C0 + 3f9c: 85 ff sbrs r24, 5 + 3f9e: fc cf rjmp .-8 ; 0x3f98 + UDR0 = ch; + 3fa0: 90 93 c6 00 sts 0x00C6, r25 + [uartBit] "I" (UART_TX_BIT) + : + "r25" + ); +#endif +} + 3fa4: 08 95 ret + +00003fa6 : + [uartBit] "I" (UART_RX_BIT) + : + "r25" +); +#else + while(!(UCSR0A & _BV(RXC0))) + 3fa6: 80 91 c0 00 lds r24, 0x00C0 + 3faa: 87 ff sbrs r24, 7 + 3fac: fc cf rjmp .-8 ; 0x3fa6 + ; + if (!(UCSR0A & _BV(FE0))) { + 3fae: 80 91 c0 00 lds r24, 0x00C0 + 3fb2: 84 fd sbrc r24, 4 + 3fb4: 01 c0 rjmp .+2 ; 0x3fb8 +} +#endif + +// Watchdog functions. These are only safe with interrupts turned off. +void watchdogReset() { + __asm__ __volatile__ ( + 3fb6: a8 95 wdr + * don't care that an invalid char is returned...) + */ + watchdogReset(); + } + + ch = UDR0; + 3fb8: 80 91 c6 00 lds r24, 0x00C6 + LED_PIN |= _BV(LED); +#endif +#endif + + return ch; +} + 3fbc: 08 95 ret + +00003fbe : + "wdr\n" + ); +} + +void watchdogConfig(uint8_t x) { + WDTCSR = _BV(WDCE) | _BV(WDE); + 3fbe: e0 e6 ldi r30, 0x60 ; 96 + 3fc0: f0 e0 ldi r31, 0x00 ; 0 + 3fc2: 98 e1 ldi r25, 0x18 ; 24 + 3fc4: 90 83 st Z, r25 + WDTCSR = x; + 3fc6: 80 83 st Z, r24 +} + 3fc8: 08 95 ret + +00003fca : + do getch(); while (--count); + verifySpace(); +} + +void verifySpace() { + if (getch() != CRC_EOP) { + 3fca: ed df rcall .-38 ; 0x3fa6 + 3fcc: 80 32 cpi r24, 0x20 ; 32 + 3fce: 19 f0 breq .+6 ; 0x3fd6 + watchdogConfig(WATCHDOG_16MS); // shorten WD timeout + 3fd0: 88 e0 ldi r24, 0x08 ; 8 + 3fd2: f5 df rcall .-22 ; 0x3fbe + 3fd4: ff cf rjmp .-2 ; 0x3fd4 + while (1) // and busy-loop so that WD causes + ; // a reset and app start. + } + putch(STK_INSYNC); + 3fd6: 84 e1 ldi r24, 0x14 ; 20 +} + 3fd8: de cf rjmp .-68 ; 0x3f96 + +00003fda : + ::[count] "M" (UART_B_VALUE) + ); +} +#endif + +void getNch(uint8_t count) { + 3fda: 1f 93 push r17 + 3fdc: 18 2f mov r17, r24 + do getch(); while (--count); + 3fde: e3 df rcall .-58 ; 0x3fa6 + 3fe0: 11 50 subi r17, 0x01 ; 1 + 3fe2: e9 f7 brne .-6 ; 0x3fde + verifySpace(); + 3fe4: f2 df rcall .-28 ; 0x3fca +} + 3fe6: 1f 91 pop r17 + 3fe8: 08 95 ret + +00003fea : + WDTCSR = _BV(WDCE) | _BV(WDE); + WDTCSR = x; +} + +void appStart() { + watchdogConfig(WATCHDOG_OFF); + 3fea: 80 e0 ldi r24, 0x00 ; 0 + 3fec: e8 df rcall .-48 ; 0x3fbe + __asm__ __volatile__ ( + 3fee: ee 27 eor r30, r30 + 3ff0: ff 27 eor r31, r31 + 3ff2: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_atmega8.hex b/bootloaders/optiboot/optiboot_atmega8.hex new file mode 100644 index 0000000..b04f276 --- /dev/null +++ b/bootloaders/optiboot/optiboot_atmega8.hex @@ -0,0 +1,33 @@ +:101E000011248FE594E09EBF8DBF84B714BE81FF7F +:101E1000E2D085E08EBD82E08BB988E18AB986E8A0 +:101E200080BD80E189B98EE0C2D0BD9A96E020E302 +:101E30003CEF54E040E23DBD2CBD58BF08B602FE69 +:101E4000FDCF88B3842788BBA8959150A1F7CC24F7 +:101E5000DD2488248394B5E0AB2EA1E19A2EF3E033 +:101E6000BF2E9ED0813461F49BD0082FA4D00238BD +:101E700011F0013811F484E001C083E08DD089C0F5 +:101E8000823411F484E103C0853419F485E09BD0D9 +:101E900080C0853579F484D0E82EFF2481D0082FC6 +:101EA00010E0102F00270E291F29000F111F83D0CB +:101EB00068016FC0863521F484E085D080E0DECFF4 +:101EC000843609F040C06CD06BD0082F69D080E018 +:101ED000C81688E1D80618F4F601B7BEE895C0E048 +:101EE000D1E05ED089930C17E1F7F0E0CF16F8E16E +:101EF000DF0618F0F601B7BEE8955DD007B600FC26 +:101F0000FDCFA601A0E0B1E02C9130E011968C91BC +:101F1000119790E0982F8827822B932B1296FA0125 +:101F20000C0187BEE89511244E5F5F4FF1E0A034AD +:101F3000BF0751F7F601A7BEE89507B600FCFDCF35 +:101F400097BEE89526C08437B1F42AD029D0F82E60 +:101F500027D031D0F601EF2C8F010F5F1F4F8491F6 +:101F60001BD0EA94F801C1F70894C11CD11CFA9463 +:101F7000CF0CD11C0EC0853739F41DD08EE10CD0AA +:101F800083E90AD087E07ACF813511F488E00FD059 +:101F900012D080E101D065CF5D9BFECF8CB9089552 +:101FA0005F9BFECF5C9901C0A8958CB1089598E124 +:101FB00091BD81BD0895F4DF803219F088E0F7DF2C +:101FC000FFCF84E1E9CF1F93182FEADF1150E9F723 +:101FD000F2DF1F91089580E0EADFEE27FF270994E2 +:021FFE000404D9 +:0400000300001E00DB +:00000001FF diff --git a/bootloaders/optiboot/optiboot_atmega8.lst b/bootloaders/optiboot/optiboot_atmega8.lst new file mode 100644 index 0000000..d921895 --- /dev/null +++ b/bootloaders/optiboot/optiboot_atmega8.lst @@ -0,0 +1,604 @@ + +optiboot_atmega8.elf: file format elf32-avr + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .text 000001e0 00001e00 00001e00 00000054 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 1 .version 00000002 00001ffe 00001ffe 00000234 2**0 + CONTENTS, READONLY + 2 .debug_aranges 00000028 00000000 00000000 00000236 2**0 + CONTENTS, READONLY, DEBUGGING + 3 .debug_pubnames 0000005f 00000000 00000000 0000025e 2**0 + CONTENTS, READONLY, DEBUGGING + 4 .debug_info 000002a6 00000000 00000000 000002bd 2**0 + CONTENTS, READONLY, DEBUGGING + 5 .debug_abbrev 00000169 00000000 00000000 00000563 2**0 + CONTENTS, READONLY, DEBUGGING + 6 .debug_line 00000498 00000000 00000000 000006cc 2**0 + CONTENTS, READONLY, DEBUGGING + 7 .debug_frame 00000080 00000000 00000000 00000b64 2**2 + CONTENTS, READONLY, DEBUGGING + 8 .debug_str 0000014f 00000000 00000000 00000be4 2**0 + CONTENTS, READONLY, DEBUGGING + 9 .debug_loc 000002ba 00000000 00000000 00000d33 2**0 + CONTENTS, READONLY, DEBUGGING + 10 .debug_ranges 00000078 00000000 00000000 00000fed 2**0 + CONTENTS, READONLY, DEBUGGING + +Disassembly of section .text: + +00001e00
: +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) +#endif + +/* main program starts here */ +int main(void) { + 1e00: 11 24 eor r1, r1 + // + // If not, uncomment the following instructions: + // cli(); + asm volatile ("clr __zero_reg__"); +#ifdef __AVR_ATmega8__ + SP=RAMEND; // This is done by hardware reset + 1e02: 8f e5 ldi r24, 0x5F ; 95 + 1e04: 94 e0 ldi r25, 0x04 ; 4 + 1e06: 9e bf out 0x3e, r25 ; 62 + 1e08: 8d bf out 0x3d, r24 ; 61 +#endif + + // Adaboot no-wait mod + ch = MCUSR; + 1e0a: 84 b7 in r24, 0x34 ; 52 + MCUSR = 0; + 1e0c: 14 be out 0x34, r1 ; 52 + if (!(ch & _BV(EXTRF))) appStart(); + 1e0e: 81 ff sbrs r24, 1 + 1e10: e2 d0 rcall .+452 ; 0x1fd6 + +#if LED_START_FLASHES > 0 + // Set up Timer 1 for timeout counter + TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 + 1e12: 85 e0 ldi r24, 0x05 ; 5 + 1e14: 8e bd out 0x2e, r24 ; 46 +#endif +#ifndef SOFT_UART +#ifdef __AVR_ATmega8__ + UCSRA = _BV(U2X); //Double speed mode USART + 1e16: 82 e0 ldi r24, 0x02 ; 2 + 1e18: 8b b9 out 0x0b, r24 ; 11 + UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx + 1e1a: 88 e1 ldi r24, 0x18 ; 24 + 1e1c: 8a b9 out 0x0a, r24 ; 10 + UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 + 1e1e: 86 e8 ldi r24, 0x86 ; 134 + 1e20: 80 bd out 0x20, r24 ; 32 + UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); + 1e22: 80 e1 ldi r24, 0x10 ; 16 + 1e24: 89 b9 out 0x09, r24 ; 9 + UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); +#endif +#endif + + // Set up watchdog to trigger after 500ms + watchdogConfig(WATCHDOG_1S); + 1e26: 8e e0 ldi r24, 0x0E ; 14 + 1e28: c2 d0 rcall .+388 ; 0x1fae + + /* Set LED pin as output */ + LED_DDR |= _BV(LED); + 1e2a: bd 9a sbi 0x17, 5 ; 23 + 1e2c: 96 e0 ldi r25, 0x06 ; 6 +} + +#if LED_START_FLASHES > 0 +void flash_led(uint8_t count) { + do { + TCNT1 = -(F_CPU/(1024*16)); + 1e2e: 20 e3 ldi r18, 0x30 ; 48 + 1e30: 3c ef ldi r19, 0xFC ; 252 + TIFR1 = _BV(TOV1); + 1e32: 54 e0 ldi r21, 0x04 ; 4 + while(!(TIFR1 & _BV(TOV1))); +#ifdef __AVR_ATmega8__ + LED_PORT ^= _BV(LED); + 1e34: 40 e2 ldi r20, 0x20 ; 32 +} + +#if LED_START_FLASHES > 0 +void flash_led(uint8_t count) { + do { + TCNT1 = -(F_CPU/(1024*16)); + 1e36: 3d bd out 0x2d, r19 ; 45 + 1e38: 2c bd out 0x2c, r18 ; 44 + TIFR1 = _BV(TOV1); + 1e3a: 58 bf out 0x38, r21 ; 56 + while(!(TIFR1 & _BV(TOV1))); + 1e3c: 08 b6 in r0, 0x38 ; 56 + 1e3e: 02 fe sbrs r0, 2 + 1e40: fd cf rjmp .-6 ; 0x1e3c +#ifdef __AVR_ATmega8__ + LED_PORT ^= _BV(LED); + 1e42: 88 b3 in r24, 0x18 ; 24 + 1e44: 84 27 eor r24, r20 + 1e46: 88 bb out 0x18, r24 ; 24 +} +#endif + +// Watchdog functions. These are only safe with interrupts turned off. +void watchdogReset() { + __asm__ __volatile__ ( + 1e48: a8 95 wdr + LED_PORT ^= _BV(LED); +#else + LED_PIN |= _BV(LED); +#endif + watchdogReset(); + } while (--count); + 1e4a: 91 50 subi r25, 0x01 ; 1 + 1e4c: a1 f7 brne .-24 ; 0x1e36 + 1e4e: cc 24 eor r12, r12 + 1e50: dd 24 eor r13, r13 + ch = SPM_PAGESIZE / 2; + do { + uint16_t a; + a = *bufPtr++; + a |= (*bufPtr++) << 8; + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); + 1e52: 88 24 eor r8, r8 + 1e54: 83 94 inc r8 + addrPtr += 2; + } while (--ch); + + // Write from programming buffer + __boot_page_write_short((uint16_t)(void*)address); + 1e56: b5 e0 ldi r27, 0x05 ; 5 + 1e58: ab 2e mov r10, r27 + boot_spm_busy_wait(); + +#if defined(RWWSRE) + // Reenable read access to flash + boot_rww_enable(); + 1e5a: a1 e1 ldi r26, 0x11 ; 17 + 1e5c: 9a 2e mov r9, r26 + do *bufPtr++ = getch(); + while (--length); + + // If we are in NRWW section, page erase has to be delayed until now. + // Todo: Take RAMPZ into account + if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 1e5e: f3 e0 ldi r31, 0x03 ; 3 + 1e60: bf 2e mov r11, r31 +#endif + + /* Forever loop */ + for (;;) { + /* get character from UART */ + ch = getch(); + 1e62: 9e d0 rcall .+316 ; 0x1fa0 + + if(ch == STK_GET_PARAMETER) { + 1e64: 81 34 cpi r24, 0x41 ; 65 + 1e66: 61 f4 brne .+24 ; 0x1e80 + unsigned char which = getch(); + 1e68: 9b d0 rcall .+310 ; 0x1fa0 + 1e6a: 08 2f mov r16, r24 + verifySpace(); + 1e6c: a4 d0 rcall .+328 ; 0x1fb6 + if (which == 0x82) { + 1e6e: 02 38 cpi r16, 0x82 ; 130 + 1e70: 11 f0 breq .+4 ; 0x1e76 + /* + * Send optiboot version as "minor SW version" + */ + putch(OPTIBOOT_MINVER); + } else if (which == 0x81) { + 1e72: 01 38 cpi r16, 0x81 ; 129 + 1e74: 11 f4 brne .+4 ; 0x1e7a + putch(OPTIBOOT_MAJVER); + 1e76: 84 e0 ldi r24, 0x04 ; 4 + 1e78: 01 c0 rjmp .+2 ; 0x1e7c + } else { + /* + * GET PARAMETER returns a generic 0x03 reply for + * other parameters - enough to keep Avrdude happy + */ + putch(0x03); + 1e7a: 83 e0 ldi r24, 0x03 ; 3 + 1e7c: 8d d0 rcall .+282 ; 0x1f98 + 1e7e: 89 c0 rjmp .+274 ; 0x1f92 + } + } + else if(ch == STK_SET_DEVICE) { + 1e80: 82 34 cpi r24, 0x42 ; 66 + 1e82: 11 f4 brne .+4 ; 0x1e88 + // SET DEVICE is ignored + getNch(20); + 1e84: 84 e1 ldi r24, 0x14 ; 20 + 1e86: 03 c0 rjmp .+6 ; 0x1e8e + } + else if(ch == STK_SET_DEVICE_EXT) { + 1e88: 85 34 cpi r24, 0x45 ; 69 + 1e8a: 19 f4 brne .+6 ; 0x1e92 + // SET DEVICE EXT is ignored + getNch(5); + 1e8c: 85 e0 ldi r24, 0x05 ; 5 + 1e8e: 9b d0 rcall .+310 ; 0x1fc6 + 1e90: 80 c0 rjmp .+256 ; 0x1f92 + } + else if(ch == STK_LOAD_ADDRESS) { + 1e92: 85 35 cpi r24, 0x55 ; 85 + 1e94: 79 f4 brne .+30 ; 0x1eb4 + // LOAD ADDRESS + uint16_t newAddress; + newAddress = getch(); + 1e96: 84 d0 rcall .+264 ; 0x1fa0 + newAddress = (newAddress & 0xff) | (getch() << 8); + 1e98: e8 2e mov r14, r24 + 1e9a: ff 24 eor r15, r15 + 1e9c: 81 d0 rcall .+258 ; 0x1fa0 + 1e9e: 08 2f mov r16, r24 + 1ea0: 10 e0 ldi r17, 0x00 ; 0 + 1ea2: 10 2f mov r17, r16 + 1ea4: 00 27 eor r16, r16 + 1ea6: 0e 29 or r16, r14 + 1ea8: 1f 29 or r17, r15 +#ifdef RAMPZ + // Transfer top bit to RAMPZ + RAMPZ = (newAddress & 0x8000) ? 1 : 0; +#endif + newAddress += newAddress; // Convert from word address to byte address + 1eaa: 00 0f add r16, r16 + 1eac: 11 1f adc r17, r17 + address = newAddress; + verifySpace(); + 1eae: 83 d0 rcall .+262 ; 0x1fb6 + 1eb0: 68 01 movw r12, r16 + 1eb2: 6f c0 rjmp .+222 ; 0x1f92 + } + else if(ch == STK_UNIVERSAL) { + 1eb4: 86 35 cpi r24, 0x56 ; 86 + 1eb6: 21 f4 brne .+8 ; 0x1ec0 + // UNIVERSAL command is ignored + getNch(4); + 1eb8: 84 e0 ldi r24, 0x04 ; 4 + 1eba: 85 d0 rcall .+266 ; 0x1fc6 + putch(0x00); + 1ebc: 80 e0 ldi r24, 0x00 ; 0 + 1ebe: de cf rjmp .-68 ; 0x1e7c + } + /* Write memory, length is big endian and is in bytes */ + else if(ch == STK_PROG_PAGE) { + 1ec0: 84 36 cpi r24, 0x64 ; 100 + 1ec2: 09 f0 breq .+2 ; 0x1ec6 + 1ec4: 40 c0 rjmp .+128 ; 0x1f46 + // PROGRAM PAGE - we support flash programming only, not EEPROM + uint8_t *bufPtr; + uint16_t addrPtr; + + getch(); /* getlen() */ + 1ec6: 6c d0 rcall .+216 ; 0x1fa0 + length = getch(); + 1ec8: 6b d0 rcall .+214 ; 0x1fa0 + 1eca: 08 2f mov r16, r24 + getch(); + 1ecc: 69 d0 rcall .+210 ; 0x1fa0 + + // If we are in RWW section, immediately start page erase + if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 1ece: 80 e0 ldi r24, 0x00 ; 0 + 1ed0: c8 16 cp r12, r24 + 1ed2: 88 e1 ldi r24, 0x18 ; 24 + 1ed4: d8 06 cpc r13, r24 + 1ed6: 18 f4 brcc .+6 ; 0x1ede + 1ed8: f6 01 movw r30, r12 + 1eda: b7 be out 0x37, r11 ; 55 + 1edc: e8 95 spm + 1ede: c0 e0 ldi r28, 0x00 ; 0 + 1ee0: d1 e0 ldi r29, 0x01 ; 1 + + // While that is going on, read in page contents + bufPtr = buff; + do *bufPtr++ = getch(); + 1ee2: 5e d0 rcall .+188 ; 0x1fa0 + 1ee4: 89 93 st Y+, r24 + while (--length); + 1ee6: 0c 17 cp r16, r28 + 1ee8: e1 f7 brne .-8 ; 0x1ee2 + + // If we are in NRWW section, page erase has to be delayed until now. + // Todo: Take RAMPZ into account + if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 1eea: f0 e0 ldi r31, 0x00 ; 0 + 1eec: cf 16 cp r12, r31 + 1eee: f8 e1 ldi r31, 0x18 ; 24 + 1ef0: df 06 cpc r13, r31 + 1ef2: 18 f0 brcs .+6 ; 0x1efa + 1ef4: f6 01 movw r30, r12 + 1ef6: b7 be out 0x37, r11 ; 55 + 1ef8: e8 95 spm + + // Read command terminator, start reply + verifySpace(); + 1efa: 5d d0 rcall .+186 ; 0x1fb6 + + // If only a partial page is to be programmed, the erase might not be complete. + // So check that here + boot_spm_busy_wait(); + 1efc: 07 b6 in r0, 0x37 ; 55 + 1efe: 00 fc sbrc r0, 0 + 1f00: fd cf rjmp .-6 ; 0x1efc + 1f02: a6 01 movw r20, r12 + 1f04: a0 e0 ldi r26, 0x00 ; 0 + 1f06: b1 e0 ldi r27, 0x01 ; 1 + bufPtr = buff; + addrPtr = (uint16_t)(void*)address; + ch = SPM_PAGESIZE / 2; + do { + uint16_t a; + a = *bufPtr++; + 1f08: 2c 91 ld r18, X + 1f0a: 30 e0 ldi r19, 0x00 ; 0 + a |= (*bufPtr++) << 8; + 1f0c: 11 96 adiw r26, 0x01 ; 1 + 1f0e: 8c 91 ld r24, X + 1f10: 11 97 sbiw r26, 0x01 ; 1 + 1f12: 90 e0 ldi r25, 0x00 ; 0 + 1f14: 98 2f mov r25, r24 + 1f16: 88 27 eor r24, r24 + 1f18: 82 2b or r24, r18 + 1f1a: 93 2b or r25, r19 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) +#endif + +/* main program starts here */ +int main(void) { + 1f1c: 12 96 adiw r26, 0x02 ; 2 + ch = SPM_PAGESIZE / 2; + do { + uint16_t a; + a = *bufPtr++; + a |= (*bufPtr++) << 8; + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); + 1f1e: fa 01 movw r30, r20 + 1f20: 0c 01 movw r0, r24 + 1f22: 87 be out 0x37, r8 ; 55 + 1f24: e8 95 spm + 1f26: 11 24 eor r1, r1 + addrPtr += 2; + 1f28: 4e 5f subi r20, 0xFE ; 254 + 1f2a: 5f 4f sbci r21, 0xFF ; 255 + } while (--ch); + 1f2c: f1 e0 ldi r31, 0x01 ; 1 + 1f2e: a0 34 cpi r26, 0x40 ; 64 + 1f30: bf 07 cpc r27, r31 + 1f32: 51 f7 brne .-44 ; 0x1f08 + + // Write from programming buffer + __boot_page_write_short((uint16_t)(void*)address); + 1f34: f6 01 movw r30, r12 + 1f36: a7 be out 0x37, r10 ; 55 + 1f38: e8 95 spm + boot_spm_busy_wait(); + 1f3a: 07 b6 in r0, 0x37 ; 55 + 1f3c: 00 fc sbrc r0, 0 + 1f3e: fd cf rjmp .-6 ; 0x1f3a + +#if defined(RWWSRE) + // Reenable read access to flash + boot_rww_enable(); + 1f40: 97 be out 0x37, r9 ; 55 + 1f42: e8 95 spm + 1f44: 26 c0 rjmp .+76 ; 0x1f92 +#endif + + } + /* Read memory block mode, length is big endian. */ + else if(ch == STK_READ_PAGE) { + 1f46: 84 37 cpi r24, 0x74 ; 116 + 1f48: b1 f4 brne .+44 ; 0x1f76 + // READ PAGE - we only read flash + getch(); /* getlen() */ + 1f4a: 2a d0 rcall .+84 ; 0x1fa0 + length = getch(); + 1f4c: 29 d0 rcall .+82 ; 0x1fa0 + 1f4e: f8 2e mov r15, r24 + getch(); + 1f50: 27 d0 rcall .+78 ; 0x1fa0 + + verifySpace(); + 1f52: 31 d0 rcall .+98 ; 0x1fb6 + 1f54: f6 01 movw r30, r12 + 1f56: ef 2c mov r14, r15 + putch(result); + address++; + } + while (--length); +#else + do putch(pgm_read_byte_near(address++)); + 1f58: 8f 01 movw r16, r30 + 1f5a: 0f 5f subi r16, 0xFF ; 255 + 1f5c: 1f 4f sbci r17, 0xFF ; 255 + 1f5e: 84 91 lpm r24, Z+ + 1f60: 1b d0 rcall .+54 ; 0x1f98 + while (--length); + 1f62: ea 94 dec r14 + 1f64: f8 01 movw r30, r16 + 1f66: c1 f7 brne .-16 ; 0x1f58 +#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) +#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) +#endif + +/* main program starts here */ +int main(void) { + 1f68: 08 94 sec + 1f6a: c1 1c adc r12, r1 + 1f6c: d1 1c adc r13, r1 + 1f6e: fa 94 dec r15 + 1f70: cf 0c add r12, r15 + 1f72: d1 1c adc r13, r1 + 1f74: 0e c0 rjmp .+28 ; 0x1f92 +#endif +#endif + } + + /* Get device signature bytes */ + else if(ch == STK_READ_SIGN) { + 1f76: 85 37 cpi r24, 0x75 ; 117 + 1f78: 39 f4 brne .+14 ; 0x1f88 + // READ SIGN - return what Avrdude wants to hear + verifySpace(); + 1f7a: 1d d0 rcall .+58 ; 0x1fb6 + putch(SIGNATURE_0); + 1f7c: 8e e1 ldi r24, 0x1E ; 30 + 1f7e: 0c d0 rcall .+24 ; 0x1f98 + putch(SIGNATURE_1); + 1f80: 83 e9 ldi r24, 0x93 ; 147 + 1f82: 0a d0 rcall .+20 ; 0x1f98 + putch(SIGNATURE_2); + 1f84: 87 e0 ldi r24, 0x07 ; 7 + 1f86: 7a cf rjmp .-268 ; 0x1e7c + } + else if (ch == 'Q') { + 1f88: 81 35 cpi r24, 0x51 ; 81 + 1f8a: 11 f4 brne .+4 ; 0x1f90 + // Adaboot no-wait mod + watchdogConfig(WATCHDOG_16MS); + 1f8c: 88 e0 ldi r24, 0x08 ; 8 + 1f8e: 0f d0 rcall .+30 ; 0x1fae + verifySpace(); + } + else { + // This covers the response to commands like STK_ENTER_PROGMODE + verifySpace(); + 1f90: 12 d0 rcall .+36 ; 0x1fb6 + } + putch(STK_OK); + 1f92: 80 e1 ldi r24, 0x10 ; 16 + 1f94: 01 d0 rcall .+2 ; 0x1f98 + 1f96: 65 cf rjmp .-310 ; 0x1e62 + +00001f98 : + } +} + +void putch(char ch) { +#ifndef SOFT_UART + while (!(UCSR0A & _BV(UDRE0))); + 1f98: 5d 9b sbis 0x0b, 5 ; 11 + 1f9a: fe cf rjmp .-4 ; 0x1f98 + UDR0 = ch; + 1f9c: 8c b9 out 0x0c, r24 ; 12 + [uartBit] "I" (UART_TX_BIT) + : + "r25" + ); +#endif +} + 1f9e: 08 95 ret + +00001fa0 : + [uartBit] "I" (UART_RX_BIT) + : + "r25" +); +#else + while(!(UCSR0A & _BV(RXC0))) + 1fa0: 5f 9b sbis 0x0b, 7 ; 11 + 1fa2: fe cf rjmp .-4 ; 0x1fa0 + ; + if (!(UCSR0A & _BV(FE0))) { + 1fa4: 5c 99 sbic 0x0b, 4 ; 11 + 1fa6: 01 c0 rjmp .+2 ; 0x1faa +} +#endif + +// Watchdog functions. These are only safe with interrupts turned off. +void watchdogReset() { + __asm__ __volatile__ ( + 1fa8: a8 95 wdr + * don't care that an invalid char is returned...) + */ + watchdogReset(); + } + + ch = UDR0; + 1faa: 8c b1 in r24, 0x0c ; 12 + LED_PIN |= _BV(LED); +#endif +#endif + + return ch; +} + 1fac: 08 95 ret + +00001fae : + "wdr\n" + ); +} + +void watchdogConfig(uint8_t x) { + WDTCSR = _BV(WDCE) | _BV(WDE); + 1fae: 98 e1 ldi r25, 0x18 ; 24 + 1fb0: 91 bd out 0x21, r25 ; 33 + WDTCSR = x; + 1fb2: 81 bd out 0x21, r24 ; 33 +} + 1fb4: 08 95 ret + +00001fb6 : + do getch(); while (--count); + verifySpace(); +} + +void verifySpace() { + if (getch() != CRC_EOP) { + 1fb6: f4 df rcall .-24 ; 0x1fa0 + 1fb8: 80 32 cpi r24, 0x20 ; 32 + 1fba: 19 f0 breq .+6 ; 0x1fc2 + watchdogConfig(WATCHDOG_16MS); // shorten WD timeout + 1fbc: 88 e0 ldi r24, 0x08 ; 8 + 1fbe: f7 df rcall .-18 ; 0x1fae + 1fc0: ff cf rjmp .-2 ; 0x1fc0 + while (1) // and busy-loop so that WD causes + ; // a reset and app start. + } + putch(STK_INSYNC); + 1fc2: 84 e1 ldi r24, 0x14 ; 20 +} + 1fc4: e9 cf rjmp .-46 ; 0x1f98 + +00001fc6 : + ::[count] "M" (UART_B_VALUE) + ); +} +#endif + +void getNch(uint8_t count) { + 1fc6: 1f 93 push r17 + 1fc8: 18 2f mov r17, r24 + do getch(); while (--count); + 1fca: ea df rcall .-44 ; 0x1fa0 + 1fcc: 11 50 subi r17, 0x01 ; 1 + 1fce: e9 f7 brne .-6 ; 0x1fca + verifySpace(); + 1fd0: f2 df rcall .-28 ; 0x1fb6 +} + 1fd2: 1f 91 pop r17 + 1fd4: 08 95 ret + +00001fd6 : + WDTCSR = _BV(WDCE) | _BV(WDE); + WDTCSR = x; +} + +void appStart() { + watchdogConfig(WATCHDOG_OFF); + 1fd6: 80 e0 ldi r24, 0x00 ; 0 + 1fd8: ea df rcall .-44 ; 0x1fae + __asm__ __volatile__ ( + 1fda: ee 27 eor r30, r30 + 1fdc: ff 27 eor r31, r31 + 1fde: 09 94 ijmp -- cgit v1.2.3-18-g5258 From 84285ab7807db69a96c96d58bb227669a81d5226 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Wed, 29 Jun 2011 22:48:07 -0400 Subject: Disabling terminal / monitor. --- bootloaders/stk500v2/stk500boot.c | 3 +- bootloaders/stk500v2/stk500boot_v2_mega2560.hex | 648 +++++------------------- 2 files changed, 140 insertions(+), 511 deletions(-) diff --git a/bootloaders/stk500v2/stk500boot.c b/bootloaders/stk500v2/stk500boot.c index 13dec89..3d5b095 100755 --- a/bootloaders/stk500v2/stk500boot.c +++ b/bootloaders/stk500v2/stk500boot.c @@ -95,7 +95,8 @@ LICENSE: #include "command.h" -#if defined(_MEGA_BOARD_) || defined(_BOARD_AMBER128_) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) +//#if defined(_MEGA_BOARD_) || defined(_BOARD_AMBER128_) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__) +#if 0 #define ENABLE_MONITOR static void RunMonitor(void); #endif diff --git a/bootloaders/stk500v2/stk500boot_v2_mega2560.hex b/bootloaders/stk500v2/stk500boot_v2_mega2560.hex index 4f36699..ace9cb1 100644 --- a/bootloaders/stk500v2/stk500boot_v2_mega2560.hex +++ b/bootloaders/stk500v2/stk500boot_v2_mega2560.hex @@ -1,513 +1,141 @@ :020000023000CC -:10E000000D94F6F20D941FF30D941FF30D941FF36E -:10E010000D941FF30D941FF30D941FF30D941FF334 -:10E020000D941FF30D941FF30D941FF30D941FF324 -:10E030000D941FF30D941FF30D941FF30D941FF314 -:10E040000D941FF30D941FF30D941FF30D941FF304 -:10E050000D941FF30D941FF30D941FF30D941FF3F4 -:10E060000D941FF30D941FF30D941FF30D941FF3E4 -:10E070000D941FF30D941FF30D941FF30D941FF3D4 -:10E080000D941FF30D941FF30D941FF30D941FF3C4 -:10E090000D941FF30D941FF30D941FF30D941FF3B4 -:10E0A0000D941FF30D941FF30D941FF30D941FF3A4 -:10E0B0000D941FF30D941FF30D941FF30D941FF394 -:10E0C0000D941FF30D941FF30D941FF30D941FF384 -:10E0D0000D941FF30D941FF30D941FF30D941FF374 -:10E0E0000D941FF341546D65676132353630004140 -:10E0F000726475696E6F206578706C6F72657220DE -:10E1000073746B3530305632206279204D4C530099 -:10E11000426F6F746C6F616465723E004875683F52 -:10E1200000436F6D70696C6564206F6E20203D2028 -:10E1300000435055205479706520202020203D2038 -:10E14000005F5F4156525F415243485F5F203D2070 -:10E1500000415652204C69624320566572203D2092 -:10E16000004743432056657273696F6E20203D203F -:10E1700000435055207369676E61747572653D2068 -:10E18000004C6F77206675736520202020203D208D -:10E1900000486967682066757365202020203D204F -:10E1A00000457874206675736520202020203D206E -:10E1B000004C6F636B2066757365202020203D2026 -:10E1C00000536570202039203230313000312E3636 -:10E1D0002E3700342E332E33005623202020414486 -:10E1E00044522020206F7020636F6465202020201F -:10E1F00020696E737472756374696F6E20616464F4 -:10E2000072202020496E74657272757074006E6F92 -:10E2100020766563746F7200726A6D702020006AE8 -:10E220006D7020005768617420706F72743A0050EE -:10E230006F7274206E6F7420737570706F72746576 -:10E2400064004D7573742062652061206C65747480 -:10E2500065720020005772697474696E67204545C5 -:10E260000052656164696E6720454500656570729E -:10E270006F6D206572726F7220636F756E743D00F2 -:10E28000504F525400303D5A65726F206164647281 -:10E290006573732063747273003F3D435055207360 -:10E2A0007461747300403D454550524F4D20746574 -:10E2B000737400423D426C696E6B204C45440045CE -:10E2C0003D44756D7020454550524F4D00463D44CC -:10E2D000756D7020464C41534800483D48656C7050 -:10E2E000004C3D4C69737420492F4F20506F72745D -:10E2F0007300513D517569742026206A756D702038 -:10E30000746F20757365722070676D00523D44759F -:10E310006D702052414D00563D73686F7720696ED5 -:10E320007465727275707420566563746F727300D1 -:10E33000593D506F727420626C696E6B002A0052F6 -:10E340004553455400494E543000494E543100491C -:10E350004E543200494E543300494E543400494E15 -:10E36000543500494E543600494E54370050434905 -:10E370004E5430005043494E5431005043494E549E -:10E3800032005744540054494D45523020434F4DBC -:10E3900050410054494D45523020434F4D504200AA -:10E3A00054494D455230204F56460054494D455230 -:10E3B0003120434150540054494D45523120434F80 -:10E3C0004D50410054494D45523120434F4D50422C -:10E3D0000054494D45523120434F4D50430054495C -:10E3E0004D455231204F56460054494D455232203A -:10E3F000434F4D50410054494D45523220434F4DFB -:10E4000050420054494D455232204F56460054491F -:10E410004D45523320434150540054494D455233E9 -:10E4200020434F4D50410054494D45523320434FF6 -:10E430004D50420054494D45523320434F4D5043B7 -:10E440000054494D455233204F56460054494D45DE -:10E45000523420434150540054494D4552342043D6 -:10E460004F4D50410054494D45523420434F4D507B -:10E47000420054494D45523420434F4D50430054BF -:10E48000494D455234204F56460054494D4552356A -:10E4900020434150540054494D45523520434F4D7F -:10E4A00050410054494D45523520434F4D50420094 -:10E4B00054494D45523520434F4D50430054494D2A -:10E4C000455235204F564600555341525430205244 -:10E4D000580055534152543020554452450055532D -:10E4E0004152543020545800555341525431205217 -:10E4F000580055534152543120554452450055530C -:10E5000041525431205458005553415254322052F4 -:10E5100058005553415254322055445245005553EA -:10E5200041525432205458005553415254332052D2 -:10E5300058005553415254332055445245005553C9 -:10E5400041525433205458005350492053544300EF -:10E5500041444300414E414C4F4720434F4D5000F2 -:10E560004545205245414459005457490053504DA8 -:10E57000205245414459002A003FE345E34AE34F16 -:10E58000E354E359E35EE363E368E36DE374E37B41 -:10E59000E382E3E9E3F6E303E4ABE3B7E3C4E3D107 -:10E5A000E3DEE386E393E3A0E348E5C8E4D2E4DEF8 -:10E5B000E454E550E560E50EE41AE427E434E44170 -:10E5C000E4E8E4F2E4FEE469E56DE54CE458E46572 -:10E5D000E472E47FE48AE496E4A3E4B0E4BDE408F2 -:10E5E000E512E51EE528E532E53EE50011241FBEF3 -:10E5F000CFEFD1E2DEBFCDBF01E00CBF12E0A0E063 -:10E60000B2E0EAEDFFEF03E00BBF02C007900D920E -:10E61000A030B107D9F712E0A0E0B2E001C01D922E -:10E62000AC30B107E1F70F94FBF40D94EBFF01E27E -:10E630000EBF0FEF0DBF11241FBE0D94FBF40D9400 -:10E6400000F020E030E040ED57E005C0FA013197DE -:10E65000F1F72F5F3F4F28173907C0F308959C014A -:10E66000442737FD4095542FDA01C901860F911DCB -:10E67000A11DB11DABBFFC018791882369F0809378 -:10E68000C6008091C00086FFFCCF8091C0008064EE -:10E690008093C0006F5FE8CF08958DE08093C6003F -:10E6A0008091C00086FFFCCF8091C0008064809381 -:10E6B000C0008AE08093C6008091C00086FFFCCF36 -:10E6C0008091C00080648093C00008950F942FF360 -:10E6D0000F944DF30895FC019081992359F0909384 -:10E6E000C6008091C00086FFFCCF8091C00080648E -:10E6F0008093C0003196992379F70895282F982F99 -:10E7000092959F70892F805D8A3308F0895F80938E -:10E71000C6008091C00086FFFCCF8091C00080645D -:10E720008093C000822F8F70982F905D9A3308F0ED -:10E73000995F9093C6008091C00086FFFCCF8091C6 -:10E74000C00080648093C00008959C01FB01853661 -:10E7500091051CF46330710594F0C90164E670E022 -:10E760000F948CFF605D7F4F6093C6008091C00066 -:10E7700086FFFCCF8091C00080648093C0002B3066 -:10E78000310514F43297B4F0C90164E670E00F94D7 -:10E790008CFF6AE070E00F948CFF605D7F4F6093A8 -:10E7A000C6008091C00086FFFCCF8091C0008064CD -:10E7B0008093C000C9016AE070E00F948CFFC0969E -:10E7C0008093C6008091C00086FFFCCF8091C0007E -:10E7D00080648093C0000895282F277020642093C0 -:10E7E0007C0020917B0086958695869590E08170CF -:10E7F000907033E0880F991F3A95E1F7277F282B17 -:10E8000020937B0080917A00806480937A008091CD -:10E810007A0086FDFCCF2091780040917900942FFA -:10E8200080E030E0282B392BC90108951F93182F61 -:10E8300080E892EE60E00F942FF31093C600809171 -:10E84000C00086FFFCCF8091C00080648093C00030 -:10E850000F944DF31F9108952F923F924F925F9224 -:10E860006F927F928F929F92AF92BF92CF92DF92E0 -:10E87000EF92FF920F931F93DF93CF93CDB7DEB745 -:10E8800062970FB6F894DEBF0FBECDBF382E622E52 -:10E89000CA01DB015C016D01772460E2262E2E01A6 -:10E8A0000894411C511C8BC081E0A81680E0B8067A -:10E8B00081E0C80680E0D80628F0C601AA27BB2759 -:10E8C0000F947EF3BB27AD2D9C2D8B2D0F947EF3E3 -:10E8D0008A2D0F947EF32092C6008091C00086FF9F -:10E8E000FCCF8091C00080648093C0009DE2909333 -:10E8F000C6008091C00086FFFCCF8091C00080647C -:10E900008093C0002092C6008091C00086FFFCCF9B -:10E910008091C00080648093C000198286017501D7 -:10E9200088249924A1E03A1651F03A1620F0B2E07A -:10E930003B1661F409C00BBFF701779007C0C70110 -:10E940000F94D5FF782E02C0F7017080872D0F94A9 -:10E950007EF32092C6008091C00086FFFCCF80919C -:10E96000C00080648093C000872D8052F401EF7056 -:10E97000F0708F3520F4E40DF51D708204C0E40DB5 -:10E98000F51D8EE280830894E11CF11C011D111D10 -:10E990000894811C911C90E18916910409F0C2CF62 -:10E9A00080E190E0A0E0B0E0A80EB91ECA1EDB1E18 -:10E9B000198AC2010F946BF30F944DF36A94662089 -:10E9C00009F072CF62960FB6F894DEBF0FBECDBFCE -:10E9D000CF91DF911F910F91FF90EF90DF90CF903B -:10E9E000BF90AF909F908F907F906F905F904F906F -:10E9F0003F902F9008952F923F924F925F926F9287 -:10EA00007F928F929F92AF92BF92CF92DF92EF92BE -:10EA1000FF920F931F93DF93CF93CDB7DEB7CD5304 -:10EA2000D1400FB6F894DEBF0FBECDBF279A2F9A04 -:10EA30008091C00082608093C00080E18093C40018 -:10EA400088E18093C1000000EE24FF248701B4E038 -:10EA5000AB2EB12CCC24DD2424C0C5010197F1F7E5 -:10EA60000894E11CF11C011D111D21E2E2162EE4A7 -:10EA7000F20620E0020720E0120718F0A1E0CA2EFB -:10EA8000D12CC801B70128E53BE140E050E00F94EC -:10EA90009FFF611571058105910519F485B18058B5 -:10EAA00085B98091C00087FD03C0C114D104A9F2CB -:10EAB000A6014F5F5F4FC25EDE4F59834883CE5140 -:10EAC000D140C25EDE4F68817981CE51D140613044 -:10EAD000710511F00D946EFFC05DDE4F1982188232 -:10EAE000C053D14060E0C15DDE4F1882CF52D140AB -:10EAF000AA24BB24C05EDE4F188219821A821B82B0 -:10EB0000C052D140CE5CDE4F188219821A821B821D -:10EB1000C253D14080E090E0A0E0B0E0ABBFFC0188 -:10EB2000A791B691C45CDE4FB983A883CC53D14082 -:10EB30000D9469FFC25EDE4FE881F981CE51D1406C -:10EB4000319709F52091C600C25EDE4F1982188206 -:10EB5000CE51D14022C02F5F3F4F4F4F5F4F2130EA -:10EB6000F2E13F07FAE74F07F0E05F0780F0C45C8F -:10EB7000DE4F08811981CC53D1400F5F1F4F19F030 -:10EB8000EE27FF27099420E030E040E050E080913C -:10EB9000C00087FFE0CF2091C600213209F094C663 -:10EBA0000894A11CB11C33E0A316B10409F08EC671 -:10EBB00000E010E018C041E24093C6008091C00020 -:10EBC00086FFFCCF8091C00080648093C0002F5FDF -:10EBD0003F4F2931310579F70F944DF30F5F1F4FE8 -:10EBE0000530110519F020E030E0E5CF1092080261 -:10EBF0001092090210920A0210920B021092040263 -:10EC00001092050210920602109207021092000262 -:10EC10001092010210920202109203028FEE90EE07 -:10EC200060E00F9466F380E191EE60E00F942FF3C3 -:10EC30008091C00087FFFCCF9091C600903608F00D -:10EC40009F759032B8F09093C6008091C00086FF07 -:10EC5000FCCF8091C00080648093C00080E28093EC -:10EC6000C6008091C00086FFFCCF8091C000806408 -:10EC70008093C000983409F4DBC19934B8F492341D -:10EC800009F45DC1933458F4903319F1903308F4CA -:10EC900018C69F33A1F1903409F013C6BDC0953456 -:10ECA00009F474C1963409F00CC69CC1923509F47C -:10ECB0002FC2933538F49C3409F4F9C1913509F029 -:10ECC00000C61CC2963509F449C2993509F0F9C548 -:10ECD0009CC485E892EE62E00F9466F31092040201 -:10ECE000109205021092060210920702109208027A -:10ECF0001092090210920A0210920B0217C189E9C0 -:10ED000092EE62E00F9466F38FEE90EE60E00F9467 -:10ED100066F381E291EE60E00F942FF381EC91EEC7 -:10ED200060E00F9466F381E391EE60E00F942FF3BF -:10ED300084EE90EE60E00F9466F381E491EE60E083 -:10ED40000F942FF386E090E061E070E00F94A5F35C -:10ED50000F944DF381E691EE60E00F942FF383ED75 -:10ED600091EE60E00F9466F381E591EE60E00F9420 -:10ED70002FF38DEC91EE60E00F9466F381E791EE56 -:10ED800060E00F942FF38EE10F947EF388E90F94E7 -:10ED90007EF381E00F947EF30F944DF381E891EEC2 -:10EDA00060E00F942FF319E0E0E0F0E010935700DB -:10EDB000E4918E2F0F947EF30F944DF381E991EE41 -:10EDC00060E00F942FF3E3E0F0E010935700E4913C -:10EDD0008E2F0F947EF30F944DF381EA91EE60E055 -:10EDE0000F942FF3E2E0F0E010935700E4918E2FA0 -:10EDF0000F947EF30F944DF381EB91EE60E00F944E -:10EE00002FF3E1E0F0E0109357001491812F0F945D -:10EE10007EF30F944DF307CF85EA92EE62E00F94F4 -:10EE200066F385E592EE60E00F9466F30F944DF380 -:10EE300000E010E019C0C8016F2D0F94DDFFFF2026 -:10EE400031F483E592EE60E00F942FF30BC0F09263 -:10EE5000C6008091C00086FFFCCF8091C000806416 -:10EE60008093C0000F5F1F4FC80181519F41AA27A7 -:10EE700097FDA095BA2FABBFFC01F7905AE2F516AB -:10EE800021F062E000301607B1F60F944DF30F94B5 -:10EE90004DF381E692EE60E00F9466F30F944DF32C -:10EEA000CC24DD2400E010E01EC0C8010F94D5FF83 -:10EEB000F82E882331F483E592EE60E00F942FF36F -:10EEC0000BC08093C6008091C00086FFFCCF80916C -:10EED000C00080648093C000FE1419F00894C11C27 -:10EEE000D11C0F5F1F4FC80181519F41AA2797FD79 -:10EEF000A095BA2FABBFFC01E7907AE2E71621F0AC -:10EF000082E00030180789F60F944DF30F944DF30B -:10EF10008CE692EE60E00F942FF3C60161E070E0A2 -:10EF20000F94A5F30F944DF30F944DF3109200023C -:10EF300010920102109202021092030274CE83EB2F -:10EF400092EE62E00F9466F3279A2F9A16C02F98DC -:10EF500080E090E0E0EDF7E03197F1F7019684363C -:10EF60009105C1F72F9A80E090E0E0EDF7E031974E -:10EF7000F1F7019684369105C1F78091C00087FFB3 -:10EF8000E6CF8091C00087FFFCCF95C48FEB92EE57 -:10EF900062E00F9466F3409100025091010260918B -:10EFA00002027091030281E020E10F942CF4809121 -:10EFB000000290910102A0910202B09103028050E0 -:10EFC0009F4FAF4FBF4F8093000290930102A093D9 -:10EFD0000202B093030280509041A040B04008F478 -:10EFE00022CEA4CF8DEC92EE62E00F9466F34091B6 -:10EFF000040250910502609106027091070280E0C0 -:10F0000020E10F942CF48091040290910502A091CC -:10F010000602B091070280509F4FAF4FBF4F8093C1 -:10F02000040290930502A0930602B0930702FBCD61 -:10F030008AED92EE62E00F9466F385E892EE60E06E -:10F040000F9466F389E992EE60E00F9466F385EA27 -:10F0500092EE60E00F9466F383EB92EE60E00F9423 -:10F0600066F38FEB92EE60E00F9466F38DEC92EE18 -:10F0700060E00F9466F38AED92EE60E00F9466F321 -:10F0800081EE92EE60E00F9466F382EF92EE60E024 -:10F090000F9466F38CE093EE60E00F9466F387E1E3 -:10F0A00093EE60E00F9466F380E393EEB9CD81EECA -:10F0B00092EE62E00F9466F381E40F9416F482E41A -:10F0C0000F9416F483E40F9416F484E40F9416F46A -:10F0D00085E40F9416F486E40F9416F487E40F94F5 -:10F0E00016F488E40F9416F48AE40F9416F48BE473 -:10F0F0000F9416F48CE40F9416F495CD82EF92EEF3 -:10F1000062E00F9466F399249394AA24BB2445C427 -:10F110008CE093EE62E00F9466F340910802509108 -:10F12000090260910A0270910B0282E020E10F94C3 -:10F130002CF48091080290910902A0910A02B091EA -:10F140000B0280509F4FAF4FBF4F809308029093A8 -:10F150000902A0930A02B0930B0265CD87E193EEFA -:10F1600062E00F9466F384EE90EE60E00F9466F335 -:10F1700089ED91EE60E00F9466F309E715EECC5D42 -:10F18000DE4F19830883C452D1406624772443019B -:10F19000CA5DDE4F19821882C652D140A401930184 -:10F1A0005695479537952795C85DDE4F2883398357 -:10F1B0004A835B83C852D140CA5DDE4F4881598182 -:10F1C000C652D1404F5F5F4FCA5DDE4F59834883BF -:10F1D000C652D140CA0162E070E00F94A5F350E23C -:10F1E0005093C6008091C00086FFFCCF8091C00084 -:10F1F00080648093C0006DE26093C6008091C0007F -:10F2000086FFFCCF8091C00080648093C00070E2D4 -:10F210007093C6008091C00086FFFCCF8091C00033 -:10F2200080648093C000C85DDE4FE880F9800A8169 -:10F230001B81C852D140BB27A12F902F8F2D0F9437 -:10F240007EF3C85DDE4F8881C852D1400F947EF3B3 -:10F2500070E2F72EF092C6008091C00086FFFCCFCE -:10F260008091C00080648093C0000DE30093C600CD -:10F270008091C00086FFFCCF8091C00080648093A5 -:10F28000C00010E21093C6008091C00086FFFCCF42 -:10F290008091C00080648093C0008BBEF3012791F1 -:10F2A000C45DDE4F2883CC52D140A22EBB24CC2497 -:10F2B000DD240894611C711C811C911C8BBEF30120 -:10F2C0008791282E332444245524142D032DF22C09 -:10F2D000EE24EA0CFB1C0C1D1D1D0894611C711C06 -:10F2E000811C911C8BBEF3013791C35DDE4F3883C7 -:10F2F000CD52D1400894611C711C811C911C8BBEA5 -:10F30000F3014791C25DDE4F4883CE52D1402DEFCD -:10F310003FEF4FEF5FEF620E731E841E951E0F943A -:10F320007EF330E23093C6008091C00086FFFCCFB0 -:10F330008091C00080648093C000C45DDE4F8881EE -:10F34000CC52D1400F947EF340E24093C6008091AE -:10F35000C00086FFFCCF8091C00080648093C00015 -:10F36000C25DDE4F8881CE52D1400F947EF350E2D1 -:10F370005093C6008091C00086FFFCCF8091C000F2 -:10F3800080648093C000C35DDE4F8881CD52D14040 -:10F390000F947EF360E26093C6008091C00086FF08 -:10F3A000FCCF8091C00080648093C0007FEFE7169F -:10F3B0007FEFF70670E0070770E0170731F48EE083 -:10F3C00092EE60E00F942FF3DFC0D801C701807088 -:10F3D000907CA070B0708050904CA040B040D1F5AF -:10F3E0002FEF3FE340E050E0E222F3220423152315 -:10F3F000C85DDE4FA880B980CA80DB80C852D1408A -:10F40000AE0CBF1CC01ED11EAA0CBB1CCC1CDD1C2C -:10F4100088E192EE60E00F942FF3BB27A12F902F8D -:10F420008F2D0F947EF38E2D0F947EF330E2309368 -:10F43000C6008091C00086FFFCCF8091C000806430 -:10F440008093C0004EE34093C6008091C00086FFC9 -:10F45000FCCF87C06EE07EEF80E090E0E622F722EE -:10F46000082319237CE0E71674E9F70670E0070724 -:10F4700070E0170709F088C0C25DDE4F8881CE5268 -:10F48000D140E82EFF2400E010E0102F0F2DFE2CBD -:10F49000EE24C35DDE4F9881CD52D140E90EF11CC0 -:10F4A000011D111DD601C50181709070A070B07052 -:10F4B000DC0199278827E80EF91E0A1F1B1F20EF81 -:10F4C00030E040E050E0A222B322C422D522F1E194 -:10F4D000AA0CBB1CCC1CDD1CFA95D1F7EA0CFB1C5A -:10F4E0000C1D1D1D41E050E060E070E0242235223B -:10F4F00046225722E5E1220C331C441C551CEA9598 -:10F50000D1F7E20CF31C041D151D57016801AA0C6C -:10F51000BB1CCC1CDD1C8FE192EE60E00F942FF33E -:10F52000C801AA27BB270F947EF3BB27A12F902FDA -:10F530008F2D0F947EF38E2D0F947EF350E2509317 -:10F54000C6008091C00086FFFCCF8091C00080641F -:10F550008093C0006EE36093C6008091C00086FF78 -:10F56000FCCF8091C00080648093C000C601AA27B0 -:10F57000BB270F947EF3BB27AD2D9C2D8B2D0F94B5 -:10F580007EF38A2D0F947EF370E27093C600809113 -:10F59000C00086FFFCCF8091C00080648093C000D3 -:10F5A000CC5DDE4FE881F981C452D140CF01AA275A -:10F5B00097FDA095BA2FABBFFC018791969160E0B3 -:10F5C0000F942FF30F944DF3CC5DDE4F088119811A -:10F5D000C452D1400E5F1F4FCC5DDE4F19830883AC -:10F5E000C452D140CA5DDE4F28813981C652D14014 -:10F5F0002933310509F417CB44E050E060E070E0B6 -:10F60000640E751E861E971EC9CD80E393EE62E0E0 -:10F610000F9466F384E292EE60E00F942FF38091F2 -:10F62000C00087FFFCCF1091C6001F751093C60065 -:10F630008091C00086FFFCCF8091C00080648093E1 -:10F64000C0000F944DF3812F81548A3108F036C1E8 -:10F65000163409F495C0173490F4133409F44EC0ED -:10F66000143430F41134F1F0123409F01DC130C0FB -:10F67000143409F459C0153409F016C16BC01A349A -:10F6800009F4C4C01B3438F4173409F48FC018349B -:10F6900009F00AC1A1C01B3409F4D2C01C3409F01E -:10F6A00003C1E8C08FEF81B90DC082B1809582B9E6 -:10F6B00080E090E0E0EDF7E03197F1F70196883CCB -:10F6C0009105C1F78091C00087FFEFCF12B8EFC05E -:10F6D0008FEF84B90DC085B1809585B980E090E049 -:10F6E000E0EDF7E03197F1F70196883C9105C1F71D -:10F6F0008091C00087FFEFCF15B8D9C08FEF87B9D1 -:10F700000DC088B1809588B980E090E0E0EDF7E029 -:10F710003197F1F70196883C9105C1F78091C000BF -:10F7200087FFEFCF18B8C3C08FEF8AB90DC08BB178 -:10F7300080958BB980E090E0E0EDF7E03197F1F74C -:10F740000196883C9105C1F78091C00087FFEFCFFB -:10F750001BB8ADC08FEF8DB90DC08EB180958EB93D -:10F7600080E090E0E0EDF7E03197F1F70196883C1A -:10F770009105C1F78091C00087FFEFCF1EB897C0F9 -:10F780008FEF80BB0DC081B3809581BB80E090E09E -:10F79000E0EDF7E03197F1F70196883C9105C1F76C -:10F7A0008091C00087FFEFCF11BA81C08FEF83BB7C -:10F7B0000DC084B3809584BB80E090E0E0EDF7E07D -:10F7C0003197F1F70196883C9105C1F78091C0000F -:10F7D00087FFEFCF14BA6BC08FEF809301010FC08A -:10F7E0008091020180958093020180E090E0E0ED3D -:10F7F000F7E03197F1F70196883C9105C1F78091C8 -:10F80000C00087FFEDCF1092020151C08FEF8093AF -:10F8100004010FC08091050180958093050180E06F -:10F8200090E0E0EDF7E03197F1F70196883C910523 -:10F83000C1F78091C00087FFEDCF1092050137C05E -:10F840008FEF809307010FC080910801809580930E -:10F85000080180E090E0E0EDF7E03197F1F70196E4 -:10F86000883C9105C1F78091C00087FFEDCF1092D1 -:10F8700008011DC08FEF80930A010FC080910B011A -:10F88000809580930B0180E090E0E0EDF7E0319708 -:10F89000F1F70196883C9105C1F78091C00087FF80 -:10F8A000EDCF10920B0103C08FE292EEB9C98091A7 -:10F8B000C00087FFFCCF8091C600B5C982E492EEFC -:10F8C000AFC98CE191EEACC9AA24BB24933061F19D -:10F8D000943028F4913089F0923008F508C09530C2 -:10F8E000B1F1953040F1963009F053C04EC02B3144 -:10F8F00009F020C991E06BE11DC9213041F0C15DE3 -:10F90000DE4F5881CF52D140251709F002C362273C -:10F91000C15DDE4F2883CF52D14092E00BC9B22F98 -:10F92000A0E0622793E006C9822F90E0A82BB92BB4 -:10F93000622794E0FFC82E3009F0EBC2622795E001 -:10F94000C05DDE4F19821882C053D140F3C8E1E098 -:10F95000F0E0EC0FFD1FC05DDE4FE880F980C05382 -:10F96000D140EE0DFF1D208387010F5F1F4FC05D4B -:10F97000DE4F19830883C053D14062270A171B0743 -:10F9800009F0D8C8D80196E0D5C8261709F0C1C239 -:10F9900003C0973009F0CEC899248981833109F4D6 -:10F9A000FCC08431C8F4863009F4C2C0873050F4FA -:10F9B000823009F4F0C0833009F458C0813009F076 -:10F9C0000AC23EC0813109F462C0823108F0A6C08B -:10F9D000803109F000C2DFC0883109F472C089317A -:10F9E00050F4853109F4D9C0853108F477C18631E6 -:10F9F00009F0F1C173C18A3109F457C08A3108F4A2 -:10FA00007CC08B3109F446C08D3109F0E4C18D8191 -:10FA1000803311F090E00AC08F81882311F49EE1B9 -:10FA200005C0813011F091E001C098E91A821B8273 -:10FA30008D818C831D829E831F8227E030E0CFC1A1 -:10FA40001A8288E08B8381E48C8386E58D8382E54E -:10FA50008E8389E48F8383E5888780E589878FE5B6 -:10FA60008A8782E38B872BE030E0B9C18A818139B4 -:10FA700041F0823941F0803911F48FE005C080E017 -:10FA800003C082E001C08AE01A828B8344C09924BB -:10FA9000939481C08D81882311F48EE12CC0813034 -:10FAA00011F081E028C088E926C01A82E1E0F0E088 -:10FAB00089E08093570084918B831C8224E030E09E -:10FAC0008EC18B81803589F48C81883039F4E2E0F5 -:10FAD000F0E089E08093570084910DC0E0E0F0E011 -:10FAE00089E080935700849106C0E3E0F0E089E06C -:10FAF0008093570084911A82DFCF8D81836C99E0C7 -:10FB0000E1E0F0E0082E90935700E89507B600FC7E -:10FB1000FDCF1A821B8223E030E061C11A82CE5CE5 -:10FB2000DE4F188219821A821B82C253D14055C1FE -:10FB30008A8190E0A0E0B0E0582F442733272227A5 -:10FB40008B8190E0A0E0B0E0DC0199278827282B8A -:10FB5000392B4A2B5B2B8D8190E0A0E0B0E0282B65 -:10FB6000392B4A2B5B2B8C8190E0A0E0B0E0BA2FC0 -:10FB7000A92F982F8827282B392B4A2B5B2B220F54 -:10FB8000331F441F551FC05EDE4F288339834A83CD -:10FB90005B83C052D1401A8220C19A812B8183316C -:10FBA00049F0C05EDE4F488159816A817B81C05235 -:10FBB000D1408AC0CE5CDE4F488159816A817B8109 -:10FBC000C253D140403080EC580783E0680780E0A2 -:10FBD0007807F0F483E0FA0160935B0080935700AC -:10FBE000E89507B600FCFDCFCE5CDE4F4881598119 -:10FBF0006A817B81C253D14040505F4F6F4F7F4F2E -:10FC0000CE5CDE4F488359836A837B83C253D140E5 -:10FC1000C95CDE4F9883C753D140CA5CDE4F18825F -:10FC2000C653D140022F10E0CA5CDE4F6881798153 -:10FC3000C653D140062B172BC05EDE4F4881598139 -:10FC40006A817B81C052D140DE011B9631E08C91EC -:10FC500011962C9111971296C75CDE4F2883C953D9 -:10FC6000D140C85CDE4F1882C853D14090E0C85CD8 -:10FC7000DE4FE881F981C853D1408E2B9F2B0C01B8 -:10FC8000FA0160935B0030935700E89511244E5FB2 -:10FC90005F4F6F4F7F4F02501040C9F685E0C05E46 -:10FCA000DE4FE880F9800A811B81C052D140F70104 -:10FCB00000935B0080935700E89507B600FCFDCFEA -:10FCC00081E180935700E8951A82C05EDE4F488339 -:10FCD00059836A837B83C052D1407FC0FA80C55C60 -:10FCE000DE4FF882CB53D140C65CDE4F1882CA5338 -:10FCF000D1408B81C82EDD24C65CDE4F088119817E -:10FD0000CA53D140C02AD12A1A828981BE016D5FAF -:10FD10007F4F843121F59601C05EDE4FE880F98087 -:10FD20000A811B81C052D1400BBFF7018791969188 -:10FD3000DB018C9311969C936E5F7F4FD801C701B6 -:10FD40000296A11DB11DC05EDE4F88839983AA83F0 -:10FD5000BB83C052D14022503040F1F636C0C05E65 -:10FD6000DE4F288139814A815B81C052D14008949D -:10FD7000C108D108760100E010E00894C11CD11C34 -:10FD80000894E11CF11C011D111DE20EF31E041F5D -:10FD9000151F21BDBB27A52F942F832F82BD2F5F59 -:10FDA0003F4F4F4F5F4FF89A80B5DB018D93BD01F8 -:10FDB0002E153F054007510761F7C05EDE4F2883CF -:10FDC00039834A835B83C052D14096012D5F3F4FF8 -:10FDD000FB01108204C080EC8A8322E030E08BE1DA -:10FDE0008093C6008091C00086FFFCCF8091C00048 -:10FDF00080648093C000C15DDE4FF881CF52D14056 -:10FE0000F093C6008091C00086FFFCCF8091C000B7 -:10FE100080648093C000432F3093C6008091C0005F -:10FE200086FFFCCF8091C00080648093C000922F39 -:10FE30002093C6008091C00086FFFCCF8091C00057 -:10FE400080648093C0008EE08093C6008091C000E3 -:10FE500086FFFCCF8091C00080648093C00065E184 -:10FE6000C15DDE4FE880CF52D1406E2569276427FF -:10FE7000FE01319610C090819093C6008091C00021 -:10FE800086FFFCCF31968091C00080648093C000D3 -:10FE90006927215030402115310569F76093C6006C -:10FEA0008091C00086FFFCCF8091C0008064809369 -:10FEB000C00085B1805885B9992081F4C15DDE4FBD -:10FEC0000881CF52D1400F5FC15DDE4F0883CF5212 -:10FED000D14090E0A0E0B0E00D949AF527982F98DB -:10FEE00080E090E020ED37E0F9013197F1F70196DD -:10FEF00084369105C9F700008091C0008D7F809302 -:10FF0000C00081E180935700E895EE27FF27099410 -:10FF1000FFCF90E00D949AF597FB092E07260AD0A3 -:10FF200077FD04D02ED006D000201AF4709561958C -:10FF30007F4F0895F6F7909581959F4F0895A1E220 -:10FF40001A2EAA1BBB1BFD010DC0AA1FBB1FEE1F53 -:10FF5000FF1FA217B307E407F50720F0A21BB30B9E -:10FF6000E40BF50B661F771F881F991F1A9469F71A -:10FF700060957095809590959B01AC01BD01CF0176 -:10FF80000895AA1BBB1B51E107C0AA1FBB1FA617E0 -:10FF9000B70710F0A61BB70B881F991F5A95A9F732 -:10FFA00080959095BC01CD010895F999FECF92BD41 -:10FFB00081BDF89A992780B50895262FF999FECF2B -:10FFC0001FBA92BD81BD20BD0FB6F894FA9AF99A76 -:0AFFD0000FBE01960895F894FFCFCC +:10E000000D9472F00D9493F00D9493F00D9493F0A1 +:10E010000D9493F00D9493F00D9493F00D9493F070 +:10E020000D9493F00D9493F00D9493F00D9493F060 +:10E030000D9493F00D9493F00D9493F00D9493F050 +:10E040000D9493F00D9493F00D9493F00D9493F040 +:10E050000D9493F00D9493F00D9493F00D9493F030 +:10E060000D9493F00D9493F00D9493F00D9493F020 +:10E070000D9493F00D9493F00D9493F00D9493F010 +:10E080000D9493F00D9493F00D9493F00D9493F000 +:10E090000D9493F00D9493F00D9493F00D9493F0F0 +:10E0A0000D9493F00D9493F00D9493F00D9493F0E0 +:10E0B0000D9493F00D9493F00D9493F00D9493F0D0 +:10E0C0000D9493F00D9493F00D9493F00D9493F0C0 +:10E0D0000D9493F00D9493F00D9493F00D9493F0B0 +:10E0E0000D9493F011241FBECFEFD1E2DEBFCDBF60 +:10E0F00001E00CBF12E0A0E0B2E0E0EAF8EE03E0DD +:10E100000BBF02C007900D92A030B107D9F70F9452 +:10E11000A3F00D944EF401E20EBF0FEF0DBF1124DA +:10E120001FBE0D94A3F00D9400F020E030E040ED10 +:10E1300057E005C0FA013197F1F72F5F3F4F2817DD +:10E140003907C0F308952F923F924F925F926F92DA +:10E150007F928F929F92AF92BF92CF92DF92EF9277 +:10E16000FF920F931F93DF93CF93CDB7DEB7C852C3 +:10E17000D1400FB6F894DEBF0FBECDBF279A2F9ABD +:10E180008091C00082608093C00080E18093C400D1 +:10E1900088E18093C1000000EE24FF248701E4E0C1 +:10E1A000AE2EB12CCC24DD2424C0C5010197F1F79B +:10E1B0000894E11CF11C011D111D21E2E2162EE460 +:10E1C000F20620E0020720E0120718F071E0C72EE7 +:10E1D000D12CC801B70128E53BE140E050E00F94A5 +:10E1E0002CF4611571058105910519F485B18058EC +:10E1F00085B98091C00087FD03C0C114D104A9F284 +:10E20000A6014F5F5F4FC25EDE4F59834883CE51F8 +:10E21000D140C25EDE4F68817981CE51D1406130FC +:10E22000710509F0FCC222243324A0E0C05EDE4F59 +:10E230001882C052D1408824992454014424552482 +:10E240003201ABBEF40187919691C95DDE4F99838F +:10E250008883C752D140DFC2C25EDE4FE881F981B8 +:10E26000CE51D140319709F53091C600C25EDE4FE4 +:10E2700019821882CE51D14022C04F5F5F4F6F4F3D +:10E280007F4F4130F2E15F07FAE76F07F0E07F0769 +:10E2900080F0C95DDE4F28813981C752D1402F5FA0 +:10E2A0003F4F19F0EE27FF27099440E050E060E06F +:10E2B00070E08091C00087FFE0CF3091C6009330BE +:10E2C00061F1943028F4913089F0923008F508C05B +:10E2D000953091F1953040F1963009F043C03EC041 +:10E2E0003B3109F0B9CF91E0ABE1B6CF313041F02D +:10E2F000C05EDE4F5881C052D140351709F0AAC226 +:10E30000A327C05EDE4F3883C052D14092E0A4CF35 +:10E31000132F00E0A32793E09FCF832F90E0082BDB +:10E32000192BA32794E098CF3E3009F093C2A3277E +:10E3300095E02224332490CFE1E0F0E0EC0FFD1FC4 +:10E34000E20DF31D30830894211C311CA3272016F5 +:10E35000310609F081CF810196E07ECF3A1709F0AE +:10E3600079C203C0973009F077CF8981833109F4EE +:10E37000F4C08431C0F4863009F4C2C0873048F458 +:10E38000823069F1833009F45BC0813009F0C4C187 +:10E3900041C0813109F465C0823108F0ACC08031E0 +:10E3A00009F0BAC11CC0883109F474C0893150F435 +:10E3B000853109F4D2C0853108F443C1863109F0B2 +:10E3C000ABC13FC18A3109F45CC08A3108F482C014 +:10E3D0008B3109F44BC08D3109F09EC102C090E031 +:10E3E00041C08D81803311F090E00AC08F81882375 +:10E3F00011F49EE105C0813011F091E001C098E96F +:10E400001A821B828D818C831D829E831F8247E02E +:10E4100050E086C11A8288E08B8381E48C8386E594 +:10E420008D8382E58E8389E48F8383E5888780E509 +:10E4300089878FE58A8782E38B874BE050E070C144 +:10E440008A81813941F0823941F0803911F48FE0BD +:10E4500005C080E003C082E001C08AE01A828B839D +:10E4600047C091E01A8242E050E05BC18D81882371 +:10E4700011F48EE129C0813011F081E025C088E9D6 +:10E4800023C01A82E1E0F0E069E060935700E49174 +:10E49000EB831CC08B81803589F48C81883039F402 +:10E4A00029E0E2E0F0E02093570084910DC029E0DC +:10E4B000E0E0F0E020935700849106C0E3E0F0E054 +:10E4C00039E03093570084911A828B831C8244E098 +:10E4D00050E026C18D81836C49E0E1E0F0E0082E38 +:10E4E00040935700E89507B600FCFDCF1A821B82C7 +:10E4F00043E050E015C11A824424552432010EC174 +:10E500008A8190E0A0E0B0E0B82EAA249924882463 +:10E510008B8190E0A0E0B0E0DC0199278827882A71 +:10E52000992AAA2ABB2A8D8190E0A0E0B0E0882A2F +:10E53000992AAA2ABB2A8C8190E0A0E0B0E0BA2FE9 +:10E54000A92F982F8827882A992AAA2ABB2A880CBB +:10E55000991CAA1CBB1C1A82E1C09A813B818331A1 +:10E5600019F0B501A40169C050E0451650EC5506FC +:10E5700053E0650650E0750690F463E0F2016092A6 +:10E580005B0060935700E89507B600FCFDCF40E0C4 +:10E5900051E060E070E0440E551E661E771ECE5DB1 +:10E5A000DE4F9883C252D140CF5DDE4F1882C152F8 +:10E5B000D140032F10E0CF5DDE4F68817981C152D9 +:10E5C000D140062B172BB501A401DE011B968C91BF +:10E5D00011962C9111971296CC5DDE4F2883C45270 +:10E5E000D140CD5DDE4F1882C352D14090E0CD5D69 +:10E5F000DE4FE881F981C352D1408E2B9F2B21E061 +:10E600000C01FA0160935B0020935700E8951124F8 +:10E610004E5F5F4F6F4F7F4F02501040C1F635E0A5 +:10E62000F401A0925B0030935700E89507B600FC18 +:10E63000FDCF81E180935700E8951A824A015B0182 +:10E640006DC09A81CA5DDE4F9883C652D140CB5DC2 +:10E65000DE4F1882C552D1408B81C82EDD24CB5DA0 +:10E66000DE4FA881B981C552D140CA2ADB2A1A825D +:10E6700089818431E9F4A60123E0E22EF12CEC0E2D +:10E68000FD1EABBEF40187919691F70180839183C3 +:10E6900022E030E0E20EF31E62E070E080E090E005 +:10E6A000860E971EA81EB91E4250504051F72EC02C +:10E6B000B501A40193E0E92EF12CEC0EFD1E0894A7 +:10E6C000C108D108860120E030E00894C11CD11CAB +:10E6D0000F5F1F4F2F4F3F4F080D191D2A1D3B1D68 +:10E6E00041BDBB27A72F962F852F82BD4F5F5F4F60 +:10E6F0006F4F7F4FF89A80B5D7018D937D014017FA +:10E7000051076207730761F74A015B01A6014D5F7C +:10E710005F4FF701108204C0F0ECFA8342E050E052 +:10E7200090E02BE12093C6008091C00086FFFCCFD3 +:10E730008091C00080648093C000C05EDE4F38814D +:10E74000C052D1403093C6008091C00086FFFCCFFC +:10E750008091C00080648093C000652F5093C600F4 +:10E760008091C00086FFFCCF8091C00080648093C0 +:10E77000C000342F4093C6008091C00086FFFCCFBC +:10E780008091C00080648093C0008EE08093C600BA +:10E790008091C00086FFFCCF8091C0008064809390 +:10E7A000C000A5E1C05EDE4F7881C052D140A727EE +:10E7B000A327A627FE01319610C030813093C600F2 +:10E7C0008091C00086FFFCCF31968091C0008064AC +:10E7D0008093C000A327415050404115510569F76F +:10E7E000A093C6008091C00086FFFCCF8091C0003E +:10E7F00080648093C00085B1805885B9992379F4ED +:10E80000C05EDE4F8881C052D1408F5FC05EDE4F58 +:10E810008883C052D14090E000E010E01DCD2798E1 +:10E820002F9880E090E020ED37E0F9013197F1F783 +:10E83000019684369105C9F700008091C0008D7F54 +:10E840008093C00081E180935700E895EE27FF2771 +:10E850000994FFCF90E000CDA1E21A2EAA1BBB1BAA +:10E86000FD010DC0AA1FBB1FEE1FFF1FA217B3079C +:10E87000E407F50720F0A21BB30BE40BF50B661FB2 +:10E88000771F881F991F1A9469F760957095809576 +:10E8900090959B01AC01BD01CF010895F894FFCF85 :040000033000E000E9 :00000001FF -- cgit v1.2.3-18-g5258 From 4b7c12b7cbd7a9575814040da1d182106638e9c0 Mon Sep 17 00:00:00 2001 From: WestfW Date: Wed, 5 Oct 2011 01:41:03 -0700 Subject: Explicitly set the SHELL variable when OS=windows, so that we'll use the same shell regardless of whether other shells are installed (different shells have different behavior WRT directory component separators, so this matters. http://code.google.com/p/arduino/issues/detail?id=667 ) --- bootloaders/optiboot/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bootloaders/optiboot/Makefile b/bootloaders/optiboot/Makefile index c2e03e3..b9f3ed5 100644 --- a/bootloaders/optiboot/Makefile +++ b/bootloaders/optiboot/Makefile @@ -57,8 +57,10 @@ AVRDUDE_CONF = -C$(TOOLROOT)/avr/etc/avrdude.conf ifeq ($(OS), windows) # On windows, SOME of the tool paths will need to have backslashes instead # of forward slashes (because they use windows cmd.exe for execution instead -# of a unix/mingw shell?) +# of a unix/mingw shell?) We also have to ensure that a consistent shell +# is used even if a unix shell is installed (ie as part of WINAVR) fixpath = $(subst /,\,$1) +SHELL = cmd.exe endif else ifeq ($(ENV), arduinodev) -- cgit v1.2.3-18-g5258