diff --git a/optiboot/bootloaders/optiboot/Makefile b/optiboot/bootloaders/optiboot/Makefile index 80be67ffe..647483dd3 100644 --- a/optiboot/bootloaders/optiboot/Makefile +++ b/optiboot/bootloaders/optiboot/Makefile @@ -493,6 +493,17 @@ atmega328_pro8_isp: LFUSE ?= FF atmega328_pro8_isp: EFUSE ?= 05 atmega328_pro8_isp: isp +bean: CHIP = atmega328 +bean: + $(MAKE) $(CHIP) AVR_FREQ=8000000L LED_START_FLASHES=0 + mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_BEAN.hex + mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_BEAN.lst +bplus: CHIP = atmega328 +bplus: + $(MAKE) $(CHIP) AVR_FREQ=16000000L LED_START_FLASHES=0 + mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_BPLUS.hex + mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_BPLUS.lst + # # Include additional platforms include Makefile.extras diff --git a/optiboot/bootloaders/optiboot/optiboot_BEAN.hex b/optiboot/bootloaders/optiboot/optiboot_BEAN.hex new file mode 100644 index 000000000..50a128bff --- /dev/null +++ b/optiboot/bootloaders/optiboot/optiboot_BEAN.hex @@ -0,0 +1,30 @@ +:107E00001F92CDB7DEB7112484B714BE982F9D7092 +:107E100009F0C4D082E08093C00088E18093C10063 +:107E200086E08093C20088E08093C4008EE0A1D0F9 +:107E3000812C912C93E0F92EEE24E39425E0D22EB0 +:107E400031E1C32E8AD0813479F487D0898397D0E9 +:107E50008981823811F482E005C0813811F486E00E +:107E600001C083E073D06FC0823411F484E103C099 +:107E7000853419F485E08BD066C0853541F46DD02A +:107E8000882E6BD0912C982A880C991C5BC0863563 +:107E900021F484E07CD080E0E5CF843609F036C060 +:107EA0005CD05BD0B82E59D0A82E00E011E055D0A0 +:107EB000F80181938F01BE12FACF61D0F5E4AF12C1 +:107EC00001C0FFCFF401F7BEE89507B600FCFDCF77 +:107ED000B401A0E0B1E02C911296AD0141505109DE +:107EE000FA01808130E0382BFB010901E7BEE895FB +:107EF00011246E5F7F4FBA12EECFF401D7BEE89522 +:107F000007B600FCFDCFC7BEE8951DC0843769F4F5 +:107F100024D023D0B82E21D032D08401F80185910D +:107F20008F0114D0BA94D1F70EC0853739F427D019 +:107F30008EE10CD085E90AD08FE094CF813511F421 +:107F400088E017D01CD080E101D07CCF9091C00098 +:107F500095FFFCCF8093C60008958091C00087FFF5 +:107F6000FCCF8091C00084FD01C0A8958091C6001F +:107F70000895E0E6F0E098E1908380830895EDDFD6 +:107F8000803219F088E0F5DFFFCF84E1DFCFCF93B7 +:107F9000C82FE3DFC150E9F7CF91F1CF282E80E061 +:087FA000E8DFE0E0FF2709948F +:027FFE00020679 +:0400000300007E007B +:00000001FF diff --git a/optiboot/bootloaders/optiboot/optiboot_BEAN.lst b/optiboot/bootloaders/optiboot/optiboot_BEAN.lst new file mode 100644 index 000000000..8f1b007a2 --- /dev/null +++ b/optiboot/bootloaders/optiboot/optiboot_BEAN.lst @@ -0,0 +1,531 @@ + +optiboot_atmega328.elf: file format elf32-avr + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .data 00000000 00800100 00007fa8 0000023c 2**0 + CONTENTS, ALLOC, LOAD, DATA + 1 .text 000001a8 00007e00 00007e00 00000094 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 2 .version 00000002 00007ffe 00007ffe 0000023c 2**0 + CONTENTS, ALLOC, LOAD, READONLY, DATA + 3 .comment 00000011 00000000 00000000 0000023e 2**0 + CONTENTS, READONLY + 4 .debug_aranges 00000028 00000000 00000000 0000024f 2**0 + CONTENTS, READONLY, DEBUGGING + 5 .debug_info 0000054a 00000000 00000000 00000277 2**0 + CONTENTS, READONLY, DEBUGGING + 6 .debug_abbrev 0000024b 00000000 00000000 000007c1 2**0 + CONTENTS, READONLY, DEBUGGING + 7 .debug_line 000002e5 00000000 00000000 00000a0c 2**0 + CONTENTS, READONLY, DEBUGGING + 8 .debug_frame 00000094 00000000 00000000 00000cf4 2**2 + CONTENTS, READONLY, DEBUGGING + 9 .debug_str 000001d7 00000000 00000000 00000d88 2**0 + CONTENTS, READONLY, DEBUGGING + 10 .debug_loc 00000383 00000000 00000000 00000f5f 2**0 + CONTENTS, READONLY, DEBUGGING + 11 .debug_ranges 00000078 00000000 00000000 000012e2 2**0 + CONTENTS, READONLY, DEBUGGING + +Disassembly of section .text: + +00007e00
: +#define appstart_vec (0) +#endif // VIRTUAL_BOOT_PARTITION + + +/* main program starts here */ +int main(void) { + 7e00: 1f 92 push r1 + 7e02: cd b7 in r28, 0x3d ; 61 + 7e04: de b7 in r29, 0x3e ; 62 + // SP points to RAMEND + // r1 contains zero + // + // If not, uncomment the following instructions: + // cli(); + asm volatile ("clr __zero_reg__"); + 7e06: 11 24 eor r1, r1 + * modified Adaboot no-wait mod. + * Pass the reset reason to app. Also, it appears that an Uno poweron + * can leave multiple reset flags set; we only want the bootloader to + * run on an 'external reset only' status + */ + ch = MCUSR; + 7e08: 84 b7 in r24, 0x34 ; 52 + MCUSR = 0; + 7e0a: 14 be out 0x34, r1 ; 52 + if (ch & (_BV(WDRF) | _BV(BORF) | _BV(PORF))) + 7e0c: 98 2f mov r25, r24 + 7e0e: 9d 70 andi r25, 0x0D ; 13 + 7e10: 09 f0 breq .+2 ; 0x7e14 + appStart(ch); + 7e12: c4 d0 rcall .+392 ; 0x7f9c + 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 + UART_SRA = _BV(U2X0); //Double speed mode USART0 + 7e14: 82 e0 ldi r24, 0x02 ; 2 + 7e16: 80 93 c0 00 sts 0x00C0, r24 + UART_SRB = _BV(RXEN0) | _BV(TXEN0); + 7e1a: 88 e1 ldi r24, 0x18 ; 24 + 7e1c: 80 93 c1 00 sts 0x00C1, r24 + UART_SRC = _BV(UCSZ00) | _BV(UCSZ01); + 7e20: 86 e0 ldi r24, 0x06 ; 6 + 7e22: 80 93 c2 00 sts 0x00C2, r24 + UART_SRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); + 7e26: 88 e0 ldi r24, 0x08 ; 8 + 7e28: 80 93 c4 00 sts 0x00C4, r24 +#endif +#endif + + // Set up watchdog to trigger after 1s + watchdogConfig(WATCHDOG_1S); + 7e2c: 8e e0 ldi r24, 0x0E ; 14 + 7e2e: a1 d0 rcall .+322 ; 0x7f72 + * 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 = 0; + 7e30: 81 2c mov r8, r1 + 7e32: 91 2c mov r9, r1 + * Start the page erase and wait for it to finish. There + * used to be code to do this while receiving the data over + * the serial link, but the performance improvement was slight, + * and we needed the space back. + */ + __boot_page_erase_short((uint16_t)(void*)address); + 7e34: 93 e0 ldi r25, 0x03 ; 3 + 7e36: f9 2e mov r15, r25 + */ + do { + uint16_t a; + a = *bufPtr++; + a |= (*bufPtr++) << 8; + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); + 7e38: ee 24 eor r14, r14 + 7e3a: e3 94 inc r14 + } while (len -= 2); + + /* + * Actually Write the buffer to flash (and wait for it to finish.) + */ + __boot_page_write_short((uint16_t)(void*)address); + 7e3c: 25 e0 ldi r18, 0x05 ; 5 + 7e3e: d2 2e mov r13, r18 + boot_spm_busy_wait(); +#if defined(RWWSRE) + // Reenable read access to flash + boot_rww_enable(); + 7e40: 31 e1 ldi r19, 0x11 ; 17 + 7e42: c3 2e mov r12, r19 +#endif + + /* Forever loop: exits by causing WDT reset */ + for (;;) { + /* get character from UART */ + ch = getch(); + 7e44: 8a d0 rcall .+276 ; 0x7f5a + + if(ch == STK_GET_PARAMETER) { + 7e46: 81 34 cpi r24, 0x41 ; 65 + 7e48: 79 f4 brne .+30 ; 0x7e68 + unsigned char which = getch(); + 7e4a: 87 d0 rcall .+270 ; 0x7f5a + verifySpace(); + 7e4c: 89 83 std Y+1, r24 ; 0x01 + 7e4e: 97 d0 rcall .+302 ; 0x7f7e + /* + * Send optiboot version as "SW version" + * Note that the references to memory are optimized away. + */ + if (which == 0x82) { + 7e50: 89 81 ldd r24, Y+1 ; 0x01 + 7e52: 82 38 cpi r24, 0x82 ; 130 + 7e54: 11 f4 brne .+4 ; 0x7e5a + putch(optiboot_version & 0xFF); + 7e56: 82 e0 ldi r24, 0x02 ; 2 + 7e58: 05 c0 rjmp .+10 ; 0x7e64 + } else if (which == 0x81) { + 7e5a: 81 38 cpi r24, 0x81 ; 129 + 7e5c: 11 f4 brne .+4 ; 0x7e62 + putch(optiboot_version >> 8); + 7e5e: 86 e0 ldi r24, 0x06 ; 6 + 7e60: 01 c0 rjmp .+2 ; 0x7e64 + } else { + /* + * GET PARAMETER returns a generic 0x03 reply for + * other parameters - enough to keep Avrdude happy + */ + putch(0x03); + 7e62: 83 e0 ldi r24, 0x03 ; 3 + 7e64: 73 d0 rcall .+230 ; 0x7f4c + 7e66: 6f c0 rjmp .+222 ; 0x7f46 + } + } + else if(ch == STK_SET_DEVICE) { + 7e68: 82 34 cpi r24, 0x42 ; 66 + 7e6a: 11 f4 brne .+4 ; 0x7e70 + // SET DEVICE is ignored + getNch(20); + 7e6c: 84 e1 ldi r24, 0x14 ; 20 + 7e6e: 03 c0 rjmp .+6 ; 0x7e76 + } + else if(ch == STK_SET_DEVICE_EXT) { + 7e70: 85 34 cpi r24, 0x45 ; 69 + 7e72: 19 f4 brne .+6 ; 0x7e7a + // SET DEVICE EXT is ignored + getNch(5); + 7e74: 85 e0 ldi r24, 0x05 ; 5 + 7e76: 8b d0 rcall .+278 ; 0x7f8e + 7e78: 66 c0 rjmp .+204 ; 0x7f46 + } + else if(ch == STK_LOAD_ADDRESS) { + 7e7a: 85 35 cpi r24, 0x55 ; 85 + 7e7c: 41 f4 brne .+16 ; 0x7e8e + // LOAD ADDRESS + uint16_t newAddress; + newAddress = getch(); + 7e7e: 6d d0 rcall .+218 ; 0x7f5a + 7e80: 88 2e mov r8, r24 + newAddress = (newAddress & 0xff) | (getch() << 8); + 7e82: 6b d0 rcall .+214 ; 0x7f5a + 7e84: 91 2c mov r9, r1 + 7e86: 98 2a or r9, r24 +#ifdef RAMPZ + // Transfer top bit to RAMPZ + RAMPZ = (newAddress & 0x8000) ? 1 : 0; +#endif + newAddress += newAddress; // Convert from word address to byte address + 7e88: 88 0c add r8, r8 + 7e8a: 99 1c adc r9, r9 + 7e8c: 5b c0 rjmp .+182 ; 0x7f44 + address = newAddress; + verifySpace(); + } + else if(ch == STK_UNIVERSAL) { + 7e8e: 86 35 cpi r24, 0x56 ; 86 + 7e90: 21 f4 brne .+8 ; 0x7e9a + // UNIVERSAL command is ignored + getNch(4); + 7e92: 84 e0 ldi r24, 0x04 ; 4 + 7e94: 7c d0 rcall .+248 ; 0x7f8e + putch(0x00); + 7e96: 80 e0 ldi r24, 0x00 ; 0 + 7e98: e5 cf rjmp .-54 ; 0x7e64 + } + /* Write memory, length is big endian and is in bytes */ + else if(ch == STK_PROG_PAGE) { + 7e9a: 84 36 cpi r24, 0x64 ; 100 + 7e9c: 09 f0 breq .+2 ; 0x7ea0 + 7e9e: 36 c0 rjmp .+108 ; 0x7f0c + // PROGRAM PAGE - we support flash programming only, not EEPROM + uint8_t desttype; + uint8_t *bufPtr; + pagelen_t savelength; + + GETLENGTH(length); + 7ea0: 5c d0 rcall .+184 ; 0x7f5a + 7ea2: 5b d0 rcall .+182 ; 0x7f5a + 7ea4: b8 2e mov r11, r24 + savelength = length; + desttype = getch(); + 7ea6: 59 d0 rcall .+178 ; 0x7f5a + 7ea8: a8 2e mov r10, r24 + 7eaa: 00 e0 ldi r16, 0x00 ; 0 + 7eac: 11 e0 ldi r17, 0x01 ; 1 + + // read a page worth of contents + bufPtr = buff; + do *bufPtr++ = getch(); + 7eae: 55 d0 rcall .+170 ; 0x7f5a + 7eb0: f8 01 movw r30, r16 + 7eb2: 81 93 st Z+, r24 + 7eb4: 8f 01 movw r16, r30 + while (--length); + 7eb6: be 12 cpse r11, r30 + 7eb8: fa cf rjmp .-12 ; 0x7eae + + // Read command terminator, start reply + verifySpace(); + 7eba: 61 d0 rcall .+194 ; 0x7f7e + * void writebuffer(memtype, buffer, address, length) + */ +static inline void writebuffer(int8_t memtype, uint8_t *mybuff, + uint16_t address, pagelen_t len) +{ + switch (memtype) { + 7ebc: f5 e4 ldi r31, 0x45 ; 69 + 7ebe: af 12 cpse r10, r31 + 7ec0: 01 c0 rjmp .+2 ; 0x7ec4 + 7ec2: ff cf rjmp .-2 ; 0x7ec2 + * Start the page erase and wait for it to finish. There + * used to be code to do this while receiving the data over + * the serial link, but the performance improvement was slight, + * and we needed the space back. + */ + __boot_page_erase_short((uint16_t)(void*)address); + 7ec4: f4 01 movw r30, r8 + 7ec6: f7 be out 0x37, r15 ; 55 + 7ec8: e8 95 spm + boot_spm_busy_wait(); + 7eca: 07 b6 in r0, 0x37 ; 55 + 7ecc: 00 fc sbrc r0, 0 + 7ece: fd cf rjmp .-6 ; 0x7eca + 7ed0: b4 01 movw r22, r8 + 7ed2: a0 e0 ldi r26, 0x00 ; 0 + 7ed4: b1 e0 ldi r27, 0x01 ; 1 + /* + * Copy data from the buffer into the flash write buffer. + */ + do { + uint16_t a; + a = *bufPtr++; + 7ed6: 2c 91 ld r18, X + 7ed8: 12 96 adiw r26, 0x02 ; 2 + 7eda: ad 01 movw r20, r26 + 7edc: 41 50 subi r20, 0x01 ; 1 + 7ede: 51 09 sbc r21, r1 + a |= (*bufPtr++) << 8; + 7ee0: fa 01 movw r30, r20 + 7ee2: 80 81 ld r24, Z + 7ee4: 30 e0 ldi r19, 0x00 ; 0 + 7ee6: 38 2b or r19, r24 + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); + 7ee8: fb 01 movw r30, r22 + 7eea: 09 01 movw r0, r18 + 7eec: e7 be out 0x37, r14 ; 55 + 7eee: e8 95 spm + 7ef0: 11 24 eor r1, r1 + addrPtr += 2; + 7ef2: 6e 5f subi r22, 0xFE ; 254 + 7ef4: 7f 4f sbci r23, 0xFF ; 255 + } while (len -= 2); + 7ef6: ba 12 cpse r11, r26 + 7ef8: ee cf rjmp .-36 ; 0x7ed6 + + /* + * Actually Write the buffer to flash (and wait for it to finish.) + */ + __boot_page_write_short((uint16_t)(void*)address); + 7efa: f4 01 movw r30, r8 + 7efc: d7 be out 0x37, r13 ; 55 + 7efe: e8 95 spm + boot_spm_busy_wait(); + 7f00: 07 b6 in r0, 0x37 ; 55 + 7f02: 00 fc sbrc r0, 0 + 7f04: fd cf rjmp .-6 ; 0x7f00 +#if defined(RWWSRE) + // Reenable read access to flash + boot_rww_enable(); + 7f06: c7 be out 0x37, r12 ; 55 + 7f08: e8 95 spm + 7f0a: 1d c0 rjmp .+58 ; 0x7f46 + writebuffer(desttype, buff, address, savelength); + + + } + /* Read memory block mode, length is big endian. */ + else if(ch == STK_READ_PAGE) { + 7f0c: 84 37 cpi r24, 0x74 ; 116 + 7f0e: 69 f4 brne .+26 ; 0x7f2a + uint8_t desttype; + GETLENGTH(length); + 7f10: 24 d0 rcall .+72 ; 0x7f5a + 7f12: 23 d0 rcall .+70 ; 0x7f5a + 7f14: b8 2e mov r11, r24 + + desttype = getch(); + 7f16: 21 d0 rcall .+66 ; 0x7f5a + + verifySpace(); + 7f18: 32 d0 rcall .+100 ; 0x7f7e + 7f1a: 84 01 movw r16, r8 + __asm__ ("elpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); +#else + // read a Flash byte and increment the address + __asm__ ("lpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); +#endif + putch(ch); + 7f1c: f8 01 movw r30, r16 + 7f1e: 85 91 lpm r24, Z+ + 7f20: 8f 01 movw r16, r30 + 7f22: 14 d0 rcall .+40 ; 0x7f4c + } while (--length); + 7f24: ba 94 dec r11 + 7f26: d1 f7 brne .-12 ; 0x7f1c + 7f28: 0e c0 rjmp .+28 ; 0x7f46 + + read_mem(desttype, address, length); + } + + /* Get device signature bytes */ + else if(ch == STK_READ_SIGN) { + 7f2a: 85 37 cpi r24, 0x75 ; 117 + 7f2c: 39 f4 brne .+14 ; 0x7f3c + // READ SIGN - return what Avrdude wants to hear + verifySpace(); + 7f2e: 27 d0 rcall .+78 ; 0x7f7e + putch(SIGNATURE_0); + 7f30: 8e e1 ldi r24, 0x1E ; 30 + 7f32: 0c d0 rcall .+24 ; 0x7f4c + putch(SIGNATURE_1); + 7f34: 85 e9 ldi r24, 0x95 ; 149 + 7f36: 0a d0 rcall .+20 ; 0x7f4c + putch(SIGNATURE_2); + 7f38: 8f e0 ldi r24, 0x0F ; 15 + 7f3a: 94 cf rjmp .-216 ; 0x7e64 + } + else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */ + 7f3c: 81 35 cpi r24, 0x51 ; 81 + 7f3e: 11 f4 brne .+4 ; 0x7f44 + // Adaboot no-wait mod + watchdogConfig(WATCHDOG_16MS); + 7f40: 88 e0 ldi r24, 0x08 ; 8 + 7f42: 17 d0 rcall .+46 ; 0x7f72 + verifySpace(); + } + else { + // This covers the response to commands like STK_ENTER_PROGMODE + verifySpace(); + 7f44: 1c d0 rcall .+56 ; 0x7f7e + } + putch(STK_OK); + 7f46: 80 e1 ldi r24, 0x10 ; 16 + 7f48: 01 d0 rcall .+2 ; 0x7f4c + } + 7f4a: 7c cf rjmp .-264 ; 0x7e44 + +00007f4c : +} + +void putch(char ch) { +#ifndef SOFT_UART + while (!(UART_SRA & _BV(UDRE0))); + 7f4c: 90 91 c0 00 lds r25, 0x00C0 + 7f50: 95 ff sbrs r25, 5 + 7f52: fc cf rjmp .-8 ; 0x7f4c + UART_UDR = ch; + 7f54: 80 93 c6 00 sts 0x00C6, r24 + 7f58: 08 95 ret + +00007f5a : + [uartBit] "I" (UART_RX_BIT) + : + "r25" +); +#else + while(!(UART_SRA & _BV(RXC0))) + 7f5a: 80 91 c0 00 lds r24, 0x00C0 + 7f5e: 87 ff sbrs r24, 7 + 7f60: fc cf rjmp .-8 ; 0x7f5a + ; + if (!(UART_SRA & _BV(FE0))) { + 7f62: 80 91 c0 00 lds r24, 0x00C0 + 7f66: 84 fd sbrc r24, 4 + 7f68: 01 c0 rjmp .+2 ; 0x7f6c +} +#endif + +// Watchdog functions. These are only safe with interrupts turned off. +void watchdogReset() { + __asm__ __volatile__ ( + 7f6a: a8 95 wdr + * don't care that an invalid char is returned...) + */ + watchdogReset(); + } + + ch = UART_UDR; + 7f6c: 80 91 c6 00 lds r24, 0x00C6 + LED_PIN |= _BV(LED); +#endif +#endif + + return ch; +} + 7f70: 08 95 ret + +00007f72 : + "wdr\n" + ); +} + +void watchdogConfig(uint8_t x) { + WDTCSR = _BV(WDCE) | _BV(WDE); + 7f72: e0 e6 ldi r30, 0x60 ; 96 + 7f74: f0 e0 ldi r31, 0x00 ; 0 + 7f76: 98 e1 ldi r25, 0x18 ; 24 + 7f78: 90 83 st Z, r25 + WDTCSR = x; + 7f7a: 80 83 st Z, r24 + 7f7c: 08 95 ret + +00007f7e : + do getch(); while (--count); + verifySpace(); +} + +void verifySpace() { + if (getch() != CRC_EOP) { + 7f7e: ed df rcall .-38 ; 0x7f5a + 7f80: 80 32 cpi r24, 0x20 ; 32 + 7f82: 19 f0 breq .+6 ; 0x7f8a + watchdogConfig(WATCHDOG_16MS); // shorten WD timeout + 7f84: 88 e0 ldi r24, 0x08 ; 8 + 7f86: f5 df rcall .-22 ; 0x7f72 + 7f88: ff cf rjmp .-2 ; 0x7f88 + while (1) // and busy-loop so that WD causes + ; // a reset and app start. + } + putch(STK_INSYNC); + 7f8a: 84 e1 ldi r24, 0x14 ; 20 + 7f8c: df cf rjmp .-66 ; 0x7f4c + +00007f8e : + ::[count] "M" (UART_B_VALUE) + ); +} +#endif + +void getNch(uint8_t count) { + 7f8e: cf 93 push r28 + 7f90: c8 2f mov r28, r24 + do getch(); while (--count); + 7f92: e3 df rcall .-58 ; 0x7f5a + 7f94: c1 50 subi r28, 0x01 ; 1 + 7f96: e9 f7 brne .-6 ; 0x7f92 + verifySpace(); +} + 7f98: cf 91 pop r28 +} +#endif + +void getNch(uint8_t count) { + do getch(); while (--count); + verifySpace(); + 7f9a: f1 cf rjmp .-30 ; 0x7f7e + +00007f9c : + +void appStart(uint8_t rstFlags) { + // save the reset flags in the designated register + // This can be saved in a main program by putting code in .init0 (which + // executes before normal c init code) to save R2 to a global variable. + __asm__ __volatile__ ("mov r2, %0\n" :: "r" (rstFlags)); + 7f9c: 28 2e mov r2, r24 + + watchdogConfig(WATCHDOG_OFF); + 7f9e: 80 e0 ldi r24, 0x00 ; 0 + 7fa0: e8 df rcall .-48 ; 0x7f72 + // Note that appstart_vec is defined so that this works with either + // real or virtual boot partitions. + __asm__ __volatile__ ( + 7fa2: e0 e0 ldi r30, 0x00 ; 0 + 7fa4: ff 27 eor r31, r31 + 7fa6: 09 94 ijmp diff --git a/optiboot/bootloaders/optiboot/optiboot_BPLUS.hex b/optiboot/bootloaders/optiboot/optiboot_BPLUS.hex new file mode 100644 index 000000000..ad7728780 --- /dev/null +++ b/optiboot/bootloaders/optiboot/optiboot_BPLUS.hex @@ -0,0 +1,30 @@ +:107E00001F92CDB7DEB7112484B714BE982F9D7092 +:107E100009F0C4D082E08093C00088E18093C10063 +:107E200086E08093C20080E18093C4008EE0A1D000 +:107E3000812C912C93E0F92EEE24E39425E0D22EB0 +:107E400031E1C32E8AD0813479F487D0898397D0E9 +:107E50008981823811F482E005C0813811F486E00E +:107E600001C083E073D06FC0823411F484E103C099 +:107E7000853419F485E08BD066C0853541F46DD02A +:107E8000882E6BD0912C982A880C991C5BC0863563 +:107E900021F484E07CD080E0E5CF843609F036C060 +:107EA0005CD05BD0B82E59D0A82E00E011E055D0A0 +:107EB000F80181938F01BE12FACF61D0F5E4AF12C1 +:107EC00001C0FFCFF401F7BEE89507B600FCFDCF77 +:107ED000B401A0E0B1E02C911296AD0141505109DE +:107EE000FA01808130E0382BFB010901E7BEE895FB +:107EF00011246E5F7F4FBA12EECFF401D7BEE89522 +:107F000007B600FCFDCFC7BEE8951DC0843769F4F5 +:107F100024D023D0B82E21D032D08401F80185910D +:107F20008F0114D0BA94D1F70EC0853739F427D019 +:107F30008EE10CD085E90AD08FE094CF813511F421 +:107F400088E017D01CD080E101D07CCF9091C00098 +:107F500095FFFCCF8093C60008958091C00087FFF5 +:107F6000FCCF8091C00084FD01C0A8958091C6001F +:107F70000895E0E6F0E098E1908380830895EDDFD6 +:107F8000803219F088E0F5DFFFCF84E1DFCFCF93B7 +:107F9000C82FE3DFC150E9F7CF91F1CF282E80E061 +:087FA000E8DFE0E0FF2709948F +:027FFE00020679 +:0400000300007E007B +:00000001FF diff --git a/optiboot/bootloaders/optiboot/optiboot_BPLUS.lst b/optiboot/bootloaders/optiboot/optiboot_BPLUS.lst new file mode 100644 index 000000000..0a168bff4 --- /dev/null +++ b/optiboot/bootloaders/optiboot/optiboot_BPLUS.lst @@ -0,0 +1,531 @@ + +optiboot_atmega328.elf: file format elf32-avr + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .data 00000000 00800100 00007fa8 0000023c 2**0 + CONTENTS, ALLOC, LOAD, DATA + 1 .text 000001a8 00007e00 00007e00 00000094 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 2 .version 00000002 00007ffe 00007ffe 0000023c 2**0 + CONTENTS, ALLOC, LOAD, READONLY, DATA + 3 .comment 00000011 00000000 00000000 0000023e 2**0 + CONTENTS, READONLY + 4 .debug_aranges 00000028 00000000 00000000 0000024f 2**0 + CONTENTS, READONLY, DEBUGGING + 5 .debug_info 0000054a 00000000 00000000 00000277 2**0 + CONTENTS, READONLY, DEBUGGING + 6 .debug_abbrev 0000024b 00000000 00000000 000007c1 2**0 + CONTENTS, READONLY, DEBUGGING + 7 .debug_line 000002e5 00000000 00000000 00000a0c 2**0 + CONTENTS, READONLY, DEBUGGING + 8 .debug_frame 00000094 00000000 00000000 00000cf4 2**2 + CONTENTS, READONLY, DEBUGGING + 9 .debug_str 000001d7 00000000 00000000 00000d88 2**0 + CONTENTS, READONLY, DEBUGGING + 10 .debug_loc 00000383 00000000 00000000 00000f5f 2**0 + CONTENTS, READONLY, DEBUGGING + 11 .debug_ranges 00000078 00000000 00000000 000012e2 2**0 + CONTENTS, READONLY, DEBUGGING + +Disassembly of section .text: + +00007e00
: +#define appstart_vec (0) +#endif // VIRTUAL_BOOT_PARTITION + + +/* main program starts here */ +int main(void) { + 7e00: 1f 92 push r1 + 7e02: cd b7 in r28, 0x3d ; 61 + 7e04: de b7 in r29, 0x3e ; 62 + // SP points to RAMEND + // r1 contains zero + // + // If not, uncomment the following instructions: + // cli(); + asm volatile ("clr __zero_reg__"); + 7e06: 11 24 eor r1, r1 + * modified Adaboot no-wait mod. + * Pass the reset reason to app. Also, it appears that an Uno poweron + * can leave multiple reset flags set; we only want the bootloader to + * run on an 'external reset only' status + */ + ch = MCUSR; + 7e08: 84 b7 in r24, 0x34 ; 52 + MCUSR = 0; + 7e0a: 14 be out 0x34, r1 ; 52 + if (ch & (_BV(WDRF) | _BV(BORF) | _BV(PORF))) + 7e0c: 98 2f mov r25, r24 + 7e0e: 9d 70 andi r25, 0x0D ; 13 + 7e10: 09 f0 breq .+2 ; 0x7e14 + appStart(ch); + 7e12: c4 d0 rcall .+392 ; 0x7f9c + 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 + UART_SRA = _BV(U2X0); //Double speed mode USART0 + 7e14: 82 e0 ldi r24, 0x02 ; 2 + 7e16: 80 93 c0 00 sts 0x00C0, r24 + UART_SRB = _BV(RXEN0) | _BV(TXEN0); + 7e1a: 88 e1 ldi r24, 0x18 ; 24 + 7e1c: 80 93 c1 00 sts 0x00C1, r24 + UART_SRC = _BV(UCSZ00) | _BV(UCSZ01); + 7e20: 86 e0 ldi r24, 0x06 ; 6 + 7e22: 80 93 c2 00 sts 0x00C2, r24 + UART_SRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); + 7e26: 80 e1 ldi r24, 0x10 ; 16 + 7e28: 80 93 c4 00 sts 0x00C4, r24 +#endif +#endif + + // Set up watchdog to trigger after 1s + watchdogConfig(WATCHDOG_1S); + 7e2c: 8e e0 ldi r24, 0x0E ; 14 + 7e2e: a1 d0 rcall .+322 ; 0x7f72 + * 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 = 0; + 7e30: 81 2c mov r8, r1 + 7e32: 91 2c mov r9, r1 + * Start the page erase and wait for it to finish. There + * used to be code to do this while receiving the data over + * the serial link, but the performance improvement was slight, + * and we needed the space back. + */ + __boot_page_erase_short((uint16_t)(void*)address); + 7e34: 93 e0 ldi r25, 0x03 ; 3 + 7e36: f9 2e mov r15, r25 + */ + do { + uint16_t a; + a = *bufPtr++; + a |= (*bufPtr++) << 8; + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); + 7e38: ee 24 eor r14, r14 + 7e3a: e3 94 inc r14 + } while (len -= 2); + + /* + * Actually Write the buffer to flash (and wait for it to finish.) + */ + __boot_page_write_short((uint16_t)(void*)address); + 7e3c: 25 e0 ldi r18, 0x05 ; 5 + 7e3e: d2 2e mov r13, r18 + boot_spm_busy_wait(); +#if defined(RWWSRE) + // Reenable read access to flash + boot_rww_enable(); + 7e40: 31 e1 ldi r19, 0x11 ; 17 + 7e42: c3 2e mov r12, r19 +#endif + + /* Forever loop: exits by causing WDT reset */ + for (;;) { + /* get character from UART */ + ch = getch(); + 7e44: 8a d0 rcall .+276 ; 0x7f5a + + if(ch == STK_GET_PARAMETER) { + 7e46: 81 34 cpi r24, 0x41 ; 65 + 7e48: 79 f4 brne .+30 ; 0x7e68 + unsigned char which = getch(); + 7e4a: 87 d0 rcall .+270 ; 0x7f5a + verifySpace(); + 7e4c: 89 83 std Y+1, r24 ; 0x01 + 7e4e: 97 d0 rcall .+302 ; 0x7f7e + /* + * Send optiboot version as "SW version" + * Note that the references to memory are optimized away. + */ + if (which == 0x82) { + 7e50: 89 81 ldd r24, Y+1 ; 0x01 + 7e52: 82 38 cpi r24, 0x82 ; 130 + 7e54: 11 f4 brne .+4 ; 0x7e5a + putch(optiboot_version & 0xFF); + 7e56: 82 e0 ldi r24, 0x02 ; 2 + 7e58: 05 c0 rjmp .+10 ; 0x7e64 + } else if (which == 0x81) { + 7e5a: 81 38 cpi r24, 0x81 ; 129 + 7e5c: 11 f4 brne .+4 ; 0x7e62 + putch(optiboot_version >> 8); + 7e5e: 86 e0 ldi r24, 0x06 ; 6 + 7e60: 01 c0 rjmp .+2 ; 0x7e64 + } else { + /* + * GET PARAMETER returns a generic 0x03 reply for + * other parameters - enough to keep Avrdude happy + */ + putch(0x03); + 7e62: 83 e0 ldi r24, 0x03 ; 3 + 7e64: 73 d0 rcall .+230 ; 0x7f4c + 7e66: 6f c0 rjmp .+222 ; 0x7f46 + } + } + else if(ch == STK_SET_DEVICE) { + 7e68: 82 34 cpi r24, 0x42 ; 66 + 7e6a: 11 f4 brne .+4 ; 0x7e70 + // SET DEVICE is ignored + getNch(20); + 7e6c: 84 e1 ldi r24, 0x14 ; 20 + 7e6e: 03 c0 rjmp .+6 ; 0x7e76 + } + else if(ch == STK_SET_DEVICE_EXT) { + 7e70: 85 34 cpi r24, 0x45 ; 69 + 7e72: 19 f4 brne .+6 ; 0x7e7a + // SET DEVICE EXT is ignored + getNch(5); + 7e74: 85 e0 ldi r24, 0x05 ; 5 + 7e76: 8b d0 rcall .+278 ; 0x7f8e + 7e78: 66 c0 rjmp .+204 ; 0x7f46 + } + else if(ch == STK_LOAD_ADDRESS) { + 7e7a: 85 35 cpi r24, 0x55 ; 85 + 7e7c: 41 f4 brne .+16 ; 0x7e8e + // LOAD ADDRESS + uint16_t newAddress; + newAddress = getch(); + 7e7e: 6d d0 rcall .+218 ; 0x7f5a + 7e80: 88 2e mov r8, r24 + newAddress = (newAddress & 0xff) | (getch() << 8); + 7e82: 6b d0 rcall .+214 ; 0x7f5a + 7e84: 91 2c mov r9, r1 + 7e86: 98 2a or r9, r24 +#ifdef RAMPZ + // Transfer top bit to RAMPZ + RAMPZ = (newAddress & 0x8000) ? 1 : 0; +#endif + newAddress += newAddress; // Convert from word address to byte address + 7e88: 88 0c add r8, r8 + 7e8a: 99 1c adc r9, r9 + 7e8c: 5b c0 rjmp .+182 ; 0x7f44 + address = newAddress; + verifySpace(); + } + else if(ch == STK_UNIVERSAL) { + 7e8e: 86 35 cpi r24, 0x56 ; 86 + 7e90: 21 f4 brne .+8 ; 0x7e9a + // UNIVERSAL command is ignored + getNch(4); + 7e92: 84 e0 ldi r24, 0x04 ; 4 + 7e94: 7c d0 rcall .+248 ; 0x7f8e + putch(0x00); + 7e96: 80 e0 ldi r24, 0x00 ; 0 + 7e98: e5 cf rjmp .-54 ; 0x7e64 + } + /* Write memory, length is big endian and is in bytes */ + else if(ch == STK_PROG_PAGE) { + 7e9a: 84 36 cpi r24, 0x64 ; 100 + 7e9c: 09 f0 breq .+2 ; 0x7ea0 + 7e9e: 36 c0 rjmp .+108 ; 0x7f0c + // PROGRAM PAGE - we support flash programming only, not EEPROM + uint8_t desttype; + uint8_t *bufPtr; + pagelen_t savelength; + + GETLENGTH(length); + 7ea0: 5c d0 rcall .+184 ; 0x7f5a + 7ea2: 5b d0 rcall .+182 ; 0x7f5a + 7ea4: b8 2e mov r11, r24 + savelength = length; + desttype = getch(); + 7ea6: 59 d0 rcall .+178 ; 0x7f5a + 7ea8: a8 2e mov r10, r24 + 7eaa: 00 e0 ldi r16, 0x00 ; 0 + 7eac: 11 e0 ldi r17, 0x01 ; 1 + + // read a page worth of contents + bufPtr = buff; + do *bufPtr++ = getch(); + 7eae: 55 d0 rcall .+170 ; 0x7f5a + 7eb0: f8 01 movw r30, r16 + 7eb2: 81 93 st Z+, r24 + 7eb4: 8f 01 movw r16, r30 + while (--length); + 7eb6: be 12 cpse r11, r30 + 7eb8: fa cf rjmp .-12 ; 0x7eae + + // Read command terminator, start reply + verifySpace(); + 7eba: 61 d0 rcall .+194 ; 0x7f7e + * void writebuffer(memtype, buffer, address, length) + */ +static inline void writebuffer(int8_t memtype, uint8_t *mybuff, + uint16_t address, pagelen_t len) +{ + switch (memtype) { + 7ebc: f5 e4 ldi r31, 0x45 ; 69 + 7ebe: af 12 cpse r10, r31 + 7ec0: 01 c0 rjmp .+2 ; 0x7ec4 + 7ec2: ff cf rjmp .-2 ; 0x7ec2 + * Start the page erase and wait for it to finish. There + * used to be code to do this while receiving the data over + * the serial link, but the performance improvement was slight, + * and we needed the space back. + */ + __boot_page_erase_short((uint16_t)(void*)address); + 7ec4: f4 01 movw r30, r8 + 7ec6: f7 be out 0x37, r15 ; 55 + 7ec8: e8 95 spm + boot_spm_busy_wait(); + 7eca: 07 b6 in r0, 0x37 ; 55 + 7ecc: 00 fc sbrc r0, 0 + 7ece: fd cf rjmp .-6 ; 0x7eca + 7ed0: b4 01 movw r22, r8 + 7ed2: a0 e0 ldi r26, 0x00 ; 0 + 7ed4: b1 e0 ldi r27, 0x01 ; 1 + /* + * Copy data from the buffer into the flash write buffer. + */ + do { + uint16_t a; + a = *bufPtr++; + 7ed6: 2c 91 ld r18, X + 7ed8: 12 96 adiw r26, 0x02 ; 2 + 7eda: ad 01 movw r20, r26 + 7edc: 41 50 subi r20, 0x01 ; 1 + 7ede: 51 09 sbc r21, r1 + a |= (*bufPtr++) << 8; + 7ee0: fa 01 movw r30, r20 + 7ee2: 80 81 ld r24, Z + 7ee4: 30 e0 ldi r19, 0x00 ; 0 + 7ee6: 38 2b or r19, r24 + __boot_page_fill_short((uint16_t)(void*)addrPtr,a); + 7ee8: fb 01 movw r30, r22 + 7eea: 09 01 movw r0, r18 + 7eec: e7 be out 0x37, r14 ; 55 + 7eee: e8 95 spm + 7ef0: 11 24 eor r1, r1 + addrPtr += 2; + 7ef2: 6e 5f subi r22, 0xFE ; 254 + 7ef4: 7f 4f sbci r23, 0xFF ; 255 + } while (len -= 2); + 7ef6: ba 12 cpse r11, r26 + 7ef8: ee cf rjmp .-36 ; 0x7ed6 + + /* + * Actually Write the buffer to flash (and wait for it to finish.) + */ + __boot_page_write_short((uint16_t)(void*)address); + 7efa: f4 01 movw r30, r8 + 7efc: d7 be out 0x37, r13 ; 55 + 7efe: e8 95 spm + boot_spm_busy_wait(); + 7f00: 07 b6 in r0, 0x37 ; 55 + 7f02: 00 fc sbrc r0, 0 + 7f04: fd cf rjmp .-6 ; 0x7f00 +#if defined(RWWSRE) + // Reenable read access to flash + boot_rww_enable(); + 7f06: c7 be out 0x37, r12 ; 55 + 7f08: e8 95 spm + 7f0a: 1d c0 rjmp .+58 ; 0x7f46 + writebuffer(desttype, buff, address, savelength); + + + } + /* Read memory block mode, length is big endian. */ + else if(ch == STK_READ_PAGE) { + 7f0c: 84 37 cpi r24, 0x74 ; 116 + 7f0e: 69 f4 brne .+26 ; 0x7f2a + uint8_t desttype; + GETLENGTH(length); + 7f10: 24 d0 rcall .+72 ; 0x7f5a + 7f12: 23 d0 rcall .+70 ; 0x7f5a + 7f14: b8 2e mov r11, r24 + + desttype = getch(); + 7f16: 21 d0 rcall .+66 ; 0x7f5a + + verifySpace(); + 7f18: 32 d0 rcall .+100 ; 0x7f7e + 7f1a: 84 01 movw r16, r8 + __asm__ ("elpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); +#else + // read a Flash byte and increment the address + __asm__ ("lpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); +#endif + putch(ch); + 7f1c: f8 01 movw r30, r16 + 7f1e: 85 91 lpm r24, Z+ + 7f20: 8f 01 movw r16, r30 + 7f22: 14 d0 rcall .+40 ; 0x7f4c + } while (--length); + 7f24: ba 94 dec r11 + 7f26: d1 f7 brne .-12 ; 0x7f1c + 7f28: 0e c0 rjmp .+28 ; 0x7f46 + + read_mem(desttype, address, length); + } + + /* Get device signature bytes */ + else if(ch == STK_READ_SIGN) { + 7f2a: 85 37 cpi r24, 0x75 ; 117 + 7f2c: 39 f4 brne .+14 ; 0x7f3c + // READ SIGN - return what Avrdude wants to hear + verifySpace(); + 7f2e: 27 d0 rcall .+78 ; 0x7f7e + putch(SIGNATURE_0); + 7f30: 8e e1 ldi r24, 0x1E ; 30 + 7f32: 0c d0 rcall .+24 ; 0x7f4c + putch(SIGNATURE_1); + 7f34: 85 e9 ldi r24, 0x95 ; 149 + 7f36: 0a d0 rcall .+20 ; 0x7f4c + putch(SIGNATURE_2); + 7f38: 8f e0 ldi r24, 0x0F ; 15 + 7f3a: 94 cf rjmp .-216 ; 0x7e64 + } + else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */ + 7f3c: 81 35 cpi r24, 0x51 ; 81 + 7f3e: 11 f4 brne .+4 ; 0x7f44 + // Adaboot no-wait mod + watchdogConfig(WATCHDOG_16MS); + 7f40: 88 e0 ldi r24, 0x08 ; 8 + 7f42: 17 d0 rcall .+46 ; 0x7f72 + verifySpace(); + } + else { + // This covers the response to commands like STK_ENTER_PROGMODE + verifySpace(); + 7f44: 1c d0 rcall .+56 ; 0x7f7e + } + putch(STK_OK); + 7f46: 80 e1 ldi r24, 0x10 ; 16 + 7f48: 01 d0 rcall .+2 ; 0x7f4c + } + 7f4a: 7c cf rjmp .-264 ; 0x7e44 + +00007f4c : +} + +void putch(char ch) { +#ifndef SOFT_UART + while (!(UART_SRA & _BV(UDRE0))); + 7f4c: 90 91 c0 00 lds r25, 0x00C0 + 7f50: 95 ff sbrs r25, 5 + 7f52: fc cf rjmp .-8 ; 0x7f4c + UART_UDR = ch; + 7f54: 80 93 c6 00 sts 0x00C6, r24 + 7f58: 08 95 ret + +00007f5a : + [uartBit] "I" (UART_RX_BIT) + : + "r25" +); +#else + while(!(UART_SRA & _BV(RXC0))) + 7f5a: 80 91 c0 00 lds r24, 0x00C0 + 7f5e: 87 ff sbrs r24, 7 + 7f60: fc cf rjmp .-8 ; 0x7f5a + ; + if (!(UART_SRA & _BV(FE0))) { + 7f62: 80 91 c0 00 lds r24, 0x00C0 + 7f66: 84 fd sbrc r24, 4 + 7f68: 01 c0 rjmp .+2 ; 0x7f6c +} +#endif + +// Watchdog functions. These are only safe with interrupts turned off. +void watchdogReset() { + __asm__ __volatile__ ( + 7f6a: a8 95 wdr + * don't care that an invalid char is returned...) + */ + watchdogReset(); + } + + ch = UART_UDR; + 7f6c: 80 91 c6 00 lds r24, 0x00C6 + LED_PIN |= _BV(LED); +#endif +#endif + + return ch; +} + 7f70: 08 95 ret + +00007f72 : + "wdr\n" + ); +} + +void watchdogConfig(uint8_t x) { + WDTCSR = _BV(WDCE) | _BV(WDE); + 7f72: e0 e6 ldi r30, 0x60 ; 96 + 7f74: f0 e0 ldi r31, 0x00 ; 0 + 7f76: 98 e1 ldi r25, 0x18 ; 24 + 7f78: 90 83 st Z, r25 + WDTCSR = x; + 7f7a: 80 83 st Z, r24 + 7f7c: 08 95 ret + +00007f7e : + do getch(); while (--count); + verifySpace(); +} + +void verifySpace() { + if (getch() != CRC_EOP) { + 7f7e: ed df rcall .-38 ; 0x7f5a + 7f80: 80 32 cpi r24, 0x20 ; 32 + 7f82: 19 f0 breq .+6 ; 0x7f8a + watchdogConfig(WATCHDOG_16MS); // shorten WD timeout + 7f84: 88 e0 ldi r24, 0x08 ; 8 + 7f86: f5 df rcall .-22 ; 0x7f72 + 7f88: ff cf rjmp .-2 ; 0x7f88 + while (1) // and busy-loop so that WD causes + ; // a reset and app start. + } + putch(STK_INSYNC); + 7f8a: 84 e1 ldi r24, 0x14 ; 20 + 7f8c: df cf rjmp .-66 ; 0x7f4c + +00007f8e : + ::[count] "M" (UART_B_VALUE) + ); +} +#endif + +void getNch(uint8_t count) { + 7f8e: cf 93 push r28 + 7f90: c8 2f mov r28, r24 + do getch(); while (--count); + 7f92: e3 df rcall .-58 ; 0x7f5a + 7f94: c1 50 subi r28, 0x01 ; 1 + 7f96: e9 f7 brne .-6 ; 0x7f92 + verifySpace(); +} + 7f98: cf 91 pop r28 +} +#endif + +void getNch(uint8_t count) { + do getch(); while (--count); + verifySpace(); + 7f9a: f1 cf rjmp .-30 ; 0x7f7e + +00007f9c : + +void appStart(uint8_t rstFlags) { + // save the reset flags in the designated register + // This can be saved in a main program by putting code in .init0 (which + // executes before normal c init code) to save R2 to a global variable. + __asm__ __volatile__ ("mov r2, %0\n" :: "r" (rstFlags)); + 7f9c: 28 2e mov r2, r24 + + watchdogConfig(WATCHDOG_OFF); + 7f9e: 80 e0 ldi r24, 0x00 ; 0 + 7fa0: e8 df rcall .-48 ; 0x7f72 + // Note that appstart_vec is defined so that this works with either + // real or virtual boot partitions. + __asm__ __volatile__ ( + 7fa2: e0 e0 ldi r30, 0x00 ; 0 + 7fa4: ff 27 eor r31, r31 + 7fa6: 09 94 ijmp diff --git a/optiboot/bootloaders/optiboot/optiboot_atmega1280.hex b/optiboot/bootloaders/optiboot/optiboot_atmega1280.hex deleted file mode 100644 index ddd38ea86..000000000 --- a/optiboot/bootloaders/optiboot/optiboot_atmega1280.hex +++ /dev/null @@ -1,43 +0,0 @@ -:020000021000EC -:10FC0000112494B714BE892F8D7011F0892F0ED155 -:10FC100085E08093810082E08093C00088E180933A -:10FC2000C10086E08093C20080E18093C4008EE032 -:10FC3000E7D0279A86E020E33CEF91E030938500FF -:10FC40002093840096BBB09BFECF1F9AA89581504D -:10FC5000A9F7CC24DD248824839425E0A22E91E109 -:10FC6000992EC2D0813471F4BFD0182FCFD0123862 -:10FC700011F482E005C0113811F486E001C083E080 -:10FC8000ABD0A7C0823411F484E103C0853419F4E9 -:10FC900085E0C4D09EC08535A1F4A6D0082F10E021 -:10FCA000A3D0E82EFF24FE2CEE24E02AF12A8F2D8B -:10FCB000881F8827881F8BBFEE0CFF1CA7D0670109 -:10FCC00088C0863521F484E0A9D080E0D9CF84367D -:10FCD00009F052C089D090E0182F002785D090E01D -:10FCE000082B192B81D0B82EE801E12CA2E0FA2EC6 -:10FCF0007BD0F70181937F012197D1F787D0F5E47D -:10FD0000BF1689F4E601E12CF2E0FF2E08C0CE0117 -:10FD10002196F70161917F0197D0015010400115A4 -:10FD20001105A9F756C083E0F60187BFE89507B62D -:10FD300000FCFDCFB801A601A0E0B2E02C9130E0BC -:10FD400011968C91119790E0982F8827822B932BF6 -:10FD50001296FA010C0187BEE89511244E5F5F4FA1 -:10FD60006250704059F7F601A7BEE89507B600FC4F -:10FD7000FDCF97BEE8952DC08437F1F435D090E0E3 -:10FD8000D82FCC2731D090E0C82BD92B2DD0182FCD -:10FD90003DD0153449F48601C8010F5F1F4F4CD088 -:10FDA0001BD02197C9F715C08601F80187918F01F3 -:10FDB00013D02197D1F70DC0853731F427D08EE1CC -:10FDC0000BD087E909D05BCF813511F488E018D0DA -:10FDD0001DD080E101D045CF982F8091C00085FFD4 -:10FDE000FCCF9093C60008958091C00087FFFCCFA0 -:10FDF0008091C00084FD01C0A8958091C60008953F -:10FE0000E0E6F0E098E1908380830895EDDF8032B2 -:10FE100019F088E0F5DFFFCF84E1DECF1F93182FC4 -:10FE2000E3DF1150E9F7F2DF1F910895282E80E0FB -:10FE3000E7DFEE27FF270994F999FECF92BD81BD38 -:10FE4000F89A992780B50895262FF999FECF1FBA01 -:10FE500092BD81BD20BD0FB6F894FA9AF99A0FBEF3 -:04FE6000019608956A -:02FFFE000206F9 -:040000031000FC00ED -:00000001FF diff --git a/optiboot/bootloaders/optiboot/optiboot_atmega1280.lst b/optiboot/bootloaders/optiboot/optiboot_atmega1280.lst deleted file mode 100644 index 5fc6de534..000000000 --- a/optiboot/bootloaders/optiboot/optiboot_atmega1280.lst +++ /dev/null @@ -1,684 +0,0 @@ - -optiboot_atmega1280.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 00000264 0001fc00 0001fc00 00000074 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 0001fffe 0001fffe 000002d8 2**0 - CONTENTS, ALLOC, LOAD, READONLY, DATA - 2 .stab 00000180 00000000 00000000 000002dc 2**2 - CONTENTS, READONLY, DEBUGGING - 3 .stabstr 000000bb 00000000 00000000 0000045c 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_aranges 00000028 00000000 00000000 00000517 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_pubnames 00000074 00000000 00000000 0000053f 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_info 000003f0 00000000 00000000 000005b3 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_abbrev 000001fe 00000000 00000000 000009a3 2**0 - CONTENTS, READONLY, DEBUGGING - 8 .debug_line 0000044b 00000000 00000000 00000ba1 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_frame 00000080 00000000 00000000 00000fec 2**2 - CONTENTS, READONLY, DEBUGGING - 10 .debug_str 0000017c 00000000 00000000 0000106c 2**0 - CONTENTS, READONLY, DEBUGGING - 11 .debug_loc 000003b3 00000000 00000000 000011e8 2**0 - CONTENTS, READONLY, DEBUGGING - 12 .debug_ranges 000000d0 00000000 00000000 0000159b 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -0001fc00
: -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - - -/* main program starts here */ -int main(void) { - 1fc00: 11 24 eor r1, r1 - * modified Adaboot no-wait mod. - * Pass the reset reason to app. Also, it appears that an Uno poweron - * can leave multiple reset flags set; we only want the bootloader to - * run on an 'external reset only' status - */ - ch = MCUSR; - 1fc02: 94 b7 in r25, 0x34 ; 52 - MCUSR = 0; - 1fc04: 14 be out 0x34, r1 ; 52 - if (ch & (_BV(WDRF) | _BV(BORF) | _BV(PORF))) - 1fc06: 89 2f mov r24, r25 - 1fc08: 8d 70 andi r24, 0x0D ; 13 - 1fc0a: 11 f0 breq .+4 ; 0x1fc10 - appStart(ch); - 1fc0c: 89 2f mov r24, r25 - 1fc0e: 0e d1 rcall .+540 ; 0x1fe2c - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 1fc10: 85 e0 ldi r24, 0x05 ; 5 - 1fc12: 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 - UART_SRA = _BV(U2X0); //Double speed mode USART0 - 1fc16: 82 e0 ldi r24, 0x02 ; 2 - 1fc18: 80 93 c0 00 sts 0x00C0, r24 - UART_SRB = _BV(RXEN0) | _BV(TXEN0); - 1fc1c: 88 e1 ldi r24, 0x18 ; 24 - 1fc1e: 80 93 c1 00 sts 0x00C1, r24 - UART_SRC = _BV(UCSZ00) | _BV(UCSZ01); - 1fc22: 86 e0 ldi r24, 0x06 ; 6 - 1fc24: 80 93 c2 00 sts 0x00C2, r24 - UART_SRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 1fc28: 80 e1 ldi r24, 0x10 ; 16 - 1fc2a: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 1fc2e: 8e e0 ldi r24, 0x0E ; 14 - 1fc30: e7 d0 rcall .+462 ; 0x1fe00 - -#if (LED_START_FLASHES > 0) || defined(LED_DATA_FLASH) - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 1fc32: 27 9a sbi 0x04, 7 ; 4 - 1fc34: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 1fc36: 20 e3 ldi r18, 0x30 ; 48 - 1fc38: 3c ef ldi r19, 0xFC ; 252 - TIFR1 = _BV(TOV1); - 1fc3a: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 1fc3c: 30 93 85 00 sts 0x0085, r19 - 1fc40: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 1fc44: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 1fc46: b0 9b sbis 0x16, 0 ; 22 - 1fc48: fe cf rjmp .-4 ; 0x1fc46 -#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 1fc4a: 1f 9a sbi 0x03, 7 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 1fc4c: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 1fc4e: 81 50 subi r24, 0x01 ; 1 - 1fc50: a9 f7 brne .-22 ; 0x1fc3c - 1fc52: cc 24 eor r12, r12 - 1fc54: dd 24 eor r13, r13 - */ - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 1fc56: 88 24 eor r8, r8 - 1fc58: 83 94 inc r8 - } while (len -= 2); - - /* - * Actually Write the buffer to flash (and wait for it to finish.) - */ - __boot_page_write_short((uint16_t)(void*)address); - 1fc5a: 25 e0 ldi r18, 0x05 ; 5 - 1fc5c: a2 2e mov r10, r18 - boot_spm_busy_wait(); -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 1fc5e: 91 e1 ldi r25, 0x11 ; 17 - 1fc60: 99 2e mov r9, r25 -#endif - - /* Forever loop: exits by causing WDT reset */ - for (;;) { - /* get character from UART */ - ch = getch(); - 1fc62: c2 d0 rcall .+388 ; 0x1fde8 - - if(ch == STK_GET_PARAMETER) { - 1fc64: 81 34 cpi r24, 0x41 ; 65 - 1fc66: 71 f4 brne .+28 ; 0x1fc84 - unsigned char which = getch(); - 1fc68: bf d0 rcall .+382 ; 0x1fde8 - 1fc6a: 18 2f mov r17, r24 - verifySpace(); - 1fc6c: cf d0 rcall .+414 ; 0x1fe0c - /* - * Send optiboot version as "SW version" - * Note that the references to memory are optimized away. - */ - if (which == 0x82) { - 1fc6e: 12 38 cpi r17, 0x82 ; 130 - 1fc70: 11 f4 brne .+4 ; 0x1fc76 - putch(optiboot_version & 0xFF); - 1fc72: 82 e0 ldi r24, 0x02 ; 2 - 1fc74: 05 c0 rjmp .+10 ; 0x1fc80 - } else if (which == 0x81) { - 1fc76: 11 38 cpi r17, 0x81 ; 129 - 1fc78: 11 f4 brne .+4 ; 0x1fc7e - putch(optiboot_version >> 8); - 1fc7a: 86 e0 ldi r24, 0x06 ; 6 - 1fc7c: 01 c0 rjmp .+2 ; 0x1fc80 - } else { - /* - * GET PARAMETER returns a generic 0x03 reply for - * other parameters - enough to keep Avrdude happy - */ - putch(0x03); - 1fc7e: 83 e0 ldi r24, 0x03 ; 3 - 1fc80: ab d0 rcall .+342 ; 0x1fdd8 - 1fc82: a7 c0 rjmp .+334 ; 0x1fdd2 - } - } - else if(ch == STK_SET_DEVICE) { - 1fc84: 82 34 cpi r24, 0x42 ; 66 - 1fc86: 11 f4 brne .+4 ; 0x1fc8c - // SET DEVICE is ignored - getNch(20); - 1fc88: 84 e1 ldi r24, 0x14 ; 20 - 1fc8a: 03 c0 rjmp .+6 ; 0x1fc92 - } - else if(ch == STK_SET_DEVICE_EXT) { - 1fc8c: 85 34 cpi r24, 0x45 ; 69 - 1fc8e: 19 f4 brne .+6 ; 0x1fc96 - // SET DEVICE EXT is ignored - getNch(5); - 1fc90: 85 e0 ldi r24, 0x05 ; 5 - 1fc92: c4 d0 rcall .+392 ; 0x1fe1c - 1fc94: 9e c0 rjmp .+316 ; 0x1fdd2 - } - else if(ch == STK_LOAD_ADDRESS) { - 1fc96: 85 35 cpi r24, 0x55 ; 85 - 1fc98: a1 f4 brne .+40 ; 0x1fcc2 - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 1fc9a: a6 d0 rcall .+332 ; 0x1fde8 - newAddress = (newAddress & 0xff) | (getch() << 8); - 1fc9c: 08 2f mov r16, r24 - 1fc9e: 10 e0 ldi r17, 0x00 ; 0 - 1fca0: a3 d0 rcall .+326 ; 0x1fde8 - 1fca2: e8 2e mov r14, r24 - 1fca4: ff 24 eor r15, r15 - 1fca6: fe 2c mov r15, r14 - 1fca8: ee 24 eor r14, r14 - 1fcaa: e0 2a or r14, r16 - 1fcac: f1 2a or r15, r17 -#ifdef RAMPZ - // Transfer top bit to RAMPZ - RAMPZ = (newAddress & 0x8000) ? 1 : 0; - 1fcae: 8f 2d mov r24, r15 - 1fcb0: 88 1f adc r24, r24 - 1fcb2: 88 27 eor r24, r24 - 1fcb4: 88 1f adc r24, r24 - 1fcb6: 8b bf out 0x3b, r24 ; 59 -#endif - newAddress += newAddress; // Convert from word address to byte address - 1fcb8: ee 0c add r14, r14 - 1fcba: ff 1c adc r15, r15 - address = newAddress; - verifySpace(); - 1fcbc: a7 d0 rcall .+334 ; 0x1fe0c - 1fcbe: 67 01 movw r12, r14 - 1fcc0: 88 c0 rjmp .+272 ; 0x1fdd2 - } - else if(ch == STK_UNIVERSAL) { - 1fcc2: 86 35 cpi r24, 0x56 ; 86 - 1fcc4: 21 f4 brne .+8 ; 0x1fcce - // UNIVERSAL command is ignored - getNch(4); - 1fcc6: 84 e0 ldi r24, 0x04 ; 4 - 1fcc8: a9 d0 rcall .+338 ; 0x1fe1c - putch(0x00); - 1fcca: 80 e0 ldi r24, 0x00 ; 0 - 1fccc: d9 cf rjmp .-78 ; 0x1fc80 - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 1fcce: 84 36 cpi r24, 0x64 ; 100 - 1fcd0: 09 f0 breq .+2 ; 0x1fcd4 - 1fcd2: 52 c0 rjmp .+164 ; 0x1fd78 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t desttype; - uint8_t *bufPtr; - pagelen_t savelength; - - GETLENGTH(length); - 1fcd4: 89 d0 rcall .+274 ; 0x1fde8 - 1fcd6: 90 e0 ldi r25, 0x00 ; 0 - 1fcd8: 18 2f mov r17, r24 - 1fcda: 00 27 eor r16, r16 - 1fcdc: 85 d0 rcall .+266 ; 0x1fde8 - 1fcde: 90 e0 ldi r25, 0x00 ; 0 - 1fce0: 08 2b or r16, r24 - 1fce2: 19 2b or r17, r25 - savelength = length; - desttype = getch(); - 1fce4: 81 d0 rcall .+258 ; 0x1fde8 - 1fce6: b8 2e mov r11, r24 - 1fce8: e8 01 movw r28, r16 - 1fcea: e1 2c mov r14, r1 - 1fcec: a2 e0 ldi r26, 0x02 ; 2 - 1fcee: fa 2e mov r15, r26 - - // read a page worth of contents - bufPtr = buff; - do *bufPtr++ = getch(); - 1fcf0: 7b d0 rcall .+246 ; 0x1fde8 - 1fcf2: f7 01 movw r30, r14 - 1fcf4: 81 93 st Z+, r24 - 1fcf6: 7f 01 movw r14, r30 - while (--length); - 1fcf8: 21 97 sbiw r28, 0x01 ; 1 - 1fcfa: d1 f7 brne .-12 ; 0x1fcf0 - - // Read command terminator, start reply - verifySpace(); - 1fcfc: 87 d0 rcall .+270 ; 0x1fe0c - * void writebuffer(memtype, buffer, address, length) - */ -static inline void writebuffer(int8_t memtype, uint8_t *mybuff, - uint16_t address, pagelen_t len) -{ - switch (memtype) { - 1fcfe: f5 e4 ldi r31, 0x45 ; 69 - 1fd00: bf 16 cp r11, r31 - 1fd02: 89 f4 brne .+34 ; 0x1fd26 - 1fd04: e6 01 movw r28, r12 - 1fd06: e1 2c mov r14, r1 - 1fd08: f2 e0 ldi r31, 0x02 ; 2 - 1fd0a: ff 2e mov r15, r31 - 1fd0c: 08 c0 rjmp .+16 ; 0x1fd1e - 1fd0e: ce 01 movw r24, r28 - case 'E': // EEPROM -#if defined(SUPPORT_EEPROM) || defined(BIGBOOT) - while(len--) { - eeprom_write_byte((uint8_t *)(address++), *mybuff++); - 1fd10: 21 96 adiw r28, 0x01 ; 1 - 1fd12: f7 01 movw r30, r14 - 1fd14: 61 91 ld r22, Z+ - 1fd16: 7f 01 movw r14, r30 - 1fd18: 97 d0 rcall .+302 ; 0x1fe48 <__eewr_byte_m1280> - 1fd1a: 01 50 subi r16, 0x01 ; 1 - 1fd1c: 10 40 sbci r17, 0x00 ; 0 - uint16_t address, pagelen_t len) -{ - switch (memtype) { - case 'E': // EEPROM -#if defined(SUPPORT_EEPROM) || defined(BIGBOOT) - while(len--) { - 1fd1e: 01 15 cp r16, r1 - 1fd20: 11 05 cpc r17, r1 - 1fd22: a9 f7 brne .-22 ; 0x1fd0e - 1fd24: 56 c0 rjmp .+172 ; 0x1fdd2 - * Start the page erase and wait for it to finish. There - * used to be code to do this while receiving the data over - * the serial link, but the performance improvement was slight, - * and we needed the space back. - */ - __boot_page_erase_short((uint16_t)(void*)address); - 1fd26: 83 e0 ldi r24, 0x03 ; 3 - 1fd28: f6 01 movw r30, r12 - 1fd2a: 87 bf out 0x37, r24 ; 55 - 1fd2c: e8 95 spm - boot_spm_busy_wait(); - 1fd2e: 07 b6 in r0, 0x37 ; 55 - 1fd30: 00 fc sbrc r0, 0 - 1fd32: fd cf rjmp .-6 ; 0x1fd2e - 1fd34: b8 01 movw r22, r16 - 1fd36: a6 01 movw r20, r12 - 1fd38: a0 e0 ldi r26, 0x00 ; 0 - 1fd3a: b2 e0 ldi r27, 0x02 ; 2 - /* - * Copy data from the buffer into the flash write buffer. - */ - do { - uint16_t a; - a = *bufPtr++; - 1fd3c: 2c 91 ld r18, X - 1fd3e: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 1fd40: 11 96 adiw r26, 0x01 ; 1 - 1fd42: 8c 91 ld r24, X - 1fd44: 11 97 sbiw r26, 0x01 ; 1 - 1fd46: 90 e0 ldi r25, 0x00 ; 0 - 1fd48: 98 2f mov r25, r24 - 1fd4a: 88 27 eor r24, r24 - 1fd4c: 82 2b or r24, r18 - 1fd4e: 93 2b or r25, r19 -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - - -/* main program starts here */ -int main(void) { - 1fd50: 12 96 adiw r26, 0x02 ; 2 - */ - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 1fd52: fa 01 movw r30, r20 - 1fd54: 0c 01 movw r0, r24 - 1fd56: 87 be out 0x37, r8 ; 55 - 1fd58: e8 95 spm - 1fd5a: 11 24 eor r1, r1 - addrPtr += 2; - 1fd5c: 4e 5f subi r20, 0xFE ; 254 - 1fd5e: 5f 4f sbci r21, 0xFF ; 255 - } while (len -= 2); - 1fd60: 62 50 subi r22, 0x02 ; 2 - 1fd62: 70 40 sbci r23, 0x00 ; 0 - 1fd64: 59 f7 brne .-42 ; 0x1fd3c - - /* - * Actually Write the buffer to flash (and wait for it to finish.) - */ - __boot_page_write_short((uint16_t)(void*)address); - 1fd66: f6 01 movw r30, r12 - 1fd68: a7 be out 0x37, r10 ; 55 - 1fd6a: e8 95 spm - boot_spm_busy_wait(); - 1fd6c: 07 b6 in r0, 0x37 ; 55 - 1fd6e: 00 fc sbrc r0, 0 - 1fd70: fd cf rjmp .-6 ; 0x1fd6c -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 1fd72: 97 be out 0x37, r9 ; 55 - 1fd74: e8 95 spm - 1fd76: 2d c0 rjmp .+90 ; 0x1fdd2 - writebuffer(desttype, buff, address, savelength); - - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 1fd78: 84 37 cpi r24, 0x74 ; 116 - 1fd7a: f1 f4 brne .+60 ; 0x1fdb8 - uint8_t desttype; - GETLENGTH(length); - 1fd7c: 35 d0 rcall .+106 ; 0x1fde8 - 1fd7e: 90 e0 ldi r25, 0x00 ; 0 - 1fd80: d8 2f mov r29, r24 - 1fd82: cc 27 eor r28, r28 - 1fd84: 31 d0 rcall .+98 ; 0x1fde8 - 1fd86: 90 e0 ldi r25, 0x00 ; 0 - 1fd88: c8 2b or r28, r24 - 1fd8a: d9 2b or r29, r25 - - desttype = getch(); - 1fd8c: 2d d0 rcall .+90 ; 0x1fde8 - 1fd8e: 18 2f mov r17, r24 - - verifySpace(); - 1fd90: 3d d0 rcall .+122 ; 0x1fe0c - -static inline void read_mem(uint8_t memtype, uint16_t address, pagelen_t length) -{ - uint8_t ch; - - switch (memtype) { - 1fd92: 15 34 cpi r17, 0x45 ; 69 - 1fd94: 49 f4 brne .+18 ; 0x1fda8 - 1fd96: 86 01 movw r16, r12 - 1fd98: c8 01 movw r24, r16 - -#if defined(SUPPORT_EEPROM) || defined(BIGBOOT) - case 'E': // EEPROM - do { - putch(eeprom_read_byte((uint8_t *)(address++))); - 1fd9a: 0f 5f subi r16, 0xFF ; 255 - 1fd9c: 1f 4f sbci r17, 0xFF ; 255 - 1fd9e: 4c d0 rcall .+152 ; 0x1fe38 <__eerd_byte_m1280> - 1fda0: 1b d0 rcall .+54 ; 0x1fdd8 - } while (--length); - 1fda2: 21 97 sbiw r28, 0x01 ; 1 - 1fda4: c9 f7 brne .-14 ; 0x1fd98 - 1fda6: 15 c0 rjmp .+42 ; 0x1fdd2 - 1fda8: 86 01 movw r16, r12 - __asm__ ("elpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#else - // read a Flash byte and increment the address - __asm__ ("lpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#endif - putch(ch); - 1fdaa: f8 01 movw r30, r16 - 1fdac: 87 91 elpm r24, Z+ - 1fdae: 8f 01 movw r16, r30 - 1fdb0: 13 d0 rcall .+38 ; 0x1fdd8 - } while (--length); - 1fdb2: 21 97 sbiw r28, 0x01 ; 1 - 1fdb4: d1 f7 brne .-12 ; 0x1fdaa - 1fdb6: 0d c0 rjmp .+26 ; 0x1fdd2 - - read_mem(desttype, address, length); - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 1fdb8: 85 37 cpi r24, 0x75 ; 117 - 1fdba: 31 f4 brne .+12 ; 0x1fdc8 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 1fdbc: 27 d0 rcall .+78 ; 0x1fe0c - putch(SIGNATURE_0); - 1fdbe: 8e e1 ldi r24, 0x1E ; 30 - 1fdc0: 0b d0 rcall .+22 ; 0x1fdd8 - putch(SIGNATURE_1); - 1fdc2: 87 e9 ldi r24, 0x97 ; 151 - 1fdc4: 09 d0 rcall .+18 ; 0x1fdd8 - 1fdc6: 5b cf rjmp .-330 ; 0x1fc7e - putch(SIGNATURE_2); - } - else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */ - 1fdc8: 81 35 cpi r24, 0x51 ; 81 - 1fdca: 11 f4 brne .+4 ; 0x1fdd0 - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 1fdcc: 88 e0 ldi r24, 0x08 ; 8 - 1fdce: 18 d0 rcall .+48 ; 0x1fe00 - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 1fdd0: 1d d0 rcall .+58 ; 0x1fe0c - } - putch(STK_OK); - 1fdd2: 80 e1 ldi r24, 0x10 ; 16 - 1fdd4: 01 d0 rcall .+2 ; 0x1fdd8 - 1fdd6: 45 cf rjmp .-374 ; 0x1fc62 - -0001fdd8 : - } -} - -void putch(char ch) { - 1fdd8: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UART_SRA & _BV(UDRE0))); - 1fdda: 80 91 c0 00 lds r24, 0x00C0 - 1fdde: 85 ff sbrs r24, 5 - 1fde0: fc cf rjmp .-8 ; 0x1fdda - UART_UDR = ch; - 1fde2: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 1fde6: 08 95 ret - -0001fde8 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UART_SRA & _BV(RXC0))) - 1fde8: 80 91 c0 00 lds r24, 0x00C0 - 1fdec: 87 ff sbrs r24, 7 - 1fdee: fc cf rjmp .-8 ; 0x1fde8 - ; - if (!(UART_SRA & _BV(FE0))) { - 1fdf0: 80 91 c0 00 lds r24, 0x00C0 - 1fdf4: 84 fd sbrc r24, 4 - 1fdf6: 01 c0 rjmp .+2 ; 0x1fdfa -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 1fdf8: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UART_UDR; - 1fdfa: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 1fdfe: 08 95 ret - -0001fe00 : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 1fe00: e0 e6 ldi r30, 0x60 ; 96 - 1fe02: f0 e0 ldi r31, 0x00 ; 0 - 1fe04: 98 e1 ldi r25, 0x18 ; 24 - 1fe06: 90 83 st Z, r25 - WDTCSR = x; - 1fe08: 80 83 st Z, r24 -} - 1fe0a: 08 95 ret - -0001fe0c : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 1fe0c: ed df rcall .-38 ; 0x1fde8 - 1fe0e: 80 32 cpi r24, 0x20 ; 32 - 1fe10: 19 f0 breq .+6 ; 0x1fe18 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 1fe12: 88 e0 ldi r24, 0x08 ; 8 - 1fe14: f5 df rcall .-22 ; 0x1fe00 - 1fe16: ff cf rjmp .-2 ; 0x1fe16 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 1fe18: 84 e1 ldi r24, 0x14 ; 20 -} - 1fe1a: de cf rjmp .-68 ; 0x1fdd8 - -0001fe1c : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 1fe1c: 1f 93 push r17 - 1fe1e: 18 2f mov r17, r24 - do getch(); while (--count); - 1fe20: e3 df rcall .-58 ; 0x1fde8 - 1fe22: 11 50 subi r17, 0x01 ; 1 - 1fe24: e9 f7 brne .-6 ; 0x1fe20 - verifySpace(); - 1fe26: f2 df rcall .-28 ; 0x1fe0c -} - 1fe28: 1f 91 pop r17 - 1fe2a: 08 95 ret - -0001fe2c : - -void appStart(uint8_t rstFlags) { - // save the reset flags in the designated register - // This can be saved in a main program by putting code in .init0 (which - // executes before normal c init code) to save R2 to a global variable. - __asm__ __volatile__ ("mov r2, %0\n" :: "r" (rstFlags)); - 1fe2c: 28 2e mov r2, r24 - - watchdogConfig(WATCHDOG_OFF); - 1fe2e: 80 e0 ldi r24, 0x00 ; 0 - 1fe30: e7 df rcall .-50 ; 0x1fe00 - __asm__ __volatile__ ( - 1fe32: ee 27 eor r30, r30 - 1fe34: ff 27 eor r31, r31 - 1fe36: 09 94 ijmp - -0001fe38 <__eerd_byte_m1280>: - 1fe38: f9 99 sbic 0x1f, 1 ; 31 - 1fe3a: fe cf rjmp .-4 ; 0x1fe38 <__eerd_byte_m1280> - 1fe3c: 92 bd out 0x22, r25 ; 34 - 1fe3e: 81 bd out 0x21, r24 ; 33 - 1fe40: f8 9a sbi 0x1f, 0 ; 31 - 1fe42: 99 27 eor r25, r25 - 1fe44: 80 b5 in r24, 0x20 ; 32 - 1fe46: 08 95 ret - -0001fe48 <__eewr_byte_m1280>: - 1fe48: 26 2f mov r18, r22 - -0001fe4a <__eewr_r18_m1280>: - 1fe4a: f9 99 sbic 0x1f, 1 ; 31 - 1fe4c: fe cf rjmp .-4 ; 0x1fe4a <__eewr_r18_m1280> - 1fe4e: 1f ba out 0x1f, r1 ; 31 - 1fe50: 92 bd out 0x22, r25 ; 34 - 1fe52: 81 bd out 0x21, r24 ; 33 - 1fe54: 20 bd out 0x20, r18 ; 32 - 1fe56: 0f b6 in r0, 0x3f ; 63 - 1fe58: f8 94 cli - 1fe5a: fa 9a sbi 0x1f, 2 ; 31 - 1fe5c: f9 9a sbi 0x1f, 1 ; 31 - 1fe5e: 0f be out 0x3f, r0 ; 63 - 1fe60: 01 96 adiw r24, 0x01 ; 1 - 1fe62: 08 95 ret diff --git a/optiboot/bootloaders/optiboot/optiboot_atmega328.hex b/optiboot/bootloaders/optiboot/optiboot_atmega328.hex deleted file mode 100644 index 3df8770c2..000000000 --- a/optiboot/bootloaders/optiboot/optiboot_atmega328.hex +++ /dev/null @@ -1,33 +0,0 @@ -:107E0000112494B714BE892F8D7011F0892FDED004 -:107E100085E08093810082E08093C00088E18093B8 -:107E2000C10086E08093C20080E18093C4008EE0B0 -:107E3000B7D0259A86E020E33CEF91E030938500AF -:107E40002093840096BBB09BFECF1D9AA8958150CD -:107E5000A9F7EE24FF24B3E0AB2EBB24B394A5E036 -:107E6000DA2EF1E1CF2E90D0813471F48DD0082F2D -:107E70009DD0023811F482E005C0013811F486E08B -:107E800001C083E079D075C0823411F484E103C06D -:107E9000853419F485E092D06CC0853579F474D0BE -:107EA000E82EFF2471D0082F10E0102F00270E2994 -:107EB0001F29000F111F7AD078015BC0863521F48D -:107EC00084E07CD080E0DECF843609F035C05CD021 -:107ED0005BD0182F59D0082FC0E0D1E055D089933E -:107EE0001C17E1F763D0053409F4FFCFF701A7BEF3 -:107EF000E89507B600FCFDCFA701A0E0B1E02C910A -:107F000030E011968C91119790E0982F8827822B62 -:107F1000932B1296FA010C01B7BEE89511244E5F1F -:107F20005F4F1A1761F7F701D7BEE89507B600FC57 -:107F3000FDCFC7BEE8951DC0843769F425D024D095 -:107F4000082F22D033D0E701FE018591EF0114D034 -:107F50000150D1F70EC0853739F428D08EE10CD00E -:107F600085E90AD08FE08ECF813511F488E018D0F2 -:107F70001DD080E101D077CF982F8091C00085FF80 -:107F8000FCCF9093C60008958091C00087FFFCCF7E -:107F90008091C00084FD01C0A8958091C60008951D -:107FA000E0E6F0E098E1908380830895EDDF803291 -:107FB00019F088E0F5DFFFCF84E1DECF1F93182FA3 -:107FC000E3DF1150E9F7F2DF1F910895282E80E0DA -:087FD000E7DFEE27FF2709940B -:027FFE00020679 -:0400000300007E007B -:00000001FF diff --git a/optiboot/bootloaders/optiboot/optiboot_atmega328.lst b/optiboot/bootloaders/optiboot/optiboot_atmega328.lst deleted file mode 100644 index 3c79ad422..000000000 --- a/optiboot/bootloaders/optiboot/optiboot_atmega328.lst +++ /dev/null @@ -1,588 +0,0 @@ - -optiboot_atmega328.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001d8 00007e00 00007e00 00000074 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00007ffe 00007ffe 0000024c 2**0 - CONTENTS, ALLOC, LOAD, READONLY, DATA - 2 .debug_aranges 00000028 00000000 00000000 0000024e 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 00000074 00000000 00000000 00000276 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 000003ea 00000000 00000000 000002ea 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 000001ef 00000000 00000000 000006d4 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000042b 00000000 00000000 000008c3 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000cf0 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 0000017c 00000000 00000000 00000d70 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 00000300 00000000 00000000 00000eec 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 000000b8 00000000 00000000 000011ec 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00007e00
: -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - - -/* main program starts here */ -int main(void) { - 7e00: 11 24 eor r1, r1 - * modified Adaboot no-wait mod. - * Pass the reset reason to app. Also, it appears that an Uno poweron - * can leave multiple reset flags set; we only want the bootloader to - * run on an 'external reset only' status - */ - ch = MCUSR; - 7e02: 94 b7 in r25, 0x34 ; 52 - MCUSR = 0; - 7e04: 14 be out 0x34, r1 ; 52 - if (ch & (_BV(WDRF) | _BV(BORF) | _BV(PORF))) - 7e06: 89 2f mov r24, r25 - 7e08: 8d 70 andi r24, 0x0D ; 13 - 7e0a: 11 f0 breq .+4 ; 0x7e10 - appStart(ch); - 7e0c: 89 2f mov r24, r25 - 7e0e: de d0 rcall .+444 ; 0x7fcc - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 7e10: 85 e0 ldi r24, 0x05 ; 5 - 7e12: 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 - UART_SRA = _BV(U2X0); //Double speed mode USART0 - 7e16: 82 e0 ldi r24, 0x02 ; 2 - 7e18: 80 93 c0 00 sts 0x00C0, r24 - UART_SRB = _BV(RXEN0) | _BV(TXEN0); - 7e1c: 88 e1 ldi r24, 0x18 ; 24 - 7e1e: 80 93 c1 00 sts 0x00C1, r24 - UART_SRC = _BV(UCSZ00) | _BV(UCSZ01); - 7e22: 86 e0 ldi r24, 0x06 ; 6 - 7e24: 80 93 c2 00 sts 0x00C2, r24 - UART_SRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 7e28: 80 e1 ldi r24, 0x10 ; 16 - 7e2a: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 7e2e: 8e e0 ldi r24, 0x0E ; 14 - 7e30: b7 d0 rcall .+366 ; 0x7fa0 - -#if (LED_START_FLASHES > 0) || defined(LED_DATA_FLASH) - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 7e32: 25 9a sbi 0x04, 5 ; 4 - 7e34: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 7e36: 20 e3 ldi r18, 0x30 ; 48 - 7e38: 3c ef ldi r19, 0xFC ; 252 - TIFR1 = _BV(TOV1); - 7e3a: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 7e3c: 30 93 85 00 sts 0x0085, r19 - 7e40: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 7e44: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 7e46: b0 9b sbis 0x16, 0 ; 22 - 7e48: fe cf rjmp .-4 ; 0x7e46 -#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 7e4a: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 7e4c: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 7e4e: 81 50 subi r24, 0x01 ; 1 - 7e50: a9 f7 brne .-22 ; 0x7e3c - 7e52: ee 24 eor r14, r14 - 7e54: ff 24 eor r15, r15 - * Start the page erase and wait for it to finish. There - * used to be code to do this while receiving the data over - * the serial link, but the performance improvement was slight, - * and we needed the space back. - */ - __boot_page_erase_short((uint16_t)(void*)address); - 7e56: b3 e0 ldi r27, 0x03 ; 3 - 7e58: ab 2e mov r10, r27 - */ - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 7e5a: bb 24 eor r11, r11 - 7e5c: b3 94 inc r11 - } while (len -= 2); - - /* - * Actually Write the buffer to flash (and wait for it to finish.) - */ - __boot_page_write_short((uint16_t)(void*)address); - 7e5e: a5 e0 ldi r26, 0x05 ; 5 - 7e60: da 2e mov r13, r26 - boot_spm_busy_wait(); -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 7e62: f1 e1 ldi r31, 0x11 ; 17 - 7e64: cf 2e mov r12, r31 -#endif - - /* Forever loop: exits by causing WDT reset */ - for (;;) { - /* get character from UART */ - ch = getch(); - 7e66: 90 d0 rcall .+288 ; 0x7f88 - - if(ch == STK_GET_PARAMETER) { - 7e68: 81 34 cpi r24, 0x41 ; 65 - 7e6a: 71 f4 brne .+28 ; 0x7e88 - unsigned char which = getch(); - 7e6c: 8d d0 rcall .+282 ; 0x7f88 - 7e6e: 08 2f mov r16, r24 - verifySpace(); - 7e70: 9d d0 rcall .+314 ; 0x7fac - /* - * Send optiboot version as "SW version" - * Note that the references to memory are optimized away. - */ - if (which == 0x82) { - 7e72: 02 38 cpi r16, 0x82 ; 130 - 7e74: 11 f4 brne .+4 ; 0x7e7a - putch(optiboot_version & 0xFF); - 7e76: 82 e0 ldi r24, 0x02 ; 2 - 7e78: 05 c0 rjmp .+10 ; 0x7e84 - } else if (which == 0x81) { - 7e7a: 01 38 cpi r16, 0x81 ; 129 - 7e7c: 11 f4 brne .+4 ; 0x7e82 - putch(optiboot_version >> 8); - 7e7e: 86 e0 ldi r24, 0x06 ; 6 - 7e80: 01 c0 rjmp .+2 ; 0x7e84 - } else { - /* - * GET PARAMETER returns a generic 0x03 reply for - * other parameters - enough to keep Avrdude happy - */ - putch(0x03); - 7e82: 83 e0 ldi r24, 0x03 ; 3 - 7e84: 79 d0 rcall .+242 ; 0x7f78 - 7e86: 75 c0 rjmp .+234 ; 0x7f72 - } - } - else if(ch == STK_SET_DEVICE) { - 7e88: 82 34 cpi r24, 0x42 ; 66 - 7e8a: 11 f4 brne .+4 ; 0x7e90 - // SET DEVICE is ignored - getNch(20); - 7e8c: 84 e1 ldi r24, 0x14 ; 20 - 7e8e: 03 c0 rjmp .+6 ; 0x7e96 - } - else if(ch == STK_SET_DEVICE_EXT) { - 7e90: 85 34 cpi r24, 0x45 ; 69 - 7e92: 19 f4 brne .+6 ; 0x7e9a - // SET DEVICE EXT is ignored - getNch(5); - 7e94: 85 e0 ldi r24, 0x05 ; 5 - 7e96: 92 d0 rcall .+292 ; 0x7fbc - 7e98: 6c c0 rjmp .+216 ; 0x7f72 - } - else if(ch == STK_LOAD_ADDRESS) { - 7e9a: 85 35 cpi r24, 0x55 ; 85 - 7e9c: 79 f4 brne .+30 ; 0x7ebc - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 7e9e: 74 d0 rcall .+232 ; 0x7f88 - newAddress = (newAddress & 0xff) | (getch() << 8); - 7ea0: e8 2e mov r14, r24 - 7ea2: ff 24 eor r15, r15 - 7ea4: 71 d0 rcall .+226 ; 0x7f88 - 7ea6: 08 2f mov r16, r24 - 7ea8: 10 e0 ldi r17, 0x00 ; 0 - 7eaa: 10 2f mov r17, r16 - 7eac: 00 27 eor r16, r16 - 7eae: 0e 29 or r16, r14 - 7eb0: 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 - 7eb2: 00 0f add r16, r16 - 7eb4: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 7eb6: 7a d0 rcall .+244 ; 0x7fac - 7eb8: 78 01 movw r14, r16 - 7eba: 5b c0 rjmp .+182 ; 0x7f72 - } - else if(ch == STK_UNIVERSAL) { - 7ebc: 86 35 cpi r24, 0x56 ; 86 - 7ebe: 21 f4 brne .+8 ; 0x7ec8 - // UNIVERSAL command is ignored - getNch(4); - 7ec0: 84 e0 ldi r24, 0x04 ; 4 - 7ec2: 7c d0 rcall .+248 ; 0x7fbc - putch(0x00); - 7ec4: 80 e0 ldi r24, 0x00 ; 0 - 7ec6: de cf rjmp .-68 ; 0x7e84 - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 7ec8: 84 36 cpi r24, 0x64 ; 100 - 7eca: 09 f0 breq .+2 ; 0x7ece - 7ecc: 35 c0 rjmp .+106 ; 0x7f38 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t desttype; - uint8_t *bufPtr; - pagelen_t savelength; - - GETLENGTH(length); - 7ece: 5c d0 rcall .+184 ; 0x7f88 - 7ed0: 5b d0 rcall .+182 ; 0x7f88 - 7ed2: 18 2f mov r17, r24 - savelength = length; - desttype = getch(); - 7ed4: 59 d0 rcall .+178 ; 0x7f88 - 7ed6: 08 2f mov r16, r24 - 7ed8: c0 e0 ldi r28, 0x00 ; 0 - 7eda: d1 e0 ldi r29, 0x01 ; 1 - - // read a page worth of contents - bufPtr = buff; - do *bufPtr++ = getch(); - 7edc: 55 d0 rcall .+170 ; 0x7f88 - 7ede: 89 93 st Y+, r24 - while (--length); - 7ee0: 1c 17 cp r17, r28 - 7ee2: e1 f7 brne .-8 ; 0x7edc - - // Read command terminator, start reply - verifySpace(); - 7ee4: 63 d0 rcall .+198 ; 0x7fac - * void writebuffer(memtype, buffer, address, length) - */ -static inline void writebuffer(int8_t memtype, uint8_t *mybuff, - uint16_t address, pagelen_t len) -{ - switch (memtype) { - 7ee6: 05 34 cpi r16, 0x45 ; 69 - 7ee8: 09 f4 brne .+2 ; 0x7eec - 7eea: ff cf rjmp .-2 ; 0x7eea - * Start the page erase and wait for it to finish. There - * used to be code to do this while receiving the data over - * the serial link, but the performance improvement was slight, - * and we needed the space back. - */ - __boot_page_erase_short((uint16_t)(void*)address); - 7eec: f7 01 movw r30, r14 - 7eee: a7 be out 0x37, r10 ; 55 - 7ef0: e8 95 spm - boot_spm_busy_wait(); - 7ef2: 07 b6 in r0, 0x37 ; 55 - 7ef4: 00 fc sbrc r0, 0 - 7ef6: fd cf rjmp .-6 ; 0x7ef2 - 7ef8: a7 01 movw r20, r14 - 7efa: a0 e0 ldi r26, 0x00 ; 0 - 7efc: b1 e0 ldi r27, 0x01 ; 1 - /* - * Copy data from the buffer into the flash write buffer. - */ - do { - uint16_t a; - a = *bufPtr++; - 7efe: 2c 91 ld r18, X - 7f00: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 7f02: 11 96 adiw r26, 0x01 ; 1 - 7f04: 8c 91 ld r24, X - 7f06: 11 97 sbiw r26, 0x01 ; 1 - 7f08: 90 e0 ldi r25, 0x00 ; 0 - 7f0a: 98 2f mov r25, r24 - 7f0c: 88 27 eor r24, r24 - 7f0e: 82 2b or r24, r18 - 7f10: 93 2b or r25, r19 -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - - -/* main program starts here */ -int main(void) { - 7f12: 12 96 adiw r26, 0x02 ; 2 - */ - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 7f14: fa 01 movw r30, r20 - 7f16: 0c 01 movw r0, r24 - 7f18: b7 be out 0x37, r11 ; 55 - 7f1a: e8 95 spm - 7f1c: 11 24 eor r1, r1 - addrPtr += 2; - 7f1e: 4e 5f subi r20, 0xFE ; 254 - 7f20: 5f 4f sbci r21, 0xFF ; 255 - } while (len -= 2); - 7f22: 1a 17 cp r17, r26 - 7f24: 61 f7 brne .-40 ; 0x7efe - - /* - * Actually Write the buffer to flash (and wait for it to finish.) - */ - __boot_page_write_short((uint16_t)(void*)address); - 7f26: f7 01 movw r30, r14 - 7f28: d7 be out 0x37, r13 ; 55 - 7f2a: e8 95 spm - boot_spm_busy_wait(); - 7f2c: 07 b6 in r0, 0x37 ; 55 - 7f2e: 00 fc sbrc r0, 0 - 7f30: fd cf rjmp .-6 ; 0x7f2c -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 7f32: c7 be out 0x37, r12 ; 55 - 7f34: e8 95 spm - 7f36: 1d c0 rjmp .+58 ; 0x7f72 - writebuffer(desttype, buff, address, savelength); - - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 7f38: 84 37 cpi r24, 0x74 ; 116 - 7f3a: 69 f4 brne .+26 ; 0x7f56 - uint8_t desttype; - GETLENGTH(length); - 7f3c: 25 d0 rcall .+74 ; 0x7f88 - 7f3e: 24 d0 rcall .+72 ; 0x7f88 - 7f40: 08 2f mov r16, r24 - - desttype = getch(); - 7f42: 22 d0 rcall .+68 ; 0x7f88 - - verifySpace(); - 7f44: 33 d0 rcall .+102 ; 0x7fac - 7f46: e7 01 movw r28, r14 - __asm__ ("elpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#else - // read a Flash byte and increment the address - __asm__ ("lpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#endif - putch(ch); - 7f48: fe 01 movw r30, r28 - 7f4a: 85 91 lpm r24, Z+ - 7f4c: ef 01 movw r28, r30 - 7f4e: 14 d0 rcall .+40 ; 0x7f78 - } while (--length); - 7f50: 01 50 subi r16, 0x01 ; 1 - 7f52: d1 f7 brne .-12 ; 0x7f48 - 7f54: 0e c0 rjmp .+28 ; 0x7f72 - - read_mem(desttype, address, length); - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 7f56: 85 37 cpi r24, 0x75 ; 117 - 7f58: 39 f4 brne .+14 ; 0x7f68 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 7f5a: 28 d0 rcall .+80 ; 0x7fac - putch(SIGNATURE_0); - 7f5c: 8e e1 ldi r24, 0x1E ; 30 - 7f5e: 0c d0 rcall .+24 ; 0x7f78 - putch(SIGNATURE_1); - 7f60: 85 e9 ldi r24, 0x95 ; 149 - 7f62: 0a d0 rcall .+20 ; 0x7f78 - putch(SIGNATURE_2); - 7f64: 8f e0 ldi r24, 0x0F ; 15 - 7f66: 8e cf rjmp .-228 ; 0x7e84 - } - else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */ - 7f68: 81 35 cpi r24, 0x51 ; 81 - 7f6a: 11 f4 brne .+4 ; 0x7f70 - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 7f6c: 88 e0 ldi r24, 0x08 ; 8 - 7f6e: 18 d0 rcall .+48 ; 0x7fa0 - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 7f70: 1d d0 rcall .+58 ; 0x7fac - } - putch(STK_OK); - 7f72: 80 e1 ldi r24, 0x10 ; 16 - 7f74: 01 d0 rcall .+2 ; 0x7f78 - 7f76: 77 cf rjmp .-274 ; 0x7e66 - -00007f78 : - } -} - -void putch(char ch) { - 7f78: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UART_SRA & _BV(UDRE0))); - 7f7a: 80 91 c0 00 lds r24, 0x00C0 - 7f7e: 85 ff sbrs r24, 5 - 7f80: fc cf rjmp .-8 ; 0x7f7a - UART_UDR = ch; - 7f82: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 7f86: 08 95 ret - -00007f88 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UART_SRA & _BV(RXC0))) - 7f88: 80 91 c0 00 lds r24, 0x00C0 - 7f8c: 87 ff sbrs r24, 7 - 7f8e: fc cf rjmp .-8 ; 0x7f88 - ; - if (!(UART_SRA & _BV(FE0))) { - 7f90: 80 91 c0 00 lds r24, 0x00C0 - 7f94: 84 fd sbrc r24, 4 - 7f96: 01 c0 rjmp .+2 ; 0x7f9a -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 7f98: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UART_UDR; - 7f9a: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 7f9e: 08 95 ret - -00007fa0 : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 7fa0: e0 e6 ldi r30, 0x60 ; 96 - 7fa2: f0 e0 ldi r31, 0x00 ; 0 - 7fa4: 98 e1 ldi r25, 0x18 ; 24 - 7fa6: 90 83 st Z, r25 - WDTCSR = x; - 7fa8: 80 83 st Z, r24 -} - 7faa: 08 95 ret - -00007fac : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 7fac: ed df rcall .-38 ; 0x7f88 - 7fae: 80 32 cpi r24, 0x20 ; 32 - 7fb0: 19 f0 breq .+6 ; 0x7fb8 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 7fb2: 88 e0 ldi r24, 0x08 ; 8 - 7fb4: f5 df rcall .-22 ; 0x7fa0 - 7fb6: ff cf rjmp .-2 ; 0x7fb6 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 7fb8: 84 e1 ldi r24, 0x14 ; 20 -} - 7fba: de cf rjmp .-68 ; 0x7f78 - -00007fbc : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 7fbc: 1f 93 push r17 - 7fbe: 18 2f mov r17, r24 - do getch(); while (--count); - 7fc0: e3 df rcall .-58 ; 0x7f88 - 7fc2: 11 50 subi r17, 0x01 ; 1 - 7fc4: e9 f7 brne .-6 ; 0x7fc0 - verifySpace(); - 7fc6: f2 df rcall .-28 ; 0x7fac -} - 7fc8: 1f 91 pop r17 - 7fca: 08 95 ret - -00007fcc : - -void appStart(uint8_t rstFlags) { - // save the reset flags in the designated register - // This can be saved in a main program by putting code in .init0 (which - // executes before normal c init code) to save R2 to a global variable. - __asm__ __volatile__ ("mov r2, %0\n" :: "r" (rstFlags)); - 7fcc: 28 2e mov r2, r24 - - watchdogConfig(WATCHDOG_OFF); - 7fce: 80 e0 ldi r24, 0x00 ; 0 - 7fd0: e7 df rcall .-50 ; 0x7fa0 - __asm__ __volatile__ ( - 7fd2: ee 27 eor r30, r30 - 7fd4: ff 27 eor r31, r31 - 7fd6: 09 94 ijmp diff --git a/optiboot/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex b/optiboot/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex deleted file mode 100644 index 0f09bce63..000000000 --- a/optiboot/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex +++ /dev/null @@ -1,33 +0,0 @@ -:107E0000112494B714BE892F8D7011F0892FDED004 -:107E100085E08093810082E08093C00088E18093B8 -:107E2000C10086E08093C20088E08093C4008EE0A9 -:107E3000B7D0259A86E028E13EEF91E030938500A7 -:107E40002093840096BBB09BFECF1D9AA8958150CD -:107E5000A9F7EE24FF24B3E0AB2EBB24B394A5E036 -:107E6000DA2EF1E1CF2E90D0813471F48DD0082F2D -:107E70009DD0023811F482E005C0013811F486E08B -:107E800001C083E079D075C0823411F484E103C06D -:107E9000853419F485E092D06CC0853579F474D0BE -:107EA000E82EFF2471D0082F10E0102F00270E2994 -:107EB0001F29000F111F7AD078015BC0863521F48D -:107EC00084E07CD080E0DECF843609F035C05CD021 -:107ED0005BD0182F59D0082FC0E0D1E055D089933E -:107EE0001C17E1F763D0053409F4FFCFF701A7BEF3 -:107EF000E89507B600FCFDCFA701A0E0B1E02C910A -:107F000030E011968C91119790E0982F8827822B62 -:107F1000932B1296FA010C01B7BEE89511244E5F1F -:107F20005F4F1A1761F7F701D7BEE89507B600FC57 -:107F3000FDCFC7BEE8951DC0843769F425D024D095 -:107F4000082F22D033D0E701FE018591EF0114D034 -:107F50000150D1F70EC0853739F428D08EE10CD00E -:107F600085E90AD08FE08ECF813511F488E018D0F2 -:107F70001DD080E101D077CF982F8091C00085FF80 -:107F8000FCCF9093C60008958091C00087FFFCCF7E -:107F90008091C00084FD01C0A8958091C60008951D -:107FA000E0E6F0E098E1908380830895EDDF803291 -:107FB00019F088E0F5DFFFCF84E1DECF1F93182FA3 -:107FC000E3DF1150E9F7F2DF1F910895282E80E0DA -:087FD000E7DFEE27FF2709940B -:027FFE00020679 -:0400000300007E007B -:00000001FF diff --git a/optiboot/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst b/optiboot/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst deleted file mode 100644 index 8c2e6b174..000000000 --- a/optiboot/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.lst +++ /dev/null @@ -1,588 +0,0 @@ - -optiboot_atmega328.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001d8 00007e00 00007e00 00000074 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00007ffe 00007ffe 0000024c 2**0 - CONTENTS, ALLOC, LOAD, READONLY, DATA - 2 .debug_aranges 00000028 00000000 00000000 0000024e 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 00000074 00000000 00000000 00000276 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 000003ea 00000000 00000000 000002ea 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 000001ef 00000000 00000000 000006d4 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000042b 00000000 00000000 000008c3 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000cf0 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 0000017c 00000000 00000000 00000d70 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 00000300 00000000 00000000 00000eec 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 000000b8 00000000 00000000 000011ec 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00007e00
: -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - - -/* main program starts here */ -int main(void) { - 7e00: 11 24 eor r1, r1 - * modified Adaboot no-wait mod. - * Pass the reset reason to app. Also, it appears that an Uno poweron - * can leave multiple reset flags set; we only want the bootloader to - * run on an 'external reset only' status - */ - ch = MCUSR; - 7e02: 94 b7 in r25, 0x34 ; 52 - MCUSR = 0; - 7e04: 14 be out 0x34, r1 ; 52 - if (ch & (_BV(WDRF) | _BV(BORF) | _BV(PORF))) - 7e06: 89 2f mov r24, r25 - 7e08: 8d 70 andi r24, 0x0D ; 13 - 7e0a: 11 f0 breq .+4 ; 0x7e10 - appStart(ch); - 7e0c: 89 2f mov r24, r25 - 7e0e: de d0 rcall .+444 ; 0x7fcc - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 7e10: 85 e0 ldi r24, 0x05 ; 5 - 7e12: 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 - UART_SRA = _BV(U2X0); //Double speed mode USART0 - 7e16: 82 e0 ldi r24, 0x02 ; 2 - 7e18: 80 93 c0 00 sts 0x00C0, r24 - UART_SRB = _BV(RXEN0) | _BV(TXEN0); - 7e1c: 88 e1 ldi r24, 0x18 ; 24 - 7e1e: 80 93 c1 00 sts 0x00C1, r24 - UART_SRC = _BV(UCSZ00) | _BV(UCSZ01); - 7e22: 86 e0 ldi r24, 0x06 ; 6 - 7e24: 80 93 c2 00 sts 0x00C2, r24 - UART_SRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 7e28: 88 e0 ldi r24, 0x08 ; 8 - 7e2a: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 7e2e: 8e e0 ldi r24, 0x0E ; 14 - 7e30: b7 d0 rcall .+366 ; 0x7fa0 - -#if (LED_START_FLASHES > 0) || defined(LED_DATA_FLASH) - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 7e32: 25 9a sbi 0x04, 5 ; 4 - 7e34: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 7e36: 28 e1 ldi r18, 0x18 ; 24 - 7e38: 3e ef ldi r19, 0xFE ; 254 - TIFR1 = _BV(TOV1); - 7e3a: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 7e3c: 30 93 85 00 sts 0x0085, r19 - 7e40: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 7e44: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 7e46: b0 9b sbis 0x16, 0 ; 22 - 7e48: fe cf rjmp .-4 ; 0x7e46 -#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 7e4a: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 7e4c: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 7e4e: 81 50 subi r24, 0x01 ; 1 - 7e50: a9 f7 brne .-22 ; 0x7e3c - 7e52: ee 24 eor r14, r14 - 7e54: ff 24 eor r15, r15 - * Start the page erase and wait for it to finish. There - * used to be code to do this while receiving the data over - * the serial link, but the performance improvement was slight, - * and we needed the space back. - */ - __boot_page_erase_short((uint16_t)(void*)address); - 7e56: b3 e0 ldi r27, 0x03 ; 3 - 7e58: ab 2e mov r10, r27 - */ - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 7e5a: bb 24 eor r11, r11 - 7e5c: b3 94 inc r11 - } while (len -= 2); - - /* - * Actually Write the buffer to flash (and wait for it to finish.) - */ - __boot_page_write_short((uint16_t)(void*)address); - 7e5e: a5 e0 ldi r26, 0x05 ; 5 - 7e60: da 2e mov r13, r26 - boot_spm_busy_wait(); -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 7e62: f1 e1 ldi r31, 0x11 ; 17 - 7e64: cf 2e mov r12, r31 -#endif - - /* Forever loop: exits by causing WDT reset */ - for (;;) { - /* get character from UART */ - ch = getch(); - 7e66: 90 d0 rcall .+288 ; 0x7f88 - - if(ch == STK_GET_PARAMETER) { - 7e68: 81 34 cpi r24, 0x41 ; 65 - 7e6a: 71 f4 brne .+28 ; 0x7e88 - unsigned char which = getch(); - 7e6c: 8d d0 rcall .+282 ; 0x7f88 - 7e6e: 08 2f mov r16, r24 - verifySpace(); - 7e70: 9d d0 rcall .+314 ; 0x7fac - /* - * Send optiboot version as "SW version" - * Note that the references to memory are optimized away. - */ - if (which == 0x82) { - 7e72: 02 38 cpi r16, 0x82 ; 130 - 7e74: 11 f4 brne .+4 ; 0x7e7a - putch(optiboot_version & 0xFF); - 7e76: 82 e0 ldi r24, 0x02 ; 2 - 7e78: 05 c0 rjmp .+10 ; 0x7e84 - } else if (which == 0x81) { - 7e7a: 01 38 cpi r16, 0x81 ; 129 - 7e7c: 11 f4 brne .+4 ; 0x7e82 - putch(optiboot_version >> 8); - 7e7e: 86 e0 ldi r24, 0x06 ; 6 - 7e80: 01 c0 rjmp .+2 ; 0x7e84 - } else { - /* - * GET PARAMETER returns a generic 0x03 reply for - * other parameters - enough to keep Avrdude happy - */ - putch(0x03); - 7e82: 83 e0 ldi r24, 0x03 ; 3 - 7e84: 79 d0 rcall .+242 ; 0x7f78 - 7e86: 75 c0 rjmp .+234 ; 0x7f72 - } - } - else if(ch == STK_SET_DEVICE) { - 7e88: 82 34 cpi r24, 0x42 ; 66 - 7e8a: 11 f4 brne .+4 ; 0x7e90 - // SET DEVICE is ignored - getNch(20); - 7e8c: 84 e1 ldi r24, 0x14 ; 20 - 7e8e: 03 c0 rjmp .+6 ; 0x7e96 - } - else if(ch == STK_SET_DEVICE_EXT) { - 7e90: 85 34 cpi r24, 0x45 ; 69 - 7e92: 19 f4 brne .+6 ; 0x7e9a - // SET DEVICE EXT is ignored - getNch(5); - 7e94: 85 e0 ldi r24, 0x05 ; 5 - 7e96: 92 d0 rcall .+292 ; 0x7fbc - 7e98: 6c c0 rjmp .+216 ; 0x7f72 - } - else if(ch == STK_LOAD_ADDRESS) { - 7e9a: 85 35 cpi r24, 0x55 ; 85 - 7e9c: 79 f4 brne .+30 ; 0x7ebc - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 7e9e: 74 d0 rcall .+232 ; 0x7f88 - newAddress = (newAddress & 0xff) | (getch() << 8); - 7ea0: e8 2e mov r14, r24 - 7ea2: ff 24 eor r15, r15 - 7ea4: 71 d0 rcall .+226 ; 0x7f88 - 7ea6: 08 2f mov r16, r24 - 7ea8: 10 e0 ldi r17, 0x00 ; 0 - 7eaa: 10 2f mov r17, r16 - 7eac: 00 27 eor r16, r16 - 7eae: 0e 29 or r16, r14 - 7eb0: 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 - 7eb2: 00 0f add r16, r16 - 7eb4: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 7eb6: 7a d0 rcall .+244 ; 0x7fac - 7eb8: 78 01 movw r14, r16 - 7eba: 5b c0 rjmp .+182 ; 0x7f72 - } - else if(ch == STK_UNIVERSAL) { - 7ebc: 86 35 cpi r24, 0x56 ; 86 - 7ebe: 21 f4 brne .+8 ; 0x7ec8 - // UNIVERSAL command is ignored - getNch(4); - 7ec0: 84 e0 ldi r24, 0x04 ; 4 - 7ec2: 7c d0 rcall .+248 ; 0x7fbc - putch(0x00); - 7ec4: 80 e0 ldi r24, 0x00 ; 0 - 7ec6: de cf rjmp .-68 ; 0x7e84 - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 7ec8: 84 36 cpi r24, 0x64 ; 100 - 7eca: 09 f0 breq .+2 ; 0x7ece - 7ecc: 35 c0 rjmp .+106 ; 0x7f38 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t desttype; - uint8_t *bufPtr; - pagelen_t savelength; - - GETLENGTH(length); - 7ece: 5c d0 rcall .+184 ; 0x7f88 - 7ed0: 5b d0 rcall .+182 ; 0x7f88 - 7ed2: 18 2f mov r17, r24 - savelength = length; - desttype = getch(); - 7ed4: 59 d0 rcall .+178 ; 0x7f88 - 7ed6: 08 2f mov r16, r24 - 7ed8: c0 e0 ldi r28, 0x00 ; 0 - 7eda: d1 e0 ldi r29, 0x01 ; 1 - - // read a page worth of contents - bufPtr = buff; - do *bufPtr++ = getch(); - 7edc: 55 d0 rcall .+170 ; 0x7f88 - 7ede: 89 93 st Y+, r24 - while (--length); - 7ee0: 1c 17 cp r17, r28 - 7ee2: e1 f7 brne .-8 ; 0x7edc - - // Read command terminator, start reply - verifySpace(); - 7ee4: 63 d0 rcall .+198 ; 0x7fac - * void writebuffer(memtype, buffer, address, length) - */ -static inline void writebuffer(int8_t memtype, uint8_t *mybuff, - uint16_t address, pagelen_t len) -{ - switch (memtype) { - 7ee6: 05 34 cpi r16, 0x45 ; 69 - 7ee8: 09 f4 brne .+2 ; 0x7eec - 7eea: ff cf rjmp .-2 ; 0x7eea - * Start the page erase and wait for it to finish. There - * used to be code to do this while receiving the data over - * the serial link, but the performance improvement was slight, - * and we needed the space back. - */ - __boot_page_erase_short((uint16_t)(void*)address); - 7eec: f7 01 movw r30, r14 - 7eee: a7 be out 0x37, r10 ; 55 - 7ef0: e8 95 spm - boot_spm_busy_wait(); - 7ef2: 07 b6 in r0, 0x37 ; 55 - 7ef4: 00 fc sbrc r0, 0 - 7ef6: fd cf rjmp .-6 ; 0x7ef2 - 7ef8: a7 01 movw r20, r14 - 7efa: a0 e0 ldi r26, 0x00 ; 0 - 7efc: b1 e0 ldi r27, 0x01 ; 1 - /* - * Copy data from the buffer into the flash write buffer. - */ - do { - uint16_t a; - a = *bufPtr++; - 7efe: 2c 91 ld r18, X - 7f00: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 7f02: 11 96 adiw r26, 0x01 ; 1 - 7f04: 8c 91 ld r24, X - 7f06: 11 97 sbiw r26, 0x01 ; 1 - 7f08: 90 e0 ldi r25, 0x00 ; 0 - 7f0a: 98 2f mov r25, r24 - 7f0c: 88 27 eor r24, r24 - 7f0e: 82 2b or r24, r18 - 7f10: 93 2b or r25, r19 -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - - -/* main program starts here */ -int main(void) { - 7f12: 12 96 adiw r26, 0x02 ; 2 - */ - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 7f14: fa 01 movw r30, r20 - 7f16: 0c 01 movw r0, r24 - 7f18: b7 be out 0x37, r11 ; 55 - 7f1a: e8 95 spm - 7f1c: 11 24 eor r1, r1 - addrPtr += 2; - 7f1e: 4e 5f subi r20, 0xFE ; 254 - 7f20: 5f 4f sbci r21, 0xFF ; 255 - } while (len -= 2); - 7f22: 1a 17 cp r17, r26 - 7f24: 61 f7 brne .-40 ; 0x7efe - - /* - * Actually Write the buffer to flash (and wait for it to finish.) - */ - __boot_page_write_short((uint16_t)(void*)address); - 7f26: f7 01 movw r30, r14 - 7f28: d7 be out 0x37, r13 ; 55 - 7f2a: e8 95 spm - boot_spm_busy_wait(); - 7f2c: 07 b6 in r0, 0x37 ; 55 - 7f2e: 00 fc sbrc r0, 0 - 7f30: fd cf rjmp .-6 ; 0x7f2c -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 7f32: c7 be out 0x37, r12 ; 55 - 7f34: e8 95 spm - 7f36: 1d c0 rjmp .+58 ; 0x7f72 - writebuffer(desttype, buff, address, savelength); - - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 7f38: 84 37 cpi r24, 0x74 ; 116 - 7f3a: 69 f4 brne .+26 ; 0x7f56 - uint8_t desttype; - GETLENGTH(length); - 7f3c: 25 d0 rcall .+74 ; 0x7f88 - 7f3e: 24 d0 rcall .+72 ; 0x7f88 - 7f40: 08 2f mov r16, r24 - - desttype = getch(); - 7f42: 22 d0 rcall .+68 ; 0x7f88 - - verifySpace(); - 7f44: 33 d0 rcall .+102 ; 0x7fac - 7f46: e7 01 movw r28, r14 - __asm__ ("elpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#else - // read a Flash byte and increment the address - __asm__ ("lpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#endif - putch(ch); - 7f48: fe 01 movw r30, r28 - 7f4a: 85 91 lpm r24, Z+ - 7f4c: ef 01 movw r28, r30 - 7f4e: 14 d0 rcall .+40 ; 0x7f78 - } while (--length); - 7f50: 01 50 subi r16, 0x01 ; 1 - 7f52: d1 f7 brne .-12 ; 0x7f48 - 7f54: 0e c0 rjmp .+28 ; 0x7f72 - - read_mem(desttype, address, length); - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 7f56: 85 37 cpi r24, 0x75 ; 117 - 7f58: 39 f4 brne .+14 ; 0x7f68 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 7f5a: 28 d0 rcall .+80 ; 0x7fac - putch(SIGNATURE_0); - 7f5c: 8e e1 ldi r24, 0x1E ; 30 - 7f5e: 0c d0 rcall .+24 ; 0x7f78 - putch(SIGNATURE_1); - 7f60: 85 e9 ldi r24, 0x95 ; 149 - 7f62: 0a d0 rcall .+20 ; 0x7f78 - putch(SIGNATURE_2); - 7f64: 8f e0 ldi r24, 0x0F ; 15 - 7f66: 8e cf rjmp .-228 ; 0x7e84 - } - else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */ - 7f68: 81 35 cpi r24, 0x51 ; 81 - 7f6a: 11 f4 brne .+4 ; 0x7f70 - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 7f6c: 88 e0 ldi r24, 0x08 ; 8 - 7f6e: 18 d0 rcall .+48 ; 0x7fa0 - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 7f70: 1d d0 rcall .+58 ; 0x7fac - } - putch(STK_OK); - 7f72: 80 e1 ldi r24, 0x10 ; 16 - 7f74: 01 d0 rcall .+2 ; 0x7f78 - 7f76: 77 cf rjmp .-274 ; 0x7e66 - -00007f78 : - } -} - -void putch(char ch) { - 7f78: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UART_SRA & _BV(UDRE0))); - 7f7a: 80 91 c0 00 lds r24, 0x00C0 - 7f7e: 85 ff sbrs r24, 5 - 7f80: fc cf rjmp .-8 ; 0x7f7a - UART_UDR = ch; - 7f82: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 7f86: 08 95 ret - -00007f88 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UART_SRA & _BV(RXC0))) - 7f88: 80 91 c0 00 lds r24, 0x00C0 - 7f8c: 87 ff sbrs r24, 7 - 7f8e: fc cf rjmp .-8 ; 0x7f88 - ; - if (!(UART_SRA & _BV(FE0))) { - 7f90: 80 91 c0 00 lds r24, 0x00C0 - 7f94: 84 fd sbrc r24, 4 - 7f96: 01 c0 rjmp .+2 ; 0x7f9a -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 7f98: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UART_UDR; - 7f9a: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 7f9e: 08 95 ret - -00007fa0 : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 7fa0: e0 e6 ldi r30, 0x60 ; 96 - 7fa2: f0 e0 ldi r31, 0x00 ; 0 - 7fa4: 98 e1 ldi r25, 0x18 ; 24 - 7fa6: 90 83 st Z, r25 - WDTCSR = x; - 7fa8: 80 83 st Z, r24 -} - 7faa: 08 95 ret - -00007fac : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 7fac: ed df rcall .-38 ; 0x7f88 - 7fae: 80 32 cpi r24, 0x20 ; 32 - 7fb0: 19 f0 breq .+6 ; 0x7fb8 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 7fb2: 88 e0 ldi r24, 0x08 ; 8 - 7fb4: f5 df rcall .-22 ; 0x7fa0 - 7fb6: ff cf rjmp .-2 ; 0x7fb6 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 7fb8: 84 e1 ldi r24, 0x14 ; 20 -} - 7fba: de cf rjmp .-68 ; 0x7f78 - -00007fbc : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 7fbc: 1f 93 push r17 - 7fbe: 18 2f mov r17, r24 - do getch(); while (--count); - 7fc0: e3 df rcall .-58 ; 0x7f88 - 7fc2: 11 50 subi r17, 0x01 ; 1 - 7fc4: e9 f7 brne .-6 ; 0x7fc0 - verifySpace(); - 7fc6: f2 df rcall .-28 ; 0x7fac -} - 7fc8: 1f 91 pop r17 - 7fca: 08 95 ret - -00007fcc : - -void appStart(uint8_t rstFlags) { - // save the reset flags in the designated register - // This can be saved in a main program by putting code in .init0 (which - // executes before normal c init code) to save R2 to a global variable. - __asm__ __volatile__ ("mov r2, %0\n" :: "r" (rstFlags)); - 7fcc: 28 2e mov r2, r24 - - watchdogConfig(WATCHDOG_OFF); - 7fce: 80 e0 ldi r24, 0x00 ; 0 - 7fd0: e7 df rcall .-50 ; 0x7fa0 - __asm__ __volatile__ ( - 7fd2: ee 27 eor r30, r30 - 7fd4: ff 27 eor r31, r31 - 7fd6: 09 94 ijmp diff --git a/optiboot/bootloaders/optiboot/optiboot_atmega644p.hex b/optiboot/bootloaders/optiboot/optiboot_atmega644p.hex deleted file mode 100644 index 0465e3ad6..000000000 --- a/optiboot/bootloaders/optiboot/optiboot_atmega644p.hex +++ /dev/null @@ -1,34 +0,0 @@ -:10FC0000112484B714BE81FFE6D085E08093810083 -:10FC100082E08093C00088E18093C10086E08093F9 -:10FC2000C20080E18093C4008EE0BFD0209A86E0BD -:10FC300020E33CEF91E0309385002093840096BB55 -:10FC4000B09BFECF189AA8958150A9F7EE24FF2407 -:10FC5000AA24A394B5E0CB2EA1E1BA2EF3E0DF2EC7 -:10FC600098D0813461F495D0082FA5D0023829F1BD -:10FC7000013811F485E001C083E083D07FC0823475 -:10FC800011F484E103C0853419F485E09CD076C07A -:10FC9000853579F47ED0E82EFF247BD0082F10E044 -:10FCA000102F00270E291F29000F111F84D0780163 -:10FCB00065C0863521F484E086D080E0DECF8436CE -:10FCC00009F040C066D065D0082F63D080E0E81608 -:10FCD00080EEF80618F4F701D7BEE895C0E0D1E051 -:10FCE00058D089930C17E1F7F0E0EF16F0EEFF061D -:10FCF00018F0F701D7BEE8955ED007B600FCFDCF3F -:10FD0000A701A0E0B1E02C9130E011968C91119701 -:10FD100090E0982F8827822B932B1296FA010C01E2 -:10FD2000A7BEE89511244E5F5F4FF2E0A030BF07F9 -:10FD300051F7F701C7BEE89507B600FCFDCFB7BE87 -:10FD4000E8951CC0843761F424D023D0082F21D03B -:10FD500032D0F70185917F0114D00150D1F70EC048 -:10FD6000853739F428D08EE10CD086E90AD08AE0B4 -:10FD700084CF813511F488E018D01DD080E101D006 -:10FD80006FCF982F8091C00085FFFCCF9093C60065 -:10FD900008958091C00087FFFCCF8091C00084FD52 -:10FDA00001C0A8958091C6000895E0E6F0E098E1D2 -:10FDB000908380830895EDDF803219F088E0F5DFCD -:10FDC000FFCF84E1DECF1F93182FE3DF1150E9F757 -:10FDD000F2DF1F910895282E80E0E7DFEE27FF274E -:02FDE000099484 -:02FFFE000005FC -:040000030000FC00FD -:00000001FF diff --git a/optiboot/bootloaders/optiboot/optiboot_atmega644p.lst b/optiboot/bootloaders/optiboot/optiboot_atmega644p.lst deleted file mode 100644 index 9a157a896..000000000 --- a/optiboot/bootloaders/optiboot/optiboot_atmega644p.lst +++ /dev/null @@ -1,586 +0,0 @@ - -optiboot_atmega644p.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001e2 0000fc00 0000fc00 00000054 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 0000fffe 0000fffe 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 00000294 00000000 00000000 000002bf 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 0000016b 00000000 00000000 00000553 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000421 00000000 00000000 000006be 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000ae0 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000131 00000000 00000000 00000b60 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 00000266 00000000 00000000 00000c91 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 00000078 00000000 00000000 00000ef7 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -0000fc00
: -# define UART_SRL UBRR3L -# define UART_UDR UDR3 -#endif - -/* main program starts here */ -int main(void) { - fc00: 11 24 eor r1, r1 -#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) - SP=RAMEND; // This is done by hardware reset -#endif - - // Adaboot no-wait mod - ch = MCUSR; - fc02: 84 b7 in r24, 0x34 ; 52 - MCUSR = 0; - fc04: 14 be out 0x34, r1 ; 52 - if (!(ch & _BV(EXTRF))) appStart(ch); - fc06: 81 ff sbrs r24, 1 - fc08: e6 d0 rcall .+460 ; 0xfdd6 - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - fc0a: 85 e0 ldi r24, 0x05 ; 5 - fc0c: 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 - UART_SRA = _BV(U2X0); //Double speed mode USART0 - fc10: 82 e0 ldi r24, 0x02 ; 2 - fc12: 80 93 c0 00 sts 0x00C0, r24 - UART_SRB = _BV(RXEN0) | _BV(TXEN0); - fc16: 88 e1 ldi r24, 0x18 ; 24 - fc18: 80 93 c1 00 sts 0x00C1, r24 - UART_SRC = _BV(UCSZ00) | _BV(UCSZ01); - fc1c: 86 e0 ldi r24, 0x06 ; 6 - fc1e: 80 93 c2 00 sts 0x00C2, r24 - UART_SRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - fc22: 80 e1 ldi r24, 0x10 ; 16 - fc24: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - fc28: 8e e0 ldi r24, 0x0E ; 14 - fc2a: bf d0 rcall .+382 ; 0xfdaa - -#if (LED_START_FLASHES > 0) || defined(LED_DATA_FLASH) - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - fc2c: 20 9a sbi 0x04, 0 ; 4 - fc2e: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - fc30: 20 e3 ldi r18, 0x30 ; 48 - fc32: 3c ef ldi r19, 0xFC ; 252 - TIFR1 = _BV(TOV1); - fc34: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - fc36: 30 93 85 00 sts 0x0085, r19 - fc3a: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - fc3e: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - fc40: b0 9b sbis 0x16, 0 ; 22 - fc42: fe cf rjmp .-4 ; 0xfc40 -#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - fc44: 18 9a sbi 0x03, 0 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - fc46: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - fc48: 81 50 subi r24, 0x01 ; 1 - fc4a: a9 f7 brne .-22 ; 0xfc36 - fc4c: ee 24 eor r14, r14 - fc4e: ff 24 eor r15, r15 - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - fc50: aa 24 eor r10, r10 - fc52: a3 94 inc r10 - addrPtr += 2; - } while (--ch); - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - fc54: b5 e0 ldi r27, 0x05 ; 5 - fc56: cb 2e mov r12, r27 - boot_spm_busy_wait(); - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - fc58: a1 e1 ldi r26, 0x11 ; 17 - fc5a: ba 2e mov r11, r26 - - // If we are in NRWW section, page erase has to be delayed until now. - // Todo: Take RAMPZ into account (not doing so just means that we will - // treat the top of both "pages" of flash as NRWW, for a slight speed - // decrease, so fixing this is not urgent.) - if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - fc5c: f3 e0 ldi r31, 0x03 ; 3 - fc5e: df 2e mov r13, r31 -#endif - - /* Forever loop */ - for (;;) { - /* get character from UART */ - ch = getch(); - fc60: 98 d0 rcall .+304 ; 0xfd92 - - if(ch == STK_GET_PARAMETER) { - fc62: 81 34 cpi r24, 0x41 ; 65 - fc64: 61 f4 brne .+24 ; 0xfc7e - unsigned char which = getch(); - fc66: 95 d0 rcall .+298 ; 0xfd92 - fc68: 08 2f mov r16, r24 - verifySpace(); - fc6a: a5 d0 rcall .+330 ; 0xfdb6 - if (which == 0x82) { - fc6c: 02 38 cpi r16, 0x82 ; 130 - fc6e: 29 f1 breq .+74 ; 0xfcba - /* - * Send optiboot version as "minor SW version" - */ - putch(OPTIBOOT_MINVER); - } else if (which == 0x81) { - fc70: 01 38 cpi r16, 0x81 ; 129 - fc72: 11 f4 brne .+4 ; 0xfc78 - putch(OPTIBOOT_MAJVER); - fc74: 85 e0 ldi r24, 0x05 ; 5 - fc76: 01 c0 rjmp .+2 ; 0xfc7a - } else { - /* - * GET PARAMETER returns a generic 0x03 reply for - * other parameters - enough to keep Avrdude happy - */ - putch(0x03); - fc78: 83 e0 ldi r24, 0x03 ; 3 - fc7a: 83 d0 rcall .+262 ; 0xfd82 - fc7c: 7f c0 rjmp .+254 ; 0xfd7c - } - } - else if(ch == STK_SET_DEVICE) { - fc7e: 82 34 cpi r24, 0x42 ; 66 - fc80: 11 f4 brne .+4 ; 0xfc86 - // SET DEVICE is ignored - getNch(20); - fc82: 84 e1 ldi r24, 0x14 ; 20 - fc84: 03 c0 rjmp .+6 ; 0xfc8c - } - else if(ch == STK_SET_DEVICE_EXT) { - fc86: 85 34 cpi r24, 0x45 ; 69 - fc88: 19 f4 brne .+6 ; 0xfc90 - // SET DEVICE EXT is ignored - getNch(5); - fc8a: 85 e0 ldi r24, 0x05 ; 5 - fc8c: 9c d0 rcall .+312 ; 0xfdc6 - fc8e: 76 c0 rjmp .+236 ; 0xfd7c - } - else if(ch == STK_LOAD_ADDRESS) { - fc90: 85 35 cpi r24, 0x55 ; 85 - fc92: 79 f4 brne .+30 ; 0xfcb2 - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - fc94: 7e d0 rcall .+252 ; 0xfd92 - newAddress = (newAddress & 0xff) | (getch() << 8); - fc96: e8 2e mov r14, r24 - fc98: ff 24 eor r15, r15 - fc9a: 7b d0 rcall .+246 ; 0xfd92 - fc9c: 08 2f mov r16, r24 - fc9e: 10 e0 ldi r17, 0x00 ; 0 - fca0: 10 2f mov r17, r16 - fca2: 00 27 eor r16, r16 - fca4: 0e 29 or r16, r14 - fca6: 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 - fca8: 00 0f add r16, r16 - fcaa: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - fcac: 84 d0 rcall .+264 ; 0xfdb6 - fcae: 78 01 movw r14, r16 - fcb0: 65 c0 rjmp .+202 ; 0xfd7c - } - else if(ch == STK_UNIVERSAL) { - fcb2: 86 35 cpi r24, 0x56 ; 86 - fcb4: 21 f4 brne .+8 ; 0xfcbe - // UNIVERSAL command is ignored - getNch(4); - fcb6: 84 e0 ldi r24, 0x04 ; 4 - fcb8: 86 d0 rcall .+268 ; 0xfdc6 - putch(0x00); - fcba: 80 e0 ldi r24, 0x00 ; 0 - fcbc: de cf rjmp .-68 ; 0xfc7a - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - fcbe: 84 36 cpi r24, 0x64 ; 100 - fcc0: 09 f0 breq .+2 ; 0xfcc4 - fcc2: 40 c0 rjmp .+128 ; 0xfd44 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t *bufPtr; - uint16_t addrPtr; - - getch(); /* getlen() */ - fcc4: 66 d0 rcall .+204 ; 0xfd92 - length = getch(); - fcc6: 65 d0 rcall .+202 ; 0xfd92 - fcc8: 08 2f mov r16, r24 - getch(); - fcca: 63 d0 rcall .+198 ; 0xfd92 - - // If we are in RWW section, immediately start page erase - if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - fccc: 80 e0 ldi r24, 0x00 ; 0 - fcce: e8 16 cp r14, r24 - fcd0: 80 ee ldi r24, 0xE0 ; 224 - fcd2: f8 06 cpc r15, r24 - fcd4: 18 f4 brcc .+6 ; 0xfcdc - fcd6: f7 01 movw r30, r14 - fcd8: d7 be out 0x37, r13 ; 55 - fcda: e8 95 spm - fcdc: c0 e0 ldi r28, 0x00 ; 0 - fcde: d1 e0 ldi r29, 0x01 ; 1 - - // While that is going on, read in page contents - bufPtr = buff; - do *bufPtr++ = getch(); - fce0: 58 d0 rcall .+176 ; 0xfd92 - fce2: 89 93 st Y+, r24 - while (--length); - fce4: 0c 17 cp r16, r28 - fce6: e1 f7 brne .-8 ; 0xfce0 - - // If we are in NRWW section, page erase has to be delayed until now. - // Todo: Take RAMPZ into account (not doing so just means that we will - // treat the top of both "pages" of flash as NRWW, for a slight speed - // decrease, so fixing this is not urgent.) - if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); - fce8: f0 e0 ldi r31, 0x00 ; 0 - fcea: ef 16 cp r14, r31 - fcec: f0 ee ldi r31, 0xE0 ; 224 - fcee: ff 06 cpc r15, r31 - fcf0: 18 f0 brcs .+6 ; 0xfcf8 - fcf2: f7 01 movw r30, r14 - fcf4: d7 be out 0x37, r13 ; 55 - fcf6: e8 95 spm - - // Read command terminator, start reply - verifySpace(); - fcf8: 5e d0 rcall .+188 ; 0xfdb6 - - // If only a partial page is to be programmed, the erase might not be complete. - // So check that here - boot_spm_busy_wait(); - fcfa: 07 b6 in r0, 0x37 ; 55 - fcfc: 00 fc sbrc r0, 0 - fcfe: fd cf rjmp .-6 ; 0xfcfa - fd00: a7 01 movw r20, r14 - fd02: a0 e0 ldi r26, 0x00 ; 0 - fd04: b1 e0 ldi r27, 0x01 ; 1 - bufPtr = buff; - addrPtr = (uint16_t)(void*)address; - ch = SPM_PAGESIZE / 2; - do { - uint16_t a; - a = *bufPtr++; - fd06: 2c 91 ld r18, X - fd08: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - fd0a: 11 96 adiw r26, 0x01 ; 1 - fd0c: 8c 91 ld r24, X - fd0e: 11 97 sbiw r26, 0x01 ; 1 - fd10: 90 e0 ldi r25, 0x00 ; 0 - fd12: 98 2f mov r25, r24 - fd14: 88 27 eor r24, r24 - fd16: 82 2b or r24, r18 - fd18: 93 2b or r25, r19 -# define UART_SRL UBRR3L -# define UART_UDR UDR3 -#endif - -/* main program starts here */ -int main(void) { - fd1a: 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); - fd1c: fa 01 movw r30, r20 - fd1e: 0c 01 movw r0, r24 - fd20: a7 be out 0x37, r10 ; 55 - fd22: e8 95 spm - fd24: 11 24 eor r1, r1 - addrPtr += 2; - fd26: 4e 5f subi r20, 0xFE ; 254 - fd28: 5f 4f sbci r21, 0xFF ; 255 - } while (--ch); - fd2a: f2 e0 ldi r31, 0x02 ; 2 - fd2c: a0 30 cpi r26, 0x00 ; 0 - fd2e: bf 07 cpc r27, r31 - fd30: 51 f7 brne .-44 ; 0xfd06 - - // Write from programming buffer - __boot_page_write_short((uint16_t)(void*)address); - fd32: f7 01 movw r30, r14 - fd34: c7 be out 0x37, r12 ; 55 - fd36: e8 95 spm - boot_spm_busy_wait(); - fd38: 07 b6 in r0, 0x37 ; 55 - fd3a: 00 fc sbrc r0, 0 - fd3c: fd cf rjmp .-6 ; 0xfd38 - -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - fd3e: b7 be out 0x37, r11 ; 55 - fd40: e8 95 spm - fd42: 1c c0 rjmp .+56 ; 0xfd7c -#endif - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - fd44: 84 37 cpi r24, 0x74 ; 116 - fd46: 61 f4 brne .+24 ; 0xfd60 - // READ PAGE - we only read flash - getch(); /* getlen() */ - fd48: 24 d0 rcall .+72 ; 0xfd92 - length = getch(); - fd4a: 23 d0 rcall .+70 ; 0xfd92 - fd4c: 08 2f mov r16, r24 - getch(); - fd4e: 21 d0 rcall .+66 ; 0xfd92 - - verifySpace(); - fd50: 32 d0 rcall .+100 ; 0xfdb6 - __asm__ ("elpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#else - // read a Flash byte and increment the address - __asm__ ("lpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#endif - putch(ch); - fd52: f7 01 movw r30, r14 - fd54: 85 91 lpm r24, Z+ - fd56: 7f 01 movw r14, r30 - fd58: 14 d0 rcall .+40 ; 0xfd82 - } while (--length); - fd5a: 01 50 subi r16, 0x01 ; 1 - fd5c: d1 f7 brne .-12 ; 0xfd52 - fd5e: 0e c0 rjmp .+28 ; 0xfd7c - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - fd60: 85 37 cpi r24, 0x75 ; 117 - fd62: 39 f4 brne .+14 ; 0xfd72 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - fd64: 28 d0 rcall .+80 ; 0xfdb6 - putch(SIGNATURE_0); - fd66: 8e e1 ldi r24, 0x1E ; 30 - fd68: 0c d0 rcall .+24 ; 0xfd82 - putch(SIGNATURE_1); - fd6a: 86 e9 ldi r24, 0x96 ; 150 - fd6c: 0a d0 rcall .+20 ; 0xfd82 - putch(SIGNATURE_2); - fd6e: 8a e0 ldi r24, 0x0A ; 10 - fd70: 84 cf rjmp .-248 ; 0xfc7a - } - else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */ - fd72: 81 35 cpi r24, 0x51 ; 81 - fd74: 11 f4 brne .+4 ; 0xfd7a - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - fd76: 88 e0 ldi r24, 0x08 ; 8 - fd78: 18 d0 rcall .+48 ; 0xfdaa - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - fd7a: 1d d0 rcall .+58 ; 0xfdb6 - } - putch(STK_OK); - fd7c: 80 e1 ldi r24, 0x10 ; 16 - fd7e: 01 d0 rcall .+2 ; 0xfd82 - fd80: 6f cf rjmp .-290 ; 0xfc60 - -0000fd82 : - } -} - -void putch(char ch) { - fd82: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UART_SRA & _BV(UDRE0))); - fd84: 80 91 c0 00 lds r24, 0x00C0 - fd88: 85 ff sbrs r24, 5 - fd8a: fc cf rjmp .-8 ; 0xfd84 - UART_UDR = ch; - fd8c: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - fd90: 08 95 ret - -0000fd92 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UART_SRA & _BV(RXC0))) - fd92: 80 91 c0 00 lds r24, 0x00C0 - fd96: 87 ff sbrs r24, 7 - fd98: fc cf rjmp .-8 ; 0xfd92 - ; - if (!(UART_SRA & _BV(FE0))) { - fd9a: 80 91 c0 00 lds r24, 0x00C0 - fd9e: 84 fd sbrc r24, 4 - fda0: 01 c0 rjmp .+2 ; 0xfda4 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - fda2: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UART_UDR; - fda4: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - fda8: 08 95 ret - -0000fdaa : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - fdaa: e0 e6 ldi r30, 0x60 ; 96 - fdac: f0 e0 ldi r31, 0x00 ; 0 - fdae: 98 e1 ldi r25, 0x18 ; 24 - fdb0: 90 83 st Z, r25 - WDTCSR = x; - fdb2: 80 83 st Z, r24 -} - fdb4: 08 95 ret - -0000fdb6 : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - fdb6: ed df rcall .-38 ; 0xfd92 - fdb8: 80 32 cpi r24, 0x20 ; 32 - fdba: 19 f0 breq .+6 ; 0xfdc2 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - fdbc: 88 e0 ldi r24, 0x08 ; 8 - fdbe: f5 df rcall .-22 ; 0xfdaa - fdc0: ff cf rjmp .-2 ; 0xfdc0 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - fdc2: 84 e1 ldi r24, 0x14 ; 20 -} - fdc4: de cf rjmp .-68 ; 0xfd82 - -0000fdc6 : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - fdc6: 1f 93 push r17 - fdc8: 18 2f mov r17, r24 - do getch(); while (--count); - fdca: e3 df rcall .-58 ; 0xfd92 - fdcc: 11 50 subi r17, 0x01 ; 1 - fdce: e9 f7 brne .-6 ; 0xfdca - verifySpace(); - fdd0: f2 df rcall .-28 ; 0xfdb6 -} - fdd2: 1f 91 pop r17 - fdd4: 08 95 ret - -0000fdd6 : - -void appStart(uint8_t rstFlags) { - // save the reset flags in the designated register - // This can be saved in a main program by putting code in .init0 (which - // executes before normal c init code) to save R2 to a global variable. - __asm__ __volatile__ ("mov r2, %0\n" :: "r" (rstFlags)); - fdd6: 28 2e mov r2, r24 - - watchdogConfig(WATCHDOG_OFF); - fdd8: 80 e0 ldi r24, 0x00 ; 0 - fdda: e7 df rcall .-50 ; 0xfdaa - __asm__ __volatile__ ( - fddc: ee 27 eor r30, r30 - fdde: ff 27 eor r31, r31 - fde0: 09 94 ijmp diff --git a/optiboot/bootloaders/optiboot/optiboot_diecimila.lst b/optiboot/bootloaders/optiboot/optiboot_diecimila.lst deleted file mode 100644 index cdddbd499..000000000 --- a/optiboot/bootloaders/optiboot/optiboot_diecimila.lst +++ /dev/null @@ -1,586 +0,0 @@ - -optiboot_atmega168.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001d6 00003e00 00003e00 00000074 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 0000024a 2**0 - CONTENTS, ALLOC, LOAD, READONLY, DATA - 2 .debug_aranges 00000028 00000000 00000000 0000024c 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 00000074 00000000 00000000 00000274 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 000003ea 00000000 00000000 000002e8 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 000001ef 00000000 00000000 000006d2 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000423 00000000 00000000 000008c1 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000ce4 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 0000017c 00000000 00000000 00000d64 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 00000300 00000000 00000000 00000ee0 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 000000b8 00000000 00000000 000011e0 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00003e00
: -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - - -/* main program starts here */ -int main(void) { - 3e00: 11 24 eor r1, r1 - * modified Adaboot no-wait mod. - * Pass the reset reason to app. Also, it appears that an Uno poweron - * can leave multiple reset flags set; we only want the bootloader to - * run on an 'external reset only' status - */ - ch = MCUSR; - 3e02: 94 b7 in r25, 0x34 ; 52 - MCUSR = 0; - 3e04: 14 be out 0x34, r1 ; 52 - if (ch & (_BV(WDRF) | _BV(BORF) | _BV(PORF))) - 3e06: 89 2f mov r24, r25 - 3e08: 8d 70 andi r24, 0x0D ; 13 - 3e0a: 11 f0 breq .+4 ; 0x3e10 - appStart(ch); - 3e0c: 89 2f mov r24, r25 - 3e0e: dd d0 rcall .+442 ; 0x3fca - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 3e10: 85 e0 ldi r24, 0x05 ; 5 - 3e12: 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 - UART_SRA = _BV(U2X0); //Double speed mode USART0 - 3e16: 82 e0 ldi r24, 0x02 ; 2 - 3e18: 80 93 c0 00 sts 0x00C0, r24 - UART_SRB = _BV(RXEN0) | _BV(TXEN0); - 3e1c: 88 e1 ldi r24, 0x18 ; 24 - 3e1e: 80 93 c1 00 sts 0x00C1, r24 - UART_SRC = _BV(UCSZ00) | _BV(UCSZ01); - 3e22: 86 e0 ldi r24, 0x06 ; 6 - 3e24: 80 93 c2 00 sts 0x00C2, r24 - UART_SRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e28: 80 e1 ldi r24, 0x10 ; 16 - 3e2a: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 3e2e: 8e e0 ldi r24, 0x0E ; 14 - 3e30: b6 d0 rcall .+364 ; 0x3f9e - -#if (LED_START_FLASHES > 0) || defined(LED_DATA_FLASH) - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 3e32: 25 9a sbi 0x04, 5 ; 4 - 3e34: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e36: 20 e3 ldi r18, 0x30 ; 48 - 3e38: 3c ef ldi r19, 0xFC ; 252 - TIFR1 = _BV(TOV1); - 3e3a: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e3c: 30 93 85 00 sts 0x0085, r19 - 3e40: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 3e44: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 3e46: b0 9b sbis 0x16, 0 ; 22 - 3e48: fe cf rjmp .-4 ; 0x3e46 -#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 3e4a: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3e4c: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 3e4e: 81 50 subi r24, 0x01 ; 1 - 3e50: a9 f7 brne .-22 ; 0x3e3c - 3e52: ee 24 eor r14, r14 - 3e54: ff 24 eor r15, r15 - * Start the page erase and wait for it to finish. There - * used to be code to do this while receiving the data over - * the serial link, but the performance improvement was slight, - * and we needed the space back. - */ - __boot_page_erase_short((uint16_t)(void*)address); - 3e56: b3 e0 ldi r27, 0x03 ; 3 - 3e58: ab 2e mov r10, r27 - */ - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3e5a: bb 24 eor r11, r11 - 3e5c: b3 94 inc r11 - } while (len -= 2); - - /* - * Actually Write the buffer to flash (and wait for it to finish.) - */ - __boot_page_write_short((uint16_t)(void*)address); - 3e5e: a5 e0 ldi r26, 0x05 ; 5 - 3e60: da 2e mov r13, r26 - boot_spm_busy_wait(); -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3e62: f1 e1 ldi r31, 0x11 ; 17 - 3e64: cf 2e mov r12, r31 -#endif - - /* Forever loop: exits by causing WDT reset */ - for (;;) { - /* get character from UART */ - ch = getch(); - 3e66: 8f d0 rcall .+286 ; 0x3f86 - - if(ch == STK_GET_PARAMETER) { - 3e68: 81 34 cpi r24, 0x41 ; 65 - 3e6a: 69 f4 brne .+26 ; 0x3e86 - unsigned char which = getch(); - 3e6c: 8c d0 rcall .+280 ; 0x3f86 - 3e6e: 08 2f mov r16, r24 - verifySpace(); - 3e70: 9c d0 rcall .+312 ; 0x3faa - /* - * Send optiboot version as "SW version" - * Note that the references to memory are optimized away. - */ - if (which == 0x82) { - 3e72: 02 38 cpi r16, 0x82 ; 130 - 3e74: 11 f4 brne .+4 ; 0x3e7a - putch(optiboot_version & 0xFF); - 3e76: 82 e0 ldi r24, 0x02 ; 2 - 3e78: 04 c0 rjmp .+8 ; 0x3e82 - } else if (which == 0x81) { - 3e7a: 01 38 cpi r16, 0x81 ; 129 - 3e7c: 09 f4 brne .+2 ; 0x3e80 - 3e7e: 71 c0 rjmp .+226 ; 0x3f62 - } else { - /* - * GET PARAMETER returns a generic 0x03 reply for - * other parameters - enough to keep Avrdude happy - */ - putch(0x03); - 3e80: 83 e0 ldi r24, 0x03 ; 3 - 3e82: 79 d0 rcall .+242 ; 0x3f76 - 3e84: 75 c0 rjmp .+234 ; 0x3f70 - } - } - else if(ch == STK_SET_DEVICE) { - 3e86: 82 34 cpi r24, 0x42 ; 66 - 3e88: 11 f4 brne .+4 ; 0x3e8e - // SET DEVICE is ignored - getNch(20); - 3e8a: 84 e1 ldi r24, 0x14 ; 20 - 3e8c: 03 c0 rjmp .+6 ; 0x3e94 - } - else if(ch == STK_SET_DEVICE_EXT) { - 3e8e: 85 34 cpi r24, 0x45 ; 69 - 3e90: 19 f4 brne .+6 ; 0x3e98 - // SET DEVICE EXT is ignored - getNch(5); - 3e92: 85 e0 ldi r24, 0x05 ; 5 - 3e94: 92 d0 rcall .+292 ; 0x3fba - 3e96: 6c c0 rjmp .+216 ; 0x3f70 - } - else if(ch == STK_LOAD_ADDRESS) { - 3e98: 85 35 cpi r24, 0x55 ; 85 - 3e9a: 79 f4 brne .+30 ; 0x3eba - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 3e9c: 74 d0 rcall .+232 ; 0x3f86 - newAddress = (newAddress & 0xff) | (getch() << 8); - 3e9e: e8 2e mov r14, r24 - 3ea0: ff 24 eor r15, r15 - 3ea2: 71 d0 rcall .+226 ; 0x3f86 - 3ea4: 08 2f mov r16, r24 - 3ea6: 10 e0 ldi r17, 0x00 ; 0 - 3ea8: 10 2f mov r17, r16 - 3eaa: 00 27 eor r16, r16 - 3eac: 0e 29 or r16, r14 - 3eae: 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 - 3eb0: 00 0f add r16, r16 - 3eb2: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 3eb4: 7a d0 rcall .+244 ; 0x3faa - 3eb6: 78 01 movw r14, r16 - 3eb8: 5b c0 rjmp .+182 ; 0x3f70 - } - else if(ch == STK_UNIVERSAL) { - 3eba: 86 35 cpi r24, 0x56 ; 86 - 3ebc: 21 f4 brne .+8 ; 0x3ec6 - // UNIVERSAL command is ignored - getNch(4); - 3ebe: 84 e0 ldi r24, 0x04 ; 4 - 3ec0: 7c d0 rcall .+248 ; 0x3fba - putch(0x00); - 3ec2: 80 e0 ldi r24, 0x00 ; 0 - 3ec4: de cf rjmp .-68 ; 0x3e82 - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 3ec6: 84 36 cpi r24, 0x64 ; 100 - 3ec8: 09 f0 breq .+2 ; 0x3ecc - 3eca: 35 c0 rjmp .+106 ; 0x3f36 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t desttype; - uint8_t *bufPtr; - pagelen_t savelength; - - GETLENGTH(length); - 3ecc: 5c d0 rcall .+184 ; 0x3f86 - 3ece: 5b d0 rcall .+182 ; 0x3f86 - 3ed0: 18 2f mov r17, r24 - savelength = length; - desttype = getch(); - 3ed2: 59 d0 rcall .+178 ; 0x3f86 - 3ed4: 08 2f mov r16, r24 - 3ed6: c0 e0 ldi r28, 0x00 ; 0 - 3ed8: d1 e0 ldi r29, 0x01 ; 1 - - // read a page worth of contents - bufPtr = buff; - do *bufPtr++ = getch(); - 3eda: 55 d0 rcall .+170 ; 0x3f86 - 3edc: 89 93 st Y+, r24 - while (--length); - 3ede: 1c 17 cp r17, r28 - 3ee0: e1 f7 brne .-8 ; 0x3eda - - // Read command terminator, start reply - verifySpace(); - 3ee2: 63 d0 rcall .+198 ; 0x3faa - * void writebuffer(memtype, buffer, address, length) - */ -static inline void writebuffer(int8_t memtype, uint8_t *mybuff, - uint16_t address, pagelen_t len) -{ - switch (memtype) { - 3ee4: 05 34 cpi r16, 0x45 ; 69 - 3ee6: 09 f4 brne .+2 ; 0x3eea - 3ee8: ff cf rjmp .-2 ; 0x3ee8 - * Start the page erase and wait for it to finish. There - * used to be code to do this while receiving the data over - * the serial link, but the performance improvement was slight, - * and we needed the space back. - */ - __boot_page_erase_short((uint16_t)(void*)address); - 3eea: f7 01 movw r30, r14 - 3eec: a7 be out 0x37, r10 ; 55 - 3eee: e8 95 spm - boot_spm_busy_wait(); - 3ef0: 07 b6 in r0, 0x37 ; 55 - 3ef2: 00 fc sbrc r0, 0 - 3ef4: fd cf rjmp .-6 ; 0x3ef0 - 3ef6: a7 01 movw r20, r14 - 3ef8: a0 e0 ldi r26, 0x00 ; 0 - 3efa: b1 e0 ldi r27, 0x01 ; 1 - /* - * Copy data from the buffer into the flash write buffer. - */ - do { - uint16_t a; - a = *bufPtr++; - 3efc: 2c 91 ld r18, X - 3efe: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 3f00: 11 96 adiw r26, 0x01 ; 1 - 3f02: 8c 91 ld r24, X - 3f04: 11 97 sbiw r26, 0x01 ; 1 - 3f06: 90 e0 ldi r25, 0x00 ; 0 - 3f08: 98 2f mov r25, r24 - 3f0a: 88 27 eor r24, r24 - 3f0c: 82 2b or r24, r18 - 3f0e: 93 2b or r25, r19 -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - - -/* main program starts here */ -int main(void) { - 3f10: 12 96 adiw r26, 0x02 ; 2 - */ - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f12: fa 01 movw r30, r20 - 3f14: 0c 01 movw r0, r24 - 3f16: b7 be out 0x37, r11 ; 55 - 3f18: e8 95 spm - 3f1a: 11 24 eor r1, r1 - addrPtr += 2; - 3f1c: 4e 5f subi r20, 0xFE ; 254 - 3f1e: 5f 4f sbci r21, 0xFF ; 255 - } while (len -= 2); - 3f20: 1a 17 cp r17, r26 - 3f22: 61 f7 brne .-40 ; 0x3efc - - /* - * Actually Write the buffer to flash (and wait for it to finish.) - */ - __boot_page_write_short((uint16_t)(void*)address); - 3f24: f7 01 movw r30, r14 - 3f26: d7 be out 0x37, r13 ; 55 - 3f28: e8 95 spm - boot_spm_busy_wait(); - 3f2a: 07 b6 in r0, 0x37 ; 55 - 3f2c: 00 fc sbrc r0, 0 - 3f2e: fd cf rjmp .-6 ; 0x3f2a -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3f30: c7 be out 0x37, r12 ; 55 - 3f32: e8 95 spm - 3f34: 1d c0 rjmp .+58 ; 0x3f70 - writebuffer(desttype, buff, address, savelength); - - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 3f36: 84 37 cpi r24, 0x74 ; 116 - 3f38: 69 f4 brne .+26 ; 0x3f54 - uint8_t desttype; - GETLENGTH(length); - 3f3a: 25 d0 rcall .+74 ; 0x3f86 - 3f3c: 24 d0 rcall .+72 ; 0x3f86 - 3f3e: 08 2f mov r16, r24 - - desttype = getch(); - 3f40: 22 d0 rcall .+68 ; 0x3f86 - - verifySpace(); - 3f42: 33 d0 rcall .+102 ; 0x3faa - 3f44: e7 01 movw r28, r14 - __asm__ ("elpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#else - // read a Flash byte and increment the address - __asm__ ("lpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#endif - putch(ch); - 3f46: fe 01 movw r30, r28 - 3f48: 85 91 lpm r24, Z+ - 3f4a: ef 01 movw r28, r30 - 3f4c: 14 d0 rcall .+40 ; 0x3f76 - } while (--length); - 3f4e: 01 50 subi r16, 0x01 ; 1 - 3f50: d1 f7 brne .-12 ; 0x3f46 - 3f52: 0e c0 rjmp .+28 ; 0x3f70 - - read_mem(desttype, address, length); - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 3f54: 85 37 cpi r24, 0x75 ; 117 - 3f56: 39 f4 brne .+14 ; 0x3f66 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 3f58: 28 d0 rcall .+80 ; 0x3faa - putch(SIGNATURE_0); - 3f5a: 8e e1 ldi r24, 0x1E ; 30 - 3f5c: 0c d0 rcall .+24 ; 0x3f76 - putch(SIGNATURE_1); - 3f5e: 84 e9 ldi r24, 0x94 ; 148 - 3f60: 0a d0 rcall .+20 ; 0x3f76 - putch(SIGNATURE_2); - 3f62: 86 e0 ldi r24, 0x06 ; 6 - 3f64: 8e cf rjmp .-228 ; 0x3e82 - } - else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */ - 3f66: 81 35 cpi r24, 0x51 ; 81 - 3f68: 11 f4 brne .+4 ; 0x3f6e - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 3f6a: 88 e0 ldi r24, 0x08 ; 8 - 3f6c: 18 d0 rcall .+48 ; 0x3f9e - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 3f6e: 1d d0 rcall .+58 ; 0x3faa - } - putch(STK_OK); - 3f70: 80 e1 ldi r24, 0x10 ; 16 - 3f72: 01 d0 rcall .+2 ; 0x3f76 - 3f74: 78 cf rjmp .-272 ; 0x3e66 - -00003f76 : - } -} - -void putch(char ch) { - 3f76: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UART_SRA & _BV(UDRE0))); - 3f78: 80 91 c0 00 lds r24, 0x00C0 - 3f7c: 85 ff sbrs r24, 5 - 3f7e: fc cf rjmp .-8 ; 0x3f78 - UART_UDR = ch; - 3f80: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 3f84: 08 95 ret - -00003f86 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UART_SRA & _BV(RXC0))) - 3f86: 80 91 c0 00 lds r24, 0x00C0 - 3f8a: 87 ff sbrs r24, 7 - 3f8c: fc cf rjmp .-8 ; 0x3f86 - ; - if (!(UART_SRA & _BV(FE0))) { - 3f8e: 80 91 c0 00 lds r24, 0x00C0 - 3f92: 84 fd sbrc r24, 4 - 3f94: 01 c0 rjmp .+2 ; 0x3f98 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3f96: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UART_UDR; - 3f98: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 3f9c: 08 95 ret - -00003f9e : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 3f9e: e0 e6 ldi r30, 0x60 ; 96 - 3fa0: f0 e0 ldi r31, 0x00 ; 0 - 3fa2: 98 e1 ldi r25, 0x18 ; 24 - 3fa4: 90 83 st Z, r25 - WDTCSR = x; - 3fa6: 80 83 st Z, r24 -} - 3fa8: 08 95 ret - -00003faa : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 3faa: ed df rcall .-38 ; 0x3f86 - 3fac: 80 32 cpi r24, 0x20 ; 32 - 3fae: 19 f0 breq .+6 ; 0x3fb6 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fb0: 88 e0 ldi r24, 0x08 ; 8 - 3fb2: f5 df rcall .-22 ; 0x3f9e - 3fb4: ff cf rjmp .-2 ; 0x3fb4 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 3fb6: 84 e1 ldi r24, 0x14 ; 20 -} - 3fb8: de cf rjmp .-68 ; 0x3f76 - -00003fba : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 3fba: 1f 93 push r17 - 3fbc: 18 2f mov r17, r24 - do getch(); while (--count); - 3fbe: e3 df rcall .-58 ; 0x3f86 - 3fc0: 11 50 subi r17, 0x01 ; 1 - 3fc2: e9 f7 brne .-6 ; 0x3fbe - verifySpace(); - 3fc4: f2 df rcall .-28 ; 0x3faa -} - 3fc6: 1f 91 pop r17 - 3fc8: 08 95 ret - -00003fca : - -void appStart(uint8_t rstFlags) { - // save the reset flags in the designated register - // This can be saved in a main program by putting code in .init0 (which - // executes before normal c init code) to save R2 to a global variable. - __asm__ __volatile__ ("mov r2, %0\n" :: "r" (rstFlags)); - 3fca: 28 2e mov r2, r24 - - watchdogConfig(WATCHDOG_OFF); - 3fcc: 80 e0 ldi r24, 0x00 ; 0 - 3fce: e7 df rcall .-50 ; 0x3f9e - __asm__ __volatile__ ( - 3fd0: ee 27 eor r30, r30 - 3fd2: ff 27 eor r31, r31 - 3fd4: 09 94 ijmp diff --git a/optiboot/bootloaders/optiboot/optiboot_lilypad.hex b/optiboot/bootloaders/optiboot/optiboot_lilypad.hex deleted file mode 100644 index b8d82f549..000000000 --- a/optiboot/bootloaders/optiboot/optiboot_lilypad.hex +++ /dev/null @@ -1,33 +0,0 @@ -:103E0000112494B714BE892F8D7011F0892FDDD045 -:103E100085E08093810082E08093C00088E18093F8 -:103E2000C10086E08093C20088E08093C4008EE0E9 -:103E3000B6D0259A86E028E13EEF91E030938500E8 -:103E40002093840096BBB09BFECF1D9AA89581500D -:103E5000A9F7EE24FF24B3E0AB2EBB24B394A5E076 -:103E6000DA2EF1E1CF2E8FD0813469F48CD0082F77 -:103E70009CD0023811F482E004C0013809F471C00A -:103E800083E079D075C0823411F484E103C08534B5 -:103E900019F485E092D06CC0853579F474D0E82EA1 -:103EA000FF2471D0082F10E0102F00270E291F29A2 -:103EB000000F111F7AD078015BC0863521F484E0B1 -:103EC0007CD080E0DECF843609F035C05CD05BD09A -:103ED000182F59D0082FC0E0D1E055D089931C1776 -:103EE000E1F763D0053409F4FFCFF701A7BEE895E9 -:103EF00007B600FCFDCFA701A0E0B1E02C9130E0B7 -:103F000011968C91119790E0982F8827822B932BF4 -:103F10001296FA010C01B7BEE89511244E5F5F4F6F -:103F20001A1761F7F701D7BEE89507B600FCFDCF79 -:103F3000C7BEE8951DC0843769F425D024D0082F6A -:103F400022D033D0E701FE018591EF0114D001505A -:103F5000D1F70EC0853739F428D08EE10CD084E932 -:103F60000AD086E08ECF813511F488E018D01DD0BC -:103F700080E101D078CF982F8091C00085FFFCCFE1 -:103F80009093C60008958091C00087FFFCCF809178 -:103F9000C00084FD01C0A8958091C6000895E0E6A8 -:103FA000F0E098E1908380830895EDDF803219F08E -:103FB00088E0F5DFFFCF84E1DECF1F93182FE3DF2A -:103FC0001150E9F7F2DF1F910895282E80E0E7DF16 -:063FD000EE27FF27099413 -:023FFE000206B9 -:0400000300003E00BB -:00000001FF diff --git a/optiboot/bootloaders/optiboot/optiboot_lilypad.lst b/optiboot/bootloaders/optiboot/optiboot_lilypad.lst deleted file mode 100644 index 101a10566..000000000 --- a/optiboot/bootloaders/optiboot/optiboot_lilypad.lst +++ /dev/null @@ -1,586 +0,0 @@ - -optiboot_atmega168.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001d6 00003e00 00003e00 00000074 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 0000024a 2**0 - CONTENTS, ALLOC, LOAD, READONLY, DATA - 2 .debug_aranges 00000028 00000000 00000000 0000024c 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 00000074 00000000 00000000 00000274 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 000003ea 00000000 00000000 000002e8 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 000001ef 00000000 00000000 000006d2 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000423 00000000 00000000 000008c1 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000ce4 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 0000017c 00000000 00000000 00000d64 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 00000300 00000000 00000000 00000ee0 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 000000b8 00000000 00000000 000011e0 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00003e00
: -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - - -/* main program starts here */ -int main(void) { - 3e00: 11 24 eor r1, r1 - * modified Adaboot no-wait mod. - * Pass the reset reason to app. Also, it appears that an Uno poweron - * can leave multiple reset flags set; we only want the bootloader to - * run on an 'external reset only' status - */ - ch = MCUSR; - 3e02: 94 b7 in r25, 0x34 ; 52 - MCUSR = 0; - 3e04: 14 be out 0x34, r1 ; 52 - if (ch & (_BV(WDRF) | _BV(BORF) | _BV(PORF))) - 3e06: 89 2f mov r24, r25 - 3e08: 8d 70 andi r24, 0x0D ; 13 - 3e0a: 11 f0 breq .+4 ; 0x3e10 - appStart(ch); - 3e0c: 89 2f mov r24, r25 - 3e0e: dd d0 rcall .+442 ; 0x3fca - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 3e10: 85 e0 ldi r24, 0x05 ; 5 - 3e12: 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 - UART_SRA = _BV(U2X0); //Double speed mode USART0 - 3e16: 82 e0 ldi r24, 0x02 ; 2 - 3e18: 80 93 c0 00 sts 0x00C0, r24 - UART_SRB = _BV(RXEN0) | _BV(TXEN0); - 3e1c: 88 e1 ldi r24, 0x18 ; 24 - 3e1e: 80 93 c1 00 sts 0x00C1, r24 - UART_SRC = _BV(UCSZ00) | _BV(UCSZ01); - 3e22: 86 e0 ldi r24, 0x06 ; 6 - 3e24: 80 93 c2 00 sts 0x00C2, r24 - UART_SRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e28: 88 e0 ldi r24, 0x08 ; 8 - 3e2a: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 3e2e: 8e e0 ldi r24, 0x0E ; 14 - 3e30: b6 d0 rcall .+364 ; 0x3f9e - -#if (LED_START_FLASHES > 0) || defined(LED_DATA_FLASH) - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 3e32: 25 9a sbi 0x04, 5 ; 4 - 3e34: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e36: 28 e1 ldi r18, 0x18 ; 24 - 3e38: 3e ef ldi r19, 0xFE ; 254 - TIFR1 = _BV(TOV1); - 3e3a: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e3c: 30 93 85 00 sts 0x0085, r19 - 3e40: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 3e44: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 3e46: b0 9b sbis 0x16, 0 ; 22 - 3e48: fe cf rjmp .-4 ; 0x3e46 -#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 3e4a: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3e4c: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 3e4e: 81 50 subi r24, 0x01 ; 1 - 3e50: a9 f7 brne .-22 ; 0x3e3c - 3e52: ee 24 eor r14, r14 - 3e54: ff 24 eor r15, r15 - * Start the page erase and wait for it to finish. There - * used to be code to do this while receiving the data over - * the serial link, but the performance improvement was slight, - * and we needed the space back. - */ - __boot_page_erase_short((uint16_t)(void*)address); - 3e56: b3 e0 ldi r27, 0x03 ; 3 - 3e58: ab 2e mov r10, r27 - */ - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3e5a: bb 24 eor r11, r11 - 3e5c: b3 94 inc r11 - } while (len -= 2); - - /* - * Actually Write the buffer to flash (and wait for it to finish.) - */ - __boot_page_write_short((uint16_t)(void*)address); - 3e5e: a5 e0 ldi r26, 0x05 ; 5 - 3e60: da 2e mov r13, r26 - boot_spm_busy_wait(); -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3e62: f1 e1 ldi r31, 0x11 ; 17 - 3e64: cf 2e mov r12, r31 -#endif - - /* Forever loop: exits by causing WDT reset */ - for (;;) { - /* get character from UART */ - ch = getch(); - 3e66: 8f d0 rcall .+286 ; 0x3f86 - - if(ch == STK_GET_PARAMETER) { - 3e68: 81 34 cpi r24, 0x41 ; 65 - 3e6a: 69 f4 brne .+26 ; 0x3e86 - unsigned char which = getch(); - 3e6c: 8c d0 rcall .+280 ; 0x3f86 - 3e6e: 08 2f mov r16, r24 - verifySpace(); - 3e70: 9c d0 rcall .+312 ; 0x3faa - /* - * Send optiboot version as "SW version" - * Note that the references to memory are optimized away. - */ - if (which == 0x82) { - 3e72: 02 38 cpi r16, 0x82 ; 130 - 3e74: 11 f4 brne .+4 ; 0x3e7a - putch(optiboot_version & 0xFF); - 3e76: 82 e0 ldi r24, 0x02 ; 2 - 3e78: 04 c0 rjmp .+8 ; 0x3e82 - } else if (which == 0x81) { - 3e7a: 01 38 cpi r16, 0x81 ; 129 - 3e7c: 09 f4 brne .+2 ; 0x3e80 - 3e7e: 71 c0 rjmp .+226 ; 0x3f62 - } else { - /* - * GET PARAMETER returns a generic 0x03 reply for - * other parameters - enough to keep Avrdude happy - */ - putch(0x03); - 3e80: 83 e0 ldi r24, 0x03 ; 3 - 3e82: 79 d0 rcall .+242 ; 0x3f76 - 3e84: 75 c0 rjmp .+234 ; 0x3f70 - } - } - else if(ch == STK_SET_DEVICE) { - 3e86: 82 34 cpi r24, 0x42 ; 66 - 3e88: 11 f4 brne .+4 ; 0x3e8e - // SET DEVICE is ignored - getNch(20); - 3e8a: 84 e1 ldi r24, 0x14 ; 20 - 3e8c: 03 c0 rjmp .+6 ; 0x3e94 - } - else if(ch == STK_SET_DEVICE_EXT) { - 3e8e: 85 34 cpi r24, 0x45 ; 69 - 3e90: 19 f4 brne .+6 ; 0x3e98 - // SET DEVICE EXT is ignored - getNch(5); - 3e92: 85 e0 ldi r24, 0x05 ; 5 - 3e94: 92 d0 rcall .+292 ; 0x3fba - 3e96: 6c c0 rjmp .+216 ; 0x3f70 - } - else if(ch == STK_LOAD_ADDRESS) { - 3e98: 85 35 cpi r24, 0x55 ; 85 - 3e9a: 79 f4 brne .+30 ; 0x3eba - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 3e9c: 74 d0 rcall .+232 ; 0x3f86 - newAddress = (newAddress & 0xff) | (getch() << 8); - 3e9e: e8 2e mov r14, r24 - 3ea0: ff 24 eor r15, r15 - 3ea2: 71 d0 rcall .+226 ; 0x3f86 - 3ea4: 08 2f mov r16, r24 - 3ea6: 10 e0 ldi r17, 0x00 ; 0 - 3ea8: 10 2f mov r17, r16 - 3eaa: 00 27 eor r16, r16 - 3eac: 0e 29 or r16, r14 - 3eae: 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 - 3eb0: 00 0f add r16, r16 - 3eb2: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 3eb4: 7a d0 rcall .+244 ; 0x3faa - 3eb6: 78 01 movw r14, r16 - 3eb8: 5b c0 rjmp .+182 ; 0x3f70 - } - else if(ch == STK_UNIVERSAL) { - 3eba: 86 35 cpi r24, 0x56 ; 86 - 3ebc: 21 f4 brne .+8 ; 0x3ec6 - // UNIVERSAL command is ignored - getNch(4); - 3ebe: 84 e0 ldi r24, 0x04 ; 4 - 3ec0: 7c d0 rcall .+248 ; 0x3fba - putch(0x00); - 3ec2: 80 e0 ldi r24, 0x00 ; 0 - 3ec4: de cf rjmp .-68 ; 0x3e82 - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 3ec6: 84 36 cpi r24, 0x64 ; 100 - 3ec8: 09 f0 breq .+2 ; 0x3ecc - 3eca: 35 c0 rjmp .+106 ; 0x3f36 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t desttype; - uint8_t *bufPtr; - pagelen_t savelength; - - GETLENGTH(length); - 3ecc: 5c d0 rcall .+184 ; 0x3f86 - 3ece: 5b d0 rcall .+182 ; 0x3f86 - 3ed0: 18 2f mov r17, r24 - savelength = length; - desttype = getch(); - 3ed2: 59 d0 rcall .+178 ; 0x3f86 - 3ed4: 08 2f mov r16, r24 - 3ed6: c0 e0 ldi r28, 0x00 ; 0 - 3ed8: d1 e0 ldi r29, 0x01 ; 1 - - // read a page worth of contents - bufPtr = buff; - do *bufPtr++ = getch(); - 3eda: 55 d0 rcall .+170 ; 0x3f86 - 3edc: 89 93 st Y+, r24 - while (--length); - 3ede: 1c 17 cp r17, r28 - 3ee0: e1 f7 brne .-8 ; 0x3eda - - // Read command terminator, start reply - verifySpace(); - 3ee2: 63 d0 rcall .+198 ; 0x3faa - * void writebuffer(memtype, buffer, address, length) - */ -static inline void writebuffer(int8_t memtype, uint8_t *mybuff, - uint16_t address, pagelen_t len) -{ - switch (memtype) { - 3ee4: 05 34 cpi r16, 0x45 ; 69 - 3ee6: 09 f4 brne .+2 ; 0x3eea - 3ee8: ff cf rjmp .-2 ; 0x3ee8 - * Start the page erase and wait for it to finish. There - * used to be code to do this while receiving the data over - * the serial link, but the performance improvement was slight, - * and we needed the space back. - */ - __boot_page_erase_short((uint16_t)(void*)address); - 3eea: f7 01 movw r30, r14 - 3eec: a7 be out 0x37, r10 ; 55 - 3eee: e8 95 spm - boot_spm_busy_wait(); - 3ef0: 07 b6 in r0, 0x37 ; 55 - 3ef2: 00 fc sbrc r0, 0 - 3ef4: fd cf rjmp .-6 ; 0x3ef0 - 3ef6: a7 01 movw r20, r14 - 3ef8: a0 e0 ldi r26, 0x00 ; 0 - 3efa: b1 e0 ldi r27, 0x01 ; 1 - /* - * Copy data from the buffer into the flash write buffer. - */ - do { - uint16_t a; - a = *bufPtr++; - 3efc: 2c 91 ld r18, X - 3efe: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 3f00: 11 96 adiw r26, 0x01 ; 1 - 3f02: 8c 91 ld r24, X - 3f04: 11 97 sbiw r26, 0x01 ; 1 - 3f06: 90 e0 ldi r25, 0x00 ; 0 - 3f08: 98 2f mov r25, r24 - 3f0a: 88 27 eor r24, r24 - 3f0c: 82 2b or r24, r18 - 3f0e: 93 2b or r25, r19 -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - - -/* main program starts here */ -int main(void) { - 3f10: 12 96 adiw r26, 0x02 ; 2 - */ - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f12: fa 01 movw r30, r20 - 3f14: 0c 01 movw r0, r24 - 3f16: b7 be out 0x37, r11 ; 55 - 3f18: e8 95 spm - 3f1a: 11 24 eor r1, r1 - addrPtr += 2; - 3f1c: 4e 5f subi r20, 0xFE ; 254 - 3f1e: 5f 4f sbci r21, 0xFF ; 255 - } while (len -= 2); - 3f20: 1a 17 cp r17, r26 - 3f22: 61 f7 brne .-40 ; 0x3efc - - /* - * Actually Write the buffer to flash (and wait for it to finish.) - */ - __boot_page_write_short((uint16_t)(void*)address); - 3f24: f7 01 movw r30, r14 - 3f26: d7 be out 0x37, r13 ; 55 - 3f28: e8 95 spm - boot_spm_busy_wait(); - 3f2a: 07 b6 in r0, 0x37 ; 55 - 3f2c: 00 fc sbrc r0, 0 - 3f2e: fd cf rjmp .-6 ; 0x3f2a -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3f30: c7 be out 0x37, r12 ; 55 - 3f32: e8 95 spm - 3f34: 1d c0 rjmp .+58 ; 0x3f70 - writebuffer(desttype, buff, address, savelength); - - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 3f36: 84 37 cpi r24, 0x74 ; 116 - 3f38: 69 f4 brne .+26 ; 0x3f54 - uint8_t desttype; - GETLENGTH(length); - 3f3a: 25 d0 rcall .+74 ; 0x3f86 - 3f3c: 24 d0 rcall .+72 ; 0x3f86 - 3f3e: 08 2f mov r16, r24 - - desttype = getch(); - 3f40: 22 d0 rcall .+68 ; 0x3f86 - - verifySpace(); - 3f42: 33 d0 rcall .+102 ; 0x3faa - 3f44: e7 01 movw r28, r14 - __asm__ ("elpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#else - // read a Flash byte and increment the address - __asm__ ("lpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#endif - putch(ch); - 3f46: fe 01 movw r30, r28 - 3f48: 85 91 lpm r24, Z+ - 3f4a: ef 01 movw r28, r30 - 3f4c: 14 d0 rcall .+40 ; 0x3f76 - } while (--length); - 3f4e: 01 50 subi r16, 0x01 ; 1 - 3f50: d1 f7 brne .-12 ; 0x3f46 - 3f52: 0e c0 rjmp .+28 ; 0x3f70 - - read_mem(desttype, address, length); - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 3f54: 85 37 cpi r24, 0x75 ; 117 - 3f56: 39 f4 brne .+14 ; 0x3f66 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 3f58: 28 d0 rcall .+80 ; 0x3faa - putch(SIGNATURE_0); - 3f5a: 8e e1 ldi r24, 0x1E ; 30 - 3f5c: 0c d0 rcall .+24 ; 0x3f76 - putch(SIGNATURE_1); - 3f5e: 84 e9 ldi r24, 0x94 ; 148 - 3f60: 0a d0 rcall .+20 ; 0x3f76 - putch(SIGNATURE_2); - 3f62: 86 e0 ldi r24, 0x06 ; 6 - 3f64: 8e cf rjmp .-228 ; 0x3e82 - } - else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */ - 3f66: 81 35 cpi r24, 0x51 ; 81 - 3f68: 11 f4 brne .+4 ; 0x3f6e - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 3f6a: 88 e0 ldi r24, 0x08 ; 8 - 3f6c: 18 d0 rcall .+48 ; 0x3f9e - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 3f6e: 1d d0 rcall .+58 ; 0x3faa - } - putch(STK_OK); - 3f70: 80 e1 ldi r24, 0x10 ; 16 - 3f72: 01 d0 rcall .+2 ; 0x3f76 - 3f74: 78 cf rjmp .-272 ; 0x3e66 - -00003f76 : - } -} - -void putch(char ch) { - 3f76: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UART_SRA & _BV(UDRE0))); - 3f78: 80 91 c0 00 lds r24, 0x00C0 - 3f7c: 85 ff sbrs r24, 5 - 3f7e: fc cf rjmp .-8 ; 0x3f78 - UART_UDR = ch; - 3f80: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 3f84: 08 95 ret - -00003f86 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UART_SRA & _BV(RXC0))) - 3f86: 80 91 c0 00 lds r24, 0x00C0 - 3f8a: 87 ff sbrs r24, 7 - 3f8c: fc cf rjmp .-8 ; 0x3f86 - ; - if (!(UART_SRA & _BV(FE0))) { - 3f8e: 80 91 c0 00 lds r24, 0x00C0 - 3f92: 84 fd sbrc r24, 4 - 3f94: 01 c0 rjmp .+2 ; 0x3f98 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3f96: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UART_UDR; - 3f98: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 3f9c: 08 95 ret - -00003f9e : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 3f9e: e0 e6 ldi r30, 0x60 ; 96 - 3fa0: f0 e0 ldi r31, 0x00 ; 0 - 3fa2: 98 e1 ldi r25, 0x18 ; 24 - 3fa4: 90 83 st Z, r25 - WDTCSR = x; - 3fa6: 80 83 st Z, r24 -} - 3fa8: 08 95 ret - -00003faa : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 3faa: ed df rcall .-38 ; 0x3f86 - 3fac: 80 32 cpi r24, 0x20 ; 32 - 3fae: 19 f0 breq .+6 ; 0x3fb6 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fb0: 88 e0 ldi r24, 0x08 ; 8 - 3fb2: f5 df rcall .-22 ; 0x3f9e - 3fb4: ff cf rjmp .-2 ; 0x3fb4 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 3fb6: 84 e1 ldi r24, 0x14 ; 20 -} - 3fb8: de cf rjmp .-68 ; 0x3f76 - -00003fba : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 3fba: 1f 93 push r17 - 3fbc: 18 2f mov r17, r24 - do getch(); while (--count); - 3fbe: e3 df rcall .-58 ; 0x3f86 - 3fc0: 11 50 subi r17, 0x01 ; 1 - 3fc2: e9 f7 brne .-6 ; 0x3fbe - verifySpace(); - 3fc4: f2 df rcall .-28 ; 0x3faa -} - 3fc6: 1f 91 pop r17 - 3fc8: 08 95 ret - -00003fca : - -void appStart(uint8_t rstFlags) { - // save the reset flags in the designated register - // This can be saved in a main program by putting code in .init0 (which - // executes before normal c init code) to save R2 to a global variable. - __asm__ __volatile__ ("mov r2, %0\n" :: "r" (rstFlags)); - 3fca: 28 2e mov r2, r24 - - watchdogConfig(WATCHDOG_OFF); - 3fcc: 80 e0 ldi r24, 0x00 ; 0 - 3fce: e7 df rcall .-50 ; 0x3f9e - __asm__ __volatile__ ( - 3fd0: ee 27 eor r30, r30 - 3fd2: ff 27 eor r31, r31 - 3fd4: 09 94 ijmp diff --git a/optiboot/bootloaders/optiboot/optiboot_luminet.hex b/optiboot/bootloaders/optiboot/optiboot_luminet.hex deleted file mode 100644 index 3bf9ee0b5..000000000 --- a/optiboot/bootloaders/optiboot/optiboot_luminet.hex +++ /dev/null @@ -1,39 +0,0 @@ -:101D0000112494B714BE892F8D7011F0892F0ED134 -:101D10008EE0F8D0D29AEE24FF2493E0B92EAA24C4 -:101D2000A39485E0982E0FE7D02E1EECC12ED7D0BD -:101D3000813471F4D4D0082FE9D0023811F482E054 -:101D400005C0013811F486E001C083E0B9D0B5C008 -:101D5000823411F484E103C0853419F485E0DED0C7 -:101D6000ACC0853579F4BBD0E82EFF24B8D0082F5D -:101D700010E0102F00270E291F29000F111FC6D0B9 -:101D800078019BC0863521F484E0C8D080E0DECFA6 -:101D9000843609F05EC0A3D0A2D0182FA0D0082F9F -:101DA000C0E0D1E09CD089931C17E1F7AFD0E114DB -:101DB000F10441F5809100012091010130E0322FC2 -:101DC000222790E0282B392B309385012093840122 -:101DD000409108018091090190E0982F882750E0F8 -:101DE000842B952B9093870180938601245030405B -:101DF00020930801232F332720930901D09200015B -:101E0000C0920101053409F4FFCFF701B7BEE89590 -:101E100007B600FCFDCFA701A0E0B1E02C9130E0B7 -:101E200011968C91119790E0982F8827822B932BF5 -:101E30001296FA010C01A7BEE89511244E5F5F4F80 -:101E40001A1761F7F70197BEE89507B600FCFDCFBA -:101E500034C0843721F543D042D0082F40D056D02B -:101E6000E701209719F48091840114C0C130D10595 -:101E700019F4809185010EC0C830D10519F4809104 -:101E8000860108C0C930D10519F48091870102C0CC -:101E9000FE01849115D0015081F02196E2CF853763 -:101EA00039F434D08EE10CD083E90AD08CE04ECFE7 -:101EB000813511F488E026D029D080E101D037CFD8 -:101EC0002AE030E08095089410F4DA9802C0DA9A9B -:101ED000000014D013D086952A95B1F7089529E013 -:101EE00030E0CB99FECF0AD009D008D08894CB99A6 -:101EF00008942A9511F08795F7CF08959EE09A955A -:101F0000F1F7089598E191BD81BD0895E8DF803231 -:101F100019F088E0F7DFFFCF84E1D2CF1F93182FAD -:101F2000DEDF1150E9F7F2DF1F910895282E80E0DF -:081F3000E9DFE4E0FF2709945A -:021FFE000206D9 -:0400000300001D00DC -:00000001FF diff --git a/optiboot/bootloaders/optiboot/optiboot_luminet.lst b/optiboot/bootloaders/optiboot/optiboot_luminet.lst deleted file mode 100644 index e374204d4..000000000 --- a/optiboot/bootloaders/optiboot/optiboot_luminet.lst +++ /dev/null @@ -1,611 +0,0 @@ - -optiboot_attiny84.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 00000238 00001d00 00001d00 00000074 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00001ffe 00001ffe 000002ac 2**0 - CONTENTS, ALLOC, LOAD, READONLY, DATA - 2 .debug_aranges 00000028 00000000 00000000 000002ae 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 00000082 00000000 00000000 000002d6 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 000003e1 00000000 00000000 00000358 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 000001a5 00000000 00000000 00000739 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 0000042a 00000000 00000000 000008de 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000090 00000000 00000000 00000d08 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 00000185 00000000 00000000 00000d98 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 00000324 00000000 00000000 00000f1d 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 000000d0 00000000 00000000 00001241 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00001d00
: -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - - -/* main program starts here */ -int main(void) { - 1d00: 11 24 eor r1, r1 - * modified Adaboot no-wait mod. - * Pass the reset reason to app. Also, it appears that an Uno poweron - * can leave multiple reset flags set; we only want the bootloader to - * run on an 'external reset only' status - */ - ch = MCUSR; - 1d02: 94 b7 in r25, 0x34 ; 52 - MCUSR = 0; - 1d04: 14 be out 0x34, r1 ; 52 - if (ch & (_BV(WDRF) | _BV(BORF) | _BV(PORF))) - 1d06: 89 2f mov r24, r25 - 1d08: 8d 70 andi r24, 0x0D ; 13 - 1d0a: 11 f0 breq .+4 ; 0x1d10 - appStart(ch); - 1d0c: 89 2f mov r24, r25 - 1d0e: 0e d1 rcall .+540 ; 0x1f2c - UART_SRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 1d10: 8e e0 ldi r24, 0x0E ; 14 - 1d12: f8 d0 rcall .+496 ; 0x1f04 - LED_DDR |= _BV(LED); -#endif - -#ifdef SOFT_UART - /* Set TX pin as output */ - UART_DDR |= _BV(UART_TX_BIT); - 1d14: d2 9a sbi 0x1a, 2 ; 26 - 1d16: ee 24 eor r14, r14 - 1d18: ff 24 eor r15, r15 - * Start the page erase and wait for it to finish. There - * used to be code to do this while receiving the data over - * the serial link, but the performance improvement was slight, - * and we needed the space back. - */ - __boot_page_erase_short((uint16_t)(void*)address); - 1d1a: 93 e0 ldi r25, 0x03 ; 3 - 1d1c: b9 2e mov r11, r25 - */ - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 1d1e: aa 24 eor r10, r10 - 1d20: a3 94 inc r10 - } while (len -= 2); - - /* - * Actually Write the buffer to flash (and wait for it to finish.) - */ - __boot_page_write_short((uint16_t)(void*)address); - 1d22: 85 e0 ldi r24, 0x05 ; 5 - 1d24: 98 2e mov r9, r24 - vect -= 4; // Instruction is a relative jump (rjmp), so recalculate. - buff[8] = vect & 0xff; - buff[9] = vect >> 8; - - // Add jump to bootloader at RESET vector - buff[0] = 0x7f; - 1d26: 0f e7 ldi r16, 0x7F ; 127 - 1d28: d0 2e mov r13, r16 - buff[1] = 0xce; // rjmp 0x1d00 instruction - 1d2a: 1e ec ldi r17, 0xCE ; 206 - 1d2c: c1 2e mov r12, r17 -#endif - - /* Forever loop: exits by causing WDT reset */ - for (;;) { - /* get character from UART */ - ch = getch(); - 1d2e: d7 d0 rcall .+430 ; 0x1ede - - if(ch == STK_GET_PARAMETER) { - 1d30: 81 34 cpi r24, 0x41 ; 65 - 1d32: 71 f4 brne .+28 ; 0x1d50 - unsigned char which = getch(); - 1d34: d4 d0 rcall .+424 ; 0x1ede - 1d36: 08 2f mov r16, r24 - verifySpace(); - 1d38: e9 d0 rcall .+466 ; 0x1f0c - /* - * Send optiboot version as "SW version" - * Note that the references to memory are optimized away. - */ - if (which == 0x82) { - 1d3a: 02 38 cpi r16, 0x82 ; 130 - 1d3c: 11 f4 brne .+4 ; 0x1d42 - putch(optiboot_version & 0xFF); - 1d3e: 82 e0 ldi r24, 0x02 ; 2 - 1d40: 05 c0 rjmp .+10 ; 0x1d4c - } else if (which == 0x81) { - 1d42: 01 38 cpi r16, 0x81 ; 129 - 1d44: 11 f4 brne .+4 ; 0x1d4a - putch(optiboot_version >> 8); - 1d46: 86 e0 ldi r24, 0x06 ; 6 - 1d48: 01 c0 rjmp .+2 ; 0x1d4c - } else { - /* - * GET PARAMETER returns a generic 0x03 reply for - * other parameters - enough to keep Avrdude happy - */ - putch(0x03); - 1d4a: 83 e0 ldi r24, 0x03 ; 3 - 1d4c: b9 d0 rcall .+370 ; 0x1ec0 - 1d4e: b5 c0 rjmp .+362 ; 0x1eba - } - } - else if(ch == STK_SET_DEVICE) { - 1d50: 82 34 cpi r24, 0x42 ; 66 - 1d52: 11 f4 brne .+4 ; 0x1d58 - // SET DEVICE is ignored - getNch(20); - 1d54: 84 e1 ldi r24, 0x14 ; 20 - 1d56: 03 c0 rjmp .+6 ; 0x1d5e - } - else if(ch == STK_SET_DEVICE_EXT) { - 1d58: 85 34 cpi r24, 0x45 ; 69 - 1d5a: 19 f4 brne .+6 ; 0x1d62 - // SET DEVICE EXT is ignored - getNch(5); - 1d5c: 85 e0 ldi r24, 0x05 ; 5 - 1d5e: de d0 rcall .+444 ; 0x1f1c - 1d60: ac c0 rjmp .+344 ; 0x1eba - } - else if(ch == STK_LOAD_ADDRESS) { - 1d62: 85 35 cpi r24, 0x55 ; 85 - 1d64: 79 f4 brne .+30 ; 0x1d84 - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 1d66: bb d0 rcall .+374 ; 0x1ede - newAddress = (newAddress & 0xff) | (getch() << 8); - 1d68: e8 2e mov r14, r24 - 1d6a: ff 24 eor r15, r15 - 1d6c: b8 d0 rcall .+368 ; 0x1ede - 1d6e: 08 2f mov r16, r24 - 1d70: 10 e0 ldi r17, 0x00 ; 0 - 1d72: 10 2f mov r17, r16 - 1d74: 00 27 eor r16, r16 - 1d76: 0e 29 or r16, r14 - 1d78: 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 - 1d7a: 00 0f add r16, r16 - 1d7c: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 1d7e: c6 d0 rcall .+396 ; 0x1f0c - 1d80: 78 01 movw r14, r16 - 1d82: 9b c0 rjmp .+310 ; 0x1eba - } - else if(ch == STK_UNIVERSAL) { - 1d84: 86 35 cpi r24, 0x56 ; 86 - 1d86: 21 f4 brne .+8 ; 0x1d90 - // UNIVERSAL command is ignored - getNch(4); - 1d88: 84 e0 ldi r24, 0x04 ; 4 - 1d8a: c8 d0 rcall .+400 ; 0x1f1c - putch(0x00); - 1d8c: 80 e0 ldi r24, 0x00 ; 0 - 1d8e: de cf rjmp .-68 ; 0x1d4c - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 1d90: 84 36 cpi r24, 0x64 ; 100 - 1d92: 09 f0 breq .+2 ; 0x1d96 - 1d94: 5e c0 rjmp .+188 ; 0x1e52 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t desttype; - uint8_t *bufPtr; - pagelen_t savelength; - - GETLENGTH(length); - 1d96: a3 d0 rcall .+326 ; 0x1ede - 1d98: a2 d0 rcall .+324 ; 0x1ede - 1d9a: 18 2f mov r17, r24 - savelength = length; - desttype = getch(); - 1d9c: a0 d0 rcall .+320 ; 0x1ede - 1d9e: 08 2f mov r16, r24 - 1da0: c0 e0 ldi r28, 0x00 ; 0 - 1da2: d1 e0 ldi r29, 0x01 ; 1 - - // read a page worth of contents - bufPtr = buff; - do *bufPtr++ = getch(); - 1da4: 9c d0 rcall .+312 ; 0x1ede - 1da6: 89 93 st Y+, r24 - while (--length); - 1da8: 1c 17 cp r17, r28 - 1daa: e1 f7 brne .-8 ; 0x1da4 - - // Read command terminator, start reply - verifySpace(); - 1dac: af d0 rcall .+350 ; 0x1f0c - -#ifdef VIRTUAL_BOOT_PARTITION - if ((uint16_t)(void*)address == 0) { - 1dae: e1 14 cp r14, r1 - 1db0: f1 04 cpc r15, r1 - 1db2: 41 f5 brne .+80 ; 0x1e04 - // 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); - 1db4: 80 91 00 01 lds r24, 0x0100 - 1db8: 20 91 01 01 lds r18, 0x0101 - 1dbc: 30 e0 ldi r19, 0x00 ; 0 - 1dbe: 32 2f mov r19, r18 - 1dc0: 22 27 eor r18, r18 - 1dc2: 90 e0 ldi r25, 0x00 ; 0 - 1dc4: 28 2b or r18, r24 - 1dc6: 39 2b or r19, r25 - rstVect = vect; - 1dc8: 30 93 85 01 sts 0x0185, r19 - 1dcc: 20 93 84 01 sts 0x0184, r18 - wdtVect = buff[8] | (buff[9]<<8); - 1dd0: 40 91 08 01 lds r20, 0x0108 - 1dd4: 80 91 09 01 lds r24, 0x0109 - 1dd8: 90 e0 ldi r25, 0x00 ; 0 - 1dda: 98 2f mov r25, r24 - 1ddc: 88 27 eor r24, r24 - 1dde: 50 e0 ldi r21, 0x00 ; 0 - 1de0: 84 2b or r24, r20 - 1de2: 95 2b or r25, r21 - 1de4: 90 93 87 01 sts 0x0187, r25 - 1de8: 80 93 86 01 sts 0x0186, r24 - vect -= 4; // Instruction is a relative jump (rjmp), so recalculate. - 1dec: 24 50 subi r18, 0x04 ; 4 - 1dee: 30 40 sbci r19, 0x00 ; 0 - buff[8] = vect & 0xff; - 1df0: 20 93 08 01 sts 0x0108, r18 - buff[9] = vect >> 8; - 1df4: 23 2f mov r18, r19 - 1df6: 33 27 eor r19, r19 - 1df8: 20 93 09 01 sts 0x0109, r18 - - // Add jump to bootloader at RESET vector - buff[0] = 0x7f; - 1dfc: d0 92 00 01 sts 0x0100, r13 - buff[1] = 0xce; // rjmp 0x1d00 instruction - 1e00: c0 92 01 01 sts 0x0101, r12 - * void writebuffer(memtype, buffer, address, length) - */ -static inline void writebuffer(int8_t memtype, uint8_t *mybuff, - uint16_t address, pagelen_t len) -{ - switch (memtype) { - 1e04: 05 34 cpi r16, 0x45 ; 69 - 1e06: 09 f4 brne .+2 ; 0x1e0a - 1e08: ff cf rjmp .-2 ; 0x1e08 - * Start the page erase and wait for it to finish. There - * used to be code to do this while receiving the data over - * the serial link, but the performance improvement was slight, - * and we needed the space back. - */ - __boot_page_erase_short((uint16_t)(void*)address); - 1e0a: f7 01 movw r30, r14 - 1e0c: b7 be out 0x37, r11 ; 55 - 1e0e: e8 95 spm - boot_spm_busy_wait(); - 1e10: 07 b6 in r0, 0x37 ; 55 - 1e12: 00 fc sbrc r0, 0 - 1e14: fd cf rjmp .-6 ; 0x1e10 - 1e16: a7 01 movw r20, r14 - 1e18: a0 e0 ldi r26, 0x00 ; 0 - 1e1a: b1 e0 ldi r27, 0x01 ; 1 - /* - * Copy data from the buffer into the flash write buffer. - */ - do { - uint16_t a; - a = *bufPtr++; - 1e1c: 2c 91 ld r18, X - 1e1e: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 1e20: 11 96 adiw r26, 0x01 ; 1 - 1e22: 8c 91 ld r24, X - 1e24: 11 97 sbiw r26, 0x01 ; 1 - 1e26: 90 e0 ldi r25, 0x00 ; 0 - 1e28: 98 2f mov r25, r24 - 1e2a: 88 27 eor r24, r24 - 1e2c: 82 2b or r24, r18 - 1e2e: 93 2b or r25, r19 -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - - -/* main program starts here */ -int main(void) { - 1e30: 12 96 adiw r26, 0x02 ; 2 - */ - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 1e32: fa 01 movw r30, r20 - 1e34: 0c 01 movw r0, r24 - 1e36: a7 be out 0x37, r10 ; 55 - 1e38: e8 95 spm - 1e3a: 11 24 eor r1, r1 - addrPtr += 2; - 1e3c: 4e 5f subi r20, 0xFE ; 254 - 1e3e: 5f 4f sbci r21, 0xFF ; 255 - } while (len -= 2); - 1e40: 1a 17 cp r17, r26 - 1e42: 61 f7 brne .-40 ; 0x1e1c - - /* - * Actually Write the buffer to flash (and wait for it to finish.) - */ - __boot_page_write_short((uint16_t)(void*)address); - 1e44: f7 01 movw r30, r14 - 1e46: 97 be out 0x37, r9 ; 55 - 1e48: e8 95 spm - boot_spm_busy_wait(); - 1e4a: 07 b6 in r0, 0x37 ; 55 - 1e4c: 00 fc sbrc r0, 0 - 1e4e: fd cf rjmp .-6 ; 0x1e4a - 1e50: 34 c0 rjmp .+104 ; 0x1eba - writebuffer(desttype, buff, address, savelength); - - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 1e52: 84 37 cpi r24, 0x74 ; 116 - 1e54: 21 f5 brne .+72 ; 0x1e9e - uint8_t desttype; - GETLENGTH(length); - 1e56: 43 d0 rcall .+134 ; 0x1ede - 1e58: 42 d0 rcall .+132 ; 0x1ede - 1e5a: 08 2f mov r16, r24 - - desttype = getch(); - 1e5c: 40 d0 rcall .+128 ; 0x1ede - - verifySpace(); - 1e5e: 56 d0 rcall .+172 ; 0x1f0c - 1e60: e7 01 movw r28, r14 -#endif - default: - do { -#ifdef VIRTUAL_BOOT_PARTITION - // 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+ - __asm__ ("elpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#else - // read a Flash byte and increment the address - __asm__ ("lpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#endif - putch(ch); - 1e94: 15 d0 rcall .+42 ; 0x1ec0 - } while (--length); - 1e96: 01 50 subi r16, 0x01 ; 1 - 1e98: 81 f0 breq .+32 ; 0x1eba - if (address == 0) ch=rstVect & 0xff; - else if (address == 1) ch=rstVect >> 8; - else if (address == 8) ch=wdtVect & 0xff; - else if (address == 9) ch=wdtVect >> 8; - else ch = pgm_read_byte_near(address); - address++; - 1e9a: 21 96 adiw r28, 0x01 ; 1 - 1e9c: e2 cf rjmp .-60 ; 0x1e62 - - read_mem(desttype, address, length); - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 1e9e: 85 37 cpi r24, 0x75 ; 117 - 1ea0: 39 f4 brne .+14 ; 0x1eb0 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 1ea2: 34 d0 rcall .+104 ; 0x1f0c - putch(SIGNATURE_0); - 1ea4: 8e e1 ldi r24, 0x1E ; 30 - 1ea6: 0c d0 rcall .+24 ; 0x1ec0 - putch(SIGNATURE_1); - 1ea8: 83 e9 ldi r24, 0x93 ; 147 - 1eaa: 0a d0 rcall .+20 ; 0x1ec0 - putch(SIGNATURE_2); - 1eac: 8c e0 ldi r24, 0x0C ; 12 - 1eae: 4e cf rjmp .-356 ; 0x1d4c - } - else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */ - 1eb0: 81 35 cpi r24, 0x51 ; 81 - 1eb2: 11 f4 brne .+4 ; 0x1eb8 - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 1eb4: 88 e0 ldi r24, 0x08 ; 8 - 1eb6: 26 d0 rcall .+76 ; 0x1f04 - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 1eb8: 29 d0 rcall .+82 ; 0x1f0c - } - putch(STK_OK); - 1eba: 80 e1 ldi r24, 0x10 ; 16 - 1ebc: 01 d0 rcall .+2 ; 0x1ec0 - 1ebe: 37 cf rjmp .-402 ; 0x1d2e - -00001ec0 : -void putch(char ch) { -#ifndef SOFT_UART - while (!(UART_SRA & _BV(UDRE0))); - UART_UDR = ch; -#else - __asm__ __volatile__ ( - 1ec0: 2a e0 ldi r18, 0x0A ; 10 - 1ec2: 30 e0 ldi r19, 0x00 ; 0 - 1ec4: 80 95 com r24 - 1ec6: 08 94 sec - 1ec8: 10 f4 brcc .+4 ; 0x1ece - 1eca: da 98 cbi 0x1b, 2 ; 27 - 1ecc: 02 c0 rjmp .+4 ; 0x1ed2 - 1ece: da 9a sbi 0x1b, 2 ; 27 - 1ed0: 00 00 nop - 1ed2: 14 d0 rcall .+40 ; 0x1efc - 1ed4: 13 d0 rcall .+38 ; 0x1efc - 1ed6: 86 95 lsr r24 - 1ed8: 2a 95 dec r18 - 1eda: b1 f7 brne .-20 ; 0x1ec8 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 1edc: 08 95 ret - -00001ede : - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 1ede: 29 e0 ldi r18, 0x09 ; 9 - 1ee0: 30 e0 ldi r19, 0x00 ; 0 - 1ee2: cb 99 sbic 0x19, 3 ; 25 - 1ee4: fe cf rjmp .-4 ; 0x1ee2 - 1ee6: 0a d0 rcall .+20 ; 0x1efc - 1ee8: 09 d0 rcall .+18 ; 0x1efc - 1eea: 08 d0 rcall .+16 ; 0x1efc - 1eec: 88 94 clc - 1eee: cb 99 sbic 0x19, 3 ; 25 - 1ef0: 08 94 sec - 1ef2: 2a 95 dec r18 - 1ef4: 11 f0 breq .+4 ; 0x1efa - 1ef6: 87 95 ror r24 - 1ef8: f7 cf rjmp .-18 ; 0x1ee8 - 1efa: 08 95 ret - -00001efc : -#if UART_B_VALUE > 255 -#error Baud rate too slow for soft UART -#endif - -void uartDelay() { - __asm__ __volatile__ ( - 1efc: 9e e0 ldi r25, 0x0E ; 14 - 1efe: 9a 95 dec r25 - 1f00: f1 f7 brne .-4 ; 0x1efe - 1f02: 08 95 ret - -00001f04 : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 1f04: 98 e1 ldi r25, 0x18 ; 24 - 1f06: 91 bd out 0x21, r25 ; 33 - WDTCSR = x; - 1f08: 81 bd out 0x21, r24 ; 33 -} - 1f0a: 08 95 ret - -00001f0c : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 1f0c: e8 df rcall .-48 ; 0x1ede - 1f0e: 80 32 cpi r24, 0x20 ; 32 - 1f10: 19 f0 breq .+6 ; 0x1f18 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 1f12: 88 e0 ldi r24, 0x08 ; 8 - 1f14: f7 df rcall .-18 ; 0x1f04 - 1f16: ff cf rjmp .-2 ; 0x1f16 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 1f18: 84 e1 ldi r24, 0x14 ; 20 -} - 1f1a: d2 cf rjmp .-92 ; 0x1ec0 - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 1f1c: 1f 93 push r17 - -00001f1e : - 1f1e: 18 2f mov r17, r24 - do getch(); while (--count); - 1f20: de df rcall .-68 ; 0x1ede - 1f22: 11 50 subi r17, 0x01 ; 1 - 1f24: e9 f7 brne .-6 ; 0x1f20 - verifySpace(); - 1f26: f2 df rcall .-28 ; 0x1f0c -} - 1f28: 1f 91 pop r17 - 1f2a: 08 95 ret - -00001f2c : - -void appStart(uint8_t rstFlags) { - // save the reset flags in the designated register - // This can be saved in a main program by putting code in .init0 (which - // executes before normal c init code) to save R2 to a global variable. - __asm__ __volatile__ ("mov r2, %0\n" :: "r" (rstFlags)); - 1f2c: 28 2e mov r2, r24 - - watchdogConfig(WATCHDOG_OFF); - 1f2e: 80 e0 ldi r24, 0x00 ; 0 - 1f30: e9 df rcall .-46 ; 0x1f04 - __asm__ __volatile__ ( - 1f32: e4 e0 ldi r30, 0x04 ; 4 - 1f34: ff 27 eor r31, r31 - 1f36: 09 94 ijmp diff --git a/optiboot/bootloaders/optiboot/optiboot_pro_16MHz.hex b/optiboot/bootloaders/optiboot/optiboot_pro_16MHz.hex deleted file mode 100644 index 261969f37..000000000 --- a/optiboot/bootloaders/optiboot/optiboot_pro_16MHz.hex +++ /dev/null @@ -1,33 +0,0 @@ -:103E0000112494B714BE892F8D7011F0892FDDD045 -:103E100085E08093810082E08093C00088E18093F8 -:103E2000C10086E08093C20080E18093C4008EE0F0 -:103E3000B6D0259A86E020E33CEF91E030938500F0 -:103E40002093840096BBB09BFECF1D9AA89581500D -:103E5000A9F7EE24FF24B3E0AB2EBB24B394A5E076 -:103E6000DA2EF1E1CF2E8FD0813469F48CD0082F77 -:103E70009CD0023811F482E004C0013809F471C00A -:103E800083E079D075C0823411F484E103C08534B5 -:103E900019F485E092D06CC0853579F474D0E82EA1 -:103EA000FF2471D0082F10E0102F00270E291F29A2 -:103EB000000F111F7AD078015BC0863521F484E0B1 -:103EC0007CD080E0DECF843609F035C05CD05BD09A -:103ED000182F59D0082FC0E0D1E055D089931C1776 -:103EE000E1F763D0053409F4FFCFF701A7BEE895E9 -:103EF00007B600FCFDCFA701A0E0B1E02C9130E0B7 -:103F000011968C91119790E0982F8827822B932BF4 -:103F10001296FA010C01B7BEE89511244E5F5F4F6F -:103F20001A1761F7F701D7BEE89507B600FCFDCF79 -:103F3000C7BEE8951DC0843769F425D024D0082F6A -:103F400022D033D0E701FE018591EF0114D001505A -:103F5000D1F70EC0853739F428D08EE10CD084E932 -:103F60000AD086E08ECF813511F488E018D01DD0BC -:103F700080E101D078CF982F8091C00085FFFCCFE1 -:103F80009093C60008958091C00087FFFCCF809178 -:103F9000C00084FD01C0A8958091C6000895E0E6A8 -:103FA000F0E098E1908380830895EDDF803219F08E -:103FB00088E0F5DFFFCF84E1DECF1F93182FE3DF2A -:103FC0001150E9F7F2DF1F910895282E80E0E7DF16 -:063FD000EE27FF27099413 -:023FFE000206B9 -:0400000300003E00BB -:00000001FF diff --git a/optiboot/bootloaders/optiboot/optiboot_pro_16MHz.lst b/optiboot/bootloaders/optiboot/optiboot_pro_16MHz.lst deleted file mode 100644 index cdddbd499..000000000 --- a/optiboot/bootloaders/optiboot/optiboot_pro_16MHz.lst +++ /dev/null @@ -1,586 +0,0 @@ - -optiboot_atmega168.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001d6 00003e00 00003e00 00000074 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 0000024a 2**0 - CONTENTS, ALLOC, LOAD, READONLY, DATA - 2 .debug_aranges 00000028 00000000 00000000 0000024c 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 00000074 00000000 00000000 00000274 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 000003ea 00000000 00000000 000002e8 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 000001ef 00000000 00000000 000006d2 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000423 00000000 00000000 000008c1 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000ce4 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 0000017c 00000000 00000000 00000d64 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 00000300 00000000 00000000 00000ee0 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 000000b8 00000000 00000000 000011e0 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00003e00
: -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - - -/* main program starts here */ -int main(void) { - 3e00: 11 24 eor r1, r1 - * modified Adaboot no-wait mod. - * Pass the reset reason to app. Also, it appears that an Uno poweron - * can leave multiple reset flags set; we only want the bootloader to - * run on an 'external reset only' status - */ - ch = MCUSR; - 3e02: 94 b7 in r25, 0x34 ; 52 - MCUSR = 0; - 3e04: 14 be out 0x34, r1 ; 52 - if (ch & (_BV(WDRF) | _BV(BORF) | _BV(PORF))) - 3e06: 89 2f mov r24, r25 - 3e08: 8d 70 andi r24, 0x0D ; 13 - 3e0a: 11 f0 breq .+4 ; 0x3e10 - appStart(ch); - 3e0c: 89 2f mov r24, r25 - 3e0e: dd d0 rcall .+442 ; 0x3fca - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 3e10: 85 e0 ldi r24, 0x05 ; 5 - 3e12: 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 - UART_SRA = _BV(U2X0); //Double speed mode USART0 - 3e16: 82 e0 ldi r24, 0x02 ; 2 - 3e18: 80 93 c0 00 sts 0x00C0, r24 - UART_SRB = _BV(RXEN0) | _BV(TXEN0); - 3e1c: 88 e1 ldi r24, 0x18 ; 24 - 3e1e: 80 93 c1 00 sts 0x00C1, r24 - UART_SRC = _BV(UCSZ00) | _BV(UCSZ01); - 3e22: 86 e0 ldi r24, 0x06 ; 6 - 3e24: 80 93 c2 00 sts 0x00C2, r24 - UART_SRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e28: 80 e1 ldi r24, 0x10 ; 16 - 3e2a: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 3e2e: 8e e0 ldi r24, 0x0E ; 14 - 3e30: b6 d0 rcall .+364 ; 0x3f9e - -#if (LED_START_FLASHES > 0) || defined(LED_DATA_FLASH) - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 3e32: 25 9a sbi 0x04, 5 ; 4 - 3e34: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e36: 20 e3 ldi r18, 0x30 ; 48 - 3e38: 3c ef ldi r19, 0xFC ; 252 - TIFR1 = _BV(TOV1); - 3e3a: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e3c: 30 93 85 00 sts 0x0085, r19 - 3e40: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 3e44: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 3e46: b0 9b sbis 0x16, 0 ; 22 - 3e48: fe cf rjmp .-4 ; 0x3e46 -#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 3e4a: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3e4c: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 3e4e: 81 50 subi r24, 0x01 ; 1 - 3e50: a9 f7 brne .-22 ; 0x3e3c - 3e52: ee 24 eor r14, r14 - 3e54: ff 24 eor r15, r15 - * Start the page erase and wait for it to finish. There - * used to be code to do this while receiving the data over - * the serial link, but the performance improvement was slight, - * and we needed the space back. - */ - __boot_page_erase_short((uint16_t)(void*)address); - 3e56: b3 e0 ldi r27, 0x03 ; 3 - 3e58: ab 2e mov r10, r27 - */ - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3e5a: bb 24 eor r11, r11 - 3e5c: b3 94 inc r11 - } while (len -= 2); - - /* - * Actually Write the buffer to flash (and wait for it to finish.) - */ - __boot_page_write_short((uint16_t)(void*)address); - 3e5e: a5 e0 ldi r26, 0x05 ; 5 - 3e60: da 2e mov r13, r26 - boot_spm_busy_wait(); -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3e62: f1 e1 ldi r31, 0x11 ; 17 - 3e64: cf 2e mov r12, r31 -#endif - - /* Forever loop: exits by causing WDT reset */ - for (;;) { - /* get character from UART */ - ch = getch(); - 3e66: 8f d0 rcall .+286 ; 0x3f86 - - if(ch == STK_GET_PARAMETER) { - 3e68: 81 34 cpi r24, 0x41 ; 65 - 3e6a: 69 f4 brne .+26 ; 0x3e86 - unsigned char which = getch(); - 3e6c: 8c d0 rcall .+280 ; 0x3f86 - 3e6e: 08 2f mov r16, r24 - verifySpace(); - 3e70: 9c d0 rcall .+312 ; 0x3faa - /* - * Send optiboot version as "SW version" - * Note that the references to memory are optimized away. - */ - if (which == 0x82) { - 3e72: 02 38 cpi r16, 0x82 ; 130 - 3e74: 11 f4 brne .+4 ; 0x3e7a - putch(optiboot_version & 0xFF); - 3e76: 82 e0 ldi r24, 0x02 ; 2 - 3e78: 04 c0 rjmp .+8 ; 0x3e82 - } else if (which == 0x81) { - 3e7a: 01 38 cpi r16, 0x81 ; 129 - 3e7c: 09 f4 brne .+2 ; 0x3e80 - 3e7e: 71 c0 rjmp .+226 ; 0x3f62 - } else { - /* - * GET PARAMETER returns a generic 0x03 reply for - * other parameters - enough to keep Avrdude happy - */ - putch(0x03); - 3e80: 83 e0 ldi r24, 0x03 ; 3 - 3e82: 79 d0 rcall .+242 ; 0x3f76 - 3e84: 75 c0 rjmp .+234 ; 0x3f70 - } - } - else if(ch == STK_SET_DEVICE) { - 3e86: 82 34 cpi r24, 0x42 ; 66 - 3e88: 11 f4 brne .+4 ; 0x3e8e - // SET DEVICE is ignored - getNch(20); - 3e8a: 84 e1 ldi r24, 0x14 ; 20 - 3e8c: 03 c0 rjmp .+6 ; 0x3e94 - } - else if(ch == STK_SET_DEVICE_EXT) { - 3e8e: 85 34 cpi r24, 0x45 ; 69 - 3e90: 19 f4 brne .+6 ; 0x3e98 - // SET DEVICE EXT is ignored - getNch(5); - 3e92: 85 e0 ldi r24, 0x05 ; 5 - 3e94: 92 d0 rcall .+292 ; 0x3fba - 3e96: 6c c0 rjmp .+216 ; 0x3f70 - } - else if(ch == STK_LOAD_ADDRESS) { - 3e98: 85 35 cpi r24, 0x55 ; 85 - 3e9a: 79 f4 brne .+30 ; 0x3eba - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 3e9c: 74 d0 rcall .+232 ; 0x3f86 - newAddress = (newAddress & 0xff) | (getch() << 8); - 3e9e: e8 2e mov r14, r24 - 3ea0: ff 24 eor r15, r15 - 3ea2: 71 d0 rcall .+226 ; 0x3f86 - 3ea4: 08 2f mov r16, r24 - 3ea6: 10 e0 ldi r17, 0x00 ; 0 - 3ea8: 10 2f mov r17, r16 - 3eaa: 00 27 eor r16, r16 - 3eac: 0e 29 or r16, r14 - 3eae: 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 - 3eb0: 00 0f add r16, r16 - 3eb2: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 3eb4: 7a d0 rcall .+244 ; 0x3faa - 3eb6: 78 01 movw r14, r16 - 3eb8: 5b c0 rjmp .+182 ; 0x3f70 - } - else if(ch == STK_UNIVERSAL) { - 3eba: 86 35 cpi r24, 0x56 ; 86 - 3ebc: 21 f4 brne .+8 ; 0x3ec6 - // UNIVERSAL command is ignored - getNch(4); - 3ebe: 84 e0 ldi r24, 0x04 ; 4 - 3ec0: 7c d0 rcall .+248 ; 0x3fba - putch(0x00); - 3ec2: 80 e0 ldi r24, 0x00 ; 0 - 3ec4: de cf rjmp .-68 ; 0x3e82 - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 3ec6: 84 36 cpi r24, 0x64 ; 100 - 3ec8: 09 f0 breq .+2 ; 0x3ecc - 3eca: 35 c0 rjmp .+106 ; 0x3f36 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t desttype; - uint8_t *bufPtr; - pagelen_t savelength; - - GETLENGTH(length); - 3ecc: 5c d0 rcall .+184 ; 0x3f86 - 3ece: 5b d0 rcall .+182 ; 0x3f86 - 3ed0: 18 2f mov r17, r24 - savelength = length; - desttype = getch(); - 3ed2: 59 d0 rcall .+178 ; 0x3f86 - 3ed4: 08 2f mov r16, r24 - 3ed6: c0 e0 ldi r28, 0x00 ; 0 - 3ed8: d1 e0 ldi r29, 0x01 ; 1 - - // read a page worth of contents - bufPtr = buff; - do *bufPtr++ = getch(); - 3eda: 55 d0 rcall .+170 ; 0x3f86 - 3edc: 89 93 st Y+, r24 - while (--length); - 3ede: 1c 17 cp r17, r28 - 3ee0: e1 f7 brne .-8 ; 0x3eda - - // Read command terminator, start reply - verifySpace(); - 3ee2: 63 d0 rcall .+198 ; 0x3faa - * void writebuffer(memtype, buffer, address, length) - */ -static inline void writebuffer(int8_t memtype, uint8_t *mybuff, - uint16_t address, pagelen_t len) -{ - switch (memtype) { - 3ee4: 05 34 cpi r16, 0x45 ; 69 - 3ee6: 09 f4 brne .+2 ; 0x3eea - 3ee8: ff cf rjmp .-2 ; 0x3ee8 - * Start the page erase and wait for it to finish. There - * used to be code to do this while receiving the data over - * the serial link, but the performance improvement was slight, - * and we needed the space back. - */ - __boot_page_erase_short((uint16_t)(void*)address); - 3eea: f7 01 movw r30, r14 - 3eec: a7 be out 0x37, r10 ; 55 - 3eee: e8 95 spm - boot_spm_busy_wait(); - 3ef0: 07 b6 in r0, 0x37 ; 55 - 3ef2: 00 fc sbrc r0, 0 - 3ef4: fd cf rjmp .-6 ; 0x3ef0 - 3ef6: a7 01 movw r20, r14 - 3ef8: a0 e0 ldi r26, 0x00 ; 0 - 3efa: b1 e0 ldi r27, 0x01 ; 1 - /* - * Copy data from the buffer into the flash write buffer. - */ - do { - uint16_t a; - a = *bufPtr++; - 3efc: 2c 91 ld r18, X - 3efe: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 3f00: 11 96 adiw r26, 0x01 ; 1 - 3f02: 8c 91 ld r24, X - 3f04: 11 97 sbiw r26, 0x01 ; 1 - 3f06: 90 e0 ldi r25, 0x00 ; 0 - 3f08: 98 2f mov r25, r24 - 3f0a: 88 27 eor r24, r24 - 3f0c: 82 2b or r24, r18 - 3f0e: 93 2b or r25, r19 -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - - -/* main program starts here */ -int main(void) { - 3f10: 12 96 adiw r26, 0x02 ; 2 - */ - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f12: fa 01 movw r30, r20 - 3f14: 0c 01 movw r0, r24 - 3f16: b7 be out 0x37, r11 ; 55 - 3f18: e8 95 spm - 3f1a: 11 24 eor r1, r1 - addrPtr += 2; - 3f1c: 4e 5f subi r20, 0xFE ; 254 - 3f1e: 5f 4f sbci r21, 0xFF ; 255 - } while (len -= 2); - 3f20: 1a 17 cp r17, r26 - 3f22: 61 f7 brne .-40 ; 0x3efc - - /* - * Actually Write the buffer to flash (and wait for it to finish.) - */ - __boot_page_write_short((uint16_t)(void*)address); - 3f24: f7 01 movw r30, r14 - 3f26: d7 be out 0x37, r13 ; 55 - 3f28: e8 95 spm - boot_spm_busy_wait(); - 3f2a: 07 b6 in r0, 0x37 ; 55 - 3f2c: 00 fc sbrc r0, 0 - 3f2e: fd cf rjmp .-6 ; 0x3f2a -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3f30: c7 be out 0x37, r12 ; 55 - 3f32: e8 95 spm - 3f34: 1d c0 rjmp .+58 ; 0x3f70 - writebuffer(desttype, buff, address, savelength); - - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 3f36: 84 37 cpi r24, 0x74 ; 116 - 3f38: 69 f4 brne .+26 ; 0x3f54 - uint8_t desttype; - GETLENGTH(length); - 3f3a: 25 d0 rcall .+74 ; 0x3f86 - 3f3c: 24 d0 rcall .+72 ; 0x3f86 - 3f3e: 08 2f mov r16, r24 - - desttype = getch(); - 3f40: 22 d0 rcall .+68 ; 0x3f86 - - verifySpace(); - 3f42: 33 d0 rcall .+102 ; 0x3faa - 3f44: e7 01 movw r28, r14 - __asm__ ("elpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#else - // read a Flash byte and increment the address - __asm__ ("lpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#endif - putch(ch); - 3f46: fe 01 movw r30, r28 - 3f48: 85 91 lpm r24, Z+ - 3f4a: ef 01 movw r28, r30 - 3f4c: 14 d0 rcall .+40 ; 0x3f76 - } while (--length); - 3f4e: 01 50 subi r16, 0x01 ; 1 - 3f50: d1 f7 brne .-12 ; 0x3f46 - 3f52: 0e c0 rjmp .+28 ; 0x3f70 - - read_mem(desttype, address, length); - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 3f54: 85 37 cpi r24, 0x75 ; 117 - 3f56: 39 f4 brne .+14 ; 0x3f66 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 3f58: 28 d0 rcall .+80 ; 0x3faa - putch(SIGNATURE_0); - 3f5a: 8e e1 ldi r24, 0x1E ; 30 - 3f5c: 0c d0 rcall .+24 ; 0x3f76 - putch(SIGNATURE_1); - 3f5e: 84 e9 ldi r24, 0x94 ; 148 - 3f60: 0a d0 rcall .+20 ; 0x3f76 - putch(SIGNATURE_2); - 3f62: 86 e0 ldi r24, 0x06 ; 6 - 3f64: 8e cf rjmp .-228 ; 0x3e82 - } - else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */ - 3f66: 81 35 cpi r24, 0x51 ; 81 - 3f68: 11 f4 brne .+4 ; 0x3f6e - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 3f6a: 88 e0 ldi r24, 0x08 ; 8 - 3f6c: 18 d0 rcall .+48 ; 0x3f9e - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 3f6e: 1d d0 rcall .+58 ; 0x3faa - } - putch(STK_OK); - 3f70: 80 e1 ldi r24, 0x10 ; 16 - 3f72: 01 d0 rcall .+2 ; 0x3f76 - 3f74: 78 cf rjmp .-272 ; 0x3e66 - -00003f76 : - } -} - -void putch(char ch) { - 3f76: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UART_SRA & _BV(UDRE0))); - 3f78: 80 91 c0 00 lds r24, 0x00C0 - 3f7c: 85 ff sbrs r24, 5 - 3f7e: fc cf rjmp .-8 ; 0x3f78 - UART_UDR = ch; - 3f80: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 3f84: 08 95 ret - -00003f86 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UART_SRA & _BV(RXC0))) - 3f86: 80 91 c0 00 lds r24, 0x00C0 - 3f8a: 87 ff sbrs r24, 7 - 3f8c: fc cf rjmp .-8 ; 0x3f86 - ; - if (!(UART_SRA & _BV(FE0))) { - 3f8e: 80 91 c0 00 lds r24, 0x00C0 - 3f92: 84 fd sbrc r24, 4 - 3f94: 01 c0 rjmp .+2 ; 0x3f98 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3f96: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UART_UDR; - 3f98: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 3f9c: 08 95 ret - -00003f9e : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 3f9e: e0 e6 ldi r30, 0x60 ; 96 - 3fa0: f0 e0 ldi r31, 0x00 ; 0 - 3fa2: 98 e1 ldi r25, 0x18 ; 24 - 3fa4: 90 83 st Z, r25 - WDTCSR = x; - 3fa6: 80 83 st Z, r24 -} - 3fa8: 08 95 ret - -00003faa : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 3faa: ed df rcall .-38 ; 0x3f86 - 3fac: 80 32 cpi r24, 0x20 ; 32 - 3fae: 19 f0 breq .+6 ; 0x3fb6 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fb0: 88 e0 ldi r24, 0x08 ; 8 - 3fb2: f5 df rcall .-22 ; 0x3f9e - 3fb4: ff cf rjmp .-2 ; 0x3fb4 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 3fb6: 84 e1 ldi r24, 0x14 ; 20 -} - 3fb8: de cf rjmp .-68 ; 0x3f76 - -00003fba : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 3fba: 1f 93 push r17 - 3fbc: 18 2f mov r17, r24 - do getch(); while (--count); - 3fbe: e3 df rcall .-58 ; 0x3f86 - 3fc0: 11 50 subi r17, 0x01 ; 1 - 3fc2: e9 f7 brne .-6 ; 0x3fbe - verifySpace(); - 3fc4: f2 df rcall .-28 ; 0x3faa -} - 3fc6: 1f 91 pop r17 - 3fc8: 08 95 ret - -00003fca : - -void appStart(uint8_t rstFlags) { - // save the reset flags in the designated register - // This can be saved in a main program by putting code in .init0 (which - // executes before normal c init code) to save R2 to a global variable. - __asm__ __volatile__ ("mov r2, %0\n" :: "r" (rstFlags)); - 3fca: 28 2e mov r2, r24 - - watchdogConfig(WATCHDOG_OFF); - 3fcc: 80 e0 ldi r24, 0x00 ; 0 - 3fce: e7 df rcall .-50 ; 0x3f9e - __asm__ __volatile__ ( - 3fd0: ee 27 eor r30, r30 - 3fd2: ff 27 eor r31, r31 - 3fd4: 09 94 ijmp diff --git a/optiboot/bootloaders/optiboot/optiboot_pro_20mhz.hex b/optiboot/bootloaders/optiboot/optiboot_pro_20mhz.hex deleted file mode 100644 index 7b3bbee08..000000000 --- a/optiboot/bootloaders/optiboot/optiboot_pro_20mhz.hex +++ /dev/null @@ -1,33 +0,0 @@ -:103E0000112494B714BE892F8D7011F0892FDDD045 -:103E100085E08093810082E08093C00088E18093F8 -:103E2000C10086E08093C20085E18093C4008EE0EB -:103E3000B6D0259A86E02CE33BEF91E030938500E5 -:103E40002093840096BBB09BFECF1D9AA89581500D -:103E5000A9F7EE24FF24B3E0AB2EBB24B394A5E076 -:103E6000DA2EF1E1CF2E8FD0813469F48CD0082F77 -:103E70009CD0023811F482E004C0013809F471C00A -:103E800083E079D075C0823411F484E103C08534B5 -:103E900019F485E092D06CC0853579F474D0E82EA1 -:103EA000FF2471D0082F10E0102F00270E291F29A2 -:103EB000000F111F7AD078015BC0863521F484E0B1 -:103EC0007CD080E0DECF843609F035C05CD05BD09A -:103ED000182F59D0082FC0E0D1E055D089931C1776 -:103EE000E1F763D0053409F4FFCFF701A7BEE895E9 -:103EF00007B600FCFDCFA701A0E0B1E02C9130E0B7 -:103F000011968C91119790E0982F8827822B932BF4 -:103F10001296FA010C01B7BEE89511244E5F5F4F6F -:103F20001A1761F7F701D7BEE89507B600FCFDCF79 -:103F3000C7BEE8951DC0843769F425D024D0082F6A -:103F400022D033D0E701FE018591EF0114D001505A -:103F5000D1F70EC0853739F428D08EE10CD084E932 -:103F60000AD086E08ECF813511F488E018D01DD0BC -:103F700080E101D078CF982F8091C00085FFFCCFE1 -:103F80009093C60008958091C00087FFFCCF809178 -:103F9000C00084FD01C0A8958091C6000895E0E6A8 -:103FA000F0E098E1908380830895EDDF803219F08E -:103FB00088E0F5DFFFCF84E1DECF1F93182FE3DF2A -:103FC0001150E9F7F2DF1F910895282E80E0E7DF16 -:063FD000EE27FF27099413 -:023FFE000206B9 -:0400000300003E00BB -:00000001FF diff --git a/optiboot/bootloaders/optiboot/optiboot_pro_20mhz.lst b/optiboot/bootloaders/optiboot/optiboot_pro_20mhz.lst deleted file mode 100644 index b8abb99f2..000000000 --- a/optiboot/bootloaders/optiboot/optiboot_pro_20mhz.lst +++ /dev/null @@ -1,586 +0,0 @@ - -optiboot_atmega168.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001d6 00003e00 00003e00 00000074 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 0000024a 2**0 - CONTENTS, ALLOC, LOAD, READONLY, DATA - 2 .debug_aranges 00000028 00000000 00000000 0000024c 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 00000074 00000000 00000000 00000274 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 000003ea 00000000 00000000 000002e8 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 000001ef 00000000 00000000 000006d2 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000423 00000000 00000000 000008c1 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000ce4 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 0000017c 00000000 00000000 00000d64 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 00000300 00000000 00000000 00000ee0 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 000000b8 00000000 00000000 000011e0 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00003e00
: -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - - -/* main program starts here */ -int main(void) { - 3e00: 11 24 eor r1, r1 - * modified Adaboot no-wait mod. - * Pass the reset reason to app. Also, it appears that an Uno poweron - * can leave multiple reset flags set; we only want the bootloader to - * run on an 'external reset only' status - */ - ch = MCUSR; - 3e02: 94 b7 in r25, 0x34 ; 52 - MCUSR = 0; - 3e04: 14 be out 0x34, r1 ; 52 - if (ch & (_BV(WDRF) | _BV(BORF) | _BV(PORF))) - 3e06: 89 2f mov r24, r25 - 3e08: 8d 70 andi r24, 0x0D ; 13 - 3e0a: 11 f0 breq .+4 ; 0x3e10 - appStart(ch); - 3e0c: 89 2f mov r24, r25 - 3e0e: dd d0 rcall .+442 ; 0x3fca - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 3e10: 85 e0 ldi r24, 0x05 ; 5 - 3e12: 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 - UART_SRA = _BV(U2X0); //Double speed mode USART0 - 3e16: 82 e0 ldi r24, 0x02 ; 2 - 3e18: 80 93 c0 00 sts 0x00C0, r24 - UART_SRB = _BV(RXEN0) | _BV(TXEN0); - 3e1c: 88 e1 ldi r24, 0x18 ; 24 - 3e1e: 80 93 c1 00 sts 0x00C1, r24 - UART_SRC = _BV(UCSZ00) | _BV(UCSZ01); - 3e22: 86 e0 ldi r24, 0x06 ; 6 - 3e24: 80 93 c2 00 sts 0x00C2, r24 - UART_SRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e28: 85 e1 ldi r24, 0x15 ; 21 - 3e2a: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 3e2e: 8e e0 ldi r24, 0x0E ; 14 - 3e30: b6 d0 rcall .+364 ; 0x3f9e - -#if (LED_START_FLASHES > 0) || defined(LED_DATA_FLASH) - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 3e32: 25 9a sbi 0x04, 5 ; 4 - 3e34: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e36: 2c e3 ldi r18, 0x3C ; 60 - 3e38: 3b ef ldi r19, 0xFB ; 251 - TIFR1 = _BV(TOV1); - 3e3a: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e3c: 30 93 85 00 sts 0x0085, r19 - 3e40: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 3e44: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 3e46: b0 9b sbis 0x16, 0 ; 22 - 3e48: fe cf rjmp .-4 ; 0x3e46 -#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 3e4a: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3e4c: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 3e4e: 81 50 subi r24, 0x01 ; 1 - 3e50: a9 f7 brne .-22 ; 0x3e3c - 3e52: ee 24 eor r14, r14 - 3e54: ff 24 eor r15, r15 - * Start the page erase and wait for it to finish. There - * used to be code to do this while receiving the data over - * the serial link, but the performance improvement was slight, - * and we needed the space back. - */ - __boot_page_erase_short((uint16_t)(void*)address); - 3e56: b3 e0 ldi r27, 0x03 ; 3 - 3e58: ab 2e mov r10, r27 - */ - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3e5a: bb 24 eor r11, r11 - 3e5c: b3 94 inc r11 - } while (len -= 2); - - /* - * Actually Write the buffer to flash (and wait for it to finish.) - */ - __boot_page_write_short((uint16_t)(void*)address); - 3e5e: a5 e0 ldi r26, 0x05 ; 5 - 3e60: da 2e mov r13, r26 - boot_spm_busy_wait(); -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3e62: f1 e1 ldi r31, 0x11 ; 17 - 3e64: cf 2e mov r12, r31 -#endif - - /* Forever loop: exits by causing WDT reset */ - for (;;) { - /* get character from UART */ - ch = getch(); - 3e66: 8f d0 rcall .+286 ; 0x3f86 - - if(ch == STK_GET_PARAMETER) { - 3e68: 81 34 cpi r24, 0x41 ; 65 - 3e6a: 69 f4 brne .+26 ; 0x3e86 - unsigned char which = getch(); - 3e6c: 8c d0 rcall .+280 ; 0x3f86 - 3e6e: 08 2f mov r16, r24 - verifySpace(); - 3e70: 9c d0 rcall .+312 ; 0x3faa - /* - * Send optiboot version as "SW version" - * Note that the references to memory are optimized away. - */ - if (which == 0x82) { - 3e72: 02 38 cpi r16, 0x82 ; 130 - 3e74: 11 f4 brne .+4 ; 0x3e7a - putch(optiboot_version & 0xFF); - 3e76: 82 e0 ldi r24, 0x02 ; 2 - 3e78: 04 c0 rjmp .+8 ; 0x3e82 - } else if (which == 0x81) { - 3e7a: 01 38 cpi r16, 0x81 ; 129 - 3e7c: 09 f4 brne .+2 ; 0x3e80 - 3e7e: 71 c0 rjmp .+226 ; 0x3f62 - } else { - /* - * GET PARAMETER returns a generic 0x03 reply for - * other parameters - enough to keep Avrdude happy - */ - putch(0x03); - 3e80: 83 e0 ldi r24, 0x03 ; 3 - 3e82: 79 d0 rcall .+242 ; 0x3f76 - 3e84: 75 c0 rjmp .+234 ; 0x3f70 - } - } - else if(ch == STK_SET_DEVICE) { - 3e86: 82 34 cpi r24, 0x42 ; 66 - 3e88: 11 f4 brne .+4 ; 0x3e8e - // SET DEVICE is ignored - getNch(20); - 3e8a: 84 e1 ldi r24, 0x14 ; 20 - 3e8c: 03 c0 rjmp .+6 ; 0x3e94 - } - else if(ch == STK_SET_DEVICE_EXT) { - 3e8e: 85 34 cpi r24, 0x45 ; 69 - 3e90: 19 f4 brne .+6 ; 0x3e98 - // SET DEVICE EXT is ignored - getNch(5); - 3e92: 85 e0 ldi r24, 0x05 ; 5 - 3e94: 92 d0 rcall .+292 ; 0x3fba - 3e96: 6c c0 rjmp .+216 ; 0x3f70 - } - else if(ch == STK_LOAD_ADDRESS) { - 3e98: 85 35 cpi r24, 0x55 ; 85 - 3e9a: 79 f4 brne .+30 ; 0x3eba - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 3e9c: 74 d0 rcall .+232 ; 0x3f86 - newAddress = (newAddress & 0xff) | (getch() << 8); - 3e9e: e8 2e mov r14, r24 - 3ea0: ff 24 eor r15, r15 - 3ea2: 71 d0 rcall .+226 ; 0x3f86 - 3ea4: 08 2f mov r16, r24 - 3ea6: 10 e0 ldi r17, 0x00 ; 0 - 3ea8: 10 2f mov r17, r16 - 3eaa: 00 27 eor r16, r16 - 3eac: 0e 29 or r16, r14 - 3eae: 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 - 3eb0: 00 0f add r16, r16 - 3eb2: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 3eb4: 7a d0 rcall .+244 ; 0x3faa - 3eb6: 78 01 movw r14, r16 - 3eb8: 5b c0 rjmp .+182 ; 0x3f70 - } - else if(ch == STK_UNIVERSAL) { - 3eba: 86 35 cpi r24, 0x56 ; 86 - 3ebc: 21 f4 brne .+8 ; 0x3ec6 - // UNIVERSAL command is ignored - getNch(4); - 3ebe: 84 e0 ldi r24, 0x04 ; 4 - 3ec0: 7c d0 rcall .+248 ; 0x3fba - putch(0x00); - 3ec2: 80 e0 ldi r24, 0x00 ; 0 - 3ec4: de cf rjmp .-68 ; 0x3e82 - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 3ec6: 84 36 cpi r24, 0x64 ; 100 - 3ec8: 09 f0 breq .+2 ; 0x3ecc - 3eca: 35 c0 rjmp .+106 ; 0x3f36 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t desttype; - uint8_t *bufPtr; - pagelen_t savelength; - - GETLENGTH(length); - 3ecc: 5c d0 rcall .+184 ; 0x3f86 - 3ece: 5b d0 rcall .+182 ; 0x3f86 - 3ed0: 18 2f mov r17, r24 - savelength = length; - desttype = getch(); - 3ed2: 59 d0 rcall .+178 ; 0x3f86 - 3ed4: 08 2f mov r16, r24 - 3ed6: c0 e0 ldi r28, 0x00 ; 0 - 3ed8: d1 e0 ldi r29, 0x01 ; 1 - - // read a page worth of contents - bufPtr = buff; - do *bufPtr++ = getch(); - 3eda: 55 d0 rcall .+170 ; 0x3f86 - 3edc: 89 93 st Y+, r24 - while (--length); - 3ede: 1c 17 cp r17, r28 - 3ee0: e1 f7 brne .-8 ; 0x3eda - - // Read command terminator, start reply - verifySpace(); - 3ee2: 63 d0 rcall .+198 ; 0x3faa - * void writebuffer(memtype, buffer, address, length) - */ -static inline void writebuffer(int8_t memtype, uint8_t *mybuff, - uint16_t address, pagelen_t len) -{ - switch (memtype) { - 3ee4: 05 34 cpi r16, 0x45 ; 69 - 3ee6: 09 f4 brne .+2 ; 0x3eea - 3ee8: ff cf rjmp .-2 ; 0x3ee8 - * Start the page erase and wait for it to finish. There - * used to be code to do this while receiving the data over - * the serial link, but the performance improvement was slight, - * and we needed the space back. - */ - __boot_page_erase_short((uint16_t)(void*)address); - 3eea: f7 01 movw r30, r14 - 3eec: a7 be out 0x37, r10 ; 55 - 3eee: e8 95 spm - boot_spm_busy_wait(); - 3ef0: 07 b6 in r0, 0x37 ; 55 - 3ef2: 00 fc sbrc r0, 0 - 3ef4: fd cf rjmp .-6 ; 0x3ef0 - 3ef6: a7 01 movw r20, r14 - 3ef8: a0 e0 ldi r26, 0x00 ; 0 - 3efa: b1 e0 ldi r27, 0x01 ; 1 - /* - * Copy data from the buffer into the flash write buffer. - */ - do { - uint16_t a; - a = *bufPtr++; - 3efc: 2c 91 ld r18, X - 3efe: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 3f00: 11 96 adiw r26, 0x01 ; 1 - 3f02: 8c 91 ld r24, X - 3f04: 11 97 sbiw r26, 0x01 ; 1 - 3f06: 90 e0 ldi r25, 0x00 ; 0 - 3f08: 98 2f mov r25, r24 - 3f0a: 88 27 eor r24, r24 - 3f0c: 82 2b or r24, r18 - 3f0e: 93 2b or r25, r19 -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - - -/* main program starts here */ -int main(void) { - 3f10: 12 96 adiw r26, 0x02 ; 2 - */ - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f12: fa 01 movw r30, r20 - 3f14: 0c 01 movw r0, r24 - 3f16: b7 be out 0x37, r11 ; 55 - 3f18: e8 95 spm - 3f1a: 11 24 eor r1, r1 - addrPtr += 2; - 3f1c: 4e 5f subi r20, 0xFE ; 254 - 3f1e: 5f 4f sbci r21, 0xFF ; 255 - } while (len -= 2); - 3f20: 1a 17 cp r17, r26 - 3f22: 61 f7 brne .-40 ; 0x3efc - - /* - * Actually Write the buffer to flash (and wait for it to finish.) - */ - __boot_page_write_short((uint16_t)(void*)address); - 3f24: f7 01 movw r30, r14 - 3f26: d7 be out 0x37, r13 ; 55 - 3f28: e8 95 spm - boot_spm_busy_wait(); - 3f2a: 07 b6 in r0, 0x37 ; 55 - 3f2c: 00 fc sbrc r0, 0 - 3f2e: fd cf rjmp .-6 ; 0x3f2a -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3f30: c7 be out 0x37, r12 ; 55 - 3f32: e8 95 spm - 3f34: 1d c0 rjmp .+58 ; 0x3f70 - writebuffer(desttype, buff, address, savelength); - - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 3f36: 84 37 cpi r24, 0x74 ; 116 - 3f38: 69 f4 brne .+26 ; 0x3f54 - uint8_t desttype; - GETLENGTH(length); - 3f3a: 25 d0 rcall .+74 ; 0x3f86 - 3f3c: 24 d0 rcall .+72 ; 0x3f86 - 3f3e: 08 2f mov r16, r24 - - desttype = getch(); - 3f40: 22 d0 rcall .+68 ; 0x3f86 - - verifySpace(); - 3f42: 33 d0 rcall .+102 ; 0x3faa - 3f44: e7 01 movw r28, r14 - __asm__ ("elpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#else - // read a Flash byte and increment the address - __asm__ ("lpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#endif - putch(ch); - 3f46: fe 01 movw r30, r28 - 3f48: 85 91 lpm r24, Z+ - 3f4a: ef 01 movw r28, r30 - 3f4c: 14 d0 rcall .+40 ; 0x3f76 - } while (--length); - 3f4e: 01 50 subi r16, 0x01 ; 1 - 3f50: d1 f7 brne .-12 ; 0x3f46 - 3f52: 0e c0 rjmp .+28 ; 0x3f70 - - read_mem(desttype, address, length); - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 3f54: 85 37 cpi r24, 0x75 ; 117 - 3f56: 39 f4 brne .+14 ; 0x3f66 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 3f58: 28 d0 rcall .+80 ; 0x3faa - putch(SIGNATURE_0); - 3f5a: 8e e1 ldi r24, 0x1E ; 30 - 3f5c: 0c d0 rcall .+24 ; 0x3f76 - putch(SIGNATURE_1); - 3f5e: 84 e9 ldi r24, 0x94 ; 148 - 3f60: 0a d0 rcall .+20 ; 0x3f76 - putch(SIGNATURE_2); - 3f62: 86 e0 ldi r24, 0x06 ; 6 - 3f64: 8e cf rjmp .-228 ; 0x3e82 - } - else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */ - 3f66: 81 35 cpi r24, 0x51 ; 81 - 3f68: 11 f4 brne .+4 ; 0x3f6e - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 3f6a: 88 e0 ldi r24, 0x08 ; 8 - 3f6c: 18 d0 rcall .+48 ; 0x3f9e - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 3f6e: 1d d0 rcall .+58 ; 0x3faa - } - putch(STK_OK); - 3f70: 80 e1 ldi r24, 0x10 ; 16 - 3f72: 01 d0 rcall .+2 ; 0x3f76 - 3f74: 78 cf rjmp .-272 ; 0x3e66 - -00003f76 : - } -} - -void putch(char ch) { - 3f76: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UART_SRA & _BV(UDRE0))); - 3f78: 80 91 c0 00 lds r24, 0x00C0 - 3f7c: 85 ff sbrs r24, 5 - 3f7e: fc cf rjmp .-8 ; 0x3f78 - UART_UDR = ch; - 3f80: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 3f84: 08 95 ret - -00003f86 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UART_SRA & _BV(RXC0))) - 3f86: 80 91 c0 00 lds r24, 0x00C0 - 3f8a: 87 ff sbrs r24, 7 - 3f8c: fc cf rjmp .-8 ; 0x3f86 - ; - if (!(UART_SRA & _BV(FE0))) { - 3f8e: 80 91 c0 00 lds r24, 0x00C0 - 3f92: 84 fd sbrc r24, 4 - 3f94: 01 c0 rjmp .+2 ; 0x3f98 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3f96: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UART_UDR; - 3f98: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 3f9c: 08 95 ret - -00003f9e : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 3f9e: e0 e6 ldi r30, 0x60 ; 96 - 3fa0: f0 e0 ldi r31, 0x00 ; 0 - 3fa2: 98 e1 ldi r25, 0x18 ; 24 - 3fa4: 90 83 st Z, r25 - WDTCSR = x; - 3fa6: 80 83 st Z, r24 -} - 3fa8: 08 95 ret - -00003faa : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 3faa: ed df rcall .-38 ; 0x3f86 - 3fac: 80 32 cpi r24, 0x20 ; 32 - 3fae: 19 f0 breq .+6 ; 0x3fb6 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fb0: 88 e0 ldi r24, 0x08 ; 8 - 3fb2: f5 df rcall .-22 ; 0x3f9e - 3fb4: ff cf rjmp .-2 ; 0x3fb4 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 3fb6: 84 e1 ldi r24, 0x14 ; 20 -} - 3fb8: de cf rjmp .-68 ; 0x3f76 - -00003fba : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 3fba: 1f 93 push r17 - 3fbc: 18 2f mov r17, r24 - do getch(); while (--count); - 3fbe: e3 df rcall .-58 ; 0x3f86 - 3fc0: 11 50 subi r17, 0x01 ; 1 - 3fc2: e9 f7 brne .-6 ; 0x3fbe - verifySpace(); - 3fc4: f2 df rcall .-28 ; 0x3faa -} - 3fc6: 1f 91 pop r17 - 3fc8: 08 95 ret - -00003fca : - -void appStart(uint8_t rstFlags) { - // save the reset flags in the designated register - // This can be saved in a main program by putting code in .init0 (which - // executes before normal c init code) to save R2 to a global variable. - __asm__ __volatile__ ("mov r2, %0\n" :: "r" (rstFlags)); - 3fca: 28 2e mov r2, r24 - - watchdogConfig(WATCHDOG_OFF); - 3fcc: 80 e0 ldi r24, 0x00 ; 0 - 3fce: e7 df rcall .-50 ; 0x3f9e - __asm__ __volatile__ ( - 3fd0: ee 27 eor r30, r30 - 3fd2: ff 27 eor r31, r31 - 3fd4: 09 94 ijmp diff --git a/optiboot/bootloaders/optiboot/optiboot_pro_8MHz.hex b/optiboot/bootloaders/optiboot/optiboot_pro_8MHz.hex deleted file mode 100644 index b8d82f549..000000000 --- a/optiboot/bootloaders/optiboot/optiboot_pro_8MHz.hex +++ /dev/null @@ -1,33 +0,0 @@ -:103E0000112494B714BE892F8D7011F0892FDDD045 -:103E100085E08093810082E08093C00088E18093F8 -:103E2000C10086E08093C20088E08093C4008EE0E9 -:103E3000B6D0259A86E028E13EEF91E030938500E8 -:103E40002093840096BBB09BFECF1D9AA89581500D -:103E5000A9F7EE24FF24B3E0AB2EBB24B394A5E076 -:103E6000DA2EF1E1CF2E8FD0813469F48CD0082F77 -:103E70009CD0023811F482E004C0013809F471C00A -:103E800083E079D075C0823411F484E103C08534B5 -:103E900019F485E092D06CC0853579F474D0E82EA1 -:103EA000FF2471D0082F10E0102F00270E291F29A2 -:103EB000000F111F7AD078015BC0863521F484E0B1 -:103EC0007CD080E0DECF843609F035C05CD05BD09A -:103ED000182F59D0082FC0E0D1E055D089931C1776 -:103EE000E1F763D0053409F4FFCFF701A7BEE895E9 -:103EF00007B600FCFDCFA701A0E0B1E02C9130E0B7 -:103F000011968C91119790E0982F8827822B932BF4 -:103F10001296FA010C01B7BEE89511244E5F5F4F6F -:103F20001A1761F7F701D7BEE89507B600FCFDCF79 -:103F3000C7BEE8951DC0843769F425D024D0082F6A -:103F400022D033D0E701FE018591EF0114D001505A -:103F5000D1F70EC0853739F428D08EE10CD084E932 -:103F60000AD086E08ECF813511F488E018D01DD0BC -:103F700080E101D078CF982F8091C00085FFFCCFE1 -:103F80009093C60008958091C00087FFFCCF809178 -:103F9000C00084FD01C0A8958091C6000895E0E6A8 -:103FA000F0E098E1908380830895EDDF803219F08E -:103FB00088E0F5DFFFCF84E1DECF1F93182FE3DF2A -:103FC0001150E9F7F2DF1F910895282E80E0E7DF16 -:063FD000EE27FF27099413 -:023FFE000206B9 -:0400000300003E00BB -:00000001FF diff --git a/optiboot/bootloaders/optiboot/optiboot_pro_8MHz.lst b/optiboot/bootloaders/optiboot/optiboot_pro_8MHz.lst deleted file mode 100644 index 101a10566..000000000 --- a/optiboot/bootloaders/optiboot/optiboot_pro_8MHz.lst +++ /dev/null @@ -1,586 +0,0 @@ - -optiboot_atmega168.elf: file format elf32-avr - -Sections: -Idx Name Size VMA LMA File off Algn - 0 .text 000001d6 00003e00 00003e00 00000074 2**1 - CONTENTS, ALLOC, LOAD, READONLY, CODE - 1 .version 00000002 00003ffe 00003ffe 0000024a 2**0 - CONTENTS, ALLOC, LOAD, READONLY, DATA - 2 .debug_aranges 00000028 00000000 00000000 0000024c 2**0 - CONTENTS, READONLY, DEBUGGING - 3 .debug_pubnames 00000074 00000000 00000000 00000274 2**0 - CONTENTS, READONLY, DEBUGGING - 4 .debug_info 000003ea 00000000 00000000 000002e8 2**0 - CONTENTS, READONLY, DEBUGGING - 5 .debug_abbrev 000001ef 00000000 00000000 000006d2 2**0 - CONTENTS, READONLY, DEBUGGING - 6 .debug_line 00000423 00000000 00000000 000008c1 2**0 - CONTENTS, READONLY, DEBUGGING - 7 .debug_frame 00000080 00000000 00000000 00000ce4 2**2 - CONTENTS, READONLY, DEBUGGING - 8 .debug_str 0000017c 00000000 00000000 00000d64 2**0 - CONTENTS, READONLY, DEBUGGING - 9 .debug_loc 00000300 00000000 00000000 00000ee0 2**0 - CONTENTS, READONLY, DEBUGGING - 10 .debug_ranges 000000b8 00000000 00000000 000011e0 2**0 - CONTENTS, READONLY, DEBUGGING - -Disassembly of section .text: - -00003e00
: -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - - -/* main program starts here */ -int main(void) { - 3e00: 11 24 eor r1, r1 - * modified Adaboot no-wait mod. - * Pass the reset reason to app. Also, it appears that an Uno poweron - * can leave multiple reset flags set; we only want the bootloader to - * run on an 'external reset only' status - */ - ch = MCUSR; - 3e02: 94 b7 in r25, 0x34 ; 52 - MCUSR = 0; - 3e04: 14 be out 0x34, r1 ; 52 - if (ch & (_BV(WDRF) | _BV(BORF) | _BV(PORF))) - 3e06: 89 2f mov r24, r25 - 3e08: 8d 70 andi r24, 0x0D ; 13 - 3e0a: 11 f0 breq .+4 ; 0x3e10 - appStart(ch); - 3e0c: 89 2f mov r24, r25 - 3e0e: dd d0 rcall .+442 ; 0x3fca - -#if LED_START_FLASHES > 0 - // Set up Timer 1 for timeout counter - TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 - 3e10: 85 e0 ldi r24, 0x05 ; 5 - 3e12: 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 - UART_SRA = _BV(U2X0); //Double speed mode USART0 - 3e16: 82 e0 ldi r24, 0x02 ; 2 - 3e18: 80 93 c0 00 sts 0x00C0, r24 - UART_SRB = _BV(RXEN0) | _BV(TXEN0); - 3e1c: 88 e1 ldi r24, 0x18 ; 24 - 3e1e: 80 93 c1 00 sts 0x00C1, r24 - UART_SRC = _BV(UCSZ00) | _BV(UCSZ01); - 3e22: 86 e0 ldi r24, 0x06 ; 6 - 3e24: 80 93 c2 00 sts 0x00C2, r24 - UART_SRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); - 3e28: 88 e0 ldi r24, 0x08 ; 8 - 3e2a: 80 93 c4 00 sts 0x00C4, r24 -#endif -#endif - - // Set up watchdog to trigger after 500ms - watchdogConfig(WATCHDOG_1S); - 3e2e: 8e e0 ldi r24, 0x0E ; 14 - 3e30: b6 d0 rcall .+364 ; 0x3f9e - -#if (LED_START_FLASHES > 0) || defined(LED_DATA_FLASH) - /* Set LED pin as output */ - LED_DDR |= _BV(LED); - 3e32: 25 9a sbi 0x04, 5 ; 4 - 3e34: 86 e0 ldi r24, 0x06 ; 6 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e36: 28 e1 ldi r18, 0x18 ; 24 - 3e38: 3e ef ldi r19, 0xFE ; 254 - TIFR1 = _BV(TOV1); - 3e3a: 91 e0 ldi r25, 0x01 ; 1 -} - -#if LED_START_FLASHES > 0 -void flash_led(uint8_t count) { - do { - TCNT1 = -(F_CPU/(1024*16)); - 3e3c: 30 93 85 00 sts 0x0085, r19 - 3e40: 20 93 84 00 sts 0x0084, r18 - TIFR1 = _BV(TOV1); - 3e44: 96 bb out 0x16, r25 ; 22 - while(!(TIFR1 & _BV(TOV1))); - 3e46: b0 9b sbis 0x16, 0 ; 22 - 3e48: fe cf rjmp .-4 ; 0x3e46 -#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); - 3e4a: 1d 9a sbi 0x03, 5 ; 3 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3e4c: a8 95 wdr - LED_PORT ^= _BV(LED); -#else - LED_PIN |= _BV(LED); -#endif - watchdogReset(); - } while (--count); - 3e4e: 81 50 subi r24, 0x01 ; 1 - 3e50: a9 f7 brne .-22 ; 0x3e3c - 3e52: ee 24 eor r14, r14 - 3e54: ff 24 eor r15, r15 - * Start the page erase and wait for it to finish. There - * used to be code to do this while receiving the data over - * the serial link, but the performance improvement was slight, - * and we needed the space back. - */ - __boot_page_erase_short((uint16_t)(void*)address); - 3e56: b3 e0 ldi r27, 0x03 ; 3 - 3e58: ab 2e mov r10, r27 - */ - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3e5a: bb 24 eor r11, r11 - 3e5c: b3 94 inc r11 - } while (len -= 2); - - /* - * Actually Write the buffer to flash (and wait for it to finish.) - */ - __boot_page_write_short((uint16_t)(void*)address); - 3e5e: a5 e0 ldi r26, 0x05 ; 5 - 3e60: da 2e mov r13, r26 - boot_spm_busy_wait(); -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3e62: f1 e1 ldi r31, 0x11 ; 17 - 3e64: cf 2e mov r12, r31 -#endif - - /* Forever loop: exits by causing WDT reset */ - for (;;) { - /* get character from UART */ - ch = getch(); - 3e66: 8f d0 rcall .+286 ; 0x3f86 - - if(ch == STK_GET_PARAMETER) { - 3e68: 81 34 cpi r24, 0x41 ; 65 - 3e6a: 69 f4 brne .+26 ; 0x3e86 - unsigned char which = getch(); - 3e6c: 8c d0 rcall .+280 ; 0x3f86 - 3e6e: 08 2f mov r16, r24 - verifySpace(); - 3e70: 9c d0 rcall .+312 ; 0x3faa - /* - * Send optiboot version as "SW version" - * Note that the references to memory are optimized away. - */ - if (which == 0x82) { - 3e72: 02 38 cpi r16, 0x82 ; 130 - 3e74: 11 f4 brne .+4 ; 0x3e7a - putch(optiboot_version & 0xFF); - 3e76: 82 e0 ldi r24, 0x02 ; 2 - 3e78: 04 c0 rjmp .+8 ; 0x3e82 - } else if (which == 0x81) { - 3e7a: 01 38 cpi r16, 0x81 ; 129 - 3e7c: 09 f4 brne .+2 ; 0x3e80 - 3e7e: 71 c0 rjmp .+226 ; 0x3f62 - } else { - /* - * GET PARAMETER returns a generic 0x03 reply for - * other parameters - enough to keep Avrdude happy - */ - putch(0x03); - 3e80: 83 e0 ldi r24, 0x03 ; 3 - 3e82: 79 d0 rcall .+242 ; 0x3f76 - 3e84: 75 c0 rjmp .+234 ; 0x3f70 - } - } - else if(ch == STK_SET_DEVICE) { - 3e86: 82 34 cpi r24, 0x42 ; 66 - 3e88: 11 f4 brne .+4 ; 0x3e8e - // SET DEVICE is ignored - getNch(20); - 3e8a: 84 e1 ldi r24, 0x14 ; 20 - 3e8c: 03 c0 rjmp .+6 ; 0x3e94 - } - else if(ch == STK_SET_DEVICE_EXT) { - 3e8e: 85 34 cpi r24, 0x45 ; 69 - 3e90: 19 f4 brne .+6 ; 0x3e98 - // SET DEVICE EXT is ignored - getNch(5); - 3e92: 85 e0 ldi r24, 0x05 ; 5 - 3e94: 92 d0 rcall .+292 ; 0x3fba - 3e96: 6c c0 rjmp .+216 ; 0x3f70 - } - else if(ch == STK_LOAD_ADDRESS) { - 3e98: 85 35 cpi r24, 0x55 ; 85 - 3e9a: 79 f4 brne .+30 ; 0x3eba - // LOAD ADDRESS - uint16_t newAddress; - newAddress = getch(); - 3e9c: 74 d0 rcall .+232 ; 0x3f86 - newAddress = (newAddress & 0xff) | (getch() << 8); - 3e9e: e8 2e mov r14, r24 - 3ea0: ff 24 eor r15, r15 - 3ea2: 71 d0 rcall .+226 ; 0x3f86 - 3ea4: 08 2f mov r16, r24 - 3ea6: 10 e0 ldi r17, 0x00 ; 0 - 3ea8: 10 2f mov r17, r16 - 3eaa: 00 27 eor r16, r16 - 3eac: 0e 29 or r16, r14 - 3eae: 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 - 3eb0: 00 0f add r16, r16 - 3eb2: 11 1f adc r17, r17 - address = newAddress; - verifySpace(); - 3eb4: 7a d0 rcall .+244 ; 0x3faa - 3eb6: 78 01 movw r14, r16 - 3eb8: 5b c0 rjmp .+182 ; 0x3f70 - } - else if(ch == STK_UNIVERSAL) { - 3eba: 86 35 cpi r24, 0x56 ; 86 - 3ebc: 21 f4 brne .+8 ; 0x3ec6 - // UNIVERSAL command is ignored - getNch(4); - 3ebe: 84 e0 ldi r24, 0x04 ; 4 - 3ec0: 7c d0 rcall .+248 ; 0x3fba - putch(0x00); - 3ec2: 80 e0 ldi r24, 0x00 ; 0 - 3ec4: de cf rjmp .-68 ; 0x3e82 - } - /* Write memory, length is big endian and is in bytes */ - else if(ch == STK_PROG_PAGE) { - 3ec6: 84 36 cpi r24, 0x64 ; 100 - 3ec8: 09 f0 breq .+2 ; 0x3ecc - 3eca: 35 c0 rjmp .+106 ; 0x3f36 - // PROGRAM PAGE - we support flash programming only, not EEPROM - uint8_t desttype; - uint8_t *bufPtr; - pagelen_t savelength; - - GETLENGTH(length); - 3ecc: 5c d0 rcall .+184 ; 0x3f86 - 3ece: 5b d0 rcall .+182 ; 0x3f86 - 3ed0: 18 2f mov r17, r24 - savelength = length; - desttype = getch(); - 3ed2: 59 d0 rcall .+178 ; 0x3f86 - 3ed4: 08 2f mov r16, r24 - 3ed6: c0 e0 ldi r28, 0x00 ; 0 - 3ed8: d1 e0 ldi r29, 0x01 ; 1 - - // read a page worth of contents - bufPtr = buff; - do *bufPtr++ = getch(); - 3eda: 55 d0 rcall .+170 ; 0x3f86 - 3edc: 89 93 st Y+, r24 - while (--length); - 3ede: 1c 17 cp r17, r28 - 3ee0: e1 f7 brne .-8 ; 0x3eda - - // Read command terminator, start reply - verifySpace(); - 3ee2: 63 d0 rcall .+198 ; 0x3faa - * void writebuffer(memtype, buffer, address, length) - */ -static inline void writebuffer(int8_t memtype, uint8_t *mybuff, - uint16_t address, pagelen_t len) -{ - switch (memtype) { - 3ee4: 05 34 cpi r16, 0x45 ; 69 - 3ee6: 09 f4 brne .+2 ; 0x3eea - 3ee8: ff cf rjmp .-2 ; 0x3ee8 - * Start the page erase and wait for it to finish. There - * used to be code to do this while receiving the data over - * the serial link, but the performance improvement was slight, - * and we needed the space back. - */ - __boot_page_erase_short((uint16_t)(void*)address); - 3eea: f7 01 movw r30, r14 - 3eec: a7 be out 0x37, r10 ; 55 - 3eee: e8 95 spm - boot_spm_busy_wait(); - 3ef0: 07 b6 in r0, 0x37 ; 55 - 3ef2: 00 fc sbrc r0, 0 - 3ef4: fd cf rjmp .-6 ; 0x3ef0 - 3ef6: a7 01 movw r20, r14 - 3ef8: a0 e0 ldi r26, 0x00 ; 0 - 3efa: b1 e0 ldi r27, 0x01 ; 1 - /* - * Copy data from the buffer into the flash write buffer. - */ - do { - uint16_t a; - a = *bufPtr++; - 3efc: 2c 91 ld r18, X - 3efe: 30 e0 ldi r19, 0x00 ; 0 - a |= (*bufPtr++) << 8; - 3f00: 11 96 adiw r26, 0x01 ; 1 - 3f02: 8c 91 ld r24, X - 3f04: 11 97 sbiw r26, 0x01 ; 1 - 3f06: 90 e0 ldi r25, 0x00 ; 0 - 3f08: 98 2f mov r25, r24 - 3f0a: 88 27 eor r24, r24 - 3f0c: 82 2b or r24, r18 - 3f0e: 93 2b or r25, r19 -#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) -#endif - - -/* main program starts here */ -int main(void) { - 3f10: 12 96 adiw r26, 0x02 ; 2 - */ - do { - uint16_t a; - a = *bufPtr++; - a |= (*bufPtr++) << 8; - __boot_page_fill_short((uint16_t)(void*)addrPtr,a); - 3f12: fa 01 movw r30, r20 - 3f14: 0c 01 movw r0, r24 - 3f16: b7 be out 0x37, r11 ; 55 - 3f18: e8 95 spm - 3f1a: 11 24 eor r1, r1 - addrPtr += 2; - 3f1c: 4e 5f subi r20, 0xFE ; 254 - 3f1e: 5f 4f sbci r21, 0xFF ; 255 - } while (len -= 2); - 3f20: 1a 17 cp r17, r26 - 3f22: 61 f7 brne .-40 ; 0x3efc - - /* - * Actually Write the buffer to flash (and wait for it to finish.) - */ - __boot_page_write_short((uint16_t)(void*)address); - 3f24: f7 01 movw r30, r14 - 3f26: d7 be out 0x37, r13 ; 55 - 3f28: e8 95 spm - boot_spm_busy_wait(); - 3f2a: 07 b6 in r0, 0x37 ; 55 - 3f2c: 00 fc sbrc r0, 0 - 3f2e: fd cf rjmp .-6 ; 0x3f2a -#if defined(RWWSRE) - // Reenable read access to flash - boot_rww_enable(); - 3f30: c7 be out 0x37, r12 ; 55 - 3f32: e8 95 spm - 3f34: 1d c0 rjmp .+58 ; 0x3f70 - writebuffer(desttype, buff, address, savelength); - - - } - /* Read memory block mode, length is big endian. */ - else if(ch == STK_READ_PAGE) { - 3f36: 84 37 cpi r24, 0x74 ; 116 - 3f38: 69 f4 brne .+26 ; 0x3f54 - uint8_t desttype; - GETLENGTH(length); - 3f3a: 25 d0 rcall .+74 ; 0x3f86 - 3f3c: 24 d0 rcall .+72 ; 0x3f86 - 3f3e: 08 2f mov r16, r24 - - desttype = getch(); - 3f40: 22 d0 rcall .+68 ; 0x3f86 - - verifySpace(); - 3f42: 33 d0 rcall .+102 ; 0x3faa - 3f44: e7 01 movw r28, r14 - __asm__ ("elpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#else - // read a Flash byte and increment the address - __asm__ ("lpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address)); -#endif - putch(ch); - 3f46: fe 01 movw r30, r28 - 3f48: 85 91 lpm r24, Z+ - 3f4a: ef 01 movw r28, r30 - 3f4c: 14 d0 rcall .+40 ; 0x3f76 - } while (--length); - 3f4e: 01 50 subi r16, 0x01 ; 1 - 3f50: d1 f7 brne .-12 ; 0x3f46 - 3f52: 0e c0 rjmp .+28 ; 0x3f70 - - read_mem(desttype, address, length); - } - - /* Get device signature bytes */ - else if(ch == STK_READ_SIGN) { - 3f54: 85 37 cpi r24, 0x75 ; 117 - 3f56: 39 f4 brne .+14 ; 0x3f66 - // READ SIGN - return what Avrdude wants to hear - verifySpace(); - 3f58: 28 d0 rcall .+80 ; 0x3faa - putch(SIGNATURE_0); - 3f5a: 8e e1 ldi r24, 0x1E ; 30 - 3f5c: 0c d0 rcall .+24 ; 0x3f76 - putch(SIGNATURE_1); - 3f5e: 84 e9 ldi r24, 0x94 ; 148 - 3f60: 0a d0 rcall .+20 ; 0x3f76 - putch(SIGNATURE_2); - 3f62: 86 e0 ldi r24, 0x06 ; 6 - 3f64: 8e cf rjmp .-228 ; 0x3e82 - } - else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */ - 3f66: 81 35 cpi r24, 0x51 ; 81 - 3f68: 11 f4 brne .+4 ; 0x3f6e - // Adaboot no-wait mod - watchdogConfig(WATCHDOG_16MS); - 3f6a: 88 e0 ldi r24, 0x08 ; 8 - 3f6c: 18 d0 rcall .+48 ; 0x3f9e - verifySpace(); - } - else { - // This covers the response to commands like STK_ENTER_PROGMODE - verifySpace(); - 3f6e: 1d d0 rcall .+58 ; 0x3faa - } - putch(STK_OK); - 3f70: 80 e1 ldi r24, 0x10 ; 16 - 3f72: 01 d0 rcall .+2 ; 0x3f76 - 3f74: 78 cf rjmp .-272 ; 0x3e66 - -00003f76 : - } -} - -void putch(char ch) { - 3f76: 98 2f mov r25, r24 -#ifndef SOFT_UART - while (!(UART_SRA & _BV(UDRE0))); - 3f78: 80 91 c0 00 lds r24, 0x00C0 - 3f7c: 85 ff sbrs r24, 5 - 3f7e: fc cf rjmp .-8 ; 0x3f78 - UART_UDR = ch; - 3f80: 90 93 c6 00 sts 0x00C6, r25 - [uartBit] "I" (UART_TX_BIT) - : - "r25" - ); -#endif -} - 3f84: 08 95 ret - -00003f86 : - [uartBit] "I" (UART_RX_BIT) - : - "r25" -); -#else - while(!(UART_SRA & _BV(RXC0))) - 3f86: 80 91 c0 00 lds r24, 0x00C0 - 3f8a: 87 ff sbrs r24, 7 - 3f8c: fc cf rjmp .-8 ; 0x3f86 - ; - if (!(UART_SRA & _BV(FE0))) { - 3f8e: 80 91 c0 00 lds r24, 0x00C0 - 3f92: 84 fd sbrc r24, 4 - 3f94: 01 c0 rjmp .+2 ; 0x3f98 -} -#endif - -// Watchdog functions. These are only safe with interrupts turned off. -void watchdogReset() { - __asm__ __volatile__ ( - 3f96: a8 95 wdr - * don't care that an invalid char is returned...) - */ - watchdogReset(); - } - - ch = UART_UDR; - 3f98: 80 91 c6 00 lds r24, 0x00C6 - LED_PIN |= _BV(LED); -#endif -#endif - - return ch; -} - 3f9c: 08 95 ret - -00003f9e : - "wdr\n" - ); -} - -void watchdogConfig(uint8_t x) { - WDTCSR = _BV(WDCE) | _BV(WDE); - 3f9e: e0 e6 ldi r30, 0x60 ; 96 - 3fa0: f0 e0 ldi r31, 0x00 ; 0 - 3fa2: 98 e1 ldi r25, 0x18 ; 24 - 3fa4: 90 83 st Z, r25 - WDTCSR = x; - 3fa6: 80 83 st Z, r24 -} - 3fa8: 08 95 ret - -00003faa : - do getch(); while (--count); - verifySpace(); -} - -void verifySpace() { - if (getch() != CRC_EOP) { - 3faa: ed df rcall .-38 ; 0x3f86 - 3fac: 80 32 cpi r24, 0x20 ; 32 - 3fae: 19 f0 breq .+6 ; 0x3fb6 - watchdogConfig(WATCHDOG_16MS); // shorten WD timeout - 3fb0: 88 e0 ldi r24, 0x08 ; 8 - 3fb2: f5 df rcall .-22 ; 0x3f9e - 3fb4: ff cf rjmp .-2 ; 0x3fb4 - while (1) // and busy-loop so that WD causes - ; // a reset and app start. - } - putch(STK_INSYNC); - 3fb6: 84 e1 ldi r24, 0x14 ; 20 -} - 3fb8: de cf rjmp .-68 ; 0x3f76 - -00003fba : - ::[count] "M" (UART_B_VALUE) - ); -} -#endif - -void getNch(uint8_t count) { - 3fba: 1f 93 push r17 - 3fbc: 18 2f mov r17, r24 - do getch(); while (--count); - 3fbe: e3 df rcall .-58 ; 0x3f86 - 3fc0: 11 50 subi r17, 0x01 ; 1 - 3fc2: e9 f7 brne .-6 ; 0x3fbe - verifySpace(); - 3fc4: f2 df rcall .-28 ; 0x3faa -} - 3fc6: 1f 91 pop r17 - 3fc8: 08 95 ret - -00003fca : - -void appStart(uint8_t rstFlags) { - // save the reset flags in the designated register - // This can be saved in a main program by putting code in .init0 (which - // executes before normal c init code) to save R2 to a global variable. - __asm__ __volatile__ ("mov r2, %0\n" :: "r" (rstFlags)); - 3fca: 28 2e mov r2, r24 - - watchdogConfig(WATCHDOG_OFF); - 3fcc: 80 e0 ldi r24, 0x00 ; 0 - 3fce: e7 df rcall .-50 ; 0x3f9e - __asm__ __volatile__ ( - 3fd0: ee 27 eor r30, r30 - 3fd2: ff 27 eor r31, r31 - 3fd4: 09 94 ijmp