From 0d9377c729d3dfe4719bab1631587bfc5d444b60 Mon Sep 17 00:00:00 2001 From: WestfW Date: Mon, 13 Jun 2011 19:07:07 -0700 Subject: [PATCH] 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.)) (cherry picked from commit e81c1123b624b6cac7da018c9c786700f3152bc9) --- 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 | 151 +++++++++--------- 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, 862 insertions(+), 751 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 + 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 -00001f0a : +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