From 1f01799bbfd17eb04ec6322a123d6d26b21b09a0 Mon Sep 17 00:00:00 2001 From: WestfW Date: Tue, 14 Jun 2011 10:24:27 -0700 Subject: Allow the READ PARAMETER command to return our version number. (significant size impact: 14 bytes!) Initialized "address" to eliminate compiler warning (4 bytes!) Add "atmega168" as a more accurate target name than "diecimila" (keep diecimila as well for backward compatibility) Reduce the .hex and .lst targets that are stored in source control to the three basics: atmega8, atmega168, atmega328. The other targets remain in the makefile and makeall, but will need to be built from source if wanted. Which should be less of a problem now that the source is buildable without installing crosspack. --- bootloaders/optiboot/Makefile | 21 +- bootloaders/optiboot/README.TXT | 11 + bootloaders/optiboot/makeall | 11 +- bootloaders/optiboot/optiboot.c | 28 +- bootloaders/optiboot/optiboot_atmega328.hex | 61 +- bootloaders/optiboot/optiboot_atmega328.lst | 479 ++++++++-------- .../optiboot/optiboot_atmega328_pro_8MHz.hex | 34 -- .../optiboot/optiboot_atmega328_pro_8MHz.lst | 571 ------------------- bootloaders/optiboot/optiboot_diecimila.hex | 34 -- bootloaders/optiboot/optiboot_diecimila.lst | 571 ------------------- bootloaders/optiboot/optiboot_lilypad.hex | 34 -- bootloaders/optiboot/optiboot_lilypad.lst | 571 ------------------- .../optiboot/optiboot_lilypad_resonator.hex | 34 -- .../optiboot/optiboot_lilypad_resonator.lst | 571 ------------------- bootloaders/optiboot/optiboot_luminet.hex | 40 -- bootloaders/optiboot/optiboot_luminet.lst | 617 --------------------- bootloaders/optiboot/optiboot_pro_16MHz.hex | 34 -- bootloaders/optiboot/optiboot_pro_16MHz.lst | 571 ------------------- bootloaders/optiboot/optiboot_pro_20mhz.hex | 34 -- bootloaders/optiboot/optiboot_pro_20mhz.lst | 571 ------------------- bootloaders/optiboot/optiboot_pro_8MHz.hex | 34 -- bootloaders/optiboot/optiboot_pro_8MHz.lst | 571 ------------------- 22 files changed, 346 insertions(+), 5157 deletions(-) delete mode 100644 bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex delete mode 100644 bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst delete mode 100644 bootloaders/optiboot/optiboot_diecimila.hex delete mode 100644 bootloaders/optiboot/optiboot_diecimila.lst delete mode 100644 bootloaders/optiboot/optiboot_lilypad.hex delete mode 100644 bootloaders/optiboot/optiboot_lilypad.lst delete mode 100644 bootloaders/optiboot/optiboot_lilypad_resonator.hex delete mode 100644 bootloaders/optiboot/optiboot_lilypad_resonator.lst delete mode 100644 bootloaders/optiboot/optiboot_luminet.hex delete mode 100644 bootloaders/optiboot/optiboot_luminet.lst delete mode 100644 bootloaders/optiboot/optiboot_pro_16MHz.hex delete mode 100644 bootloaders/optiboot/optiboot_pro_16MHz.lst delete mode 100644 bootloaders/optiboot/optiboot_pro_20mhz.hex delete mode 100644 bootloaders/optiboot/optiboot_pro_20mhz.lst delete mode 100644 bootloaders/optiboot/optiboot_pro_8MHz.hex delete mode 100644 bootloaders/optiboot/optiboot_pro_8MHz.lst diff --git a/bootloaders/optiboot/Makefile b/bootloaders/optiboot/Makefile index f6ba374..c2e03e3 100644 --- a/bootloaders/optiboot/Makefile +++ b/bootloaders/optiboot/Makefile @@ -177,8 +177,27 @@ pro16_isp: LFUSE = C6 pro16_isp: EFUSE = 04 pro16_isp: isp -# Diecimila and NG use identical bootloaders +# Diecimila, Duemilanove with m168, and NG use identical bootloaders +# Call it "atmega168" for generality and clarity, keep "diecimila" for +# backward compatibility of makefile # +atmega168: TARGET = atmega168 +atmega168: MCU_TARGET = atmega168 +atmega168: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' +atmega168: AVR_FREQ = 16000000L +atmega168: $(PROGRAM)_atmega168.hex +atmega168: $(PROGRAM)_atmega168.lst + +atmega168_isp: atmega168 +atmega168_isp: TARGET = atmega168 +# 2.7V brownout +atmega168_isp: HFUSE = DD +# Low power xtal (16MHz) 16KCK/14CK+65ms +atmega168_isp: LFUSE = FF +# 512 byte boot +atmega168_isp: EFUSE = 04 +atmega168_isp: isp + diecimila: TARGET = diecimila diecimila: MCU_TARGET = atmega168 diecimila: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200' diff --git a/bootloaders/optiboot/README.TXT b/bootloaders/optiboot/README.TXT index 7e2f46d..cd79cd9 100644 --- a/bootloaders/optiboot/README.TXT +++ b/bootloaders/optiboot/README.TXT @@ -68,3 +68,14 @@ variables when you invoke make: make ISPTOOL=stk500v1 ISPPORT=/dev/tty.usbserial-A20e1eAN \ ISPSPEED=-b19200 atmega328_isp + +The "atmega8_isp" target does not currently work, because the mega8 +doesn't have the "extended" fuse that the generic ISP target wants to +pass on to avrdude. You'll need to run avrdude manually. + + +Standard Targets + +I've reduced the pre-built and source-version-controlled targets +(.hex and .lst files included in the git repository) to just the +three basic 16MHz targets: atmega8, atmega16, atmega328. diff --git a/bootloaders/optiboot/makeall b/bootloaders/optiboot/makeall index b92c56e..f076bc7 100755 --- a/bootloaders/optiboot/makeall +++ b/bootloaders/optiboot/makeall @@ -1,15 +1,20 @@ #!/bin/bash make clean +# +# The "big three" standard bootloaders. +make atmega8 +make atmega168 +make atmega328 +# +# additional buildable platforms of +# somewhat questionable support level make lilypad make lilypad_resonator make pro8 make pro16 make pro20 -make diecimila -make atmega328 make atmega328_pro8 make sanguino make mega -make atmega8 make atmega88 make luminet diff --git a/bootloaders/optiboot/optiboot.c b/bootloaders/optiboot/optiboot.c index 3f4404d..d499d85 100644 --- a/bootloaders/optiboot/optiboot.c +++ b/bootloaders/optiboot/optiboot.c @@ -132,6 +132,9 @@ /**********************************************************/ /* Edit History: */ /* */ +/* 4.4 WestfW: add initialization of address to keep */ +/* the compiler happy. Change SC'ed targets. */ +/* Return the SW version via READ PARAM */ /* 4.3 WestfW: catch framing errors in getch(), so that */ /* AVRISP works without HW kludges. */ /* http://code.google.com/p/arduino/issues/detail?id=368n*/ @@ -141,7 +144,7 @@ /**********************************************************/ #define OPTIBOOT_MAJVER 4 -#define OPTIBOOT_MINVER 3 +#define OPTIBOOT_MINVER 4 #define MAKESTR(a) #a #define MAKEVER(a, b) MAKESTR(a*256+b) @@ -261,8 +264,10 @@ int main(void) { /* * Making these local and in registers prevents the need for initializing * them, and also saves space because code no longer stores to memory. + * (initializing address keeps the compiler happy, but isn't really + * necessary, and uses 4 bytes of flash.) */ - register uint16_t address; + register uint16_t address = 0; register uint8_t length; // After the zero init loop, this is the first code to run. @@ -324,9 +329,22 @@ int main(void) { ch = getch(); if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - putch(0x03); + unsigned char which = getch(); + verifySpace(); + if (which == 0x82) { + /* + * Send optiboot version as "minor SW version" + */ + putch(OPTIBOOT_MINVER); + } else if (which == 0x81) { + putch(OPTIBOOT_MAJVER); + } else { + /* + * GET PARAMETER returns a generic 0x03 reply for + * other parameters - enough to keep Avrdude happy + */ + putch(0x03); + } } else if(ch == STK_SET_DEVICE) { // SET DEVICE is ignored diff --git a/bootloaders/optiboot/optiboot_atmega328.hex b/bootloaders/optiboot/optiboot_atmega328.hex index f147e81..a219f08 100644 --- a/bootloaders/optiboot/optiboot_atmega328.hex +++ b/bootloaders/optiboot/optiboot_atmega328.hex @@ -1,34 +1,35 @@ -:107E0000112484B714BE81FFE7D085E08093810000 +:107E0000112484B714BE81FFF0D085E080938100F7 :107E100082E08093C00088E18093C10086E0809377 -:107E2000C20080E18093C4008EE0C0D0259A86E035 +:107E2000C20080E18093C4008EE0C9D0259A86E02C :107E300020E33CEF91E0309385002093840096BBD3 -:107E4000B09BFECF1D9AA8958150A9F799249394D1 -:107E5000A5E0AA2EF1E1BF2E9DD0813421F481E06E -:107E6000B3D083E01FC0823411F484E103C08534B1 -:107E700019F485E0A9D083C0853579F48BD0E82E3C -:107E8000FF2488D0082F10E0102F00270E291F296B -:107E9000000F111F91D0680172C0863529F484E06B -:107EA00093D080E06FD06BC0843609F042C072D0AE -:107EB00071D0082F6FD080E0C81680E7D80620F474 -:107EC00083E0F60187BFE895C0E0D1E063D08993F5 -:107ED0000C17E1F7F0E0CF16F0E7DF0620F083E0C3 -:107EE000F60187BFE89568D007B600FCFDCFA60174 -:107EF000A0E0B1E02C9130E011968C91119790E0C8 -:107F0000982F8827822B932B1296FA010C0197BE8B -:107F1000E89511244E5F5F4FF1E0A038BF0751F79D -:107F2000F601A7BEE89507B600FCFDCFB7BEE89501 -:107F300026C08437B1F42ED02DD0F82E2BD03CD0D3 -:107F4000F601EF2C8F010F5F1F4F84911BD0EA9435 -:107F5000F801C1F70894C11CD11CFA94CF0CD11CB4 -:107F60000EC0853739F428D08EE10CD085E90AD0CF -:107F70008FE098CF813511F488E018D01DD080E1D2 -:107F800001D06ACF982F8091C00085FFFCCF9093DD -:107F9000C60008958091C00087FFFCCF8091C0008B -:107FA00084FD01C0A8958091C6000895E0E6F0E048 -:107FB00098E1908380830895EDDF803219F088E0A6 -:107FC000F5DFFFCF84E1DECF1F93182FE3DF1150E1 -:107FD000E9F7F2DF1F91089580E0E8DFEE27FF2741 -:027FE000099402 -:027FFE0003047A +:107E4000B09BFECF1D9AA8958150A9F7CC24DD24C4 +:107E500088248394B5E0AB2EA1E19A2EF3E0BF2EE7 +:107E6000A2D0813461F49FD0082FAFD0023811F036 +:107E7000013811F484E001C083E08DD089C08234E0 +:107E800011F484E103C0853419F485E0A6D080C0E4 +:107E9000853579F488D0E82EFF2485D0082F10E0AE +:107EA000102F00270E291F29000F111F8ED06801E7 +:107EB0006FC0863521F484E090D080E0DECF843638 +:107EC00009F040C070D06FD0082F6DD080E0C81688 +:107ED00080E7D80618F4F601B7BEE895C0E0D1E017 +:107EE00062D089930C17E1F7F0E0CF16F0E7DF06D8 +:107EF00018F0F601B7BEE89568D007B600FCFDCFD4 +:107F0000A601A0E0B1E02C9130E011968C91119780 +:107F100090E0982F8827822B932B1296FA010C0160 +:107F200087BEE89511244E5F5F4FF1E0A038BF0790 +:107F300051F7F601A7BEE89507B600FCFDCF97BE46 +:107F4000E89526C08437B1F42ED02DD0F82E2BD052 +:107F50003CD0F601EF2C8F010F5F1F4F84911BD097 +:107F6000EA94F801C1F70894C11CD11CFA94CF0C13 +:107F7000D11C0EC0853739F428D08EE10CD085E9AC +:107F80000AD08FE07ACF813511F488E018D01DD067 +:107F900080E101D065CF982F8091C00085FFFCCF94 +:107FA0009093C60008958091C00087FFFCCF809118 +:107FB000C00084FD01C0A8958091C6000895E0E648 +:107FC000F0E098E1908380830895EDDF803219F02E +:107FD00088E0F5DFFFCF84E1DECF1F93182FE3DFCA +:107FE0001150E9F7F2DF1F91089580E0E8DFEE27F6 +:047FF000FF270994CA +:027FFE00040479 :0400000300007E007B :00000001FF diff --git a/bootloaders/optiboot/optiboot_atmega328.lst b/bootloaders/optiboot/optiboot_atmega328.lst index db45462..d9dd4cc 100644 --- a/bootloaders/optiboot/optiboot_atmega328.lst +++ b/bootloaders/optiboot/optiboot_atmega328.lst @@ -3,27 +3,27 @@ optiboot_atmega328.elf: file format elf32-avr Sections: Idx Name Size VMA LMA File off Algn - 0 .text 000001e2 00007e00 00007e00 00000054 2**1 + 0 .text 000001f4 00007e00 00007e00 00000054 2**1 CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00007ffe 00007ffe 00000236 2**0 + 1 .version 00000002 00007ffe 00007ffe 00000248 2**0 CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 + 2 .debug_aranges 00000028 00000000 00000000 0000024a 2**0 CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 + 3 .debug_pubnames 0000005f 00000000 00000000 00000272 2**0 CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 + 4 .debug_info 000002a8 00000000 00000000 000002d1 2**0 CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 + 5 .debug_abbrev 00000178 00000000 00000000 00000579 2**0 CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 + 6 .debug_line 00000488 00000000 00000000 000006f1 2**0 CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 + 7 .debug_frame 00000080 00000000 00000000 00000b7c 2**2 CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 + 8 .debug_str 0000014f 00000000 00000000 00000bfc 2**0 CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 + 9 .debug_loc 000002d8 00000000 00000000 00000d4b 2**0 CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 + 10 .debug_ranges 00000078 00000000 00000000 00001023 2**0 CONTENTS, READONLY, DEBUGGING Disassembly of section .text: @@ -47,7 +47,7 @@ int main(void) { 7e04: 14 be out 0x34, r1 ; 52 if (!(ch & _BV(EXTRF))) appStart(); 7e06: 81 ff sbrs r24, 1 - 7e08: e7 d0 rcall .+462 ; 0x7fd8 + 7e08: f0 d0 rcall .+480 ; 0x7fea #if LED_START_FLASHES > 0 // Set up Timer 1 for timeout counter @@ -77,7 +77,7 @@ int main(void) { // Set up watchdog to trigger after 500ms watchdogConfig(WATCHDOG_1S); 7e28: 8e e0 ldi r24, 0x0E ; 14 - 7e2a: c0 d0 rcall .+384 ; 0x7fac + 7e2a: c9 d0 rcall .+402 ; 0x7fbe /* Set LED pin as output */ LED_DDR |= _BV(LED); @@ -126,446 +126,473 @@ void watchdogReset() { } while (--count); 7e48: 81 50 subi r24, 0x01 ; 1 7e4a: a9 f7 brne .-22 ; 0x7e36 - /* get character from UART */ - ch = getch(); - - if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 7e4c: 99 24 eor r9, r9 - 7e4e: 93 94 inc r9 + 7e4c: cc 24 eor r12, r12 + 7e4e: dd 24 eor r13, r13 + ch = SPM_PAGESIZE / 2; + do { + uint16_t a; + a = *bufPtr++; + a |= (*bufPtr++) << 8; __boot_page_fill_short((uint16_t)(void*)addrPtr,a); + 7e50: 88 24 eor r8, r8 + 7e52: 83 94 inc r8 addrPtr += 2; } while (--ch); // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 7e50: a5 e0 ldi r26, 0x05 ; 5 - 7e52: aa 2e mov r10, r26 + 7e54: b5 e0 ldi r27, 0x05 ; 5 + 7e56: ab 2e mov r10, r27 boot_spm_busy_wait(); #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 7e54: f1 e1 ldi r31, 0x11 ; 17 - 7e56: bf 2e mov r11, r31 + 7e58: a1 e1 ldi r26, 0x11 ; 17 + 7e5a: 9a 2e mov r9, r26 + do *bufPtr++ = getch(); + while (--length); + + // If we are in NRWW section, page erase has to be delayed until now. + // Todo: Take RAMPZ into account + if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); + 7e5c: f3 e0 ldi r31, 0x03 ; 3 + 7e5e: bf 2e mov r11, r31 #endif /* Forever loop */ for (;;) { /* get character from UART */ ch = getch(); - 7e58: 9d d0 rcall .+314 ; 0x7f94 + 7e60: a2 d0 rcall .+324 ; 0x7fa6 if(ch == STK_GET_PARAMETER) { - 7e5a: 81 34 cpi r24, 0x41 ; 65 - 7e5c: 21 f4 brne .+8 ; 0x7e66 - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 7e5e: 81 e0 ldi r24, 0x01 ; 1 - 7e60: b3 d0 rcall .+358 ; 0x7fc8 - putch(0x03); - 7e62: 83 e0 ldi r24, 0x03 ; 3 - 7e64: 1f c0 rjmp .+62 ; 0x7ea4 + 7e62: 81 34 cpi r24, 0x41 ; 65 + 7e64: 61 f4 brne .+24 ; 0x7e7e + unsigned char which = getch(); + 7e66: 9f d0 rcall .+318 ; 0x7fa6 + 7e68: 08 2f mov r16, r24 + verifySpace(); + 7e6a: af d0 rcall .+350 ; 0x7fca + if (which == 0x82) { + 7e6c: 02 38 cpi r16, 0x82 ; 130 + 7e6e: 11 f0 breq .+4 ; 0x7e74 + /* + * Send optiboot version as "minor SW version" + */ + putch(OPTIBOOT_MINVER); + } else if (which == 0x81) { + 7e70: 01 38 cpi r16, 0x81 ; 129 + 7e72: 11 f4 brne .+4 ; 0x7e78 + putch(OPTIBOOT_MAJVER); + 7e74: 84 e0 ldi r24, 0x04 ; 4 + 7e76: 01 c0 rjmp .+2 ; 0x7e7a + } else { + /* + * GET PARAMETER returns a generic 0x03 reply for + * other parameters - enough to keep Avrdude happy + */ + putch(0x03); + 7e78: 83 e0 ldi r24, 0x03 ; 3 + 7e7a: 8d d0 rcall .+282 ; 0x7f96 + 7e7c: 89 c0 rjmp .+274 ; 0x7f90 + } } else if(ch == STK_SET_DEVICE) { - 7e66: 82 34 cpi r24, 0x42 ; 66 - 7e68: 11 f4 brne .+4 ; 0x7e6e + 7e7e: 82 34 cpi r24, 0x42 ; 66 + 7e80: 11 f4 brne .+4 ; 0x7e86 // SET DEVICE is ignored getNch(20); - 7e6a: 84 e1 ldi r24, 0x14 ; 20 - 7e6c: 03 c0 rjmp .+6 ; 0x7e74 + 7e82: 84 e1 ldi r24, 0x14 ; 20 + 7e84: 03 c0 rjmp .+6 ; 0x7e8c } else if(ch == STK_SET_DEVICE_EXT) { - 7e6e: 85 34 cpi r24, 0x45 ; 69 - 7e70: 19 f4 brne .+6 ; 0x7e78 + 7e86: 85 34 cpi r24, 0x45 ; 69 + 7e88: 19 f4 brne .+6 ; 0x7e90 // SET DEVICE EXT is ignored getNch(5); - 7e72: 85 e0 ldi r24, 0x05 ; 5 - 7e74: a9 d0 rcall .+338 ; 0x7fc8 - 7e76: 83 c0 rjmp .+262 ; 0x7f7e + 7e8a: 85 e0 ldi r24, 0x05 ; 5 + 7e8c: a6 d0 rcall .+332 ; 0x7fda + 7e8e: 80 c0 rjmp .+256 ; 0x7f90 } else if(ch == STK_LOAD_ADDRESS) { - 7e78: 85 35 cpi r24, 0x55 ; 85 - 7e7a: 79 f4 brne .+30 ; 0x7e9a + 7e90: 85 35 cpi r24, 0x55 ; 85 + 7e92: 79 f4 brne .+30 ; 0x7eb2 // LOAD ADDRESS uint16_t newAddress; newAddress = getch(); - 7e7c: 8b d0 rcall .+278 ; 0x7f94 + 7e94: 88 d0 rcall .+272 ; 0x7fa6 newAddress = (newAddress & 0xff) | (getch() << 8); - 7e7e: e8 2e mov r14, r24 - 7e80: ff 24 eor r15, r15 - 7e82: 88 d0 rcall .+272 ; 0x7f94 - 7e84: 08 2f mov r16, r24 - 7e86: 10 e0 ldi r17, 0x00 ; 0 - 7e88: 10 2f mov r17, r16 - 7e8a: 00 27 eor r16, r16 - 7e8c: 0e 29 or r16, r14 - 7e8e: 1f 29 or r17, r15 + 7e96: e8 2e mov r14, r24 + 7e98: ff 24 eor r15, r15 + 7e9a: 85 d0 rcall .+266 ; 0x7fa6 + 7e9c: 08 2f mov r16, r24 + 7e9e: 10 e0 ldi r17, 0x00 ; 0 + 7ea0: 10 2f mov r17, r16 + 7ea2: 00 27 eor r16, r16 + 7ea4: 0e 29 or r16, r14 + 7ea6: 1f 29 or r17, r15 #ifdef RAMPZ // Transfer top bit to RAMPZ RAMPZ = (newAddress & 0x8000) ? 1 : 0; #endif newAddress += newAddress; // Convert from word address to byte address - 7e90: 00 0f add r16, r16 - 7e92: 11 1f adc r17, r17 + 7ea8: 00 0f add r16, r16 + 7eaa: 11 1f adc r17, r17 address = newAddress; verifySpace(); - 7e94: 91 d0 rcall .+290 ; 0x7fb8 - 7e96: 68 01 movw r12, r16 - 7e98: 72 c0 rjmp .+228 ; 0x7f7e + 7eac: 8e d0 rcall .+284 ; 0x7fca + 7eae: 68 01 movw r12, r16 + 7eb0: 6f c0 rjmp .+222 ; 0x7f90 } else if(ch == STK_UNIVERSAL) { - 7e9a: 86 35 cpi r24, 0x56 ; 86 - 7e9c: 29 f4 brne .+10 ; 0x7ea8 + 7eb2: 86 35 cpi r24, 0x56 ; 86 + 7eb4: 21 f4 brne .+8 ; 0x7ebe // UNIVERSAL command is ignored getNch(4); - 7e9e: 84 e0 ldi r24, 0x04 ; 4 - 7ea0: 93 d0 rcall .+294 ; 0x7fc8 + 7eb6: 84 e0 ldi r24, 0x04 ; 4 + 7eb8: 90 d0 rcall .+288 ; 0x7fda putch(0x00); - 7ea2: 80 e0 ldi r24, 0x00 ; 0 - 7ea4: 6f d0 rcall .+222 ; 0x7f84 - 7ea6: 6b c0 rjmp .+214 ; 0x7f7e + 7eba: 80 e0 ldi r24, 0x00 ; 0 + 7ebc: de cf rjmp .-68 ; 0x7e7a } /* Write memory, length is big endian and is in bytes */ else if(ch == STK_PROG_PAGE) { - 7ea8: 84 36 cpi r24, 0x64 ; 100 - 7eaa: 09 f0 breq .+2 ; 0x7eae - 7eac: 42 c0 rjmp .+132 ; 0x7f32 + 7ebe: 84 36 cpi r24, 0x64 ; 100 + 7ec0: 09 f0 breq .+2 ; 0x7ec4 + 7ec2: 40 c0 rjmp .+128 ; 0x7f44 // PROGRAM PAGE - we support flash programming only, not EEPROM uint8_t *bufPtr; uint16_t addrPtr; getch(); /* getlen() */ - 7eae: 72 d0 rcall .+228 ; 0x7f94 + 7ec4: 70 d0 rcall .+224 ; 0x7fa6 length = getch(); - 7eb0: 71 d0 rcall .+226 ; 0x7f94 - 7eb2: 08 2f mov r16, r24 + 7ec6: 6f d0 rcall .+222 ; 0x7fa6 + 7ec8: 08 2f mov r16, r24 getch(); - 7eb4: 6f d0 rcall .+222 ; 0x7f94 + 7eca: 6d d0 rcall .+218 ; 0x7fa6 // If we are in RWW section, immediately start page erase if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 7eb6: 80 e0 ldi r24, 0x00 ; 0 - 7eb8: c8 16 cp r12, r24 - 7eba: 80 e7 ldi r24, 0x70 ; 112 - 7ebc: d8 06 cpc r13, r24 - 7ebe: 20 f4 brcc .+8 ; 0x7ec8 - 7ec0: 83 e0 ldi r24, 0x03 ; 3 - 7ec2: f6 01 movw r30, r12 - 7ec4: 87 bf out 0x37, r24 ; 55 - 7ec6: e8 95 spm - 7ec8: c0 e0 ldi r28, 0x00 ; 0 - 7eca: d1 e0 ldi r29, 0x01 ; 1 + 7ecc: 80 e0 ldi r24, 0x00 ; 0 + 7ece: c8 16 cp r12, r24 + 7ed0: 80 e7 ldi r24, 0x70 ; 112 + 7ed2: d8 06 cpc r13, r24 + 7ed4: 18 f4 brcc .+6 ; 0x7edc + 7ed6: f6 01 movw r30, r12 + 7ed8: b7 be out 0x37, r11 ; 55 + 7eda: e8 95 spm + 7edc: c0 e0 ldi r28, 0x00 ; 0 + 7ede: d1 e0 ldi r29, 0x01 ; 1 // While that is going on, read in page contents bufPtr = buff; do *bufPtr++ = getch(); - 7ecc: 63 d0 rcall .+198 ; 0x7f94 - 7ece: 89 93 st Y+, r24 + 7ee0: 62 d0 rcall .+196 ; 0x7fa6 + 7ee2: 89 93 st Y+, r24 while (--length); - 7ed0: 0c 17 cp r16, r28 - 7ed2: e1 f7 brne .-8 ; 0x7ecc + 7ee4: 0c 17 cp r16, r28 + 7ee6: e1 f7 brne .-8 ; 0x7ee0 // If we are in NRWW section, page erase has to be delayed until now. // Todo: Take RAMPZ into account if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 7ed4: f0 e0 ldi r31, 0x00 ; 0 - 7ed6: cf 16 cp r12, r31 - 7ed8: f0 e7 ldi r31, 0x70 ; 112 - 7eda: df 06 cpc r13, r31 - 7edc: 20 f0 brcs .+8 ; 0x7ee6 - 7ede: 83 e0 ldi r24, 0x03 ; 3 - 7ee0: f6 01 movw r30, r12 - 7ee2: 87 bf out 0x37, r24 ; 55 - 7ee4: e8 95 spm + 7ee8: f0 e0 ldi r31, 0x00 ; 0 + 7eea: cf 16 cp r12, r31 + 7eec: f0 e7 ldi r31, 0x70 ; 112 + 7eee: df 06 cpc r13, r31 + 7ef0: 18 f0 brcs .+6 ; 0x7ef8 + 7ef2: f6 01 movw r30, r12 + 7ef4: b7 be out 0x37, r11 ; 55 + 7ef6: e8 95 spm // Read command terminator, start reply verifySpace(); - 7ee6: 68 d0 rcall .+208 ; 0x7fb8 + 7ef8: 68 d0 rcall .+208 ; 0x7fca // If only a partial page is to be programmed, the erase might not be complete. // So check that here boot_spm_busy_wait(); - 7ee8: 07 b6 in r0, 0x37 ; 55 - 7eea: 00 fc sbrc r0, 0 - 7eec: fd cf rjmp .-6 ; 0x7ee8 - 7eee: a6 01 movw r20, r12 - 7ef0: a0 e0 ldi r26, 0x00 ; 0 - 7ef2: b1 e0 ldi r27, 0x01 ; 1 + 7efa: 07 b6 in r0, 0x37 ; 55 + 7efc: 00 fc sbrc r0, 0 + 7efe: fd cf rjmp .-6 ; 0x7efa + 7f00: a6 01 movw r20, r12 + 7f02: a0 e0 ldi r26, 0x00 ; 0 + 7f04: b1 e0 ldi r27, 0x01 ; 1 bufPtr = buff; addrPtr = (uint16_t)(void*)address; ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; - 7ef4: 2c 91 ld r18, X - 7ef6: 30 e0 ldi r19, 0x00 ; 0 + 7f06: 2c 91 ld r18, X + 7f08: 30 e0 ldi r19, 0x00 ; 0 a |= (*bufPtr++) << 8; - 7ef8: 11 96 adiw r26, 0x01 ; 1 - 7efa: 8c 91 ld r24, X - 7efc: 11 97 sbiw r26, 0x01 ; 1 - 7efe: 90 e0 ldi r25, 0x00 ; 0 - 7f00: 98 2f mov r25, r24 - 7f02: 88 27 eor r24, r24 - 7f04: 82 2b or r24, r18 - 7f06: 93 2b or r25, r19 + 7f0a: 11 96 adiw r26, 0x01 ; 1 + 7f0c: 8c 91 ld r24, X + 7f0e: 11 97 sbiw r26, 0x01 ; 1 + 7f10: 90 e0 ldi r25, 0x00 ; 0 + 7f12: 98 2f mov r25, r24 + 7f14: 88 27 eor r24, r24 + 7f16: 82 2b or r24, r18 + 7f18: 93 2b or r25, r19 #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 7f08: 12 96 adiw r26, 0x02 ; 2 + 7f1a: 12 96 adiw r26, 0x02 ; 2 ch = SPM_PAGESIZE / 2; do { uint16_t a; a = *bufPtr++; a |= (*bufPtr++) << 8; __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 7f0a: fa 01 movw r30, r20 - 7f0c: 0c 01 movw r0, r24 - 7f0e: 97 be out 0x37, r9 ; 55 - 7f10: e8 95 spm - 7f12: 11 24 eor r1, r1 + 7f1c: fa 01 movw r30, r20 + 7f1e: 0c 01 movw r0, r24 + 7f20: 87 be out 0x37, r8 ; 55 + 7f22: e8 95 spm + 7f24: 11 24 eor r1, r1 addrPtr += 2; - 7f14: 4e 5f subi r20, 0xFE ; 254 - 7f16: 5f 4f sbci r21, 0xFF ; 255 + 7f26: 4e 5f subi r20, 0xFE ; 254 + 7f28: 5f 4f sbci r21, 0xFF ; 255 } while (--ch); - 7f18: f1 e0 ldi r31, 0x01 ; 1 - 7f1a: a0 38 cpi r26, 0x80 ; 128 - 7f1c: bf 07 cpc r27, r31 - 7f1e: 51 f7 brne .-44 ; 0x7ef4 + 7f2a: f1 e0 ldi r31, 0x01 ; 1 + 7f2c: a0 38 cpi r26, 0x80 ; 128 + 7f2e: bf 07 cpc r27, r31 + 7f30: 51 f7 brne .-44 ; 0x7f06 // Write from programming buffer __boot_page_write_short((uint16_t)(void*)address); - 7f20: f6 01 movw r30, r12 - 7f22: a7 be out 0x37, r10 ; 55 - 7f24: e8 95 spm + 7f32: f6 01 movw r30, r12 + 7f34: a7 be out 0x37, r10 ; 55 + 7f36: e8 95 spm boot_spm_busy_wait(); - 7f26: 07 b6 in r0, 0x37 ; 55 - 7f28: 00 fc sbrc r0, 0 - 7f2a: fd cf rjmp .-6 ; 0x7f26 + 7f38: 07 b6 in r0, 0x37 ; 55 + 7f3a: 00 fc sbrc r0, 0 + 7f3c: fd cf rjmp .-6 ; 0x7f38 #if defined(RWWSRE) // Reenable read access to flash boot_rww_enable(); - 7f2c: b7 be out 0x37, r11 ; 55 - 7f2e: e8 95 spm - 7f30: 26 c0 rjmp .+76 ; 0x7f7e + 7f3e: 97 be out 0x37, r9 ; 55 + 7f40: e8 95 spm + 7f42: 26 c0 rjmp .+76 ; 0x7f90 #endif } /* Read memory block mode, length is big endian. */ else if(ch == STK_READ_PAGE) { - 7f32: 84 37 cpi r24, 0x74 ; 116 - 7f34: b1 f4 brne .+44 ; 0x7f62 + 7f44: 84 37 cpi r24, 0x74 ; 116 + 7f46: b1 f4 brne .+44 ; 0x7f74 // READ PAGE - we only read flash getch(); /* getlen() */ - 7f36: 2e d0 rcall .+92 ; 0x7f94 + 7f48: 2e d0 rcall .+92 ; 0x7fa6 length = getch(); - 7f38: 2d d0 rcall .+90 ; 0x7f94 - 7f3a: f8 2e mov r15, r24 + 7f4a: 2d d0 rcall .+90 ; 0x7fa6 + 7f4c: f8 2e mov r15, r24 getch(); - 7f3c: 2b d0 rcall .+86 ; 0x7f94 + 7f4e: 2b d0 rcall .+86 ; 0x7fa6 verifySpace(); - 7f3e: 3c d0 rcall .+120 ; 0x7fb8 - 7f40: f6 01 movw r30, r12 - 7f42: ef 2c mov r14, r15 + 7f50: 3c d0 rcall .+120 ; 0x7fca + 7f52: f6 01 movw r30, r12 + 7f54: ef 2c mov r14, r15 putch(result); address++; } while (--length); #else do putch(pgm_read_byte_near(address++)); - 7f44: 8f 01 movw r16, r30 - 7f46: 0f 5f subi r16, 0xFF ; 255 - 7f48: 1f 4f sbci r17, 0xFF ; 255 - 7f4a: 84 91 lpm r24, Z+ - 7f4c: 1b d0 rcall .+54 ; 0x7f84 + 7f56: 8f 01 movw r16, r30 + 7f58: 0f 5f subi r16, 0xFF ; 255 + 7f5a: 1f 4f sbci r17, 0xFF ; 255 + 7f5c: 84 91 lpm r24, Z+ + 7f5e: 1b d0 rcall .+54 ; 0x7f96 while (--length); - 7f4e: ea 94 dec r14 - 7f50: f8 01 movw r30, r16 - 7f52: c1 f7 brne .-16 ; 0x7f44 + 7f60: ea 94 dec r14 + 7f62: f8 01 movw r30, r16 + 7f64: c1 f7 brne .-16 ; 0x7f56 #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) #endif /* main program starts here */ int main(void) { - 7f54: 08 94 sec - 7f56: c1 1c adc r12, r1 - 7f58: d1 1c adc r13, r1 - 7f5a: fa 94 dec r15 - 7f5c: cf 0c add r12, r15 - 7f5e: d1 1c adc r13, r1 - 7f60: 0e c0 rjmp .+28 ; 0x7f7e + 7f66: 08 94 sec + 7f68: c1 1c adc r12, r1 + 7f6a: d1 1c adc r13, r1 + 7f6c: fa 94 dec r15 + 7f6e: cf 0c add r12, r15 + 7f70: d1 1c adc r13, r1 + 7f72: 0e c0 rjmp .+28 ; 0x7f90 #endif #endif } /* Get device signature bytes */ else if(ch == STK_READ_SIGN) { - 7f62: 85 37 cpi r24, 0x75 ; 117 - 7f64: 39 f4 brne .+14 ; 0x7f74 + 7f74: 85 37 cpi r24, 0x75 ; 117 + 7f76: 39 f4 brne .+14 ; 0x7f86 // READ SIGN - return what Avrdude wants to hear verifySpace(); - 7f66: 28 d0 rcall .+80 ; 0x7fb8 + 7f78: 28 d0 rcall .+80 ; 0x7fca putch(SIGNATURE_0); - 7f68: 8e e1 ldi r24, 0x1E ; 30 - 7f6a: 0c d0 rcall .+24 ; 0x7f84 + 7f7a: 8e e1 ldi r24, 0x1E ; 30 + 7f7c: 0c d0 rcall .+24 ; 0x7f96 putch(SIGNATURE_1); - 7f6c: 85 e9 ldi r24, 0x95 ; 149 - 7f6e: 0a d0 rcall .+20 ; 0x7f84 + 7f7e: 85 e9 ldi r24, 0x95 ; 149 + 7f80: 0a d0 rcall .+20 ; 0x7f96 putch(SIGNATURE_2); - 7f70: 8f e0 ldi r24, 0x0F ; 15 - 7f72: 98 cf rjmp .-208 ; 0x7ea4 + 7f82: 8f e0 ldi r24, 0x0F ; 15 + 7f84: 7a cf rjmp .-268 ; 0x7e7a } else if (ch == 'Q') { - 7f74: 81 35 cpi r24, 0x51 ; 81 - 7f76: 11 f4 brne .+4 ; 0x7f7c + 7f86: 81 35 cpi r24, 0x51 ; 81 + 7f88: 11 f4 brne .+4 ; 0x7f8e // Adaboot no-wait mod watchdogConfig(WATCHDOG_16MS); - 7f78: 88 e0 ldi r24, 0x08 ; 8 - 7f7a: 18 d0 rcall .+48 ; 0x7fac + 7f8a: 88 e0 ldi r24, 0x08 ; 8 + 7f8c: 18 d0 rcall .+48 ; 0x7fbe verifySpace(); } else { // This covers the response to commands like STK_ENTER_PROGMODE verifySpace(); - 7f7c: 1d d0 rcall .+58 ; 0x7fb8 + 7f8e: 1d d0 rcall .+58 ; 0x7fca } putch(STK_OK); - 7f7e: 80 e1 ldi r24, 0x10 ; 16 - 7f80: 01 d0 rcall .+2 ; 0x7f84 - 7f82: 6a cf rjmp .-300 ; 0x7e58 + 7f90: 80 e1 ldi r24, 0x10 ; 16 + 7f92: 01 d0 rcall .+2 ; 0x7f96 + 7f94: 65 cf rjmp .-310 ; 0x7e60 -00007f84 : +00007f96 : } } void putch(char ch) { - 7f84: 98 2f mov r25, r24 + 7f96: 98 2f mov r25, r24 #ifndef SOFT_UART while (!(UCSR0A & _BV(UDRE0))); - 7f86: 80 91 c0 00 lds r24, 0x00C0 - 7f8a: 85 ff sbrs r24, 5 - 7f8c: fc cf rjmp .-8 ; 0x7f86 + 7f98: 80 91 c0 00 lds r24, 0x00C0 + 7f9c: 85 ff sbrs r24, 5 + 7f9e: fc cf rjmp .-8 ; 0x7f98 UDR0 = ch; - 7f8e: 90 93 c6 00 sts 0x00C6, r25 + 7fa0: 90 93 c6 00 sts 0x00C6, r25 [uartBit] "I" (UART_TX_BIT) : "r25" ); #endif } - 7f92: 08 95 ret + 7fa4: 08 95 ret -00007f94 : +00007fa6 : [uartBit] "I" (UART_RX_BIT) : "r25" ); #else while(!(UCSR0A & _BV(RXC0))) - 7f94: 80 91 c0 00 lds r24, 0x00C0 - 7f98: 87 ff sbrs r24, 7 - 7f9a: fc cf rjmp .-8 ; 0x7f94 + 7fa6: 80 91 c0 00 lds r24, 0x00C0 + 7faa: 87 ff sbrs r24, 7 + 7fac: fc cf rjmp .-8 ; 0x7fa6 ; if (!(UCSR0A & _BV(FE0))) { - 7f9c: 80 91 c0 00 lds r24, 0x00C0 - 7fa0: 84 fd sbrc r24, 4 - 7fa2: 01 c0 rjmp .+2 ; 0x7fa6 + 7fae: 80 91 c0 00 lds r24, 0x00C0 + 7fb2: 84 fd sbrc r24, 4 + 7fb4: 01 c0 rjmp .+2 ; 0x7fb8 } #endif // Watchdog functions. These are only safe with interrupts turned off. void watchdogReset() { __asm__ __volatile__ ( - 7fa4: a8 95 wdr + 7fb6: a8 95 wdr * don't care that an invalid char is returned...) */ watchdogReset(); } ch = UDR0; - 7fa6: 80 91 c6 00 lds r24, 0x00C6 + 7fb8: 80 91 c6 00 lds r24, 0x00C6 LED_PIN |= _BV(LED); #endif #endif return ch; } - 7faa: 08 95 ret + 7fbc: 08 95 ret -00007fac : +00007fbe : "wdr\n" ); } void watchdogConfig(uint8_t x) { WDTCSR = _BV(WDCE) | _BV(WDE); - 7fac: e0 e6 ldi r30, 0x60 ; 96 - 7fae: f0 e0 ldi r31, 0x00 ; 0 - 7fb0: 98 e1 ldi r25, 0x18 ; 24 - 7fb2: 90 83 st Z, r25 + 7fbe: e0 e6 ldi r30, 0x60 ; 96 + 7fc0: f0 e0 ldi r31, 0x00 ; 0 + 7fc2: 98 e1 ldi r25, 0x18 ; 24 + 7fc4: 90 83 st Z, r25 WDTCSR = x; - 7fb4: 80 83 st Z, r24 + 7fc6: 80 83 st Z, r24 } - 7fb6: 08 95 ret + 7fc8: 08 95 ret -00007fb8 : +00007fca : do getch(); while (--count); verifySpace(); } void verifySpace() { if (getch() != CRC_EOP) { - 7fb8: ed df rcall .-38 ; 0x7f94 - 7fba: 80 32 cpi r24, 0x20 ; 32 - 7fbc: 19 f0 breq .+6 ; 0x7fc4 + 7fca: ed df rcall .-38 ; 0x7fa6 + 7fcc: 80 32 cpi r24, 0x20 ; 32 + 7fce: 19 f0 breq .+6 ; 0x7fd6 watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 7fbe: 88 e0 ldi r24, 0x08 ; 8 - 7fc0: f5 df rcall .-22 ; 0x7fac - 7fc2: ff cf rjmp .-2 ; 0x7fc2 + 7fd0: 88 e0 ldi r24, 0x08 ; 8 + 7fd2: f5 df rcall .-22 ; 0x7fbe + 7fd4: ff cf rjmp .-2 ; 0x7fd4 while (1) // and busy-loop so that WD causes ; // a reset and app start. } putch(STK_INSYNC); - 7fc4: 84 e1 ldi r24, 0x14 ; 20 + 7fd6: 84 e1 ldi r24, 0x14 ; 20 } - 7fc6: de cf rjmp .-68 ; 0x7f84 + 7fd8: de cf rjmp .-68 ; 0x7f96 -00007fc8 : +00007fda : ::[count] "M" (UART_B_VALUE) ); } #endif void getNch(uint8_t count) { - 7fc8: 1f 93 push r17 - 7fca: 18 2f mov r17, r24 + 7fda: 1f 93 push r17 + 7fdc: 18 2f mov r17, r24 do getch(); while (--count); - 7fcc: e3 df rcall .-58 ; 0x7f94 - 7fce: 11 50 subi r17, 0x01 ; 1 - 7fd0: e9 f7 brne .-6 ; 0x7fcc + 7fde: e3 df rcall .-58 ; 0x7fa6 + 7fe0: 11 50 subi r17, 0x01 ; 1 + 7fe2: e9 f7 brne .-6 ; 0x7fde verifySpace(); - 7fd2: f2 df rcall .-28 ; 0x7fb8 + 7fe4: f2 df rcall .-28 ; 0x7fca } - 7fd4: 1f 91 pop r17 - 7fd6: 08 95 ret + 7fe6: 1f 91 pop r17 + 7fe8: 08 95 ret -00007fd8 : +00007fea : WDTCSR = _BV(WDCE) | _BV(WDE); WDTCSR = x; } void appStart() { watchdogConfig(WATCHDOG_OFF); - 7fd8: 80 e0 ldi r24, 0x00 ; 0 - 7fda: e8 df rcall .-48 ; 0x7fac + 7fea: 80 e0 ldi r24, 0x00 ; 0 + 7fec: e8 df rcall .-48 ; 0x7fbe __asm__ __volatile__ ( - 7fdc: ee 27 eor r30, r30 - 7fde: ff 27 eor r31, r31 - 7fe0: 09 94 ijmp + 7fee: ee 27 eor r30, r30 + 7ff0: ff 27 eor r31, r31 + 7ff2: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex deleted file mode 100644 index 499c631..0000000 --- a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex +++ /dev/null @@ -1,34 +0,0 @@ -:107E0000112484B714BE81FFE7D085E08093810000 -:107E100082E08093C00088E18093C10086E0809377 -:107E2000C20088E08093C4008EE0C0D0259A86E02E -:107E300028E13EEF91E0309385002093840096BBCB -:107E4000B09BFECF1D9AA8958150A9F799249394D1 -:107E5000A5E0AA2EF1E1BF2E9DD0813421F481E06E -:107E6000B3D083E01FC0823411F484E103C08534B1 -:107E700019F485E0A9D083C0853579F48BD0E82E3C -:107E8000FF2488D0082F10E0102F00270E291F296B -:107E9000000F111F91D0680172C0863529F484E06B -:107EA00093D080E06FD06BC0843609F042C072D0AE -:107EB00071D0082F6FD080E0C81680E7D80620F474 -:107EC00083E0F60187BFE895C0E0D1E063D08993F5 -:107ED0000C17E1F7F0E0CF16F0E7DF0620F083E0C3 -:107EE000F60187BFE89568D007B600FCFDCFA60174 -:107EF000A0E0B1E02C9130E011968C91119790E0C8 -:107F0000982F8827822B932B1296FA010C0197BE8B -:107F1000E89511244E5F5F4FF1E0A038BF0751F79D -:107F2000F601A7BEE89507B600FCFDCFB7BEE89501 -:107F300026C08437B1F42ED02DD0F82E2BD03CD0D3 -:107F4000F601EF2C8F010F5F1F4F84911BD0EA9435 -:107F5000F801C1F70894C11CD11CFA94CF0CD11CB4 -:107F60000EC0853739F428D08EE10CD085E90AD0CF -:107F70008FE098CF813511F488E018D01DD080E1D2 -:107F800001D06ACF982F8091C00085FFFCCF9093DD -:107F9000C60008958091C00087FFFCCF8091C0008B -:107FA00084FD01C0A8958091C6000895E0E6F0E048 -:107FB00098E1908380830895EDDF803219F088E0A6 -:107FC000F5DFFFCF84E1DECF1F93182FE3DF1150E1 -:107FD000E9F7F2DF1F91089580E0E8DFEE27FF2741 -:027FE000099402 -:027FFE0003047A -:0400000300007E007B -:00000001FF diff --git a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst b/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst deleted file mode 100644 index 0577bdc..0000000 --- a/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst +++ /dev/null @@ -1,571 +0,0 @@ - -optiboot_atmega328_pro_8MHz.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001e2 00007e00 00007e00 00000054 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00007ffe 00007ffe 00000236 2**0 - CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00007e00
: -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 7e00: 11 24 eor r1, r1 -#ifdef __AVR_ATmega8__ - SP=RAMEND; // This is done by hardware reset -#endif - - // Adaboot no-wait mod - ch = MCUSR; - 7e02: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 7e04: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 7e06: 81 ff sbrs r24, 1 - 7e08: e7 d0 rcall .+462 ; 0x7fd8 - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 7e0a: 85 e0 ldi r24, 0x05 ; 5 - 7e0c: 80 93 81 00 sts 0x0081, r24 - UCSRA = _BV(U2X); //Double speed mode USART - UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx - UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 - UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); -#else - UCSR0A = _BV(U2X0); //Double speed mode USART0 - 7e10: 82 e0 ldi r24, 0x02 ; 2 - 7e12: 80 93 c0 00 sts 0x00C0, r24 - UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 7e16: 88 e1 ldi r24, 0x18 ; 24 - 7e18: 80 93 c1 00 sts 0x00C1, r24 - UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 7e1c: 86 e0 ldi r24, 0x06 ; 6 - 7e1e: 80 93 c2 00 sts 0x00C2, r24 - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 7e22: 88 e0 ldi r24, 0x08 ; 8 - 7e24: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 7e28: 8e e0 ldi r24, 0x0E ; 14 - 7e2a: c0 d0 rcall .+384 ; 0x7fac - - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 7e2c: 25 9a sbi 0x04, 5 ; 4 - 7e2e: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 7e30: 28 e1 ldi r18, 0x18 ; 24 - 7e32: 3e ef ldi r19, 0xFE ; 254 - TIFR1 = _BV(TOV1); - 7e34: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 7e36: 30 93 85 00 sts 0x0085, r19 - 7e3a: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 7e3e: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 7e40: b0 9b sbis 0x16, 0 ; 22 - 7e42: fe cf rjmp .-4 ; 0x7e40 -#ifdef __AVR_ATmega8__ - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 7e44: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 7e46: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 7e48: 81 50 subi r24, 0x01 ; 1 - 7e4a: a9 f7 brne .-22 ; 0x7e36 - /* get character from UART */ - ch = getch(); - - if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 7e4c: 99 24 eor r9, r9 - 7e4e: 93 94 inc r9 - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - addrPtr += 2; - } while (--ch); - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 7e50: a5 e0 ldi r26, 0x05 ; 5 - 7e52: aa 2e mov r10, r26 - boot_spm_busy_wait(); - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 7e54: f1 e1 ldi r31, 0x11 ; 17 - 7e56: bf 2e mov r11, r31 -#endif - - /* Forever loop */ - for (;;) { - /* get character from UART */ - ch = getch(); - 7e58: 9d d0 rcall .+314 ; 0x7f94 - - if(ch == STK_GET_PARAMETER) { - 7e5a: 81 34 cpi r24, 0x41 ; 65 - 7e5c: 21 f4 brne .+8 ; 0x7e66 - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 7e5e: 81 e0 ldi r24, 0x01 ; 1 - 7e60: b3 d0 rcall .+358 ; 0x7fc8 - putch(0x03); - 7e62: 83 e0 ldi r24, 0x03 ; 3 - 7e64: 1f c0 rjmp .+62 ; 0x7ea4 - } - else if(ch == STK_SET_DEVICE) { - 7e66: 82 34 cpi r24, 0x42 ; 66 - 7e68: 11 f4 brne .+4 ; 0x7e6e - // SET DEVICE is ignored - getNch(20); - 7e6a: 84 e1 ldi r24, 0x14 ; 20 - 7e6c: 03 c0 rjmp .+6 ; 0x7e74 - } - else if(ch == STK_SET_DEVICE_EXT) { - 7e6e: 85 34 cpi r24, 0x45 ; 69 - 7e70: 19 f4 brne .+6 ; 0x7e78 - // SET DEVICE EXT is ignored - getNch(5); - 7e72: 85 e0 ldi r24, 0x05 ; 5 - 7e74: a9 d0 rcall .+338 ; 0x7fc8 - 7e76: 83 c0 rjmp .+262 ; 0x7f7e - } - else if(ch == STK_LOAD_ADDRESS) { - 7e78: 85 35 cpi r24, 0x55 ; 85 - 7e7a: 79 f4 brne .+30 ; 0x7e9a - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 7e7c: 8b d0 rcall .+278 ; 0x7f94 - newAddress = (newAddress & 0xff) | (getch() << 8); - 7e7e: e8 2e mov r14, r24 - 7e80: ff 24 eor r15, r15 - 7e82: 88 d0 rcall .+272 ; 0x7f94 - 7e84: 08 2f mov r16, r24 - 7e86: 10 e0 ldi r17, 0x00 ; 0 - 7e88: 10 2f mov r17, r16 - 7e8a: 00 27 eor r16, r16 - 7e8c: 0e 29 or r16, r14 - 7e8e: 1f 29 or r17, r15 -#ifdef RAMPZ - // Transfer top bit to RAMPZ - RAMPZ = (newAddress & 0x8000) ? 1 : 0; -#endif - newAddress += newAddress; // Convert from word address to byte address - 7e90: 00 0f add r16, r16 - 7e92: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 7e94: 91 d0 rcall .+290 ; 0x7fb8 - 7e96: 68 01 movw r12, r16 - 7e98: 72 c0 rjmp .+228 ; 0x7f7e - } - else if(ch == STK_UNIVERSAL) { - 7e9a: 86 35 cpi r24, 0x56 ; 86 - 7e9c: 29 f4 brne .+10 ; 0x7ea8 - // UNIVERSAL command is ignored - getNch(4); - 7e9e: 84 e0 ldi r24, 0x04 ; 4 - 7ea0: 93 d0 rcall .+294 ; 0x7fc8 - putch(0x00); - 7ea2: 80 e0 ldi r24, 0x00 ; 0 - 7ea4: 6f d0 rcall .+222 ; 0x7f84 - 7ea6: 6b c0 rjmp .+214 ; 0x7f7e - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 7ea8: 84 36 cpi r24, 0x64 ; 100 - 7eaa: 09 f0 breq .+2 ; 0x7eae - 7eac: 42 c0 rjmp .+132 ; 0x7f32 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t *bufPtr; - uint16_t addrPtr; - - getch(); /* getlen() */ - 7eae: 72 d0 rcall .+228 ; 0x7f94 - length = getch(); - 7eb0: 71 d0 rcall .+226 ; 0x7f94 - 7eb2: 08 2f mov r16, r24 - getch(); - 7eb4: 6f d0 rcall .+222 ; 0x7f94 - - // If we are in RWW section, immediately start page erase - if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 7eb6: 80 e0 ldi r24, 0x00 ; 0 - 7eb8: c8 16 cp r12, r24 - 7eba: 80 e7 ldi r24, 0x70 ; 112 - 7ebc: d8 06 cpc r13, r24 - 7ebe: 20 f4 brcc .+8 ; 0x7ec8 - 7ec0: 83 e0 ldi r24, 0x03 ; 3 - 7ec2: f6 01 movw r30, r12 - 7ec4: 87 bf out 0x37, r24 ; 55 - 7ec6: e8 95 spm - 7ec8: c0 e0 ldi r28, 0x00 ; 0 - 7eca: d1 e0 ldi r29, 0x01 ; 1 - - // While that is going on, read in page contents - bufPtr = buff; - do *bufPtr++ = getch(); - 7ecc: 63 d0 rcall .+198 ; 0x7f94 - 7ece: 89 93 st Y+, r24 - while (--length); - 7ed0: 0c 17 cp r16, r28 - 7ed2: e1 f7 brne .-8 ; 0x7ecc - - // If we are in NRWW section, page erase has to be delayed until now. - // Todo: Take RAMPZ into account - if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 7ed4: f0 e0 ldi r31, 0x00 ; 0 - 7ed6: cf 16 cp r12, r31 - 7ed8: f0 e7 ldi r31, 0x70 ; 112 - 7eda: df 06 cpc r13, r31 - 7edc: 20 f0 brcs .+8 ; 0x7ee6 - 7ede: 83 e0 ldi r24, 0x03 ; 3 - 7ee0: f6 01 movw r30, r12 - 7ee2: 87 bf out 0x37, r24 ; 55 - 7ee4: e8 95 spm - - // Read command terminator, start reply - verifySpace(); - 7ee6: 68 d0 rcall .+208 ; 0x7fb8 - - // If only a partial page is to be programmed, the erase might not be complete. - // So check that here - boot_spm_busy_wait(); - 7ee8: 07 b6 in r0, 0x37 ; 55 - 7eea: 00 fc sbrc r0, 0 - 7eec: fd cf rjmp .-6 ; 0x7ee8 - 7eee: a6 01 movw r20, r12 - 7ef0: a0 e0 ldi r26, 0x00 ; 0 - 7ef2: b1 e0 ldi r27, 0x01 ; 1 - bufPtr = buff; - addrPtr = (uint16_t)(void*)address; - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - 7ef4: 2c 91 ld r18, X - 7ef6: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 7ef8: 11 96 adiw r26, 0x01 ; 1 - 7efa: 8c 91 ld r24, X - 7efc: 11 97 sbiw r26, 0x01 ; 1 - 7efe: 90 e0 ldi r25, 0x00 ; 0 - 7f00: 98 2f mov r25, r24 - 7f02: 88 27 eor r24, r24 - 7f04: 82 2b or r24, r18 - 7f06: 93 2b or r25, r19 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 7f08: 12 96 adiw r26, 0x02 ; 2 - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 7f0a: fa 01 movw r30, r20 - 7f0c: 0c 01 movw r0, r24 - 7f0e: 97 be out 0x37, r9 ; 55 - 7f10: e8 95 spm - 7f12: 11 24 eor r1, r1 - addrPtr += 2; - 7f14: 4e 5f subi r20, 0xFE ; 254 - 7f16: 5f 4f sbci r21, 0xFF ; 255 - } while (--ch); - 7f18: f1 e0 ldi r31, 0x01 ; 1 - 7f1a: a0 38 cpi r26, 0x80 ; 128 - 7f1c: bf 07 cpc r27, r31 - 7f1e: 51 f7 brne .-44 ; 0x7ef4 - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 7f20: f6 01 movw r30, r12 - 7f22: a7 be out 0x37, r10 ; 55 - 7f24: e8 95 spm - boot_spm_busy_wait(); - 7f26: 07 b6 in r0, 0x37 ; 55 - 7f28: 00 fc sbrc r0, 0 - 7f2a: fd cf rjmp .-6 ; 0x7f26 - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 7f2c: b7 be out 0x37, r11 ; 55 - 7f2e: e8 95 spm - 7f30: 26 c0 rjmp .+76 ; 0x7f7e -#endif - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 7f32: 84 37 cpi r24, 0x74 ; 116 - 7f34: b1 f4 brne .+44 ; 0x7f62 - // READ PAGE - we only read flash - getch(); /* getlen() */ - 7f36: 2e d0 rcall .+92 ; 0x7f94 - length = getch(); - 7f38: 2d d0 rcall .+90 ; 0x7f94 - 7f3a: f8 2e mov r15, r24 - getch(); - 7f3c: 2b d0 rcall .+86 ; 0x7f94 - - verifySpace(); - 7f3e: 3c d0 rcall .+120 ; 0x7fb8 - 7f40: f6 01 movw r30, r12 - 7f42: ef 2c mov r14, r15 - putch(result); - address++; - } - while (--length); -#else - do putch(pgm_read_byte_near(address++)); - 7f44: 8f 01 movw r16, r30 - 7f46: 0f 5f subi r16, 0xFF ; 255 - 7f48: 1f 4f sbci r17, 0xFF ; 255 - 7f4a: 84 91 lpm r24, Z+ - 7f4c: 1b d0 rcall .+54 ; 0x7f84 - while (--length); - 7f4e: ea 94 dec r14 - 7f50: f8 01 movw r30, r16 - 7f52: c1 f7 brne .-16 ; 0x7f44 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 7f54: 08 94 sec - 7f56: c1 1c adc r12, r1 - 7f58: d1 1c adc r13, r1 - 7f5a: fa 94 dec r15 - 7f5c: cf 0c add r12, r15 - 7f5e: d1 1c adc r13, r1 - 7f60: 0e c0 rjmp .+28 ; 0x7f7e -#endif -#endif - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 7f62: 85 37 cpi r24, 0x75 ; 117 - 7f64: 39 f4 brne .+14 ; 0x7f74 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 7f66: 28 d0 rcall .+80 ; 0x7fb8 - putch(SIGNATURE_0); - 7f68: 8e e1 ldi r24, 0x1E ; 30 - 7f6a: 0c d0 rcall .+24 ; 0x7f84 - putch(SIGNATURE_1); - 7f6c: 85 e9 ldi r24, 0x95 ; 149 - 7f6e: 0a d0 rcall .+20 ; 0x7f84 - putch(SIGNATURE_2); - 7f70: 8f e0 ldi r24, 0x0F ; 15 - 7f72: 98 cf rjmp .-208 ; 0x7ea4 - } - else if (ch == 'Q') { - 7f74: 81 35 cpi r24, 0x51 ; 81 - 7f76: 11 f4 brne .+4 ; 0x7f7c - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 7f78: 88 e0 ldi r24, 0x08 ; 8 - 7f7a: 18 d0 rcall .+48 ; 0x7fac - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 7f7c: 1d d0 rcall .+58 ; 0x7fb8 - } - putch(STK_OK); - 7f7e: 80 e1 ldi r24, 0x10 ; 16 - 7f80: 01 d0 rcall .+2 ; 0x7f84 - 7f82: 6a cf rjmp .-300 ; 0x7e58 - -00007f84 : - } -} - -void putch(char ch) { - 7f84: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UCSR0A & _BV(UDRE0))); - 7f86: 80 91 c0 00 lds r24, 0x00C0 - 7f8a: 85 ff sbrs r24, 5 - 7f8c: fc cf rjmp .-8 ; 0x7f86 - UDR0 = ch; - 7f8e: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 7f92: 08 95 ret - -00007f94 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))) - 7f94: 80 91 c0 00 lds r24, 0x00C0 - 7f98: 87 ff sbrs r24, 7 - 7f9a: fc cf rjmp .-8 ; 0x7f94 - ; - if (!(UCSR0A & _BV(FE0))) { - 7f9c: 80 91 c0 00 lds r24, 0x00C0 - 7fa0: 84 fd sbrc r24, 4 - 7fa2: 01 c0 rjmp .+2 ; 0x7fa6 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 7fa4: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UDR0; - 7fa6: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 7faa: 08 95 ret - -00007fac : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 7fac: e0 e6 ldi r30, 0x60 ; 96 - 7fae: f0 e0 ldi r31, 0x00 ; 0 - 7fb0: 98 e1 ldi r25, 0x18 ; 24 - 7fb2: 90 83 st Z, r25 - WDTCSR = x; - 7fb4: 80 83 st Z, r24 -} - 7fb6: 08 95 ret - -00007fb8 : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 7fb8: ed df rcall .-38 ; 0x7f94 - 7fba: 80 32 cpi r24, 0x20 ; 32 - 7fbc: 19 f0 breq .+6 ; 0x7fc4 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 7fbe: 88 e0 ldi r24, 0x08 ; 8 - 7fc0: f5 df rcall .-22 ; 0x7fac - 7fc2: ff cf rjmp .-2 ; 0x7fc2 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 7fc4: 84 e1 ldi r24, 0x14 ; 20 -} - 7fc6: de cf rjmp .-68 ; 0x7f84 - -00007fc8 : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 7fc8: 1f 93 push r17 - 7fca: 18 2f mov r17, r24 - do getch(); while (--count); - 7fcc: e3 df rcall .-58 ; 0x7f94 - 7fce: 11 50 subi r17, 0x01 ; 1 - 7fd0: e9 f7 brne .-6 ; 0x7fcc - verifySpace(); - 7fd2: f2 df rcall .-28 ; 0x7fb8 -} - 7fd4: 1f 91 pop r17 - 7fd6: 08 95 ret - -00007fd8 : - WDTCSR = _BV(WDCE) | _BV(WDE); - WDTCSR = x; -} - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 7fd8: 80 e0 ldi r24, 0x00 ; 0 - 7fda: e8 df rcall .-48 ; 0x7fac - __asm__ __volatile__ ( - 7fdc: ee 27 eor r30, r30 - 7fde: ff 27 eor r31, r31 - 7fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_diecimila.hex b/bootloaders/optiboot/optiboot_diecimila.hex deleted file mode 100644 index b685a4e..0000000 --- a/bootloaders/optiboot/optiboot_diecimila.hex +++ /dev/null @@ -1,34 +0,0 @@ -:103E0000112484B714BE81FFE7D085E08093810040 -:103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20080E18093C4008EE0C0D0259A86E075 -:103E300020E33CEF91E0309385002093840096BB13 -:103E4000B09BFECF1D9AA8958150A9F79924939411 -:103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE -:103E6000B3D083E01FC0823411F484E103C08534F1 -:103E700019F485E0A9D083C0853579F48BD0E82E7C -:103E8000FF2488D0082F10E0102F00270E291F29AB -:103E9000000F111F91D0680172C0863529F484E0AB -:103EA00093D080E06FD06BC0843609F042C072D0EE -:103EB00071D0082F6FD080E0C81688E3D80620F4B0 -:103EC00083E0F60187BFE895C0E0D1E063D0899335 -:103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF -:103EE000F60187BFE89568D007B600FCFDCFA601B4 -:103EF000A0E0B1E02C9130E011968C91119790E008 -:103F0000982F8827822B932B1296FA010C0197BECB -:103F1000E89511244E5F5F4FF1E0A038BF0751F7DD -:103F2000F601A7BEE89507B600FCFDCFB7BEE89541 -:103F300026C08437B1F42ED02DD0F82E2BD03CD013 -:103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 -:103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 -:103F60000EC0853739F428D08EE10CD084E90AD010 -:103F700086E098CF813511F488E018D01DD080E11B -:103F800001D06ACF982F8091C00085FFFCCF90931D -:103F9000C60008958091C00087FFFCCF8091C000CB -:103FA00084FD01C0A8958091C6000895E0E6F0E088 -:103FB00098E1908380830895EDDF803219F088E0E6 -:103FC000F5DFFFCF84E1DECF1F93182FE3DF115021 -:103FD000E9F7F2DF1F91089580E0E8DFEE27FF2781 -:023FE000099442 -:023FFE000304BA -:0400000300003E00BB -:00000001FF diff --git a/bootloaders/optiboot/optiboot_diecimila.lst b/bootloaders/optiboot/optiboot_diecimila.lst deleted file mode 100644 index 357dc11..0000000 --- a/bootloaders/optiboot/optiboot_diecimila.lst +++ /dev/null @@ -1,571 +0,0 @@ - -optiboot_diecimila.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001e2 00003e00 00003e00 00000054 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 00000236 2**0 - CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00003e00
: -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3e00: 11 24 eor r1, r1 -#ifdef __AVR_ATmega8__ - SP=RAMEND; // This is done by hardware reset -#endif - - // Adaboot no-wait mod - ch = MCUSR; - 3e02: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 3e04: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 3e06: 81 ff sbrs r24, 1 - 3e08: e7 d0 rcall .+462 ; 0x3fd8 - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 3e0a: 85 e0 ldi r24, 0x05 ; 5 - 3e0c: 80 93 81 00 sts 0x0081, r24 - UCSRA = _BV(U2X); //Double speed mode USART - UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx - UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 - UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); -#else - UCSR0A = _BV(U2X0); //Double speed mode USART0 - 3e10: 82 e0 ldi r24, 0x02 ; 2 - 3e12: 80 93 c0 00 sts 0x00C0, r24 - UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 3e16: 88 e1 ldi r24, 0x18 ; 24 - 3e18: 80 93 c1 00 sts 0x00C1, r24 - UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 3e1c: 86 e0 ldi r24, 0x06 ; 6 - 3e1e: 80 93 c2 00 sts 0x00C2, r24 - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e22: 80 e1 ldi r24, 0x10 ; 16 - 3e24: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: c0 d0 rcall .+384 ; 0x3fac - - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 3e2c: 25 9a sbi 0x04, 5 ; 4 - 3e2e: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e30: 20 e3 ldi r18, 0x30 ; 48 - 3e32: 3c ef ldi r19, 0xFC ; 252 - TIFR1 = _BV(TOV1); - 3e34: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e36: 30 93 85 00 sts 0x0085, r19 - 3e3a: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 3e3e: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 3e40: b0 9b sbis 0x16, 0 ; 22 - 3e42: fe cf rjmp .-4 ; 0x3e40 -#ifdef __AVR_ATmega8__ - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 3e44: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3e46: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 3e48: 81 50 subi r24, 0x01 ; 1 - 3e4a: a9 f7 brne .-22 ; 0x3e36 - /* get character from UART */ - ch = getch(); - - if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e4c: 99 24 eor r9, r9 - 3e4e: 93 94 inc r9 - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - addrPtr += 2; - } while (--ch); - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3e50: a5 e0 ldi r26, 0x05 ; 5 - 3e52: aa 2e mov r10, r26 - boot_spm_busy_wait(); - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3e54: f1 e1 ldi r31, 0x11 ; 17 - 3e56: bf 2e mov r11, r31 -#endif - - /* Forever loop */ - for (;;) { - /* get character from UART */ - ch = getch(); - 3e58: 9d d0 rcall .+314 ; 0x3f94 - - if(ch == STK_GET_PARAMETER) { - 3e5a: 81 34 cpi r24, 0x41 ; 65 - 3e5c: 21 f4 brne .+8 ; 0x3e66 - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: b3 d0 rcall .+358 ; 0x3fc8 - putch(0x03); - 3e62: 83 e0 ldi r24, 0x03 ; 3 - 3e64: 1f c0 rjmp .+62 ; 0x3ea4 - } - else if(ch == STK_SET_DEVICE) { - 3e66: 82 34 cpi r24, 0x42 ; 66 - 3e68: 11 f4 brne .+4 ; 0x3e6e - // SET DEVICE is ignored - getNch(20); - 3e6a: 84 e1 ldi r24, 0x14 ; 20 - 3e6c: 03 c0 rjmp .+6 ; 0x3e74 - } - else if(ch == STK_SET_DEVICE_EXT) { - 3e6e: 85 34 cpi r24, 0x45 ; 69 - 3e70: 19 f4 brne .+6 ; 0x3e78 - // SET DEVICE EXT is ignored - getNch(5); - 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: a9 d0 rcall .+338 ; 0x3fc8 - 3e76: 83 c0 rjmp .+262 ; 0x3f7e - } - else if(ch == STK_LOAD_ADDRESS) { - 3e78: 85 35 cpi r24, 0x55 ; 85 - 3e7a: 79 f4 brne .+30 ; 0x3e9a - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 3e7c: 8b d0 rcall .+278 ; 0x3f94 - newAddress = (newAddress & 0xff) | (getch() << 8); - 3e7e: e8 2e mov r14, r24 - 3e80: ff 24 eor r15, r15 - 3e82: 88 d0 rcall .+272 ; 0x3f94 - 3e84: 08 2f mov r16, r24 - 3e86: 10 e0 ldi r17, 0x00 ; 0 - 3e88: 10 2f mov r17, r16 - 3e8a: 00 27 eor r16, r16 - 3e8c: 0e 29 or r16, r14 - 3e8e: 1f 29 or r17, r15 -#ifdef RAMPZ - // Transfer top bit to RAMPZ - RAMPZ = (newAddress & 0x8000) ? 1 : 0; -#endif - newAddress += newAddress; // Convert from word address to byte address - 3e90: 00 0f add r16, r16 - 3e92: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 3e94: 91 d0 rcall .+290 ; 0x3fb8 - 3e96: 68 01 movw r12, r16 - 3e98: 72 c0 rjmp .+228 ; 0x3f7e - } - else if(ch == STK_UNIVERSAL) { - 3e9a: 86 35 cpi r24, 0x56 ; 86 - 3e9c: 29 f4 brne .+10 ; 0x3ea8 - // UNIVERSAL command is ignored - getNch(4); - 3e9e: 84 e0 ldi r24, 0x04 ; 4 - 3ea0: 93 d0 rcall .+294 ; 0x3fc8 - putch(0x00); - 3ea2: 80 e0 ldi r24, 0x00 ; 0 - 3ea4: 6f d0 rcall .+222 ; 0x3f84 - 3ea6: 6b c0 rjmp .+214 ; 0x3f7e - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 3ea8: 84 36 cpi r24, 0x64 ; 100 - 3eaa: 09 f0 breq .+2 ; 0x3eae - 3eac: 42 c0 rjmp .+132 ; 0x3f32 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t *bufPtr; - uint16_t addrPtr; - - getch(); /* getlen() */ - 3eae: 72 d0 rcall .+228 ; 0x3f94 - length = getch(); - 3eb0: 71 d0 rcall .+226 ; 0x3f94 - 3eb2: 08 2f mov r16, r24 - getch(); - 3eb4: 6f d0 rcall .+222 ; 0x3f94 - - // If we are in RWW section, immediately start page erase - if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3eb6: 80 e0 ldi r24, 0x00 ; 0 - 3eb8: c8 16 cp r12, r24 - 3eba: 88 e3 ldi r24, 0x38 ; 56 - 3ebc: d8 06 cpc r13, r24 - 3ebe: 20 f4 brcc .+8 ; 0x3ec8 - 3ec0: 83 e0 ldi r24, 0x03 ; 3 - 3ec2: f6 01 movw r30, r12 - 3ec4: 87 bf out 0x37, r24 ; 55 - 3ec6: e8 95 spm - 3ec8: c0 e0 ldi r28, 0x00 ; 0 - 3eca: d1 e0 ldi r29, 0x01 ; 1 - - // While that is going on, read in page contents - bufPtr = buff; - do *bufPtr++ = getch(); - 3ecc: 63 d0 rcall .+198 ; 0x3f94 - 3ece: 89 93 st Y+, r24 - while (--length); - 3ed0: 0c 17 cp r16, r28 - 3ed2: e1 f7 brne .-8 ; 0x3ecc - - // If we are in NRWW section, page erase has to be delayed until now. - // Todo: Take RAMPZ into account - if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3ed4: f0 e0 ldi r31, 0x00 ; 0 - 3ed6: cf 16 cp r12, r31 - 3ed8: f8 e3 ldi r31, 0x38 ; 56 - 3eda: df 06 cpc r13, r31 - 3edc: 20 f0 brcs .+8 ; 0x3ee6 - 3ede: 83 e0 ldi r24, 0x03 ; 3 - 3ee0: f6 01 movw r30, r12 - 3ee2: 87 bf out 0x37, r24 ; 55 - 3ee4: e8 95 spm - - // Read command terminator, start reply - verifySpace(); - 3ee6: 68 d0 rcall .+208 ; 0x3fb8 - - // If only a partial page is to be programmed, the erase might not be complete. - // So check that here - boot_spm_busy_wait(); - 3ee8: 07 b6 in r0, 0x37 ; 55 - 3eea: 00 fc sbrc r0, 0 - 3eec: fd cf rjmp .-6 ; 0x3ee8 - 3eee: a6 01 movw r20, r12 - 3ef0: a0 e0 ldi r26, 0x00 ; 0 - 3ef2: b1 e0 ldi r27, 0x01 ; 1 - bufPtr = buff; - addrPtr = (uint16_t)(void*)address; - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - 3ef4: 2c 91 ld r18, X - 3ef6: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 3ef8: 11 96 adiw r26, 0x01 ; 1 - 3efa: 8c 91 ld r24, X - 3efc: 11 97 sbiw r26, 0x01 ; 1 - 3efe: 90 e0 ldi r25, 0x00 ; 0 - 3f00: 98 2f mov r25, r24 - 3f02: 88 27 eor r24, r24 - 3f04: 82 2b or r24, r18 - 3f06: 93 2b or r25, r19 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f08: 12 96 adiw r26, 0x02 ; 2 - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f0a: fa 01 movw r30, r20 - 3f0c: 0c 01 movw r0, r24 - 3f0e: 97 be out 0x37, r9 ; 55 - 3f10: e8 95 spm - 3f12: 11 24 eor r1, r1 - addrPtr += 2; - 3f14: 4e 5f subi r20, 0xFE ; 254 - 3f16: 5f 4f sbci r21, 0xFF ; 255 - } while (--ch); - 3f18: f1 e0 ldi r31, 0x01 ; 1 - 3f1a: a0 38 cpi r26, 0x80 ; 128 - 3f1c: bf 07 cpc r27, r31 - 3f1e: 51 f7 brne .-44 ; 0x3ef4 - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3f20: f6 01 movw r30, r12 - 3f22: a7 be out 0x37, r10 ; 55 - 3f24: e8 95 spm - boot_spm_busy_wait(); - 3f26: 07 b6 in r0, 0x37 ; 55 - 3f28: 00 fc sbrc r0, 0 - 3f2a: fd cf rjmp .-6 ; 0x3f26 - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3f2c: b7 be out 0x37, r11 ; 55 - 3f2e: e8 95 spm - 3f30: 26 c0 rjmp .+76 ; 0x3f7e -#endif - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 3f32: 84 37 cpi r24, 0x74 ; 116 - 3f34: b1 f4 brne .+44 ; 0x3f62 - // READ PAGE - we only read flash - getch(); /* getlen() */ - 3f36: 2e d0 rcall .+92 ; 0x3f94 - length = getch(); - 3f38: 2d d0 rcall .+90 ; 0x3f94 - 3f3a: f8 2e mov r15, r24 - getch(); - 3f3c: 2b d0 rcall .+86 ; 0x3f94 - - verifySpace(); - 3f3e: 3c d0 rcall .+120 ; 0x3fb8 - 3f40: f6 01 movw r30, r12 - 3f42: ef 2c mov r14, r15 - putch(result); - address++; - } - while (--length); -#else - do putch(pgm_read_byte_near(address++)); - 3f44: 8f 01 movw r16, r30 - 3f46: 0f 5f subi r16, 0xFF ; 255 - 3f48: 1f 4f sbci r17, 0xFF ; 255 - 3f4a: 84 91 lpm r24, Z+ - 3f4c: 1b d0 rcall .+54 ; 0x3f84 - while (--length); - 3f4e: ea 94 dec r14 - 3f50: f8 01 movw r30, r16 - 3f52: c1 f7 brne .-16 ; 0x3f44 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f54: 08 94 sec - 3f56: c1 1c adc r12, r1 - 3f58: d1 1c adc r13, r1 - 3f5a: fa 94 dec r15 - 3f5c: cf 0c add r12, r15 - 3f5e: d1 1c adc r13, r1 - 3f60: 0e c0 rjmp .+28 ; 0x3f7e -#endif -#endif - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 3f62: 85 37 cpi r24, 0x75 ; 117 - 3f64: 39 f4 brne .+14 ; 0x3f74 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 3f66: 28 d0 rcall .+80 ; 0x3fb8 - putch(SIGNATURE_0); - 3f68: 8e e1 ldi r24, 0x1E ; 30 - 3f6a: 0c d0 rcall .+24 ; 0x3f84 - putch(SIGNATURE_1); - 3f6c: 84 e9 ldi r24, 0x94 ; 148 - 3f6e: 0a d0 rcall .+20 ; 0x3f84 - putch(SIGNATURE_2); - 3f70: 86 e0 ldi r24, 0x06 ; 6 - 3f72: 98 cf rjmp .-208 ; 0x3ea4 - } - else if (ch == 'Q') { - 3f74: 81 35 cpi r24, 0x51 ; 81 - 3f76: 11 f4 brne .+4 ; 0x3f7c - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 3f78: 88 e0 ldi r24, 0x08 ; 8 - 3f7a: 18 d0 rcall .+48 ; 0x3fac - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 3f7c: 1d d0 rcall .+58 ; 0x3fb8 - } - putch(STK_OK); - 3f7e: 80 e1 ldi r24, 0x10 ; 16 - 3f80: 01 d0 rcall .+2 ; 0x3f84 - 3f82: 6a cf rjmp .-300 ; 0x3e58 - -00003f84 : - } -} - -void putch(char ch) { - 3f84: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UCSR0A & _BV(UDRE0))); - 3f86: 80 91 c0 00 lds r24, 0x00C0 - 3f8a: 85 ff sbrs r24, 5 - 3f8c: fc cf rjmp .-8 ; 0x3f86 - UDR0 = ch; - 3f8e: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 3f92: 08 95 ret - -00003f94 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))) - 3f94: 80 91 c0 00 lds r24, 0x00C0 - 3f98: 87 ff sbrs r24, 7 - 3f9a: fc cf rjmp .-8 ; 0x3f94 - ; - if (!(UCSR0A & _BV(FE0))) { - 3f9c: 80 91 c0 00 lds r24, 0x00C0 - 3fa0: 84 fd sbrc r24, 4 - 3fa2: 01 c0 rjmp .+2 ; 0x3fa6 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3fa4: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UDR0; - 3fa6: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 3faa: 08 95 ret - -00003fac : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 3fac: e0 e6 ldi r30, 0x60 ; 96 - 3fae: f0 e0 ldi r31, 0x00 ; 0 - 3fb0: 98 e1 ldi r25, 0x18 ; 24 - 3fb2: 90 83 st Z, r25 - WDTCSR = x; - 3fb4: 80 83 st Z, r24 -} - 3fb6: 08 95 ret - -00003fb8 : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 3fb8: ed df rcall .-38 ; 0x3f94 - 3fba: 80 32 cpi r24, 0x20 ; 32 - 3fbc: 19 f0 breq .+6 ; 0x3fc4 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fbe: 88 e0 ldi r24, 0x08 ; 8 - 3fc0: f5 df rcall .-22 ; 0x3fac - 3fc2: ff cf rjmp .-2 ; 0x3fc2 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 3fc4: 84 e1 ldi r24, 0x14 ; 20 -} - 3fc6: de cf rjmp .-68 ; 0x3f84 - -00003fc8 : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 3fc8: 1f 93 push r17 - 3fca: 18 2f mov r17, r24 - do getch(); while (--count); - 3fcc: e3 df rcall .-58 ; 0x3f94 - 3fce: 11 50 subi r17, 0x01 ; 1 - 3fd0: e9 f7 brne .-6 ; 0x3fcc - verifySpace(); - 3fd2: f2 df rcall .-28 ; 0x3fb8 -} - 3fd4: 1f 91 pop r17 - 3fd6: 08 95 ret - -00003fd8 : - WDTCSR = _BV(WDCE) | _BV(WDE); - WDTCSR = x; -} - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 3fd8: 80 e0 ldi r24, 0x00 ; 0 - 3fda: e8 df rcall .-48 ; 0x3fac - __asm__ __volatile__ ( - 3fdc: ee 27 eor r30, r30 - 3fde: ff 27 eor r31, r31 - 3fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_lilypad.hex b/bootloaders/optiboot/optiboot_lilypad.hex deleted file mode 100644 index 2c63395..0000000 --- a/bootloaders/optiboot/optiboot_lilypad.hex +++ /dev/null @@ -1,34 +0,0 @@ -:103E0000112484B714BE81FFE7D085E08093810040 -:103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20088E08093C4008EE0C0D0259A86E06E -:103E300028E13EEF91E0309385002093840096BB0B -:103E4000B09BFECF1D9AA8958150A9F79924939411 -:103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE -:103E6000B3D083E01FC0823411F484E103C08534F1 -:103E700019F485E0A9D083C0853579F48BD0E82E7C -:103E8000FF2488D0082F10E0102F00270E291F29AB -:103E9000000F111F91D0680172C0863529F484E0AB -:103EA00093D080E06FD06BC0843609F042C072D0EE -:103EB00071D0082F6FD080E0C81688E3D80620F4B0 -:103EC00083E0F60187BFE895C0E0D1E063D0899335 -:103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF -:103EE000F60187BFE89568D007B600FCFDCFA601B4 -:103EF000A0E0B1E02C9130E011968C91119790E008 -:103F0000982F8827822B932B1296FA010C0197BECB -:103F1000E89511244E5F5F4FF1E0A038BF0751F7DD -:103F2000F601A7BEE89507B600FCFDCFB7BEE89541 -:103F300026C08437B1F42ED02DD0F82E2BD03CD013 -:103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 -:103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 -:103F60000EC0853739F428D08EE10CD084E90AD010 -:103F700086E098CF813511F488E018D01DD080E11B -:103F800001D06ACF982F8091C00085FFFCCF90931D -:103F9000C60008958091C00087FFFCCF8091C000CB -:103FA00084FD01C0A8958091C6000895E0E6F0E088 -:103FB00098E1908380830895EDDF803219F088E0E6 -:103FC000F5DFFFCF84E1DECF1F93182FE3DF115021 -:103FD000E9F7F2DF1F91089580E0E8DFEE27FF2781 -:023FE000099442 -:023FFE000304BA -:0400000300003E00BB -:00000001FF diff --git a/bootloaders/optiboot/optiboot_lilypad.lst b/bootloaders/optiboot/optiboot_lilypad.lst deleted file mode 100644 index 425cbf4..0000000 --- a/bootloaders/optiboot/optiboot_lilypad.lst +++ /dev/null @@ -1,571 +0,0 @@ - -optiboot_lilypad.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001e2 00003e00 00003e00 00000054 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 00000236 2**0 - CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00003e00
: -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3e00: 11 24 eor r1, r1 -#ifdef __AVR_ATmega8__ - SP=RAMEND; // This is done by hardware reset -#endif - - // Adaboot no-wait mod - ch = MCUSR; - 3e02: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 3e04: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 3e06: 81 ff sbrs r24, 1 - 3e08: e7 d0 rcall .+462 ; 0x3fd8 - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 3e0a: 85 e0 ldi r24, 0x05 ; 5 - 3e0c: 80 93 81 00 sts 0x0081, r24 - UCSRA = _BV(U2X); //Double speed mode USART - UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx - UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 - UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); -#else - UCSR0A = _BV(U2X0); //Double speed mode USART0 - 3e10: 82 e0 ldi r24, 0x02 ; 2 - 3e12: 80 93 c0 00 sts 0x00C0, r24 - UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 3e16: 88 e1 ldi r24, 0x18 ; 24 - 3e18: 80 93 c1 00 sts 0x00C1, r24 - UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 3e1c: 86 e0 ldi r24, 0x06 ; 6 - 3e1e: 80 93 c2 00 sts 0x00C2, r24 - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e22: 88 e0 ldi r24, 0x08 ; 8 - 3e24: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: c0 d0 rcall .+384 ; 0x3fac - - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 3e2c: 25 9a sbi 0x04, 5 ; 4 - 3e2e: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e30: 28 e1 ldi r18, 0x18 ; 24 - 3e32: 3e ef ldi r19, 0xFE ; 254 - TIFR1 = _BV(TOV1); - 3e34: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e36: 30 93 85 00 sts 0x0085, r19 - 3e3a: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 3e3e: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 3e40: b0 9b sbis 0x16, 0 ; 22 - 3e42: fe cf rjmp .-4 ; 0x3e40 -#ifdef __AVR_ATmega8__ - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 3e44: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3e46: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 3e48: 81 50 subi r24, 0x01 ; 1 - 3e4a: a9 f7 brne .-22 ; 0x3e36 - /* get character from UART */ - ch = getch(); - - if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e4c: 99 24 eor r9, r9 - 3e4e: 93 94 inc r9 - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - addrPtr += 2; - } while (--ch); - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3e50: a5 e0 ldi r26, 0x05 ; 5 - 3e52: aa 2e mov r10, r26 - boot_spm_busy_wait(); - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3e54: f1 e1 ldi r31, 0x11 ; 17 - 3e56: bf 2e mov r11, r31 -#endif - - /* Forever loop */ - for (;;) { - /* get character from UART */ - ch = getch(); - 3e58: 9d d0 rcall .+314 ; 0x3f94 - - if(ch == STK_GET_PARAMETER) { - 3e5a: 81 34 cpi r24, 0x41 ; 65 - 3e5c: 21 f4 brne .+8 ; 0x3e66 - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: b3 d0 rcall .+358 ; 0x3fc8 - putch(0x03); - 3e62: 83 e0 ldi r24, 0x03 ; 3 - 3e64: 1f c0 rjmp .+62 ; 0x3ea4 - } - else if(ch == STK_SET_DEVICE) { - 3e66: 82 34 cpi r24, 0x42 ; 66 - 3e68: 11 f4 brne .+4 ; 0x3e6e - // SET DEVICE is ignored - getNch(20); - 3e6a: 84 e1 ldi r24, 0x14 ; 20 - 3e6c: 03 c0 rjmp .+6 ; 0x3e74 - } - else if(ch == STK_SET_DEVICE_EXT) { - 3e6e: 85 34 cpi r24, 0x45 ; 69 - 3e70: 19 f4 brne .+6 ; 0x3e78 - // SET DEVICE EXT is ignored - getNch(5); - 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: a9 d0 rcall .+338 ; 0x3fc8 - 3e76: 83 c0 rjmp .+262 ; 0x3f7e - } - else if(ch == STK_LOAD_ADDRESS) { - 3e78: 85 35 cpi r24, 0x55 ; 85 - 3e7a: 79 f4 brne .+30 ; 0x3e9a - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 3e7c: 8b d0 rcall .+278 ; 0x3f94 - newAddress = (newAddress & 0xff) | (getch() << 8); - 3e7e: e8 2e mov r14, r24 - 3e80: ff 24 eor r15, r15 - 3e82: 88 d0 rcall .+272 ; 0x3f94 - 3e84: 08 2f mov r16, r24 - 3e86: 10 e0 ldi r17, 0x00 ; 0 - 3e88: 10 2f mov r17, r16 - 3e8a: 00 27 eor r16, r16 - 3e8c: 0e 29 or r16, r14 - 3e8e: 1f 29 or r17, r15 -#ifdef RAMPZ - // Transfer top bit to RAMPZ - RAMPZ = (newAddress & 0x8000) ? 1 : 0; -#endif - newAddress += newAddress; // Convert from word address to byte address - 3e90: 00 0f add r16, r16 - 3e92: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 3e94: 91 d0 rcall .+290 ; 0x3fb8 - 3e96: 68 01 movw r12, r16 - 3e98: 72 c0 rjmp .+228 ; 0x3f7e - } - else if(ch == STK_UNIVERSAL) { - 3e9a: 86 35 cpi r24, 0x56 ; 86 - 3e9c: 29 f4 brne .+10 ; 0x3ea8 - // UNIVERSAL command is ignored - getNch(4); - 3e9e: 84 e0 ldi r24, 0x04 ; 4 - 3ea0: 93 d0 rcall .+294 ; 0x3fc8 - putch(0x00); - 3ea2: 80 e0 ldi r24, 0x00 ; 0 - 3ea4: 6f d0 rcall .+222 ; 0x3f84 - 3ea6: 6b c0 rjmp .+214 ; 0x3f7e - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 3ea8: 84 36 cpi r24, 0x64 ; 100 - 3eaa: 09 f0 breq .+2 ; 0x3eae - 3eac: 42 c0 rjmp .+132 ; 0x3f32 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t *bufPtr; - uint16_t addrPtr; - - getch(); /* getlen() */ - 3eae: 72 d0 rcall .+228 ; 0x3f94 - length = getch(); - 3eb0: 71 d0 rcall .+226 ; 0x3f94 - 3eb2: 08 2f mov r16, r24 - getch(); - 3eb4: 6f d0 rcall .+222 ; 0x3f94 - - // If we are in RWW section, immediately start page erase - if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3eb6: 80 e0 ldi r24, 0x00 ; 0 - 3eb8: c8 16 cp r12, r24 - 3eba: 88 e3 ldi r24, 0x38 ; 56 - 3ebc: d8 06 cpc r13, r24 - 3ebe: 20 f4 brcc .+8 ; 0x3ec8 - 3ec0: 83 e0 ldi r24, 0x03 ; 3 - 3ec2: f6 01 movw r30, r12 - 3ec4: 87 bf out 0x37, r24 ; 55 - 3ec6: e8 95 spm - 3ec8: c0 e0 ldi r28, 0x00 ; 0 - 3eca: d1 e0 ldi r29, 0x01 ; 1 - - // While that is going on, read in page contents - bufPtr = buff; - do *bufPtr++ = getch(); - 3ecc: 63 d0 rcall .+198 ; 0x3f94 - 3ece: 89 93 st Y+, r24 - while (--length); - 3ed0: 0c 17 cp r16, r28 - 3ed2: e1 f7 brne .-8 ; 0x3ecc - - // If we are in NRWW section, page erase has to be delayed until now. - // Todo: Take RAMPZ into account - if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3ed4: f0 e0 ldi r31, 0x00 ; 0 - 3ed6: cf 16 cp r12, r31 - 3ed8: f8 e3 ldi r31, 0x38 ; 56 - 3eda: df 06 cpc r13, r31 - 3edc: 20 f0 brcs .+8 ; 0x3ee6 - 3ede: 83 e0 ldi r24, 0x03 ; 3 - 3ee0: f6 01 movw r30, r12 - 3ee2: 87 bf out 0x37, r24 ; 55 - 3ee4: e8 95 spm - - // Read command terminator, start reply - verifySpace(); - 3ee6: 68 d0 rcall .+208 ; 0x3fb8 - - // If only a partial page is to be programmed, the erase might not be complete. - // So check that here - boot_spm_busy_wait(); - 3ee8: 07 b6 in r0, 0x37 ; 55 - 3eea: 00 fc sbrc r0, 0 - 3eec: fd cf rjmp .-6 ; 0x3ee8 - 3eee: a6 01 movw r20, r12 - 3ef0: a0 e0 ldi r26, 0x00 ; 0 - 3ef2: b1 e0 ldi r27, 0x01 ; 1 - bufPtr = buff; - addrPtr = (uint16_t)(void*)address; - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - 3ef4: 2c 91 ld r18, X - 3ef6: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 3ef8: 11 96 adiw r26, 0x01 ; 1 - 3efa: 8c 91 ld r24, X - 3efc: 11 97 sbiw r26, 0x01 ; 1 - 3efe: 90 e0 ldi r25, 0x00 ; 0 - 3f00: 98 2f mov r25, r24 - 3f02: 88 27 eor r24, r24 - 3f04: 82 2b or r24, r18 - 3f06: 93 2b or r25, r19 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f08: 12 96 adiw r26, 0x02 ; 2 - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f0a: fa 01 movw r30, r20 - 3f0c: 0c 01 movw r0, r24 - 3f0e: 97 be out 0x37, r9 ; 55 - 3f10: e8 95 spm - 3f12: 11 24 eor r1, r1 - addrPtr += 2; - 3f14: 4e 5f subi r20, 0xFE ; 254 - 3f16: 5f 4f sbci r21, 0xFF ; 255 - } while (--ch); - 3f18: f1 e0 ldi r31, 0x01 ; 1 - 3f1a: a0 38 cpi r26, 0x80 ; 128 - 3f1c: bf 07 cpc r27, r31 - 3f1e: 51 f7 brne .-44 ; 0x3ef4 - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3f20: f6 01 movw r30, r12 - 3f22: a7 be out 0x37, r10 ; 55 - 3f24: e8 95 spm - boot_spm_busy_wait(); - 3f26: 07 b6 in r0, 0x37 ; 55 - 3f28: 00 fc sbrc r0, 0 - 3f2a: fd cf rjmp .-6 ; 0x3f26 - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3f2c: b7 be out 0x37, r11 ; 55 - 3f2e: e8 95 spm - 3f30: 26 c0 rjmp .+76 ; 0x3f7e -#endif - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 3f32: 84 37 cpi r24, 0x74 ; 116 - 3f34: b1 f4 brne .+44 ; 0x3f62 - // READ PAGE - we only read flash - getch(); /* getlen() */ - 3f36: 2e d0 rcall .+92 ; 0x3f94 - length = getch(); - 3f38: 2d d0 rcall .+90 ; 0x3f94 - 3f3a: f8 2e mov r15, r24 - getch(); - 3f3c: 2b d0 rcall .+86 ; 0x3f94 - - verifySpace(); - 3f3e: 3c d0 rcall .+120 ; 0x3fb8 - 3f40: f6 01 movw r30, r12 - 3f42: ef 2c mov r14, r15 - putch(result); - address++; - } - while (--length); -#else - do putch(pgm_read_byte_near(address++)); - 3f44: 8f 01 movw r16, r30 - 3f46: 0f 5f subi r16, 0xFF ; 255 - 3f48: 1f 4f sbci r17, 0xFF ; 255 - 3f4a: 84 91 lpm r24, Z+ - 3f4c: 1b d0 rcall .+54 ; 0x3f84 - while (--length); - 3f4e: ea 94 dec r14 - 3f50: f8 01 movw r30, r16 - 3f52: c1 f7 brne .-16 ; 0x3f44 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f54: 08 94 sec - 3f56: c1 1c adc r12, r1 - 3f58: d1 1c adc r13, r1 - 3f5a: fa 94 dec r15 - 3f5c: cf 0c add r12, r15 - 3f5e: d1 1c adc r13, r1 - 3f60: 0e c0 rjmp .+28 ; 0x3f7e -#endif -#endif - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 3f62: 85 37 cpi r24, 0x75 ; 117 - 3f64: 39 f4 brne .+14 ; 0x3f74 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 3f66: 28 d0 rcall .+80 ; 0x3fb8 - putch(SIGNATURE_0); - 3f68: 8e e1 ldi r24, 0x1E ; 30 - 3f6a: 0c d0 rcall .+24 ; 0x3f84 - putch(SIGNATURE_1); - 3f6c: 84 e9 ldi r24, 0x94 ; 148 - 3f6e: 0a d0 rcall .+20 ; 0x3f84 - putch(SIGNATURE_2); - 3f70: 86 e0 ldi r24, 0x06 ; 6 - 3f72: 98 cf rjmp .-208 ; 0x3ea4 - } - else if (ch == 'Q') { - 3f74: 81 35 cpi r24, 0x51 ; 81 - 3f76: 11 f4 brne .+4 ; 0x3f7c - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 3f78: 88 e0 ldi r24, 0x08 ; 8 - 3f7a: 18 d0 rcall .+48 ; 0x3fac - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 3f7c: 1d d0 rcall .+58 ; 0x3fb8 - } - putch(STK_OK); - 3f7e: 80 e1 ldi r24, 0x10 ; 16 - 3f80: 01 d0 rcall .+2 ; 0x3f84 - 3f82: 6a cf rjmp .-300 ; 0x3e58 - -00003f84 : - } -} - -void putch(char ch) { - 3f84: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UCSR0A & _BV(UDRE0))); - 3f86: 80 91 c0 00 lds r24, 0x00C0 - 3f8a: 85 ff sbrs r24, 5 - 3f8c: fc cf rjmp .-8 ; 0x3f86 - UDR0 = ch; - 3f8e: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 3f92: 08 95 ret - -00003f94 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))) - 3f94: 80 91 c0 00 lds r24, 0x00C0 - 3f98: 87 ff sbrs r24, 7 - 3f9a: fc cf rjmp .-8 ; 0x3f94 - ; - if (!(UCSR0A & _BV(FE0))) { - 3f9c: 80 91 c0 00 lds r24, 0x00C0 - 3fa0: 84 fd sbrc r24, 4 - 3fa2: 01 c0 rjmp .+2 ; 0x3fa6 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3fa4: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UDR0; - 3fa6: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 3faa: 08 95 ret - -00003fac : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 3fac: e0 e6 ldi r30, 0x60 ; 96 - 3fae: f0 e0 ldi r31, 0x00 ; 0 - 3fb0: 98 e1 ldi r25, 0x18 ; 24 - 3fb2: 90 83 st Z, r25 - WDTCSR = x; - 3fb4: 80 83 st Z, r24 -} - 3fb6: 08 95 ret - -00003fb8 : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 3fb8: ed df rcall .-38 ; 0x3f94 - 3fba: 80 32 cpi r24, 0x20 ; 32 - 3fbc: 19 f0 breq .+6 ; 0x3fc4 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fbe: 88 e0 ldi r24, 0x08 ; 8 - 3fc0: f5 df rcall .-22 ; 0x3fac - 3fc2: ff cf rjmp .-2 ; 0x3fc2 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 3fc4: 84 e1 ldi r24, 0x14 ; 20 -} - 3fc6: de cf rjmp .-68 ; 0x3f84 - -00003fc8 : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 3fc8: 1f 93 push r17 - 3fca: 18 2f mov r17, r24 - do getch(); while (--count); - 3fcc: e3 df rcall .-58 ; 0x3f94 - 3fce: 11 50 subi r17, 0x01 ; 1 - 3fd0: e9 f7 brne .-6 ; 0x3fcc - verifySpace(); - 3fd2: f2 df rcall .-28 ; 0x3fb8 -} - 3fd4: 1f 91 pop r17 - 3fd6: 08 95 ret - -00003fd8 : - WDTCSR = _BV(WDCE) | _BV(WDE); - WDTCSR = x; -} - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 3fd8: 80 e0 ldi r24, 0x00 ; 0 - 3fda: e8 df rcall .-48 ; 0x3fac - __asm__ __volatile__ ( - 3fdc: ee 27 eor r30, r30 - 3fde: ff 27 eor r31, r31 - 3fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_lilypad_resonator.hex b/bootloaders/optiboot/optiboot_lilypad_resonator.hex deleted file mode 100644 index 2c63395..0000000 --- a/bootloaders/optiboot/optiboot_lilypad_resonator.hex +++ /dev/null @@ -1,34 +0,0 @@ -:103E0000112484B714BE81FFE7D085E08093810040 -:103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20088E08093C4008EE0C0D0259A86E06E -:103E300028E13EEF91E0309385002093840096BB0B -:103E4000B09BFECF1D9AA8958150A9F79924939411 -:103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE -:103E6000B3D083E01FC0823411F484E103C08534F1 -:103E700019F485E0A9D083C0853579F48BD0E82E7C -:103E8000FF2488D0082F10E0102F00270E291F29AB -:103E9000000F111F91D0680172C0863529F484E0AB -:103EA00093D080E06FD06BC0843609F042C072D0EE -:103EB00071D0082F6FD080E0C81688E3D80620F4B0 -:103EC00083E0F60187BFE895C0E0D1E063D0899335 -:103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF -:103EE000F60187BFE89568D007B600FCFDCFA601B4 -:103EF000A0E0B1E02C9130E011968C91119790E008 -:103F0000982F8827822B932B1296FA010C0197BECB -:103F1000E89511244E5F5F4FF1E0A038BF0751F7DD -:103F2000F601A7BEE89507B600FCFDCFB7BEE89541 -:103F300026C08437B1F42ED02DD0F82E2BD03CD013 -:103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 -:103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 -:103F60000EC0853739F428D08EE10CD084E90AD010 -:103F700086E098CF813511F488E018D01DD080E11B -:103F800001D06ACF982F8091C00085FFFCCF90931D -:103F9000C60008958091C00087FFFCCF8091C000CB -:103FA00084FD01C0A8958091C6000895E0E6F0E088 -:103FB00098E1908380830895EDDF803219F088E0E6 -:103FC000F5DFFFCF84E1DECF1F93182FE3DF115021 -:103FD000E9F7F2DF1F91089580E0E8DFEE27FF2781 -:023FE000099442 -:023FFE000304BA -:0400000300003E00BB -:00000001FF diff --git a/bootloaders/optiboot/optiboot_lilypad_resonator.lst b/bootloaders/optiboot/optiboot_lilypad_resonator.lst deleted file mode 100644 index cb0ea83..0000000 --- a/bootloaders/optiboot/optiboot_lilypad_resonator.lst +++ /dev/null @@ -1,571 +0,0 @@ - -optiboot_lilypad_resonator.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001e2 00003e00 00003e00 00000054 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 00000236 2**0 - CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00003e00
: -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3e00: 11 24 eor r1, r1 -#ifdef __AVR_ATmega8__ - SP=RAMEND; // This is done by hardware reset -#endif - - // Adaboot no-wait mod - ch = MCUSR; - 3e02: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 3e04: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 3e06: 81 ff sbrs r24, 1 - 3e08: e7 d0 rcall .+462 ; 0x3fd8 - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 3e0a: 85 e0 ldi r24, 0x05 ; 5 - 3e0c: 80 93 81 00 sts 0x0081, r24 - UCSRA = _BV(U2X); //Double speed mode USART - UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx - UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 - UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); -#else - UCSR0A = _BV(U2X0); //Double speed mode USART0 - 3e10: 82 e0 ldi r24, 0x02 ; 2 - 3e12: 80 93 c0 00 sts 0x00C0, r24 - UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 3e16: 88 e1 ldi r24, 0x18 ; 24 - 3e18: 80 93 c1 00 sts 0x00C1, r24 - UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 3e1c: 86 e0 ldi r24, 0x06 ; 6 - 3e1e: 80 93 c2 00 sts 0x00C2, r24 - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e22: 88 e0 ldi r24, 0x08 ; 8 - 3e24: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: c0 d0 rcall .+384 ; 0x3fac - - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 3e2c: 25 9a sbi 0x04, 5 ; 4 - 3e2e: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e30: 28 e1 ldi r18, 0x18 ; 24 - 3e32: 3e ef ldi r19, 0xFE ; 254 - TIFR1 = _BV(TOV1); - 3e34: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e36: 30 93 85 00 sts 0x0085, r19 - 3e3a: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 3e3e: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 3e40: b0 9b sbis 0x16, 0 ; 22 - 3e42: fe cf rjmp .-4 ; 0x3e40 -#ifdef __AVR_ATmega8__ - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 3e44: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3e46: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 3e48: 81 50 subi r24, 0x01 ; 1 - 3e4a: a9 f7 brne .-22 ; 0x3e36 - /* get character from UART */ - ch = getch(); - - if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e4c: 99 24 eor r9, r9 - 3e4e: 93 94 inc r9 - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - addrPtr += 2; - } while (--ch); - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3e50: a5 e0 ldi r26, 0x05 ; 5 - 3e52: aa 2e mov r10, r26 - boot_spm_busy_wait(); - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3e54: f1 e1 ldi r31, 0x11 ; 17 - 3e56: bf 2e mov r11, r31 -#endif - - /* Forever loop */ - for (;;) { - /* get character from UART */ - ch = getch(); - 3e58: 9d d0 rcall .+314 ; 0x3f94 - - if(ch == STK_GET_PARAMETER) { - 3e5a: 81 34 cpi r24, 0x41 ; 65 - 3e5c: 21 f4 brne .+8 ; 0x3e66 - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: b3 d0 rcall .+358 ; 0x3fc8 - putch(0x03); - 3e62: 83 e0 ldi r24, 0x03 ; 3 - 3e64: 1f c0 rjmp .+62 ; 0x3ea4 - } - else if(ch == STK_SET_DEVICE) { - 3e66: 82 34 cpi r24, 0x42 ; 66 - 3e68: 11 f4 brne .+4 ; 0x3e6e - // SET DEVICE is ignored - getNch(20); - 3e6a: 84 e1 ldi r24, 0x14 ; 20 - 3e6c: 03 c0 rjmp .+6 ; 0x3e74 - } - else if(ch == STK_SET_DEVICE_EXT) { - 3e6e: 85 34 cpi r24, 0x45 ; 69 - 3e70: 19 f4 brne .+6 ; 0x3e78 - // SET DEVICE EXT is ignored - getNch(5); - 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: a9 d0 rcall .+338 ; 0x3fc8 - 3e76: 83 c0 rjmp .+262 ; 0x3f7e - } - else if(ch == STK_LOAD_ADDRESS) { - 3e78: 85 35 cpi r24, 0x55 ; 85 - 3e7a: 79 f4 brne .+30 ; 0x3e9a - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 3e7c: 8b d0 rcall .+278 ; 0x3f94 - newAddress = (newAddress & 0xff) | (getch() << 8); - 3e7e: e8 2e mov r14, r24 - 3e80: ff 24 eor r15, r15 - 3e82: 88 d0 rcall .+272 ; 0x3f94 - 3e84: 08 2f mov r16, r24 - 3e86: 10 e0 ldi r17, 0x00 ; 0 - 3e88: 10 2f mov r17, r16 - 3e8a: 00 27 eor r16, r16 - 3e8c: 0e 29 or r16, r14 - 3e8e: 1f 29 or r17, r15 -#ifdef RAMPZ - // Transfer top bit to RAMPZ - RAMPZ = (newAddress & 0x8000) ? 1 : 0; -#endif - newAddress += newAddress; // Convert from word address to byte address - 3e90: 00 0f add r16, r16 - 3e92: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 3e94: 91 d0 rcall .+290 ; 0x3fb8 - 3e96: 68 01 movw r12, r16 - 3e98: 72 c0 rjmp .+228 ; 0x3f7e - } - else if(ch == STK_UNIVERSAL) { - 3e9a: 86 35 cpi r24, 0x56 ; 86 - 3e9c: 29 f4 brne .+10 ; 0x3ea8 - // UNIVERSAL command is ignored - getNch(4); - 3e9e: 84 e0 ldi r24, 0x04 ; 4 - 3ea0: 93 d0 rcall .+294 ; 0x3fc8 - putch(0x00); - 3ea2: 80 e0 ldi r24, 0x00 ; 0 - 3ea4: 6f d0 rcall .+222 ; 0x3f84 - 3ea6: 6b c0 rjmp .+214 ; 0x3f7e - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 3ea8: 84 36 cpi r24, 0x64 ; 100 - 3eaa: 09 f0 breq .+2 ; 0x3eae - 3eac: 42 c0 rjmp .+132 ; 0x3f32 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t *bufPtr; - uint16_t addrPtr; - - getch(); /* getlen() */ - 3eae: 72 d0 rcall .+228 ; 0x3f94 - length = getch(); - 3eb0: 71 d0 rcall .+226 ; 0x3f94 - 3eb2: 08 2f mov r16, r24 - getch(); - 3eb4: 6f d0 rcall .+222 ; 0x3f94 - - // If we are in RWW section, immediately start page erase - if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3eb6: 80 e0 ldi r24, 0x00 ; 0 - 3eb8: c8 16 cp r12, r24 - 3eba: 88 e3 ldi r24, 0x38 ; 56 - 3ebc: d8 06 cpc r13, r24 - 3ebe: 20 f4 brcc .+8 ; 0x3ec8 - 3ec0: 83 e0 ldi r24, 0x03 ; 3 - 3ec2: f6 01 movw r30, r12 - 3ec4: 87 bf out 0x37, r24 ; 55 - 3ec6: e8 95 spm - 3ec8: c0 e0 ldi r28, 0x00 ; 0 - 3eca: d1 e0 ldi r29, 0x01 ; 1 - - // While that is going on, read in page contents - bufPtr = buff; - do *bufPtr++ = getch(); - 3ecc: 63 d0 rcall .+198 ; 0x3f94 - 3ece: 89 93 st Y+, r24 - while (--length); - 3ed0: 0c 17 cp r16, r28 - 3ed2: e1 f7 brne .-8 ; 0x3ecc - - // If we are in NRWW section, page erase has to be delayed until now. - // Todo: Take RAMPZ into account - if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3ed4: f0 e0 ldi r31, 0x00 ; 0 - 3ed6: cf 16 cp r12, r31 - 3ed8: f8 e3 ldi r31, 0x38 ; 56 - 3eda: df 06 cpc r13, r31 - 3edc: 20 f0 brcs .+8 ; 0x3ee6 - 3ede: 83 e0 ldi r24, 0x03 ; 3 - 3ee0: f6 01 movw r30, r12 - 3ee2: 87 bf out 0x37, r24 ; 55 - 3ee4: e8 95 spm - - // Read command terminator, start reply - verifySpace(); - 3ee6: 68 d0 rcall .+208 ; 0x3fb8 - - // If only a partial page is to be programmed, the erase might not be complete. - // So check that here - boot_spm_busy_wait(); - 3ee8: 07 b6 in r0, 0x37 ; 55 - 3eea: 00 fc sbrc r0, 0 - 3eec: fd cf rjmp .-6 ; 0x3ee8 - 3eee: a6 01 movw r20, r12 - 3ef0: a0 e0 ldi r26, 0x00 ; 0 - 3ef2: b1 e0 ldi r27, 0x01 ; 1 - bufPtr = buff; - addrPtr = (uint16_t)(void*)address; - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - 3ef4: 2c 91 ld r18, X - 3ef6: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 3ef8: 11 96 adiw r26, 0x01 ; 1 - 3efa: 8c 91 ld r24, X - 3efc: 11 97 sbiw r26, 0x01 ; 1 - 3efe: 90 e0 ldi r25, 0x00 ; 0 - 3f00: 98 2f mov r25, r24 - 3f02: 88 27 eor r24, r24 - 3f04: 82 2b or r24, r18 - 3f06: 93 2b or r25, r19 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f08: 12 96 adiw r26, 0x02 ; 2 - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f0a: fa 01 movw r30, r20 - 3f0c: 0c 01 movw r0, r24 - 3f0e: 97 be out 0x37, r9 ; 55 - 3f10: e8 95 spm - 3f12: 11 24 eor r1, r1 - addrPtr += 2; - 3f14: 4e 5f subi r20, 0xFE ; 254 - 3f16: 5f 4f sbci r21, 0xFF ; 255 - } while (--ch); - 3f18: f1 e0 ldi r31, 0x01 ; 1 - 3f1a: a0 38 cpi r26, 0x80 ; 128 - 3f1c: bf 07 cpc r27, r31 - 3f1e: 51 f7 brne .-44 ; 0x3ef4 - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3f20: f6 01 movw r30, r12 - 3f22: a7 be out 0x37, r10 ; 55 - 3f24: e8 95 spm - boot_spm_busy_wait(); - 3f26: 07 b6 in r0, 0x37 ; 55 - 3f28: 00 fc sbrc r0, 0 - 3f2a: fd cf rjmp .-6 ; 0x3f26 - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3f2c: b7 be out 0x37, r11 ; 55 - 3f2e: e8 95 spm - 3f30: 26 c0 rjmp .+76 ; 0x3f7e -#endif - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 3f32: 84 37 cpi r24, 0x74 ; 116 - 3f34: b1 f4 brne .+44 ; 0x3f62 - // READ PAGE - we only read flash - getch(); /* getlen() */ - 3f36: 2e d0 rcall .+92 ; 0x3f94 - length = getch(); - 3f38: 2d d0 rcall .+90 ; 0x3f94 - 3f3a: f8 2e mov r15, r24 - getch(); - 3f3c: 2b d0 rcall .+86 ; 0x3f94 - - verifySpace(); - 3f3e: 3c d0 rcall .+120 ; 0x3fb8 - 3f40: f6 01 movw r30, r12 - 3f42: ef 2c mov r14, r15 - putch(result); - address++; - } - while (--length); -#else - do putch(pgm_read_byte_near(address++)); - 3f44: 8f 01 movw r16, r30 - 3f46: 0f 5f subi r16, 0xFF ; 255 - 3f48: 1f 4f sbci r17, 0xFF ; 255 - 3f4a: 84 91 lpm r24, Z+ - 3f4c: 1b d0 rcall .+54 ; 0x3f84 - while (--length); - 3f4e: ea 94 dec r14 - 3f50: f8 01 movw r30, r16 - 3f52: c1 f7 brne .-16 ; 0x3f44 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f54: 08 94 sec - 3f56: c1 1c adc r12, r1 - 3f58: d1 1c adc r13, r1 - 3f5a: fa 94 dec r15 - 3f5c: cf 0c add r12, r15 - 3f5e: d1 1c adc r13, r1 - 3f60: 0e c0 rjmp .+28 ; 0x3f7e -#endif -#endif - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 3f62: 85 37 cpi r24, 0x75 ; 117 - 3f64: 39 f4 brne .+14 ; 0x3f74 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 3f66: 28 d0 rcall .+80 ; 0x3fb8 - putch(SIGNATURE_0); - 3f68: 8e e1 ldi r24, 0x1E ; 30 - 3f6a: 0c d0 rcall .+24 ; 0x3f84 - putch(SIGNATURE_1); - 3f6c: 84 e9 ldi r24, 0x94 ; 148 - 3f6e: 0a d0 rcall .+20 ; 0x3f84 - putch(SIGNATURE_2); - 3f70: 86 e0 ldi r24, 0x06 ; 6 - 3f72: 98 cf rjmp .-208 ; 0x3ea4 - } - else if (ch == 'Q') { - 3f74: 81 35 cpi r24, 0x51 ; 81 - 3f76: 11 f4 brne .+4 ; 0x3f7c - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 3f78: 88 e0 ldi r24, 0x08 ; 8 - 3f7a: 18 d0 rcall .+48 ; 0x3fac - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 3f7c: 1d d0 rcall .+58 ; 0x3fb8 - } - putch(STK_OK); - 3f7e: 80 e1 ldi r24, 0x10 ; 16 - 3f80: 01 d0 rcall .+2 ; 0x3f84 - 3f82: 6a cf rjmp .-300 ; 0x3e58 - -00003f84 : - } -} - -void putch(char ch) { - 3f84: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UCSR0A & _BV(UDRE0))); - 3f86: 80 91 c0 00 lds r24, 0x00C0 - 3f8a: 85 ff sbrs r24, 5 - 3f8c: fc cf rjmp .-8 ; 0x3f86 - UDR0 = ch; - 3f8e: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 3f92: 08 95 ret - -00003f94 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))) - 3f94: 80 91 c0 00 lds r24, 0x00C0 - 3f98: 87 ff sbrs r24, 7 - 3f9a: fc cf rjmp .-8 ; 0x3f94 - ; - if (!(UCSR0A & _BV(FE0))) { - 3f9c: 80 91 c0 00 lds r24, 0x00C0 - 3fa0: 84 fd sbrc r24, 4 - 3fa2: 01 c0 rjmp .+2 ; 0x3fa6 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3fa4: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UDR0; - 3fa6: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 3faa: 08 95 ret - -00003fac : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 3fac: e0 e6 ldi r30, 0x60 ; 96 - 3fae: f0 e0 ldi r31, 0x00 ; 0 - 3fb0: 98 e1 ldi r25, 0x18 ; 24 - 3fb2: 90 83 st Z, r25 - WDTCSR = x; - 3fb4: 80 83 st Z, r24 -} - 3fb6: 08 95 ret - -00003fb8 : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 3fb8: ed df rcall .-38 ; 0x3f94 - 3fba: 80 32 cpi r24, 0x20 ; 32 - 3fbc: 19 f0 breq .+6 ; 0x3fc4 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fbe: 88 e0 ldi r24, 0x08 ; 8 - 3fc0: f5 df rcall .-22 ; 0x3fac - 3fc2: ff cf rjmp .-2 ; 0x3fc2 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 3fc4: 84 e1 ldi r24, 0x14 ; 20 -} - 3fc6: de cf rjmp .-68 ; 0x3f84 - -00003fc8 : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 3fc8: 1f 93 push r17 - 3fca: 18 2f mov r17, r24 - do getch(); while (--count); - 3fcc: e3 df rcall .-58 ; 0x3f94 - 3fce: 11 50 subi r17, 0x01 ; 1 - 3fd0: e9 f7 brne .-6 ; 0x3fcc - verifySpace(); - 3fd2: f2 df rcall .-28 ; 0x3fb8 -} - 3fd4: 1f 91 pop r17 - 3fd6: 08 95 ret - -00003fd8 : - WDTCSR = _BV(WDCE) | _BV(WDE); - WDTCSR = x; -} - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 3fd8: 80 e0 ldi r24, 0x00 ; 0 - 3fda: e8 df rcall .-48 ; 0x3fac - __asm__ __volatile__ ( - 3fdc: ee 27 eor r30, r30 - 3fde: ff 27 eor r31, r31 - 3fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_luminet.hex b/bootloaders/optiboot/optiboot_luminet.hex deleted file mode 100644 index 45b4dcd..0000000 --- a/bootloaders/optiboot/optiboot_luminet.hex +++ /dev/null @@ -1,40 +0,0 @@ -:101D0000112484B714BE81FF17D185E08EBD8EE00B -:101D1000FFD0D49AD29A86E023EC3FEF91E03DBD0C -:101D20002CBD9BB9589BFECFCC9AA8958150B9F792 -:101D3000BB24B39425E0A22E9FE7D92E8EECC82EAB -:101D4000D4D0813421F481E0EFD083E0B5C0823477 -:101D500011F484E103C0853419F485E0E5D0B3C003 -:101D6000853569F4C2D0E82EFF24BFD0082F10E0DB -:101D7000102F00270E291F29000F111FA3C0863521 -:101D800021F484E0D1D080E097C0843609F060C0AF -:101D9000ACD0ABD0F82EA9D0C0E0D1E0A6D08993CA -:101DA000FC16E1F783E0F80187BFE895B5D007B6E8 -:101DB00000FCFDCF0115110511F0A8012AC080918A -:101DC00000012091010130E0322F222790E0282BE2 -:101DD000392B309385012093840140910801809133 -:101DE000090190E0982F882750E0842B952B909341 -:101DF0008701809386012450304020930801232FCF -:101E0000332720930901D0920001C092010140E0E4 -:101E100050E0A0E0B1E02C9130E011968C91119748 -:101E200090E0982F8827822B932B1296FA010C01B1 -:101E3000B7BEE89511244E5F5F4FF1E0A034BF07B5 -:101E400051F7F801A7BEE89507B600FCFDCF3BC0EF -:101E5000843751F54AD049D0F82E47D05DD0E801FB -:101E6000EF2C209719F48091840114C0C130D10562 -:101E700019F4809185010EC0C830D10519F4809104 -:101E8000860108C0C930D10519F48091870102C0CC -:101E9000FE01849121961AD0EA9419F70F5F1F4F23 -:101EA000FA940F0D111D0FC0853741F435D08EE126 -:101EB0000DD083E90BD08CE009D005C0813511F439 -:101EC00088E026D029D080E101D03ACF2AE030E066 -:101ED0008095089410F4DA9802C0DA9A000014D0C1 -:101EE00013D086952A95B1F7089529E030E0CB9973 -:101EF000FECF0AD009D008D08894CB9908942A95AF -:101F000011F08795F7CF08959EE09A95F1F708951F -:101F100098E191BD81BD0895E8DF803219F088E035 -:101F2000F7DFFFCF84E1D2CF1F93182FDEDF1150F0 -:101F3000E9F7F2DF1F91089580E0EADFE4E0FF2790 -:021F4000099402 -:021EFE000304DB -:0400000300001D00DC -:00000001FF diff --git a/bootloaders/optiboot/optiboot_luminet.lst b/bootloaders/optiboot/optiboot_luminet.lst deleted file mode 100644 index e40e0ef..0000000 --- a/bootloaders/optiboot/optiboot_luminet.lst +++ /dev/null @@ -1,617 +0,0 @@ - -optiboot_luminet.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 00000242 00001d00 00001d00 00000054 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00001efe 00001efe 00000296 2**0 - CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000298 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000006d 00000000 00000000 000002c0 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 000002a2 00000000 00000000 0000032d 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000016f 00000000 00000000 000005cf 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000049d 00000000 00000000 0000073e 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000090 00000000 00000000 00000bdc 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000158 00000000 00000000 00000c6c 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 00000268 00000000 00000000 00000dc4 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000080 00000000 00000000 0000102c 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00001d00
: -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 1d00: 11 24 eor r1, r1 -#ifdef __AVR_ATmega8__ - SP=RAMEND; // This is done by hardware reset -#endif - - // Adaboot no-wait mod - ch = MCUSR; - 1d02: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 1d04: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 1d06: 81 ff sbrs r24, 1 - 1d08: 17 d1 rcall .+558 ; 0x1f38 - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 1d0a: 85 e0 ldi r24, 0x05 ; 5 - 1d0c: 8e bd out 0x2e, r24 ; 46 - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 1d0e: 8e e0 ldi r24, 0x0E ; 14 - 1d10: ff d0 rcall .+510 ; 0x1f10 - - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 1d12: d4 9a sbi 0x1a, 4 ; 26 - -#ifdef SOFT_UART - /* Set TX pin as output */ - UART_DDR |= _BV(UART_TX_BIT); - 1d14: d2 9a sbi 0x1a, 2 ; 26 - 1d16: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 1d18: 23 ec ldi r18, 0xC3 ; 195 - 1d1a: 3f ef ldi r19, 0xFF ; 255 - TIFR1 = _BV(TOV1); - 1d1c: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 1d1e: 3d bd out 0x2d, r19 ; 45 - 1d20: 2c bd out 0x2c, r18 ; 44 - TIFR1 = _BV(TOV1); - 1d22: 9b b9 out 0x0b, r25 ; 11 - while(!(TIFR1 & _BV(TOV1))); - 1d24: 58 9b sbis 0x0b, 0 ; 11 - 1d26: fe cf rjmp .-4 ; 0x1d24 -#ifdef __AVR_ATmega8__ - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 1d28: cc 9a sbi 0x19, 4 ; 25 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 1d2a: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 1d2c: 81 50 subi r24, 0x01 ; 1 - 1d2e: b9 f7 brne .-18 ; 0x1d1e - /* get character from UART */ - ch = getch(); - - if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 1d30: bb 24 eor r11, r11 - 1d32: b3 94 inc r11 - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - addrPtr += 2; - } while (--ch); - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 1d34: 25 e0 ldi r18, 0x05 ; 5 - 1d36: a2 2e mov r10, r18 - vect -= 4; // Instruction is a relative jump (rjmp), so recalculate. - buff[8] = vect & 0xff; - buff[9] = vect >> 8; - - // Add jump to bootloader at RESET vector - buff[0] = 0x7f; - 1d38: 9f e7 ldi r25, 0x7F ; 127 - 1d3a: d9 2e mov r13, r25 - buff[1] = 0xce; // rjmp 0x1d00 instruction - 1d3c: 8e ec ldi r24, 0xCE ; 206 - 1d3e: c8 2e mov r12, r24 -#endif - - /* Forever loop */ - for (;;) { - /* get character from UART */ - ch = getch(); - 1d40: d4 d0 rcall .+424 ; 0x1eea - - if(ch == STK_GET_PARAMETER) { - 1d42: 81 34 cpi r24, 0x41 ; 65 - 1d44: 21 f4 brne .+8 ; 0x1d4e - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 1d46: 81 e0 ldi r24, 0x01 ; 1 - 1d48: ef d0 rcall .+478 ; 0x1f28 - putch(0x03); - 1d4a: 83 e0 ldi r24, 0x03 ; 3 - 1d4c: b5 c0 rjmp .+362 ; 0x1eb8 - } - else if(ch == STK_SET_DEVICE) { - 1d4e: 82 34 cpi r24, 0x42 ; 66 - 1d50: 11 f4 brne .+4 ; 0x1d56 - // SET DEVICE is ignored - getNch(20); - 1d52: 84 e1 ldi r24, 0x14 ; 20 - 1d54: 03 c0 rjmp .+6 ; 0x1d5c - } - else if(ch == STK_SET_DEVICE_EXT) { - 1d56: 85 34 cpi r24, 0x45 ; 69 - 1d58: 19 f4 brne .+6 ; 0x1d60 - // SET DEVICE EXT is ignored - getNch(5); - 1d5a: 85 e0 ldi r24, 0x05 ; 5 - 1d5c: e5 d0 rcall .+458 ; 0x1f28 - 1d5e: b3 c0 rjmp .+358 ; 0x1ec6 - } - else if(ch == STK_LOAD_ADDRESS) { - 1d60: 85 35 cpi r24, 0x55 ; 85 - 1d62: 69 f4 brne .+26 ; 0x1d7e - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 1d64: c2 d0 rcall .+388 ; 0x1eea - newAddress = (newAddress & 0xff) | (getch() << 8); - 1d66: e8 2e mov r14, r24 - 1d68: ff 24 eor r15, r15 - 1d6a: bf d0 rcall .+382 ; 0x1eea - 1d6c: 08 2f mov r16, r24 - 1d6e: 10 e0 ldi r17, 0x00 ; 0 - 1d70: 10 2f mov r17, r16 - 1d72: 00 27 eor r16, r16 - 1d74: 0e 29 or r16, r14 - 1d76: 1f 29 or r17, r15 -#ifdef RAMPZ - // Transfer top bit to RAMPZ - RAMPZ = (newAddress & 0x8000) ? 1 : 0; -#endif - newAddress += newAddress; // Convert from word address to byte address - 1d78: 00 0f add r16, r16 - 1d7a: 11 1f adc r17, r17 - 1d7c: a3 c0 rjmp .+326 ; 0x1ec4 - address = newAddress; - verifySpace(); - } - else if(ch == STK_UNIVERSAL) { - 1d7e: 86 35 cpi r24, 0x56 ; 86 - 1d80: 21 f4 brne .+8 ; 0x1d8a - // UNIVERSAL command is ignored - getNch(4); - 1d82: 84 e0 ldi r24, 0x04 ; 4 - 1d84: d1 d0 rcall .+418 ; 0x1f28 - putch(0x00); - 1d86: 80 e0 ldi r24, 0x00 ; 0 - 1d88: 97 c0 rjmp .+302 ; 0x1eb8 - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 1d8a: 84 36 cpi r24, 0x64 ; 100 - 1d8c: 09 f0 breq .+2 ; 0x1d90 - 1d8e: 60 c0 rjmp .+192 ; 0x1e50 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t *bufPtr; - uint16_t addrPtr; - - getch(); /* getlen() */ - 1d90: ac d0 rcall .+344 ; 0x1eea - length = getch(); - 1d92: ab d0 rcall .+342 ; 0x1eea - 1d94: f8 2e mov r15, r24 - getch(); - 1d96: a9 d0 rcall .+338 ; 0x1eea - 1d98: c0 e0 ldi r28, 0x00 ; 0 - 1d9a: d1 e0 ldi r29, 0x01 ; 1 - // If we are in RWW section, immediately start page erase - if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - - // While that is going on, read in page contents - bufPtr = buff; - do *bufPtr++ = getch(); - 1d9c: a6 d0 rcall .+332 ; 0x1eea - 1d9e: 89 93 st Y+, r24 - while (--length); - 1da0: fc 16 cp r15, r28 - 1da2: e1 f7 brne .-8 ; 0x1d9c - - // If we are in NRWW section, page erase has to be delayed until now. - // Todo: Take RAMPZ into account - if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 1da4: 83 e0 ldi r24, 0x03 ; 3 - 1da6: f8 01 movw r30, r16 - 1da8: 87 bf out 0x37, r24 ; 55 - 1daa: e8 95 spm - - // Read command terminator, start reply - verifySpace(); - 1dac: b5 d0 rcall .+362 ; 0x1f18 - - // If only a partial page is to be programmed, the erase might not be complete. - // So check that here - boot_spm_busy_wait(); - 1dae: 07 b6 in r0, 0x37 ; 55 - 1db0: 00 fc sbrc r0, 0 - 1db2: fd cf rjmp .-6 ; 0x1dae - -#ifdef VIRTUAL_BOOT_PARTITION - if ((uint16_t)(void*)address == 0) { - 1db4: 01 15 cp r16, r1 - 1db6: 11 05 cpc r17, r1 - 1db8: 11 f0 breq .+4 ; 0x1dbe - 1dba: a8 01 movw r20, r16 - 1dbc: 2a c0 rjmp .+84 ; 0x1e12 - // This is the reset vector page. We need to live-patch the code so the - // bootloader runs. - // - // Move RESET vector to WDT vector - uint16_t vect = buff[0] | (buff[1]<<8); - 1dbe: 80 91 00 01 lds r24, 0x0100 - 1dc2: 20 91 01 01 lds r18, 0x0101 - 1dc6: 30 e0 ldi r19, 0x00 ; 0 - 1dc8: 32 2f mov r19, r18 - 1dca: 22 27 eor r18, r18 - 1dcc: 90 e0 ldi r25, 0x00 ; 0 - 1dce: 28 2b or r18, r24 - 1dd0: 39 2b or r19, r25 - rstVect = vect; - 1dd2: 30 93 85 01 sts 0x0185, r19 - 1dd6: 20 93 84 01 sts 0x0184, r18 - wdtVect = buff[8] | (buff[9]<<8); - 1dda: 40 91 08 01 lds r20, 0x0108 - 1dde: 80 91 09 01 lds r24, 0x0109 - 1de2: 90 e0 ldi r25, 0x00 ; 0 - 1de4: 98 2f mov r25, r24 - 1de6: 88 27 eor r24, r24 - 1de8: 50 e0 ldi r21, 0x00 ; 0 - 1dea: 84 2b or r24, r20 - 1dec: 95 2b or r25, r21 - 1dee: 90 93 87 01 sts 0x0187, r25 - 1df2: 80 93 86 01 sts 0x0186, r24 - vect -= 4; // Instruction is a relative jump (rjmp), so recalculate. - 1df6: 24 50 subi r18, 0x04 ; 4 - 1df8: 30 40 sbci r19, 0x00 ; 0 - buff[8] = vect & 0xff; - 1dfa: 20 93 08 01 sts 0x0108, r18 - buff[9] = vect >> 8; - 1dfe: 23 2f mov r18, r19 - 1e00: 33 27 eor r19, r19 - 1e02: 20 93 09 01 sts 0x0109, r18 - - // Add jump to bootloader at RESET vector - buff[0] = 0x7f; - 1e06: d0 92 00 01 sts 0x0100, r13 - buff[1] = 0xce; // rjmp 0x1d00 instruction - 1e0a: c0 92 01 01 sts 0x0101, r12 - 1e0e: 40 e0 ldi r20, 0x00 ; 0 - 1e10: 50 e0 ldi r21, 0x00 ; 0 - 1e12: a0 e0 ldi r26, 0x00 ; 0 - 1e14: b1 e0 ldi r27, 0x01 ; 1 - bufPtr = buff; - addrPtr = (uint16_t)(void*)address; - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - 1e16: 2c 91 ld r18, X - 1e18: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 1e1a: 11 96 adiw r26, 0x01 ; 1 - 1e1c: 8c 91 ld r24, X - 1e1e: 11 97 sbiw r26, 0x01 ; 1 - 1e20: 90 e0 ldi r25, 0x00 ; 0 - 1e22: 98 2f mov r25, r24 - 1e24: 88 27 eor r24, r24 - 1e26: 82 2b or r24, r18 - 1e28: 93 2b or r25, r19 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 1e2a: 12 96 adiw r26, 0x02 ; 2 - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 1e2c: fa 01 movw r30, r20 - 1e2e: 0c 01 movw r0, r24 - 1e30: b7 be out 0x37, r11 ; 55 - 1e32: e8 95 spm - 1e34: 11 24 eor r1, r1 - addrPtr += 2; - 1e36: 4e 5f subi r20, 0xFE ; 254 - 1e38: 5f 4f sbci r21, 0xFF ; 255 - } while (--ch); - 1e3a: f1 e0 ldi r31, 0x01 ; 1 - 1e3c: a0 34 cpi r26, 0x40 ; 64 - 1e3e: bf 07 cpc r27, r31 - 1e40: 51 f7 brne .-44 ; 0x1e16 - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 1e42: f8 01 movw r30, r16 - 1e44: a7 be out 0x37, r10 ; 55 - 1e46: e8 95 spm - boot_spm_busy_wait(); - 1e48: 07 b6 in r0, 0x37 ; 55 - 1e4a: 00 fc sbrc r0, 0 - 1e4c: fd cf rjmp .-6 ; 0x1e48 - 1e4e: 3b c0 rjmp .+118 ; 0x1ec6 - boot_rww_enable(); -#endif - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 1e50: 84 37 cpi r24, 0x74 ; 116 - 1e52: 51 f5 brne .+84 ; 0x1ea8 - // READ PAGE - we only read flash - getch(); /* getlen() */ - 1e54: 4a d0 rcall .+148 ; 0x1eea - length = getch(); - 1e56: 49 d0 rcall .+146 ; 0x1eea - 1e58: f8 2e mov r15, r24 - getch(); - 1e5a: 47 d0 rcall .+142 ; 0x1eea - - verifySpace(); - 1e5c: 5d d0 rcall .+186 ; 0x1f18 - 1e5e: e8 01 movw r28, r16 - 1e60: ef 2c mov r14, r15 -#ifdef VIRTUAL_BOOT_PARTITION - do { - // Undo vector patch in bottom page so verify passes - if (address == 0) ch=rstVect & 0xff; - 1e62: 20 97 sbiw r28, 0x00 ; 0 - 1e64: 19 f4 brne .+6 ; 0x1e6c - 1e66: 80 91 84 01 lds r24, 0x0184 - 1e6a: 14 c0 rjmp .+40 ; 0x1e94 - else if (address == 1) ch=rstVect >> 8; - 1e6c: c1 30 cpi r28, 0x01 ; 1 - 1e6e: d1 05 cpc r29, r1 - 1e70: 19 f4 brne .+6 ; 0x1e78 - 1e72: 80 91 85 01 lds r24, 0x0185 - 1e76: 0e c0 rjmp .+28 ; 0x1e94 - else if (address == 8) ch=wdtVect & 0xff; - 1e78: c8 30 cpi r28, 0x08 ; 8 - 1e7a: d1 05 cpc r29, r1 - 1e7c: 19 f4 brne .+6 ; 0x1e84 - 1e7e: 80 91 86 01 lds r24, 0x0186 - 1e82: 08 c0 rjmp .+16 ; 0x1e94 - else if (address == 9) ch=wdtVect >> 8; - 1e84: c9 30 cpi r28, 0x09 ; 9 - 1e86: d1 05 cpc r29, r1 - 1e88: 19 f4 brne .+6 ; 0x1e90 - 1e8a: 80 91 87 01 lds r24, 0x0187 - 1e8e: 02 c0 rjmp .+4 ; 0x1e94 - else ch = pgm_read_byte_near(address); - 1e90: fe 01 movw r30, r28 - 1e92: 84 91 lpm r24, Z+ - address++; - 1e94: 21 96 adiw r28, 0x01 ; 1 - putch(ch); - 1e96: 1a d0 rcall .+52 ; 0x1ecc - } while (--length); - 1e98: ea 94 dec r14 - 1e9a: 19 f7 brne .-58 ; 0x1e62 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 1e9c: 0f 5f subi r16, 0xFF ; 255 - 1e9e: 1f 4f sbci r17, 0xFF ; 255 - 1ea0: fa 94 dec r15 - 1ea2: 0f 0d add r16, r15 - 1ea4: 11 1d adc r17, r1 - 1ea6: 0f c0 rjmp .+30 ; 0x1ec6 -#endif -#endif - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 1ea8: 85 37 cpi r24, 0x75 ; 117 - 1eaa: 41 f4 brne .+16 ; 0x1ebc - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 1eac: 35 d0 rcall .+106 ; 0x1f18 - putch(SIGNATURE_0); - 1eae: 8e e1 ldi r24, 0x1E ; 30 - 1eb0: 0d d0 rcall .+26 ; 0x1ecc - putch(SIGNATURE_1); - 1eb2: 83 e9 ldi r24, 0x93 ; 147 - 1eb4: 0b d0 rcall .+22 ; 0x1ecc - putch(SIGNATURE_2); - 1eb6: 8c e0 ldi r24, 0x0C ; 12 - 1eb8: 09 d0 rcall .+18 ; 0x1ecc - 1eba: 05 c0 rjmp .+10 ; 0x1ec6 - } - else if (ch == 'Q') { - 1ebc: 81 35 cpi r24, 0x51 ; 81 - 1ebe: 11 f4 brne .+4 ; 0x1ec4 - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 1ec0: 88 e0 ldi r24, 0x08 ; 8 - 1ec2: 26 d0 rcall .+76 ; 0x1f10 - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 1ec4: 29 d0 rcall .+82 ; 0x1f18 - } - putch(STK_OK); - 1ec6: 80 e1 ldi r24, 0x10 ; 16 - 1ec8: 01 d0 rcall .+2 ; 0x1ecc - 1eca: 3a cf rjmp .-396 ; 0x1d40 - -00001ecc : -void putch(char ch) { -#ifndef SOFT_UART - while (!(UCSR0A & _BV(UDRE0))); - UDR0 = ch; -#else - __asm__ __volatile__ ( - 1ecc: 2a e0 ldi r18, 0x0A ; 10 - 1ece: 30 e0 ldi r19, 0x00 ; 0 - 1ed0: 80 95 com r24 - 1ed2: 08 94 sec - 1ed4: 10 f4 brcc .+4 ; 0x1eda - 1ed6: da 98 cbi 0x1b, 2 ; 27 - 1ed8: 02 c0 rjmp .+4 ; 0x1ede - 1eda: da 9a sbi 0x1b, 2 ; 27 - 1edc: 00 00 nop - 1ede: 14 d0 rcall .+40 ; 0x1f08 - 1ee0: 13 d0 rcall .+38 ; 0x1f08 - 1ee2: 86 95 lsr r24 - 1ee4: 2a 95 dec r18 - 1ee6: b1 f7 brne .-20 ; 0x1ed4 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 1ee8: 08 95 ret - -00001eea : - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 1eea: 29 e0 ldi r18, 0x09 ; 9 - 1eec: 30 e0 ldi r19, 0x00 ; 0 - 1eee: cb 99 sbic 0x19, 3 ; 25 - 1ef0: fe cf rjmp .-4 ; 0x1eee - 1ef2: 0a d0 rcall .+20 ; 0x1f08 - 1ef4: 09 d0 rcall .+18 ; 0x1f08 - 1ef6: 08 d0 rcall .+16 ; 0x1f08 - 1ef8: 88 94 clc - 1efa: cb 99 sbic 0x19, 3 ; 25 - 1efc: 08 94 sec - 1efe: 2a 95 dec r18 - 1f00: 11 f0 breq .+4 ; 0x1f06 - 1f02: 87 95 ror r24 - 1f04: f7 cf rjmp .-18 ; 0x1ef4 - 1f06: 08 95 ret - -00001f08 : -#if UART_B_VALUE > 255 -#error Baud rate too slow for soft UART -#endif - -void uartDelay() { - __asm__ __volatile__ ( - 1f08: 9e e0 ldi r25, 0x0E ; 14 - 1f0a: 9a 95 dec r25 - 1f0c: f1 f7 brne .-4 ; 0x1f0a - 1f0e: 08 95 ret - -00001f10 : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 1f10: 98 e1 ldi r25, 0x18 ; 24 - 1f12: 91 bd out 0x21, r25 ; 33 - WDTCSR = x; - 1f14: 81 bd out 0x21, r24 ; 33 -} - 1f16: 08 95 ret - -00001f18 : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 1f18: e8 df rcall .-48 ; 0x1eea - 1f1a: 80 32 cpi r24, 0x20 ; 32 - 1f1c: 19 f0 breq .+6 ; 0x1f24 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 1f1e: 88 e0 ldi r24, 0x08 ; 8 - 1f20: f7 df rcall .-18 ; 0x1f10 - 1f22: ff cf rjmp .-2 ; 0x1f22 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 1f24: 84 e1 ldi r24, 0x14 ; 20 -} - 1f26: d2 cf rjmp .-92 ; 0x1ecc - -00001f28 : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 1f28: 1f 93 push r17 - 1f2a: 18 2f mov r17, r24 - do getch(); while (--count); - 1f2c: de df rcall .-68 ; 0x1eea - 1f2e: 11 50 subi r17, 0x01 ; 1 - 1f30: e9 f7 brne .-6 ; 0x1f2c - verifySpace(); - 1f32: f2 df rcall .-28 ; 0x1f18 -} - 1f34: 1f 91 pop r17 - 1f36: 08 95 ret - -00001f38 : - WDTCSR = _BV(WDCE) | _BV(WDE); - WDTCSR = x; -} - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 1f38: 80 e0 ldi r24, 0x00 ; 0 - 1f3a: ea df rcall .-44 ; 0x1f10 - __asm__ __volatile__ ( - 1f3c: e4 e0 ldi r30, 0x04 ; 4 - 1f3e: ff 27 eor r31, r31 - 1f40: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_pro_16MHz.hex b/bootloaders/optiboot/optiboot_pro_16MHz.hex deleted file mode 100644 index b685a4e..0000000 --- a/bootloaders/optiboot/optiboot_pro_16MHz.hex +++ /dev/null @@ -1,34 +0,0 @@ -:103E0000112484B714BE81FFE7D085E08093810040 -:103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20080E18093C4008EE0C0D0259A86E075 -:103E300020E33CEF91E0309385002093840096BB13 -:103E4000B09BFECF1D9AA8958150A9F79924939411 -:103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE -:103E6000B3D083E01FC0823411F484E103C08534F1 -:103E700019F485E0A9D083C0853579F48BD0E82E7C -:103E8000FF2488D0082F10E0102F00270E291F29AB -:103E9000000F111F91D0680172C0863529F484E0AB -:103EA00093D080E06FD06BC0843609F042C072D0EE -:103EB00071D0082F6FD080E0C81688E3D80620F4B0 -:103EC00083E0F60187BFE895C0E0D1E063D0899335 -:103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF -:103EE000F60187BFE89568D007B600FCFDCFA601B4 -:103EF000A0E0B1E02C9130E011968C91119790E008 -:103F0000982F8827822B932B1296FA010C0197BECB -:103F1000E89511244E5F5F4FF1E0A038BF0751F7DD -:103F2000F601A7BEE89507B600FCFDCFB7BEE89541 -:103F300026C08437B1F42ED02DD0F82E2BD03CD013 -:103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 -:103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 -:103F60000EC0853739F428D08EE10CD084E90AD010 -:103F700086E098CF813511F488E018D01DD080E11B -:103F800001D06ACF982F8091C00085FFFCCF90931D -:103F9000C60008958091C00087FFFCCF8091C000CB -:103FA00084FD01C0A8958091C6000895E0E6F0E088 -:103FB00098E1908380830895EDDF803219F088E0E6 -:103FC000F5DFFFCF84E1DECF1F93182FE3DF115021 -:103FD000E9F7F2DF1F91089580E0E8DFEE27FF2781 -:023FE000099442 -:023FFE000304BA -:0400000300003E00BB -:00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_16MHz.lst b/bootloaders/optiboot/optiboot_pro_16MHz.lst deleted file mode 100644 index 2c6bea1..0000000 --- a/bootloaders/optiboot/optiboot_pro_16MHz.lst +++ /dev/null @@ -1,571 +0,0 @@ - -optiboot_pro_16MHz.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001e2 00003e00 00003e00 00000054 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 00000236 2**0 - CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00003e00
: -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3e00: 11 24 eor r1, r1 -#ifdef __AVR_ATmega8__ - SP=RAMEND; // This is done by hardware reset -#endif - - // Adaboot no-wait mod - ch = MCUSR; - 3e02: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 3e04: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 3e06: 81 ff sbrs r24, 1 - 3e08: e7 d0 rcall .+462 ; 0x3fd8 - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 3e0a: 85 e0 ldi r24, 0x05 ; 5 - 3e0c: 80 93 81 00 sts 0x0081, r24 - UCSRA = _BV(U2X); //Double speed mode USART - UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx - UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 - UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); -#else - UCSR0A = _BV(U2X0); //Double speed mode USART0 - 3e10: 82 e0 ldi r24, 0x02 ; 2 - 3e12: 80 93 c0 00 sts 0x00C0, r24 - UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 3e16: 88 e1 ldi r24, 0x18 ; 24 - 3e18: 80 93 c1 00 sts 0x00C1, r24 - UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 3e1c: 86 e0 ldi r24, 0x06 ; 6 - 3e1e: 80 93 c2 00 sts 0x00C2, r24 - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e22: 80 e1 ldi r24, 0x10 ; 16 - 3e24: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: c0 d0 rcall .+384 ; 0x3fac - - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 3e2c: 25 9a sbi 0x04, 5 ; 4 - 3e2e: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e30: 20 e3 ldi r18, 0x30 ; 48 - 3e32: 3c ef ldi r19, 0xFC ; 252 - TIFR1 = _BV(TOV1); - 3e34: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e36: 30 93 85 00 sts 0x0085, r19 - 3e3a: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 3e3e: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 3e40: b0 9b sbis 0x16, 0 ; 22 - 3e42: fe cf rjmp .-4 ; 0x3e40 -#ifdef __AVR_ATmega8__ - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 3e44: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3e46: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 3e48: 81 50 subi r24, 0x01 ; 1 - 3e4a: a9 f7 brne .-22 ; 0x3e36 - /* get character from UART */ - ch = getch(); - - if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e4c: 99 24 eor r9, r9 - 3e4e: 93 94 inc r9 - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - addrPtr += 2; - } while (--ch); - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3e50: a5 e0 ldi r26, 0x05 ; 5 - 3e52: aa 2e mov r10, r26 - boot_spm_busy_wait(); - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3e54: f1 e1 ldi r31, 0x11 ; 17 - 3e56: bf 2e mov r11, r31 -#endif - - /* Forever loop */ - for (;;) { - /* get character from UART */ - ch = getch(); - 3e58: 9d d0 rcall .+314 ; 0x3f94 - - if(ch == STK_GET_PARAMETER) { - 3e5a: 81 34 cpi r24, 0x41 ; 65 - 3e5c: 21 f4 brne .+8 ; 0x3e66 - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: b3 d0 rcall .+358 ; 0x3fc8 - putch(0x03); - 3e62: 83 e0 ldi r24, 0x03 ; 3 - 3e64: 1f c0 rjmp .+62 ; 0x3ea4 - } - else if(ch == STK_SET_DEVICE) { - 3e66: 82 34 cpi r24, 0x42 ; 66 - 3e68: 11 f4 brne .+4 ; 0x3e6e - // SET DEVICE is ignored - getNch(20); - 3e6a: 84 e1 ldi r24, 0x14 ; 20 - 3e6c: 03 c0 rjmp .+6 ; 0x3e74 - } - else if(ch == STK_SET_DEVICE_EXT) { - 3e6e: 85 34 cpi r24, 0x45 ; 69 - 3e70: 19 f4 brne .+6 ; 0x3e78 - // SET DEVICE EXT is ignored - getNch(5); - 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: a9 d0 rcall .+338 ; 0x3fc8 - 3e76: 83 c0 rjmp .+262 ; 0x3f7e - } - else if(ch == STK_LOAD_ADDRESS) { - 3e78: 85 35 cpi r24, 0x55 ; 85 - 3e7a: 79 f4 brne .+30 ; 0x3e9a - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 3e7c: 8b d0 rcall .+278 ; 0x3f94 - newAddress = (newAddress & 0xff) | (getch() << 8); - 3e7e: e8 2e mov r14, r24 - 3e80: ff 24 eor r15, r15 - 3e82: 88 d0 rcall .+272 ; 0x3f94 - 3e84: 08 2f mov r16, r24 - 3e86: 10 e0 ldi r17, 0x00 ; 0 - 3e88: 10 2f mov r17, r16 - 3e8a: 00 27 eor r16, r16 - 3e8c: 0e 29 or r16, r14 - 3e8e: 1f 29 or r17, r15 -#ifdef RAMPZ - // Transfer top bit to RAMPZ - RAMPZ = (newAddress & 0x8000) ? 1 : 0; -#endif - newAddress += newAddress; // Convert from word address to byte address - 3e90: 00 0f add r16, r16 - 3e92: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 3e94: 91 d0 rcall .+290 ; 0x3fb8 - 3e96: 68 01 movw r12, r16 - 3e98: 72 c0 rjmp .+228 ; 0x3f7e - } - else if(ch == STK_UNIVERSAL) { - 3e9a: 86 35 cpi r24, 0x56 ; 86 - 3e9c: 29 f4 brne .+10 ; 0x3ea8 - // UNIVERSAL command is ignored - getNch(4); - 3e9e: 84 e0 ldi r24, 0x04 ; 4 - 3ea0: 93 d0 rcall .+294 ; 0x3fc8 - putch(0x00); - 3ea2: 80 e0 ldi r24, 0x00 ; 0 - 3ea4: 6f d0 rcall .+222 ; 0x3f84 - 3ea6: 6b c0 rjmp .+214 ; 0x3f7e - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 3ea8: 84 36 cpi r24, 0x64 ; 100 - 3eaa: 09 f0 breq .+2 ; 0x3eae - 3eac: 42 c0 rjmp .+132 ; 0x3f32 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t *bufPtr; - uint16_t addrPtr; - - getch(); /* getlen() */ - 3eae: 72 d0 rcall .+228 ; 0x3f94 - length = getch(); - 3eb0: 71 d0 rcall .+226 ; 0x3f94 - 3eb2: 08 2f mov r16, r24 - getch(); - 3eb4: 6f d0 rcall .+222 ; 0x3f94 - - // If we are in RWW section, immediately start page erase - if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3eb6: 80 e0 ldi r24, 0x00 ; 0 - 3eb8: c8 16 cp r12, r24 - 3eba: 88 e3 ldi r24, 0x38 ; 56 - 3ebc: d8 06 cpc r13, r24 - 3ebe: 20 f4 brcc .+8 ; 0x3ec8 - 3ec0: 83 e0 ldi r24, 0x03 ; 3 - 3ec2: f6 01 movw r30, r12 - 3ec4: 87 bf out 0x37, r24 ; 55 - 3ec6: e8 95 spm - 3ec8: c0 e0 ldi r28, 0x00 ; 0 - 3eca: d1 e0 ldi r29, 0x01 ; 1 - - // While that is going on, read in page contents - bufPtr = buff; - do *bufPtr++ = getch(); - 3ecc: 63 d0 rcall .+198 ; 0x3f94 - 3ece: 89 93 st Y+, r24 - while (--length); - 3ed0: 0c 17 cp r16, r28 - 3ed2: e1 f7 brne .-8 ; 0x3ecc - - // If we are in NRWW section, page erase has to be delayed until now. - // Todo: Take RAMPZ into account - if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3ed4: f0 e0 ldi r31, 0x00 ; 0 - 3ed6: cf 16 cp r12, r31 - 3ed8: f8 e3 ldi r31, 0x38 ; 56 - 3eda: df 06 cpc r13, r31 - 3edc: 20 f0 brcs .+8 ; 0x3ee6 - 3ede: 83 e0 ldi r24, 0x03 ; 3 - 3ee0: f6 01 movw r30, r12 - 3ee2: 87 bf out 0x37, r24 ; 55 - 3ee4: e8 95 spm - - // Read command terminator, start reply - verifySpace(); - 3ee6: 68 d0 rcall .+208 ; 0x3fb8 - - // If only a partial page is to be programmed, the erase might not be complete. - // So check that here - boot_spm_busy_wait(); - 3ee8: 07 b6 in r0, 0x37 ; 55 - 3eea: 00 fc sbrc r0, 0 - 3eec: fd cf rjmp .-6 ; 0x3ee8 - 3eee: a6 01 movw r20, r12 - 3ef0: a0 e0 ldi r26, 0x00 ; 0 - 3ef2: b1 e0 ldi r27, 0x01 ; 1 - bufPtr = buff; - addrPtr = (uint16_t)(void*)address; - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - 3ef4: 2c 91 ld r18, X - 3ef6: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 3ef8: 11 96 adiw r26, 0x01 ; 1 - 3efa: 8c 91 ld r24, X - 3efc: 11 97 sbiw r26, 0x01 ; 1 - 3efe: 90 e0 ldi r25, 0x00 ; 0 - 3f00: 98 2f mov r25, r24 - 3f02: 88 27 eor r24, r24 - 3f04: 82 2b or r24, r18 - 3f06: 93 2b or r25, r19 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f08: 12 96 adiw r26, 0x02 ; 2 - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f0a: fa 01 movw r30, r20 - 3f0c: 0c 01 movw r0, r24 - 3f0e: 97 be out 0x37, r9 ; 55 - 3f10: e8 95 spm - 3f12: 11 24 eor r1, r1 - addrPtr += 2; - 3f14: 4e 5f subi r20, 0xFE ; 254 - 3f16: 5f 4f sbci r21, 0xFF ; 255 - } while (--ch); - 3f18: f1 e0 ldi r31, 0x01 ; 1 - 3f1a: a0 38 cpi r26, 0x80 ; 128 - 3f1c: bf 07 cpc r27, r31 - 3f1e: 51 f7 brne .-44 ; 0x3ef4 - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3f20: f6 01 movw r30, r12 - 3f22: a7 be out 0x37, r10 ; 55 - 3f24: e8 95 spm - boot_spm_busy_wait(); - 3f26: 07 b6 in r0, 0x37 ; 55 - 3f28: 00 fc sbrc r0, 0 - 3f2a: fd cf rjmp .-6 ; 0x3f26 - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3f2c: b7 be out 0x37, r11 ; 55 - 3f2e: e8 95 spm - 3f30: 26 c0 rjmp .+76 ; 0x3f7e -#endif - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 3f32: 84 37 cpi r24, 0x74 ; 116 - 3f34: b1 f4 brne .+44 ; 0x3f62 - // READ PAGE - we only read flash - getch(); /* getlen() */ - 3f36: 2e d0 rcall .+92 ; 0x3f94 - length = getch(); - 3f38: 2d d0 rcall .+90 ; 0x3f94 - 3f3a: f8 2e mov r15, r24 - getch(); - 3f3c: 2b d0 rcall .+86 ; 0x3f94 - - verifySpace(); - 3f3e: 3c d0 rcall .+120 ; 0x3fb8 - 3f40: f6 01 movw r30, r12 - 3f42: ef 2c mov r14, r15 - putch(result); - address++; - } - while (--length); -#else - do putch(pgm_read_byte_near(address++)); - 3f44: 8f 01 movw r16, r30 - 3f46: 0f 5f subi r16, 0xFF ; 255 - 3f48: 1f 4f sbci r17, 0xFF ; 255 - 3f4a: 84 91 lpm r24, Z+ - 3f4c: 1b d0 rcall .+54 ; 0x3f84 - while (--length); - 3f4e: ea 94 dec r14 - 3f50: f8 01 movw r30, r16 - 3f52: c1 f7 brne .-16 ; 0x3f44 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f54: 08 94 sec - 3f56: c1 1c adc r12, r1 - 3f58: d1 1c adc r13, r1 - 3f5a: fa 94 dec r15 - 3f5c: cf 0c add r12, r15 - 3f5e: d1 1c adc r13, r1 - 3f60: 0e c0 rjmp .+28 ; 0x3f7e -#endif -#endif - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 3f62: 85 37 cpi r24, 0x75 ; 117 - 3f64: 39 f4 brne .+14 ; 0x3f74 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 3f66: 28 d0 rcall .+80 ; 0x3fb8 - putch(SIGNATURE_0); - 3f68: 8e e1 ldi r24, 0x1E ; 30 - 3f6a: 0c d0 rcall .+24 ; 0x3f84 - putch(SIGNATURE_1); - 3f6c: 84 e9 ldi r24, 0x94 ; 148 - 3f6e: 0a d0 rcall .+20 ; 0x3f84 - putch(SIGNATURE_2); - 3f70: 86 e0 ldi r24, 0x06 ; 6 - 3f72: 98 cf rjmp .-208 ; 0x3ea4 - } - else if (ch == 'Q') { - 3f74: 81 35 cpi r24, 0x51 ; 81 - 3f76: 11 f4 brne .+4 ; 0x3f7c - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 3f78: 88 e0 ldi r24, 0x08 ; 8 - 3f7a: 18 d0 rcall .+48 ; 0x3fac - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 3f7c: 1d d0 rcall .+58 ; 0x3fb8 - } - putch(STK_OK); - 3f7e: 80 e1 ldi r24, 0x10 ; 16 - 3f80: 01 d0 rcall .+2 ; 0x3f84 - 3f82: 6a cf rjmp .-300 ; 0x3e58 - -00003f84 : - } -} - -void putch(char ch) { - 3f84: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UCSR0A & _BV(UDRE0))); - 3f86: 80 91 c0 00 lds r24, 0x00C0 - 3f8a: 85 ff sbrs r24, 5 - 3f8c: fc cf rjmp .-8 ; 0x3f86 - UDR0 = ch; - 3f8e: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 3f92: 08 95 ret - -00003f94 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))) - 3f94: 80 91 c0 00 lds r24, 0x00C0 - 3f98: 87 ff sbrs r24, 7 - 3f9a: fc cf rjmp .-8 ; 0x3f94 - ; - if (!(UCSR0A & _BV(FE0))) { - 3f9c: 80 91 c0 00 lds r24, 0x00C0 - 3fa0: 84 fd sbrc r24, 4 - 3fa2: 01 c0 rjmp .+2 ; 0x3fa6 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3fa4: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UDR0; - 3fa6: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 3faa: 08 95 ret - -00003fac : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 3fac: e0 e6 ldi r30, 0x60 ; 96 - 3fae: f0 e0 ldi r31, 0x00 ; 0 - 3fb0: 98 e1 ldi r25, 0x18 ; 24 - 3fb2: 90 83 st Z, r25 - WDTCSR = x; - 3fb4: 80 83 st Z, r24 -} - 3fb6: 08 95 ret - -00003fb8 : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 3fb8: ed df rcall .-38 ; 0x3f94 - 3fba: 80 32 cpi r24, 0x20 ; 32 - 3fbc: 19 f0 breq .+6 ; 0x3fc4 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fbe: 88 e0 ldi r24, 0x08 ; 8 - 3fc0: f5 df rcall .-22 ; 0x3fac - 3fc2: ff cf rjmp .-2 ; 0x3fc2 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 3fc4: 84 e1 ldi r24, 0x14 ; 20 -} - 3fc6: de cf rjmp .-68 ; 0x3f84 - -00003fc8 : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 3fc8: 1f 93 push r17 - 3fca: 18 2f mov r17, r24 - do getch(); while (--count); - 3fcc: e3 df rcall .-58 ; 0x3f94 - 3fce: 11 50 subi r17, 0x01 ; 1 - 3fd0: e9 f7 brne .-6 ; 0x3fcc - verifySpace(); - 3fd2: f2 df rcall .-28 ; 0x3fb8 -} - 3fd4: 1f 91 pop r17 - 3fd6: 08 95 ret - -00003fd8 : - WDTCSR = _BV(WDCE) | _BV(WDE); - WDTCSR = x; -} - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 3fd8: 80 e0 ldi r24, 0x00 ; 0 - 3fda: e8 df rcall .-48 ; 0x3fac - __asm__ __volatile__ ( - 3fdc: ee 27 eor r30, r30 - 3fde: ff 27 eor r31, r31 - 3fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_pro_20mhz.hex b/bootloaders/optiboot/optiboot_pro_20mhz.hex deleted file mode 100644 index 451a99c..0000000 --- a/bootloaders/optiboot/optiboot_pro_20mhz.hex +++ /dev/null @@ -1,34 +0,0 @@ -:103E0000112484B714BE81FFE7D085E08093810040 -:103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20085E18093C4008EE0C0D0259A86E070 -:103E30002CE33BEF91E0309385002093840096BB08 -:103E4000B09BFECF1D9AA8958150A9F79924939411 -:103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE -:103E6000B3D083E01FC0823411F484E103C08534F1 -:103E700019F485E0A9D083C0853579F48BD0E82E7C -:103E8000FF2488D0082F10E0102F00270E291F29AB -:103E9000000F111F91D0680172C0863529F484E0AB -:103EA00093D080E06FD06BC0843609F042C072D0EE -:103EB00071D0082F6FD080E0C81688E3D80620F4B0 -:103EC00083E0F60187BFE895C0E0D1E063D0899335 -:103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF -:103EE000F60187BFE89568D007B600FCFDCFA601B4 -:103EF000A0E0B1E02C9130E011968C91119790E008 -:103F0000982F8827822B932B1296FA010C0197BECB -:103F1000E89511244E5F5F4FF1E0A038BF0751F7DD -:103F2000F601A7BEE89507B600FCFDCFB7BEE89541 -:103F300026C08437B1F42ED02DD0F82E2BD03CD013 -:103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 -:103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 -:103F60000EC0853739F428D08EE10CD084E90AD010 -:103F700086E098CF813511F488E018D01DD080E11B -:103F800001D06ACF982F8091C00085FFFCCF90931D -:103F9000C60008958091C00087FFFCCF8091C000CB -:103FA00084FD01C0A8958091C6000895E0E6F0E088 -:103FB00098E1908380830895EDDF803219F088E0E6 -:103FC000F5DFFFCF84E1DECF1F93182FE3DF115021 -:103FD000E9F7F2DF1F91089580E0E8DFEE27FF2781 -:023FE000099442 -:023FFE000304BA -:0400000300003E00BB -:00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_20mhz.lst b/bootloaders/optiboot/optiboot_pro_20mhz.lst deleted file mode 100644 index 8314647..0000000 --- a/bootloaders/optiboot/optiboot_pro_20mhz.lst +++ /dev/null @@ -1,571 +0,0 @@ - -optiboot_pro_20mhz.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001e2 00003e00 00003e00 00000054 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 00000236 2**0 - CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00003e00
: -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3e00: 11 24 eor r1, r1 -#ifdef __AVR_ATmega8__ - SP=RAMEND; // This is done by hardware reset -#endif - - // Adaboot no-wait mod - ch = MCUSR; - 3e02: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 3e04: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 3e06: 81 ff sbrs r24, 1 - 3e08: e7 d0 rcall .+462 ; 0x3fd8 - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 3e0a: 85 e0 ldi r24, 0x05 ; 5 - 3e0c: 80 93 81 00 sts 0x0081, r24 - UCSRA = _BV(U2X); //Double speed mode USART - UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx - UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 - UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); -#else - UCSR0A = _BV(U2X0); //Double speed mode USART0 - 3e10: 82 e0 ldi r24, 0x02 ; 2 - 3e12: 80 93 c0 00 sts 0x00C0, r24 - UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 3e16: 88 e1 ldi r24, 0x18 ; 24 - 3e18: 80 93 c1 00 sts 0x00C1, r24 - UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 3e1c: 86 e0 ldi r24, 0x06 ; 6 - 3e1e: 80 93 c2 00 sts 0x00C2, r24 - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e22: 85 e1 ldi r24, 0x15 ; 21 - 3e24: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: c0 d0 rcall .+384 ; 0x3fac - - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 3e2c: 25 9a sbi 0x04, 5 ; 4 - 3e2e: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e30: 2c e3 ldi r18, 0x3C ; 60 - 3e32: 3b ef ldi r19, 0xFB ; 251 - TIFR1 = _BV(TOV1); - 3e34: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e36: 30 93 85 00 sts 0x0085, r19 - 3e3a: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 3e3e: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 3e40: b0 9b sbis 0x16, 0 ; 22 - 3e42: fe cf rjmp .-4 ; 0x3e40 -#ifdef __AVR_ATmega8__ - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 3e44: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3e46: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 3e48: 81 50 subi r24, 0x01 ; 1 - 3e4a: a9 f7 brne .-22 ; 0x3e36 - /* get character from UART */ - ch = getch(); - - if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e4c: 99 24 eor r9, r9 - 3e4e: 93 94 inc r9 - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - addrPtr += 2; - } while (--ch); - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3e50: a5 e0 ldi r26, 0x05 ; 5 - 3e52: aa 2e mov r10, r26 - boot_spm_busy_wait(); - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3e54: f1 e1 ldi r31, 0x11 ; 17 - 3e56: bf 2e mov r11, r31 -#endif - - /* Forever loop */ - for (;;) { - /* get character from UART */ - ch = getch(); - 3e58: 9d d0 rcall .+314 ; 0x3f94 - - if(ch == STK_GET_PARAMETER) { - 3e5a: 81 34 cpi r24, 0x41 ; 65 - 3e5c: 21 f4 brne .+8 ; 0x3e66 - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: b3 d0 rcall .+358 ; 0x3fc8 - putch(0x03); - 3e62: 83 e0 ldi r24, 0x03 ; 3 - 3e64: 1f c0 rjmp .+62 ; 0x3ea4 - } - else if(ch == STK_SET_DEVICE) { - 3e66: 82 34 cpi r24, 0x42 ; 66 - 3e68: 11 f4 brne .+4 ; 0x3e6e - // SET DEVICE is ignored - getNch(20); - 3e6a: 84 e1 ldi r24, 0x14 ; 20 - 3e6c: 03 c0 rjmp .+6 ; 0x3e74 - } - else if(ch == STK_SET_DEVICE_EXT) { - 3e6e: 85 34 cpi r24, 0x45 ; 69 - 3e70: 19 f4 brne .+6 ; 0x3e78 - // SET DEVICE EXT is ignored - getNch(5); - 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: a9 d0 rcall .+338 ; 0x3fc8 - 3e76: 83 c0 rjmp .+262 ; 0x3f7e - } - else if(ch == STK_LOAD_ADDRESS) { - 3e78: 85 35 cpi r24, 0x55 ; 85 - 3e7a: 79 f4 brne .+30 ; 0x3e9a - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 3e7c: 8b d0 rcall .+278 ; 0x3f94 - newAddress = (newAddress & 0xff) | (getch() << 8); - 3e7e: e8 2e mov r14, r24 - 3e80: ff 24 eor r15, r15 - 3e82: 88 d0 rcall .+272 ; 0x3f94 - 3e84: 08 2f mov r16, r24 - 3e86: 10 e0 ldi r17, 0x00 ; 0 - 3e88: 10 2f mov r17, r16 - 3e8a: 00 27 eor r16, r16 - 3e8c: 0e 29 or r16, r14 - 3e8e: 1f 29 or r17, r15 -#ifdef RAMPZ - // Transfer top bit to RAMPZ - RAMPZ = (newAddress & 0x8000) ? 1 : 0; -#endif - newAddress += newAddress; // Convert from word address to byte address - 3e90: 00 0f add r16, r16 - 3e92: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 3e94: 91 d0 rcall .+290 ; 0x3fb8 - 3e96: 68 01 movw r12, r16 - 3e98: 72 c0 rjmp .+228 ; 0x3f7e - } - else if(ch == STK_UNIVERSAL) { - 3e9a: 86 35 cpi r24, 0x56 ; 86 - 3e9c: 29 f4 brne .+10 ; 0x3ea8 - // UNIVERSAL command is ignored - getNch(4); - 3e9e: 84 e0 ldi r24, 0x04 ; 4 - 3ea0: 93 d0 rcall .+294 ; 0x3fc8 - putch(0x00); - 3ea2: 80 e0 ldi r24, 0x00 ; 0 - 3ea4: 6f d0 rcall .+222 ; 0x3f84 - 3ea6: 6b c0 rjmp .+214 ; 0x3f7e - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 3ea8: 84 36 cpi r24, 0x64 ; 100 - 3eaa: 09 f0 breq .+2 ; 0x3eae - 3eac: 42 c0 rjmp .+132 ; 0x3f32 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t *bufPtr; - uint16_t addrPtr; - - getch(); /* getlen() */ - 3eae: 72 d0 rcall .+228 ; 0x3f94 - length = getch(); - 3eb0: 71 d0 rcall .+226 ; 0x3f94 - 3eb2: 08 2f mov r16, r24 - getch(); - 3eb4: 6f d0 rcall .+222 ; 0x3f94 - - // If we are in RWW section, immediately start page erase - if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3eb6: 80 e0 ldi r24, 0x00 ; 0 - 3eb8: c8 16 cp r12, r24 - 3eba: 88 e3 ldi r24, 0x38 ; 56 - 3ebc: d8 06 cpc r13, r24 - 3ebe: 20 f4 brcc .+8 ; 0x3ec8 - 3ec0: 83 e0 ldi r24, 0x03 ; 3 - 3ec2: f6 01 movw r30, r12 - 3ec4: 87 bf out 0x37, r24 ; 55 - 3ec6: e8 95 spm - 3ec8: c0 e0 ldi r28, 0x00 ; 0 - 3eca: d1 e0 ldi r29, 0x01 ; 1 - - // While that is going on, read in page contents - bufPtr = buff; - do *bufPtr++ = getch(); - 3ecc: 63 d0 rcall .+198 ; 0x3f94 - 3ece: 89 93 st Y+, r24 - while (--length); - 3ed0: 0c 17 cp r16, r28 - 3ed2: e1 f7 brne .-8 ; 0x3ecc - - // If we are in NRWW section, page erase has to be delayed until now. - // Todo: Take RAMPZ into account - if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3ed4: f0 e0 ldi r31, 0x00 ; 0 - 3ed6: cf 16 cp r12, r31 - 3ed8: f8 e3 ldi r31, 0x38 ; 56 - 3eda: df 06 cpc r13, r31 - 3edc: 20 f0 brcs .+8 ; 0x3ee6 - 3ede: 83 e0 ldi r24, 0x03 ; 3 - 3ee0: f6 01 movw r30, r12 - 3ee2: 87 bf out 0x37, r24 ; 55 - 3ee4: e8 95 spm - - // Read command terminator, start reply - verifySpace(); - 3ee6: 68 d0 rcall .+208 ; 0x3fb8 - - // If only a partial page is to be programmed, the erase might not be complete. - // So check that here - boot_spm_busy_wait(); - 3ee8: 07 b6 in r0, 0x37 ; 55 - 3eea: 00 fc sbrc r0, 0 - 3eec: fd cf rjmp .-6 ; 0x3ee8 - 3eee: a6 01 movw r20, r12 - 3ef0: a0 e0 ldi r26, 0x00 ; 0 - 3ef2: b1 e0 ldi r27, 0x01 ; 1 - bufPtr = buff; - addrPtr = (uint16_t)(void*)address; - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - 3ef4: 2c 91 ld r18, X - 3ef6: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 3ef8: 11 96 adiw r26, 0x01 ; 1 - 3efa: 8c 91 ld r24, X - 3efc: 11 97 sbiw r26, 0x01 ; 1 - 3efe: 90 e0 ldi r25, 0x00 ; 0 - 3f00: 98 2f mov r25, r24 - 3f02: 88 27 eor r24, r24 - 3f04: 82 2b or r24, r18 - 3f06: 93 2b or r25, r19 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f08: 12 96 adiw r26, 0x02 ; 2 - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f0a: fa 01 movw r30, r20 - 3f0c: 0c 01 movw r0, r24 - 3f0e: 97 be out 0x37, r9 ; 55 - 3f10: e8 95 spm - 3f12: 11 24 eor r1, r1 - addrPtr += 2; - 3f14: 4e 5f subi r20, 0xFE ; 254 - 3f16: 5f 4f sbci r21, 0xFF ; 255 - } while (--ch); - 3f18: f1 e0 ldi r31, 0x01 ; 1 - 3f1a: a0 38 cpi r26, 0x80 ; 128 - 3f1c: bf 07 cpc r27, r31 - 3f1e: 51 f7 brne .-44 ; 0x3ef4 - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3f20: f6 01 movw r30, r12 - 3f22: a7 be out 0x37, r10 ; 55 - 3f24: e8 95 spm - boot_spm_busy_wait(); - 3f26: 07 b6 in r0, 0x37 ; 55 - 3f28: 00 fc sbrc r0, 0 - 3f2a: fd cf rjmp .-6 ; 0x3f26 - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3f2c: b7 be out 0x37, r11 ; 55 - 3f2e: e8 95 spm - 3f30: 26 c0 rjmp .+76 ; 0x3f7e -#endif - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 3f32: 84 37 cpi r24, 0x74 ; 116 - 3f34: b1 f4 brne .+44 ; 0x3f62 - // READ PAGE - we only read flash - getch(); /* getlen() */ - 3f36: 2e d0 rcall .+92 ; 0x3f94 - length = getch(); - 3f38: 2d d0 rcall .+90 ; 0x3f94 - 3f3a: f8 2e mov r15, r24 - getch(); - 3f3c: 2b d0 rcall .+86 ; 0x3f94 - - verifySpace(); - 3f3e: 3c d0 rcall .+120 ; 0x3fb8 - 3f40: f6 01 movw r30, r12 - 3f42: ef 2c mov r14, r15 - putch(result); - address++; - } - while (--length); -#else - do putch(pgm_read_byte_near(address++)); - 3f44: 8f 01 movw r16, r30 - 3f46: 0f 5f subi r16, 0xFF ; 255 - 3f48: 1f 4f sbci r17, 0xFF ; 255 - 3f4a: 84 91 lpm r24, Z+ - 3f4c: 1b d0 rcall .+54 ; 0x3f84 - while (--length); - 3f4e: ea 94 dec r14 - 3f50: f8 01 movw r30, r16 - 3f52: c1 f7 brne .-16 ; 0x3f44 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f54: 08 94 sec - 3f56: c1 1c adc r12, r1 - 3f58: d1 1c adc r13, r1 - 3f5a: fa 94 dec r15 - 3f5c: cf 0c add r12, r15 - 3f5e: d1 1c adc r13, r1 - 3f60: 0e c0 rjmp .+28 ; 0x3f7e -#endif -#endif - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 3f62: 85 37 cpi r24, 0x75 ; 117 - 3f64: 39 f4 brne .+14 ; 0x3f74 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 3f66: 28 d0 rcall .+80 ; 0x3fb8 - putch(SIGNATURE_0); - 3f68: 8e e1 ldi r24, 0x1E ; 30 - 3f6a: 0c d0 rcall .+24 ; 0x3f84 - putch(SIGNATURE_1); - 3f6c: 84 e9 ldi r24, 0x94 ; 148 - 3f6e: 0a d0 rcall .+20 ; 0x3f84 - putch(SIGNATURE_2); - 3f70: 86 e0 ldi r24, 0x06 ; 6 - 3f72: 98 cf rjmp .-208 ; 0x3ea4 - } - else if (ch == 'Q') { - 3f74: 81 35 cpi r24, 0x51 ; 81 - 3f76: 11 f4 brne .+4 ; 0x3f7c - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 3f78: 88 e0 ldi r24, 0x08 ; 8 - 3f7a: 18 d0 rcall .+48 ; 0x3fac - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 3f7c: 1d d0 rcall .+58 ; 0x3fb8 - } - putch(STK_OK); - 3f7e: 80 e1 ldi r24, 0x10 ; 16 - 3f80: 01 d0 rcall .+2 ; 0x3f84 - 3f82: 6a cf rjmp .-300 ; 0x3e58 - -00003f84 : - } -} - -void putch(char ch) { - 3f84: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UCSR0A & _BV(UDRE0))); - 3f86: 80 91 c0 00 lds r24, 0x00C0 - 3f8a: 85 ff sbrs r24, 5 - 3f8c: fc cf rjmp .-8 ; 0x3f86 - UDR0 = ch; - 3f8e: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 3f92: 08 95 ret - -00003f94 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))) - 3f94: 80 91 c0 00 lds r24, 0x00C0 - 3f98: 87 ff sbrs r24, 7 - 3f9a: fc cf rjmp .-8 ; 0x3f94 - ; - if (!(UCSR0A & _BV(FE0))) { - 3f9c: 80 91 c0 00 lds r24, 0x00C0 - 3fa0: 84 fd sbrc r24, 4 - 3fa2: 01 c0 rjmp .+2 ; 0x3fa6 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3fa4: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UDR0; - 3fa6: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 3faa: 08 95 ret - -00003fac : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 3fac: e0 e6 ldi r30, 0x60 ; 96 - 3fae: f0 e0 ldi r31, 0x00 ; 0 - 3fb0: 98 e1 ldi r25, 0x18 ; 24 - 3fb2: 90 83 st Z, r25 - WDTCSR = x; - 3fb4: 80 83 st Z, r24 -} - 3fb6: 08 95 ret - -00003fb8 : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 3fb8: ed df rcall .-38 ; 0x3f94 - 3fba: 80 32 cpi r24, 0x20 ; 32 - 3fbc: 19 f0 breq .+6 ; 0x3fc4 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fbe: 88 e0 ldi r24, 0x08 ; 8 - 3fc0: f5 df rcall .-22 ; 0x3fac - 3fc2: ff cf rjmp .-2 ; 0x3fc2 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 3fc4: 84 e1 ldi r24, 0x14 ; 20 -} - 3fc6: de cf rjmp .-68 ; 0x3f84 - -00003fc8 : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 3fc8: 1f 93 push r17 - 3fca: 18 2f mov r17, r24 - do getch(); while (--count); - 3fcc: e3 df rcall .-58 ; 0x3f94 - 3fce: 11 50 subi r17, 0x01 ; 1 - 3fd0: e9 f7 brne .-6 ; 0x3fcc - verifySpace(); - 3fd2: f2 df rcall .-28 ; 0x3fb8 -} - 3fd4: 1f 91 pop r17 - 3fd6: 08 95 ret - -00003fd8 : - WDTCSR = _BV(WDCE) | _BV(WDE); - WDTCSR = x; -} - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 3fd8: 80 e0 ldi r24, 0x00 ; 0 - 3fda: e8 df rcall .-48 ; 0x3fac - __asm__ __volatile__ ( - 3fdc: ee 27 eor r30, r30 - 3fde: ff 27 eor r31, r31 - 3fe0: 09 94 ijmp diff --git a/bootloaders/optiboot/optiboot_pro_8MHz.hex b/bootloaders/optiboot/optiboot_pro_8MHz.hex deleted file mode 100644 index 2c63395..0000000 --- a/bootloaders/optiboot/optiboot_pro_8MHz.hex +++ /dev/null @@ -1,34 +0,0 @@ -:103E0000112484B714BE81FFE7D085E08093810040 -:103E100082E08093C00088E18093C10086E08093B7 -:103E2000C20088E08093C4008EE0C0D0259A86E06E -:103E300028E13EEF91E0309385002093840096BB0B -:103E4000B09BFECF1D9AA8958150A9F79924939411 -:103E5000A5E0AA2EF1E1BF2E9DD0813421F481E0AE -:103E6000B3D083E01FC0823411F484E103C08534F1 -:103E700019F485E0A9D083C0853579F48BD0E82E7C -:103E8000FF2488D0082F10E0102F00270E291F29AB -:103E9000000F111F91D0680172C0863529F484E0AB -:103EA00093D080E06FD06BC0843609F042C072D0EE -:103EB00071D0082F6FD080E0C81688E3D80620F4B0 -:103EC00083E0F60187BFE895C0E0D1E063D0899335 -:103ED0000C17E1F7F0E0CF16F8E3DF0620F083E0FF -:103EE000F60187BFE89568D007B600FCFDCFA601B4 -:103EF000A0E0B1E02C9130E011968C91119790E008 -:103F0000982F8827822B932B1296FA010C0197BECB -:103F1000E89511244E5F5F4FF1E0A038BF0751F7DD -:103F2000F601A7BEE89507B600FCFDCFB7BEE89541 -:103F300026C08437B1F42ED02DD0F82E2BD03CD013 -:103F4000F601EF2C8F010F5F1F4F84911BD0EA9475 -:103F5000F801C1F70894C11CD11CFA94CF0CD11CF4 -:103F60000EC0853739F428D08EE10CD084E90AD010 -:103F700086E098CF813511F488E018D01DD080E11B -:103F800001D06ACF982F8091C00085FFFCCF90931D -:103F9000C60008958091C00087FFFCCF8091C000CB -:103FA00084FD01C0A8958091C6000895E0E6F0E088 -:103FB00098E1908380830895EDDF803219F088E0E6 -:103FC000F5DFFFCF84E1DECF1F93182FE3DF115021 -:103FD000E9F7F2DF1F91089580E0E8DFEE27FF2781 -:023FE000099442 -:023FFE000304BA -:0400000300003E00BB -:00000001FF diff --git a/bootloaders/optiboot/optiboot_pro_8MHz.lst b/bootloaders/optiboot/optiboot_pro_8MHz.lst deleted file mode 100644 index 1fb903c..0000000 --- a/bootloaders/optiboot/optiboot_pro_8MHz.lst +++ /dev/null @@ -1,571 +0,0 @@ - -optiboot_pro_8MHz.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001e2 00003e00 00003e00 00000054 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 00000236 2**0 - CONTENTS, READONLY - 2 .debug_aranges 00000028 00000000 00000000 00000238 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 0000005f 00000000 00000000 00000260 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 0000028e 00000000 00000000 000002bf 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 00000171 00000000 00000000 0000054d 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000045e 00000000 00000000 000006be 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000b1c 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000149 00000000 00000000 00000b9c 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 0000027e 00000000 00000000 00000ce5 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000060 00000000 00000000 00000f63 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00003e00
: -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3e00: 11 24 eor r1, r1 -#ifdef __AVR_ATmega8__ - SP=RAMEND; // This is done by hardware reset -#endif - - // Adaboot no-wait mod - ch = MCUSR; - 3e02: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - 3e04: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(); - 3e06: 81 ff sbrs r24, 1 - 3e08: e7 d0 rcall .+462 ; 0x3fd8 - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 3e0a: 85 e0 ldi r24, 0x05 ; 5 - 3e0c: 80 93 81 00 sts 0x0081, r24 - UCSRA = _BV(U2X); //Double speed mode USART - UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx - UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 - UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); -#else - UCSR0A = _BV(U2X0); //Double speed mode USART0 - 3e10: 82 e0 ldi r24, 0x02 ; 2 - 3e12: 80 93 c0 00 sts 0x00C0, r24 - UCSR0B = _BV(RXEN0) | _BV(TXEN0); - 3e16: 88 e1 ldi r24, 0x18 ; 24 - 3e18: 80 93 c1 00 sts 0x00C1, r24 - UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); - 3e1c: 86 e0 ldi r24, 0x06 ; 6 - 3e1e: 80 93 c2 00 sts 0x00C2, r24 - UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e22: 88 e0 ldi r24, 0x08 ; 8 - 3e24: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 3e28: 8e e0 ldi r24, 0x0E ; 14 - 3e2a: c0 d0 rcall .+384 ; 0x3fac - - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 3e2c: 25 9a sbi 0x04, 5 ; 4 - 3e2e: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e30: 28 e1 ldi r18, 0x18 ; 24 - 3e32: 3e ef ldi r19, 0xFE ; 254 - TIFR1 = _BV(TOV1); - 3e34: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e36: 30 93 85 00 sts 0x0085, r19 - 3e3a: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 3e3e: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 3e40: b0 9b sbis 0x16, 0 ; 22 - 3e42: fe cf rjmp .-4 ; 0x3e40 -#ifdef __AVR_ATmega8__ - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 3e44: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3e46: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 3e48: 81 50 subi r24, 0x01 ; 1 - 3e4a: a9 f7 brne .-22 ; 0x3e36 - /* get character from UART */ - ch = getch(); - - if(ch == STK_GET_PARAMETER) { - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e4c: 99 24 eor r9, r9 - 3e4e: 93 94 inc r9 - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - addrPtr += 2; - } while (--ch); - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3e50: a5 e0 ldi r26, 0x05 ; 5 - 3e52: aa 2e mov r10, r26 - boot_spm_busy_wait(); - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3e54: f1 e1 ldi r31, 0x11 ; 17 - 3e56: bf 2e mov r11, r31 -#endif - - /* Forever loop */ - for (;;) { - /* get character from UART */ - ch = getch(); - 3e58: 9d d0 rcall .+314 ; 0x3f94 - - if(ch == STK_GET_PARAMETER) { - 3e5a: 81 34 cpi r24, 0x41 ; 65 - 3e5c: 21 f4 brne .+8 ; 0x3e66 - // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy - getNch(1); - 3e5e: 81 e0 ldi r24, 0x01 ; 1 - 3e60: b3 d0 rcall .+358 ; 0x3fc8 - putch(0x03); - 3e62: 83 e0 ldi r24, 0x03 ; 3 - 3e64: 1f c0 rjmp .+62 ; 0x3ea4 - } - else if(ch == STK_SET_DEVICE) { - 3e66: 82 34 cpi r24, 0x42 ; 66 - 3e68: 11 f4 brne .+4 ; 0x3e6e - // SET DEVICE is ignored - getNch(20); - 3e6a: 84 e1 ldi r24, 0x14 ; 20 - 3e6c: 03 c0 rjmp .+6 ; 0x3e74 - } - else if(ch == STK_SET_DEVICE_EXT) { - 3e6e: 85 34 cpi r24, 0x45 ; 69 - 3e70: 19 f4 brne .+6 ; 0x3e78 - // SET DEVICE EXT is ignored - getNch(5); - 3e72: 85 e0 ldi r24, 0x05 ; 5 - 3e74: a9 d0 rcall .+338 ; 0x3fc8 - 3e76: 83 c0 rjmp .+262 ; 0x3f7e - } - else if(ch == STK_LOAD_ADDRESS) { - 3e78: 85 35 cpi r24, 0x55 ; 85 - 3e7a: 79 f4 brne .+30 ; 0x3e9a - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 3e7c: 8b d0 rcall .+278 ; 0x3f94 - newAddress = (newAddress & 0xff) | (getch() << 8); - 3e7e: e8 2e mov r14, r24 - 3e80: ff 24 eor r15, r15 - 3e82: 88 d0 rcall .+272 ; 0x3f94 - 3e84: 08 2f mov r16, r24 - 3e86: 10 e0 ldi r17, 0x00 ; 0 - 3e88: 10 2f mov r17, r16 - 3e8a: 00 27 eor r16, r16 - 3e8c: 0e 29 or r16, r14 - 3e8e: 1f 29 or r17, r15 -#ifdef RAMPZ - // Transfer top bit to RAMPZ - RAMPZ = (newAddress & 0x8000) ? 1 : 0; -#endif - newAddress += newAddress; // Convert from word address to byte address - 3e90: 00 0f add r16, r16 - 3e92: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 3e94: 91 d0 rcall .+290 ; 0x3fb8 - 3e96: 68 01 movw r12, r16 - 3e98: 72 c0 rjmp .+228 ; 0x3f7e - } - else if(ch == STK_UNIVERSAL) { - 3e9a: 86 35 cpi r24, 0x56 ; 86 - 3e9c: 29 f4 brne .+10 ; 0x3ea8 - // UNIVERSAL command is ignored - getNch(4); - 3e9e: 84 e0 ldi r24, 0x04 ; 4 - 3ea0: 93 d0 rcall .+294 ; 0x3fc8 - putch(0x00); - 3ea2: 80 e0 ldi r24, 0x00 ; 0 - 3ea4: 6f d0 rcall .+222 ; 0x3f84 - 3ea6: 6b c0 rjmp .+214 ; 0x3f7e - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 3ea8: 84 36 cpi r24, 0x64 ; 100 - 3eaa: 09 f0 breq .+2 ; 0x3eae - 3eac: 42 c0 rjmp .+132 ; 0x3f32 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t *bufPtr; - uint16_t addrPtr; - - getch(); /* getlen() */ - 3eae: 72 d0 rcall .+228 ; 0x3f94 - length = getch(); - 3eb0: 71 d0 rcall .+226 ; 0x3f94 - 3eb2: 08 2f mov r16, r24 - getch(); - 3eb4: 6f d0 rcall .+222 ; 0x3f94 - - // If we are in RWW section, immediately start page erase - if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3eb6: 80 e0 ldi r24, 0x00 ; 0 - 3eb8: c8 16 cp r12, r24 - 3eba: 88 e3 ldi r24, 0x38 ; 56 - 3ebc: d8 06 cpc r13, r24 - 3ebe: 20 f4 brcc .+8 ; 0x3ec8 - 3ec0: 83 e0 ldi r24, 0x03 ; 3 - 3ec2: f6 01 movw r30, r12 - 3ec4: 87 bf out 0x37, r24 ; 55 - 3ec6: e8 95 spm - 3ec8: c0 e0 ldi r28, 0x00 ; 0 - 3eca: d1 e0 ldi r29, 0x01 ; 1 - - // While that is going on, read in page contents - bufPtr = buff; - do *bufPtr++ = getch(); - 3ecc: 63 d0 rcall .+198 ; 0x3f94 - 3ece: 89 93 st Y+, r24 - while (--length); - 3ed0: 0c 17 cp r16, r28 - 3ed2: e1 f7 brne .-8 ; 0x3ecc - - // If we are in NRWW section, page erase has to be delayed until now. - // Todo: Take RAMPZ into account - if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - 3ed4: f0 e0 ldi r31, 0x00 ; 0 - 3ed6: cf 16 cp r12, r31 - 3ed8: f8 e3 ldi r31, 0x38 ; 56 - 3eda: df 06 cpc r13, r31 - 3edc: 20 f0 brcs .+8 ; 0x3ee6 - 3ede: 83 e0 ldi r24, 0x03 ; 3 - 3ee0: f6 01 movw r30, r12 - 3ee2: 87 bf out 0x37, r24 ; 55 - 3ee4: e8 95 spm - - // Read command terminator, start reply - verifySpace(); - 3ee6: 68 d0 rcall .+208 ; 0x3fb8 - - // If only a partial page is to be programmed, the erase might not be complete. - // So check that here - boot_spm_busy_wait(); - 3ee8: 07 b6 in r0, 0x37 ; 55 - 3eea: 00 fc sbrc r0, 0 - 3eec: fd cf rjmp .-6 ; 0x3ee8 - 3eee: a6 01 movw r20, r12 - 3ef0: a0 e0 ldi r26, 0x00 ; 0 - 3ef2: b1 e0 ldi r27, 0x01 ; 1 - bufPtr = buff; - addrPtr = (uint16_t)(void*)address; - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - 3ef4: 2c 91 ld r18, X - 3ef6: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 3ef8: 11 96 adiw r26, 0x01 ; 1 - 3efa: 8c 91 ld r24, X - 3efc: 11 97 sbiw r26, 0x01 ; 1 - 3efe: 90 e0 ldi r25, 0x00 ; 0 - 3f00: 98 2f mov r25, r24 - 3f02: 88 27 eor r24, r24 - 3f04: 82 2b or r24, r18 - 3f06: 93 2b or r25, r19 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f08: 12 96 adiw r26, 0x02 ; 2 - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f0a: fa 01 movw r30, r20 - 3f0c: 0c 01 movw r0, r24 - 3f0e: 97 be out 0x37, r9 ; 55 - 3f10: e8 95 spm - 3f12: 11 24 eor r1, r1 - addrPtr += 2; - 3f14: 4e 5f subi r20, 0xFE ; 254 - 3f16: 5f 4f sbci r21, 0xFF ; 255 - } while (--ch); - 3f18: f1 e0 ldi r31, 0x01 ; 1 - 3f1a: a0 38 cpi r26, 0x80 ; 128 - 3f1c: bf 07 cpc r27, r31 - 3f1e: 51 f7 brne .-44 ; 0x3ef4 - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - 3f20: f6 01 movw r30, r12 - 3f22: a7 be out 0x37, r10 ; 55 - 3f24: e8 95 spm - boot_spm_busy_wait(); - 3f26: 07 b6 in r0, 0x37 ; 55 - 3f28: 00 fc sbrc r0, 0 - 3f2a: fd cf rjmp .-6 ; 0x3f26 - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3f2c: b7 be out 0x37, r11 ; 55 - 3f2e: e8 95 spm - 3f30: 26 c0 rjmp .+76 ; 0x3f7e -#endif - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 3f32: 84 37 cpi r24, 0x74 ; 116 - 3f34: b1 f4 brne .+44 ; 0x3f62 - // READ PAGE - we only read flash - getch(); /* getlen() */ - 3f36: 2e d0 rcall .+92 ; 0x3f94 - length = getch(); - 3f38: 2d d0 rcall .+90 ; 0x3f94 - 3f3a: f8 2e mov r15, r24 - getch(); - 3f3c: 2b d0 rcall .+86 ; 0x3f94 - - verifySpace(); - 3f3e: 3c d0 rcall .+120 ; 0x3fb8 - 3f40: f6 01 movw r30, r12 - 3f42: ef 2c mov r14, r15 - putch(result); - address++; - } - while (--length); -#else - do putch(pgm_read_byte_near(address++)); - 3f44: 8f 01 movw r16, r30 - 3f46: 0f 5f subi r16, 0xFF ; 255 - 3f48: 1f 4f sbci r17, 0xFF ; 255 - 3f4a: 84 91 lpm r24, Z+ - 3f4c: 1b d0 rcall .+54 ; 0x3f84 - while (--length); - 3f4e: ea 94 dec r14 - 3f50: f8 01 movw r30, r16 - 3f52: c1 f7 brne .-16 ; 0x3f44 -#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - -/* main program starts here */ -int main(void) { - 3f54: 08 94 sec - 3f56: c1 1c adc r12, r1 - 3f58: d1 1c adc r13, r1 - 3f5a: fa 94 dec r15 - 3f5c: cf 0c add r12, r15 - 3f5e: d1 1c adc r13, r1 - 3f60: 0e c0 rjmp .+28 ; 0x3f7e -#endif -#endif - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 3f62: 85 37 cpi r24, 0x75 ; 117 - 3f64: 39 f4 brne .+14 ; 0x3f74 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 3f66: 28 d0 rcall .+80 ; 0x3fb8 - putch(SIGNATURE_0); - 3f68: 8e e1 ldi r24, 0x1E ; 30 - 3f6a: 0c d0 rcall .+24 ; 0x3f84 - putch(SIGNATURE_1); - 3f6c: 84 e9 ldi r24, 0x94 ; 148 - 3f6e: 0a d0 rcall .+20 ; 0x3f84 - putch(SIGNATURE_2); - 3f70: 86 e0 ldi r24, 0x06 ; 6 - 3f72: 98 cf rjmp .-208 ; 0x3ea4 - } - else if (ch == 'Q') { - 3f74: 81 35 cpi r24, 0x51 ; 81 - 3f76: 11 f4 brne .+4 ; 0x3f7c - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 3f78: 88 e0 ldi r24, 0x08 ; 8 - 3f7a: 18 d0 rcall .+48 ; 0x3fac - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 3f7c: 1d d0 rcall .+58 ; 0x3fb8 - } - putch(STK_OK); - 3f7e: 80 e1 ldi r24, 0x10 ; 16 - 3f80: 01 d0 rcall .+2 ; 0x3f84 - 3f82: 6a cf rjmp .-300 ; 0x3e58 - -00003f84 : - } -} - -void putch(char ch) { - 3f84: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UCSR0A & _BV(UDRE0))); - 3f86: 80 91 c0 00 lds r24, 0x00C0 - 3f8a: 85 ff sbrs r24, 5 - 3f8c: fc cf rjmp .-8 ; 0x3f86 - UDR0 = ch; - 3f8e: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 3f92: 08 95 ret - -00003f94 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UCSR0A & _BV(RXC0))) - 3f94: 80 91 c0 00 lds r24, 0x00C0 - 3f98: 87 ff sbrs r24, 7 - 3f9a: fc cf rjmp .-8 ; 0x3f94 - ; - if (!(UCSR0A & _BV(FE0))) { - 3f9c: 80 91 c0 00 lds r24, 0x00C0 - 3fa0: 84 fd sbrc r24, 4 - 3fa2: 01 c0 rjmp .+2 ; 0x3fa6 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3fa4: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UDR0; - 3fa6: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 3faa: 08 95 ret - -00003fac : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 3fac: e0 e6 ldi r30, 0x60 ; 96 - 3fae: f0 e0 ldi r31, 0x00 ; 0 - 3fb0: 98 e1 ldi r25, 0x18 ; 24 - 3fb2: 90 83 st Z, r25 - WDTCSR = x; - 3fb4: 80 83 st Z, r24 -} - 3fb6: 08 95 ret - -00003fb8 : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 3fb8: ed df rcall .-38 ; 0x3f94 - 3fba: 80 32 cpi r24, 0x20 ; 32 - 3fbc: 19 f0 breq .+6 ; 0x3fc4 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fbe: 88 e0 ldi r24, 0x08 ; 8 - 3fc0: f5 df rcall .-22 ; 0x3fac - 3fc2: ff cf rjmp .-2 ; 0x3fc2 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 3fc4: 84 e1 ldi r24, 0x14 ; 20 -} - 3fc6: de cf rjmp .-68 ; 0x3f84 - -00003fc8 : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 3fc8: 1f 93 push r17 - 3fca: 18 2f mov r17, r24 - do getch(); while (--count); - 3fcc: e3 df rcall .-58 ; 0x3f94 - 3fce: 11 50 subi r17, 0x01 ; 1 - 3fd0: e9 f7 brne .-6 ; 0x3fcc - verifySpace(); - 3fd2: f2 df rcall .-28 ; 0x3fb8 -} - 3fd4: 1f 91 pop r17 - 3fd6: 08 95 ret - -00003fd8 : - WDTCSR = _BV(WDCE) | _BV(WDE); - WDTCSR = x; -} - -void appStart() { - watchdogConfig(WATCHDOG_OFF); - 3fd8: 80 e0 ldi r24, 0x00 ; 0 - 3fda: e8 df rcall .-48 ; 0x3fac - __asm__ __volatile__ ( - 3fdc: ee 27 eor r30, r30 - 3fde: ff 27 eor r31, r31 - 3fe0: 09 94 ijmp -- cgit v1.2.3-18-g5258