|
@@ -0,0 +1,608 @@
|
|
|
+
|
|
|
+optiboot_luminet.elf: file format elf32-avr
|
|
|
+
|
|
|
+Sections:
|
|
|
+Idx Name Size VMA LMA File off Algn
|
|
|
+ 0 .text 00000272 00001d00 00001d00 00000054 2**1
|
|
|
+ CONTENTS, ALLOC, LOAD, READONLY, CODE
|
|
|
+ 1 .debug_aranges 00000028 00000000 00000000 000002c6 2**0
|
|
|
+ CONTENTS, READONLY, DEBUGGING
|
|
|
+ 2 .debug_pubnames 00000078 00000000 00000000 000002ee 2**0
|
|
|
+ CONTENTS, READONLY, DEBUGGING
|
|
|
+ 3 .debug_info 000002a3 00000000 00000000 00000366 2**0
|
|
|
+ CONTENTS, READONLY, DEBUGGING
|
|
|
+ 4 .debug_abbrev 000001ac 00000000 00000000 00000609 2**0
|
|
|
+ CONTENTS, READONLY, DEBUGGING
|
|
|
+ 5 .debug_line 0000043d 00000000 00000000 000007b5 2**0
|
|
|
+ CONTENTS, READONLY, DEBUGGING
|
|
|
+ 6 .debug_frame 000000a0 00000000 00000000 00000bf4 2**2
|
|
|
+ CONTENTS, READONLY, DEBUGGING
|
|
|
+ 7 .debug_str 0000014f 00000000 00000000 00000c94 2**0
|
|
|
+ CONTENTS, READONLY, DEBUGGING
|
|
|
+ 8 .debug_loc 00000194 00000000 00000000 00000de3 2**0
|
|
|
+ CONTENTS, READONLY, DEBUGGING
|
|
|
+ 9 .debug_ranges 00000088 00000000 00000000 00000f77 2**0
|
|
|
+ CONTENTS, READONLY, DEBUGGING
|
|
|
+
|
|
|
+Disassembly of section .text:
|
|
|
+
|
|
|
+00001d00 <main>:
|
|
|
+#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4))
|
|
|
+#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6))
|
|
|
+#endif
|
|
|
+
|
|
|
+/* main program starts here */
|
|
|
+int main(void) {
|
|
|
+ 1d00: 85 e0 ldi r24, 0x05 ; 5
|
|
|
+ 1d02: 8e bd out 0x2e, r24 ; 46
|
|
|
+ UCSR0C = _BV(UCSZ00) | _BV(UCSZ01);
|
|
|
+ UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
|
|
|
+#endif
|
|
|
+
|
|
|
+ // Adaboot no-wait mod
|
|
|
+ ch = MCUSR;
|
|
|
+ 1d04: 84 b7 in r24, 0x34 ; 52
|
|
|
+ MCUSR = 0;
|
|
|
+ 1d06: 14 be out 0x34, r1 ; 52
|
|
|
+ if (!(ch & _BV(EXTRF))) appStart();
|
|
|
+ 1d08: 81 ff sbrs r24, 1
|
|
|
+ 1d0a: 20 d1 rcall .+576 ; 0x1f4c <appStart>
|
|
|
+
|
|
|
+ // Set up watchdog to trigger after 500ms
|
|
|
+ watchdogConfig(WATCHDOG_500MS);
|
|
|
+ 1d0c: 8d e0 ldi r24, 0x0D ; 13
|
|
|
+ 1d0e: 1a d1 rcall .+564 ; 0x1f44 <watchdogConfig>
|
|
|
+
|
|
|
+ /* Set LED pin as output */
|
|
|
+ LED_DDR |= _BV(LED);
|
|
|
+ 1d10: d4 9a sbi 0x1a, 4 ; 26
|
|
|
+
|
|
|
+#ifdef SOFT_UART
|
|
|
+ /* Set TX pin as output */
|
|
|
+ UART_DDR |= _BV(UART_TX_BIT);
|
|
|
+ 1d12: d2 9a sbi 0x1a, 2 ; 26
|
|
|
+ 1d14: 86 e0 ldi r24, 0x06 ; 6
|
|
|
+}
|
|
|
+
|
|
|
+#if LED_START_FLASHES > 0
|
|
|
+void flash_led(uint8_t count) {
|
|
|
+ do {
|
|
|
+ TCNT1 = -(F_CPU/(1024*16));
|
|
|
+ 1d16: 23 ec ldi r18, 0xC3 ; 195
|
|
|
+ 1d18: 3f ef ldi r19, 0xFF ; 255
|
|
|
+ TIFR1 = _BV(TOV1);
|
|
|
+ 1d1a: 91 e0 ldi r25, 0x01 ; 1
|
|
|
+}
|
|
|
+
|
|
|
+#if LED_START_FLASHES > 0
|
|
|
+void flash_led(uint8_t count) {
|
|
|
+ do {
|
|
|
+ TCNT1 = -(F_CPU/(1024*16));
|
|
|
+ 1d1c: 3d bd out 0x2d, r19 ; 45
|
|
|
+ 1d1e: 2c bd out 0x2c, r18 ; 44
|
|
|
+ TIFR1 = _BV(TOV1);
|
|
|
+ 1d20: 9b b9 out 0x0b, r25 ; 11
|
|
|
+ while(!(TIFR1 & _BV(TOV1)));
|
|
|
+ 1d22: 58 9b sbis 0x0b, 0 ; 11
|
|
|
+ 1d24: fe cf rjmp .-4 ; 0x1d22 <main+0x22>
|
|
|
+ LED_PIN |= _BV(LED);
|
|
|
+ 1d26: cc 9a sbi 0x19, 4 ; 25
|
|
|
+ return getch();
|
|
|
+}
|
|
|
+
|
|
|
+// Watchdog functions. These are only safe with interrupts turned off.
|
|
|
+void watchdogReset() {
|
|
|
+ __asm__ __volatile__ (
|
|
|
+ 1d28: a8 95 wdr
|
|
|
+ TCNT1 = -(F_CPU/(1024*16));
|
|
|
+ TIFR1 = _BV(TOV1);
|
|
|
+ while(!(TIFR1 & _BV(TOV1)));
|
|
|
+ LED_PIN |= _BV(LED);
|
|
|
+ watchdogReset();
|
|
|
+ } while (--count);
|
|
|
+ 1d2a: 81 50 subi r24, 0x01 ; 1
|
|
|
+ 1d2c: b9 f7 brne .-18 ; 0x1d1c <main+0x1c>
|
|
|
+ /* get character from UART */
|
|
|
+ ch = getch();
|
|
|
+
|
|
|
+ if(ch == STK_GET_PARAMETER) {
|
|
|
+ // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy
|
|
|
+ getNch(1);
|
|
|
+ 1d2e: dd 24 eor r13, r13
|
|
|
+ 1d30: d3 94 inc r13
|
|
|
+ __boot_page_fill_short((uint16_t)(void*)addrPtr,a);
|
|
|
+ addrPtr += 2;
|
|
|
+ } while (--ch);
|
|
|
+
|
|
|
+ // Write from programming buffer
|
|
|
+ __boot_page_write_short((uint16_t)(void*)address);
|
|
|
+ 1d32: 85 e0 ldi r24, 0x05 ; 5
|
|
|
+ 1d34: c8 2e mov r12, r24
|
|
|
+ vect -= 4; // Instruction is a relative jump (rjmp), so recalculate.
|
|
|
+ buff[8] = vect & 0xff;
|
|
|
+ buff[9] = vect >> 8;
|
|
|
+
|
|
|
+ // Add jump to bootloader at RESET vector
|
|
|
+ buff[0] = 0x7f;
|
|
|
+ 1d36: 0f e7 ldi r16, 0x7F ; 127
|
|
|
+ 1d38: f0 2e mov r15, r16
|
|
|
+ buff[1] = 0xce; // rjmp 0x1d00 instruction
|
|
|
+ 1d3a: 1e ec ldi r17, 0xCE ; 206
|
|
|
+ 1d3c: e1 2e mov r14, r17
|
|
|
+#endif
|
|
|
+
|
|
|
+ /* Forever loop */
|
|
|
+ for (;;) {
|
|
|
+ /* get character from UART */
|
|
|
+ ch = getch();
|
|
|
+ 1d3e: e9 d0 rcall .+466 ; 0x1f12 <getch>
|
|
|
+
|
|
|
+ if(ch == STK_GET_PARAMETER) {
|
|
|
+ 1d40: 81 34 cpi r24, 0x41 ; 65
|
|
|
+ 1d42: 21 f4 brne .+8 ; 0x1d4c <main+0x4c>
|
|
|
+ // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy
|
|
|
+ getNch(1);
|
|
|
+ 1d44: 81 e0 ldi r24, 0x01 ; 1
|
|
|
+ 1d46: 0d d1 rcall .+538 ; 0x1f62 <verifySpace+0xc>
|
|
|
+ putch(0x03);
|
|
|
+ 1d48: 83 e0 ldi r24, 0x03 ; 3
|
|
|
+ 1d4a: 20 c0 rjmp .+64 ; 0x1d8c <main+0x8c>
|
|
|
+ }
|
|
|
+ else if(ch == STK_SET_DEVICE) {
|
|
|
+ 1d4c: 82 34 cpi r24, 0x42 ; 66
|
|
|
+ 1d4e: 11 f4 brne .+4 ; 0x1d54 <main+0x54>
|
|
|
+ // SET DEVICE is ignored
|
|
|
+ getNch(20);
|
|
|
+ 1d50: 84 e1 ldi r24, 0x14 ; 20
|
|
|
+ 1d52: 03 c0 rjmp .+6 ; 0x1d5a <main+0x5a>
|
|
|
+ }
|
|
|
+ else if(ch == STK_SET_DEVICE_EXT) {
|
|
|
+ 1d54: 85 34 cpi r24, 0x45 ; 69
|
|
|
+ 1d56: 19 f4 brne .+6 ; 0x1d5e <main+0x5e>
|
|
|
+ // SET DEVICE EXT is ignored
|
|
|
+ getNch(5);
|
|
|
+ 1d58: 85 e0 ldi r24, 0x05 ; 5
|
|
|
+ 1d5a: 03 d1 rcall .+518 ; 0x1f62 <verifySpace+0xc>
|
|
|
+ 1d5c: c8 c0 rjmp .+400 ; 0x1eee <main+0x1ee>
|
|
|
+ }
|
|
|
+ else if(ch == STK_LOAD_ADDRESS) {
|
|
|
+ 1d5e: 85 35 cpi r24, 0x55 ; 85
|
|
|
+ 1d60: 81 f4 brne .+32 ; 0x1d82 <main+0x82>
|
|
|
+ // LOAD ADDRESS
|
|
|
+ uint16_t newAddress;
|
|
|
+ newAddress = getch();
|
|
|
+ 1d62: d7 d0 rcall .+430 ; 0x1f12 <getch>
|
|
|
+ newAddress = (newAddress & 0xff) | (getch() << 8);
|
|
|
+ 1d64: 08 2f mov r16, r24
|
|
|
+ 1d66: 10 e0 ldi r17, 0x00 ; 0
|
|
|
+ 1d68: d4 d0 rcall .+424 ; 0x1f12 <getch>
|
|
|
+ 1d6a: 90 e0 ldi r25, 0x00 ; 0
|
|
|
+ 1d6c: 98 2f mov r25, r24
|
|
|
+ 1d6e: 88 27 eor r24, r24
|
|
|
+ 1d70: 80 2b or r24, r16
|
|
|
+ 1d72: 91 2b or r25, r17
|
|
|
+#ifdef RAMPZ
|
|
|
+ // Transfer top bit to RAMPZ
|
|
|
+ RAMPZ = (newAddress & 0x8000) ? 1 : 0;
|
|
|
+#endif
|
|
|
+ newAddress += newAddress; // Convert from word address to byte address
|
|
|
+ 1d74: 88 0f add r24, r24
|
|
|
+ 1d76: 99 1f adc r25, r25
|
|
|
+ address = newAddress;
|
|
|
+ 1d78: 90 93 81 01 sts 0x0181, r25
|
|
|
+ 1d7c: 80 93 80 01 sts 0x0180, r24
|
|
|
+ 1d80: b5 c0 rjmp .+362 ; 0x1eec <main+0x1ec>
|
|
|
+ verifySpace();
|
|
|
+ }
|
|
|
+ else if(ch == STK_UNIVERSAL) {
|
|
|
+ 1d82: 86 35 cpi r24, 0x56 ; 86
|
|
|
+ 1d84: 29 f4 brne .+10 ; 0x1d90 <main+0x90>
|
|
|
+ // UNIVERSAL command is ignored
|
|
|
+ getNch(4);
|
|
|
+ 1d86: 84 e0 ldi r24, 0x04 ; 4
|
|
|
+ 1d88: ec d0 rcall .+472 ; 0x1f62 <verifySpace+0xc>
|
|
|
+ putch(0x00);
|
|
|
+ 1d8a: 80 e0 ldi r24, 0x00 ; 0
|
|
|
+ 1d8c: b3 d0 rcall .+358 ; 0x1ef4 <putch>
|
|
|
+ 1d8e: af c0 rjmp .+350 ; 0x1eee <main+0x1ee>
|
|
|
+ }
|
|
|
+ /* 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 <main+0x96>
|
|
|
+ 1d94: 6b c0 rjmp .+214 ; 0x1e6c <main+0x16c>
|
|
|
+ // PROGRAM PAGE - we support flash programming only, not EEPROM
|
|
|
+ uint8_t *bufPtr;
|
|
|
+ uint16_t addrPtr;
|
|
|
+
|
|
|
+ getLen();
|
|
|
+ 1d96: d1 d0 rcall .+418 ; 0x1f3a <getLen>
|
|
|
+
|
|
|
+ // Immediately start page erase - this will 4.5ms
|
|
|
+ __boot_page_erase_short((uint16_t)(void*)address);
|
|
|
+ 1d98: e0 91 80 01 lds r30, 0x0180
|
|
|
+ 1d9c: f0 91 81 01 lds r31, 0x0181
|
|
|
+ 1da0: 83 e0 ldi r24, 0x03 ; 3
|
|
|
+ 1da2: 87 bf out 0x37, r24 ; 55
|
|
|
+ 1da4: e8 95 spm
|
|
|
+ 1da6: c0 e0 ldi r28, 0x00 ; 0
|
|
|
+ 1da8: d1 e0 ldi r29, 0x01 ; 1
|
|
|
+
|
|
|
+ // While that is going on, read in page contents
|
|
|
+ bufPtr = buff;
|
|
|
+ do *bufPtr++ = getch();
|
|
|
+ 1daa: b3 d0 rcall .+358 ; 0x1f12 <getch>
|
|
|
+ 1dac: 89 93 st Y+, r24
|
|
|
+ while (--length);
|
|
|
+ 1dae: 80 91 82 01 lds r24, 0x0182
|
|
|
+ 1db2: 81 50 subi r24, 0x01 ; 1
|
|
|
+ 1db4: 80 93 82 01 sts 0x0182, r24
|
|
|
+ 1db8: 88 23 and r24, r24
|
|
|
+ 1dba: b9 f7 brne .-18 ; 0x1daa <main+0xaa>
|
|
|
+
|
|
|
+ // Read command terminator, start reply
|
|
|
+ verifySpace();
|
|
|
+ 1dbc: cc d0 rcall .+408 ; 0x1f56 <verifySpace>
|
|
|
+
|
|
|
+ // If only a partial page is to be programmed, the erase might not be complete.
|
|
|
+ // So check that here
|
|
|
+ boot_spm_busy_wait();
|
|
|
+ 1dbe: 07 b6 in r0, 0x37 ; 55
|
|
|
+ 1dc0: 00 fc sbrc r0, 0
|
|
|
+ 1dc2: fd cf rjmp .-6 ; 0x1dbe <main+0xbe>
|
|
|
+
|
|
|
+#ifdef VIRTUAL_BOOT_PARTITION
|
|
|
+ if ((uint16_t)(void*)address == 0) {
|
|
|
+ 1dc4: 80 91 80 01 lds r24, 0x0180
|
|
|
+ 1dc8: 90 91 81 01 lds r25, 0x0181
|
|
|
+ 1dcc: 89 2b or r24, r25
|
|
|
+ 1dce: 41 f5 brne .+80 ; 0x1e20 <main+0x120>
|
|
|
+ // 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);
|
|
|
+ 1dd0: 80 91 00 01 lds r24, 0x0100
|
|
|
+ 1dd4: 20 91 01 01 lds r18, 0x0101
|
|
|
+ 1dd8: 30 e0 ldi r19, 0x00 ; 0
|
|
|
+ 1dda: 32 2f mov r19, r18
|
|
|
+ 1ddc: 22 27 eor r18, r18
|
|
|
+ 1dde: 90 e0 ldi r25, 0x00 ; 0
|
|
|
+ 1de0: 28 2b or r18, r24
|
|
|
+ 1de2: 39 2b or r19, r25
|
|
|
+ rstVect = vect;
|
|
|
+ 1de4: 30 93 85 01 sts 0x0185, r19
|
|
|
+ 1de8: 20 93 84 01 sts 0x0184, r18
|
|
|
+ wdtVect = buff[8] | (buff[9]<<8);
|
|
|
+ 1dec: 40 91 08 01 lds r20, 0x0108
|
|
|
+ 1df0: 80 91 09 01 lds r24, 0x0109
|
|
|
+ 1df4: 90 e0 ldi r25, 0x00 ; 0
|
|
|
+ 1df6: 98 2f mov r25, r24
|
|
|
+ 1df8: 88 27 eor r24, r24
|
|
|
+ 1dfa: 50 e0 ldi r21, 0x00 ; 0
|
|
|
+ 1dfc: 84 2b or r24, r20
|
|
|
+ 1dfe: 95 2b or r25, r21
|
|
|
+ 1e00: 90 93 87 01 sts 0x0187, r25
|
|
|
+ 1e04: 80 93 86 01 sts 0x0186, r24
|
|
|
+ vect -= 4; // Instruction is a relative jump (rjmp), so recalculate.
|
|
|
+ 1e08: 24 50 subi r18, 0x04 ; 4
|
|
|
+ 1e0a: 30 40 sbci r19, 0x00 ; 0
|
|
|
+ buff[8] = vect & 0xff;
|
|
|
+ 1e0c: 20 93 08 01 sts 0x0108, r18
|
|
|
+ buff[9] = vect >> 8;
|
|
|
+ 1e10: 23 2f mov r18, r19
|
|
|
+ 1e12: 33 27 eor r19, r19
|
|
|
+ 1e14: 20 93 09 01 sts 0x0109, r18
|
|
|
+
|
|
|
+ // Add jump to bootloader at RESET vector
|
|
|
+ buff[0] = 0x7f;
|
|
|
+ 1e18: f0 92 00 01 sts 0x0100, r15
|
|
|
+ buff[1] = 0xce; // rjmp 0x1d00 instruction
|
|
|
+ 1e1c: e0 92 01 01 sts 0x0101, r14
|
|
|
+ }
|
|
|
+#endif
|
|
|
+
|
|
|
+ // Copy buffer into programming buffer
|
|
|
+ bufPtr = buff;
|
|
|
+ addrPtr = (uint16_t)(void*)address;
|
|
|
+ 1e20: 40 91 80 01 lds r20, 0x0180
|
|
|
+ 1e24: 50 91 81 01 lds r21, 0x0181
|
|
|
+ 1e28: a0 e0 ldi r26, 0x00 ; 0
|
|
|
+ 1e2a: b1 e0 ldi r27, 0x01 ; 1
|
|
|
+ ch = SPM_PAGESIZE / 2;
|
|
|
+ do {
|
|
|
+ uint16_t a;
|
|
|
+ a = *bufPtr++;
|
|
|
+ 1e2c: 2c 91 ld r18, X
|
|
|
+ 1e2e: 30 e0 ldi r19, 0x00 ; 0
|
|
|
+ a |= (*bufPtr++) << 8;
|
|
|
+ 1e30: 11 96 adiw r26, 0x01 ; 1
|
|
|
+ 1e32: 8c 91 ld r24, X
|
|
|
+ 1e34: 11 97 sbiw r26, 0x01 ; 1
|
|
|
+ 1e36: 90 e0 ldi r25, 0x00 ; 0
|
|
|
+ 1e38: 98 2f mov r25, r24
|
|
|
+ 1e3a: 88 27 eor r24, r24
|
|
|
+ 1e3c: 82 2b or r24, r18
|
|
|
+ 1e3e: 93 2b or r25, r19
|
|
|
+#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4))
|
|
|
+#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6))
|
|
|
+#endif
|
|
|
+
|
|
|
+/* main program starts here */
|
|
|
+int main(void) {
|
|
|
+ 1e40: 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);
|
|
|
+ 1e42: fa 01 movw r30, r20
|
|
|
+ 1e44: 0c 01 movw r0, r24
|
|
|
+ 1e46: d7 be out 0x37, r13 ; 55
|
|
|
+ 1e48: e8 95 spm
|
|
|
+ 1e4a: 11 24 eor r1, r1
|
|
|
+ addrPtr += 2;
|
|
|
+ 1e4c: 4e 5f subi r20, 0xFE ; 254
|
|
|
+ 1e4e: 5f 4f sbci r21, 0xFF ; 255
|
|
|
+ } while (--ch);
|
|
|
+ 1e50: f1 e0 ldi r31, 0x01 ; 1
|
|
|
+ 1e52: a0 34 cpi r26, 0x40 ; 64
|
|
|
+ 1e54: bf 07 cpc r27, r31
|
|
|
+ 1e56: 51 f7 brne .-44 ; 0x1e2c <main+0x12c>
|
|
|
+
|
|
|
+ // Write from programming buffer
|
|
|
+ __boot_page_write_short((uint16_t)(void*)address);
|
|
|
+ 1e58: e0 91 80 01 lds r30, 0x0180
|
|
|
+ 1e5c: f0 91 81 01 lds r31, 0x0181
|
|
|
+ 1e60: c7 be out 0x37, r12 ; 55
|
|
|
+ 1e62: e8 95 spm
|
|
|
+ boot_spm_busy_wait();
|
|
|
+ 1e64: 07 b6 in r0, 0x37 ; 55
|
|
|
+ 1e66: 00 fc sbrc r0, 0
|
|
|
+ 1e68: fd cf rjmp .-6 ; 0x1e64 <main+0x164>
|
|
|
+ 1e6a: 41 c0 rjmp .+130 ; 0x1eee <main+0x1ee>
|
|
|
+ boot_rww_enable();
|
|
|
+#endif
|
|
|
+
|
|
|
+ }
|
|
|
+ /* Read memory block mode, length is big endian. */
|
|
|
+ else if(ch == STK_READ_PAGE) {
|
|
|
+ 1e6c: 84 37 cpi r24, 0x74 ; 116
|
|
|
+ 1e6e: 89 f5 brne .+98 ; 0x1ed2 <main+0x1d2>
|
|
|
+ // READ PAGE - we only read flash
|
|
|
+ getLen();
|
|
|
+ 1e70: 64 d0 rcall .+200 ; 0x1f3a <getLen>
|
|
|
+ verifySpace();
|
|
|
+ 1e72: 71 d0 rcall .+226 ; 0x1f56 <verifySpace>
|
|
|
+#ifdef VIRTUAL_BOOT_PARTITION
|
|
|
+ do {
|
|
|
+ // Undo vector patch in bottom page so verify passes
|
|
|
+ if (address == 0) ch=rstVect & 0xff;
|
|
|
+ 1e74: e0 91 80 01 lds r30, 0x0180
|
|
|
+ 1e78: f0 91 81 01 lds r31, 0x0181
|
|
|
+ 1e7c: 30 97 sbiw r30, 0x00 ; 0
|
|
|
+ 1e7e: 19 f4 brne .+6 ; 0x1e86 <main+0x186>
|
|
|
+ 1e80: 20 91 84 01 lds r18, 0x0184
|
|
|
+ 1e84: 13 c0 rjmp .+38 ; 0x1eac <main+0x1ac>
|
|
|
+ else if (address == 1) ch=rstVect >> 8;
|
|
|
+ 1e86: e1 30 cpi r30, 0x01 ; 1
|
|
|
+ 1e88: f1 05 cpc r31, r1
|
|
|
+ 1e8a: 19 f4 brne .+6 ; 0x1e92 <main+0x192>
|
|
|
+ 1e8c: 20 91 85 01 lds r18, 0x0185
|
|
|
+ 1e90: 0d c0 rjmp .+26 ; 0x1eac <main+0x1ac>
|
|
|
+ else if (address == 8) ch=wdtVect & 0xff;
|
|
|
+ 1e92: e8 30 cpi r30, 0x08 ; 8
|
|
|
+ 1e94: f1 05 cpc r31, r1
|
|
|
+ 1e96: 19 f4 brne .+6 ; 0x1e9e <main+0x19e>
|
|
|
+ 1e98: 20 91 86 01 lds r18, 0x0186
|
|
|
+ 1e9c: 07 c0 rjmp .+14 ; 0x1eac <main+0x1ac>
|
|
|
+ else if (address == 9) ch=wdtVect >> 8;
|
|
|
+ 1e9e: e9 30 cpi r30, 0x09 ; 9
|
|
|
+ 1ea0: f1 05 cpc r31, r1
|
|
|
+ 1ea2: 19 f4 brne .+6 ; 0x1eaa <main+0x1aa>
|
|
|
+ 1ea4: 20 91 87 01 lds r18, 0x0187
|
|
|
+ 1ea8: 01 c0 rjmp .+2 ; 0x1eac <main+0x1ac>
|
|
|
+ else ch = pgm_read_byte_near(address);
|
|
|
+ 1eaa: 24 91 lpm r18, Z+
|
|
|
+ address++;
|
|
|
+ 1eac: 80 91 80 01 lds r24, 0x0180
|
|
|
+ 1eb0: 90 91 81 01 lds r25, 0x0181
|
|
|
+ 1eb4: 01 96 adiw r24, 0x01 ; 1
|
|
|
+ 1eb6: 90 93 81 01 sts 0x0181, r25
|
|
|
+ 1eba: 80 93 80 01 sts 0x0180, r24
|
|
|
+ putch(ch);
|
|
|
+ 1ebe: 82 2f mov r24, r18
|
|
|
+ 1ec0: 19 d0 rcall .+50 ; 0x1ef4 <putch>
|
|
|
+ } while (--length);
|
|
|
+ 1ec2: 80 91 82 01 lds r24, 0x0182
|
|
|
+ 1ec6: 81 50 subi r24, 0x01 ; 1
|
|
|
+ 1ec8: 80 93 82 01 sts 0x0182, r24
|
|
|
+ 1ecc: 88 23 and r24, r24
|
|
|
+ 1ece: 91 f6 brne .-92 ; 0x1e74 <main+0x174>
|
|
|
+ 1ed0: 0e c0 rjmp .+28 ; 0x1eee <main+0x1ee>
|
|
|
+#endif
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
+ /* Get device signature bytes */
|
|
|
+ else if(ch == STK_READ_SIGN) {
|
|
|
+ 1ed2: 85 37 cpi r24, 0x75 ; 117
|
|
|
+ 1ed4: 39 f4 brne .+14 ; 0x1ee4 <main+0x1e4>
|
|
|
+ // READ SIGN - return what Avrdude wants to hear
|
|
|
+ verifySpace();
|
|
|
+ 1ed6: 3f d0 rcall .+126 ; 0x1f56 <verifySpace>
|
|
|
+ putch(SIGNATURE_0);
|
|
|
+ 1ed8: 8e e1 ldi r24, 0x1E ; 30
|
|
|
+ 1eda: 0c d0 rcall .+24 ; 0x1ef4 <putch>
|
|
|
+ putch(SIGNATURE_1);
|
|
|
+ 1edc: 83 e9 ldi r24, 0x93 ; 147
|
|
|
+ 1ede: 0a d0 rcall .+20 ; 0x1ef4 <putch>
|
|
|
+ putch(SIGNATURE_2);
|
|
|
+ 1ee0: 8c e0 ldi r24, 0x0C ; 12
|
|
|
+ 1ee2: 54 cf rjmp .-344 ; 0x1d8c <main+0x8c>
|
|
|
+ }
|
|
|
+ else if (ch == 'Q') {
|
|
|
+ 1ee4: 81 35 cpi r24, 0x51 ; 81
|
|
|
+ 1ee6: 11 f4 brne .+4 ; 0x1eec <main+0x1ec>
|
|
|
+ // Adaboot no-wait mod
|
|
|
+ watchdogConfig(WATCHDOG_16MS);
|
|
|
+ 1ee8: 88 e0 ldi r24, 0x08 ; 8
|
|
|
+ 1eea: 2c d0 rcall .+88 ; 0x1f44 <watchdogConfig>
|
|
|
+ verifySpace();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ // This covers the response to commands like STK_ENTER_PROGMODE
|
|
|
+ verifySpace();
|
|
|
+ 1eec: 34 d0 rcall .+104 ; 0x1f56 <verifySpace>
|
|
|
+ }
|
|
|
+ putch(STK_OK);
|
|
|
+ 1eee: 80 e1 ldi r24, 0x10 ; 16
|
|
|
+ 1ef0: 01 d0 rcall .+2 ; 0x1ef4 <putch>
|
|
|
+ 1ef2: 25 cf rjmp .-438 ; 0x1d3e <main+0x3e>
|
|
|
+
|
|
|
+00001ef4 <putch>:
|
|
|
+void putch(char ch) {
|
|
|
+#ifndef SOFT_UART
|
|
|
+ while (!(UCSR0A & _BV(UDRE0)));
|
|
|
+ UDR0 = ch;
|
|
|
+#else
|
|
|
+ __asm__ __volatile__ (
|
|
|
+ 1ef4: 2a e0 ldi r18, 0x0A ; 10
|
|
|
+ 1ef6: 30 e0 ldi r19, 0x00 ; 0
|
|
|
+ 1ef8: 80 95 com r24
|
|
|
+ 1efa: 08 94 sec
|
|
|
+ 1efc: 10 f4 brcc .+4 ; 0x1f02 <putch+0xe>
|
|
|
+ 1efe: da 98 cbi 0x1b, 2 ; 27
|
|
|
+ 1f00: 02 c0 rjmp .+4 ; 0x1f06 <putch+0x12>
|
|
|
+ 1f02: da 9a sbi 0x1b, 2 ; 27
|
|
|
+ 1f04: 00 00 nop
|
|
|
+ 1f06: 15 d0 rcall .+42 ; 0x1f32 <uartDelay>
|
|
|
+ 1f08: 14 d0 rcall .+40 ; 0x1f32 <uartDelay>
|
|
|
+ 1f0a: 86 95 lsr r24
|
|
|
+ 1f0c: 2a 95 dec r18
|
|
|
+ 1f0e: b1 f7 brne .-20 ; 0x1efc <putch+0x8>
|
|
|
+ [uartBit] "I" (UART_TX_BIT)
|
|
|
+ :
|
|
|
+ "r25"
|
|
|
+ );
|
|
|
+#endif
|
|
|
+}
|
|
|
+ 1f10: 08 95 ret
|
|
|
+
|
|
|
+00001f12 <getch>:
|
|
|
+ return getch();
|
|
|
+}
|
|
|
+
|
|
|
+// Watchdog functions. These are only safe with interrupts turned off.
|
|
|
+void watchdogReset() {
|
|
|
+ __asm__ __volatile__ (
|
|
|
+ 1f12: a8 95 wdr
|
|
|
+#ifdef LED_DATA_FLASH
|
|
|
+ LED_PIN |= _BV(LED);
|
|
|
+#endif
|
|
|
+
|
|
|
+ return ch;
|
|
|
+}
|
|
|
+ 1f14: 29 e0 ldi r18, 0x09 ; 9
|
|
|
+ 1f16: 30 e0 ldi r19, 0x00 ; 0
|
|
|
+ 1f18: cb 99 sbic 0x19, 3 ; 25
|
|
|
+ 1f1a: fe cf rjmp .-4 ; 0x1f18 <getch+0x6>
|
|
|
+ 1f1c: 0a d0 rcall .+20 ; 0x1f32 <uartDelay>
|
|
|
+ 1f1e: 09 d0 rcall .+18 ; 0x1f32 <uartDelay>
|
|
|
+ 1f20: 08 d0 rcall .+16 ; 0x1f32 <uartDelay>
|
|
|
+ 1f22: 88 94 clc
|
|
|
+ 1f24: cb 99 sbic 0x19, 3 ; 25
|
|
|
+ 1f26: 08 94 sec
|
|
|
+ 1f28: 2a 95 dec r18
|
|
|
+ 1f2a: 11 f0 breq .+4 ; 0x1f30 <getch+0x1e>
|
|
|
+ 1f2c: 87 95 ror r24
|
|
|
+ 1f2e: f7 cf rjmp .-18 ; 0x1f1e <getch+0xc>
|
|
|
+ 1f30: 08 95 ret
|
|
|
+
|
|
|
+00001f32 <uartDelay>:
|
|
|
+#if UART_B_VALUE > 255
|
|
|
+#error Baud rate too slow for soft UART
|
|
|
+#endif
|
|
|
+
|
|
|
+void uartDelay() {
|
|
|
+ __asm__ __volatile__ (
|
|
|
+ 1f32: 9e e0 ldi r25, 0x0E ; 14
|
|
|
+ 1f34: 9a 95 dec r25
|
|
|
+ 1f36: f1 f7 brne .-4 ; 0x1f34 <uartDelay+0x2>
|
|
|
+ 1f38: 08 95 ret
|
|
|
+
|
|
|
+00001f3a <getLen>:
|
|
|
+ } while (--count);
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
+uint8_t getLen() {
|
|
|
+ getch();
|
|
|
+ 1f3a: eb df rcall .-42 ; 0x1f12 <getch>
|
|
|
+ length = getch();
|
|
|
+ 1f3c: ea df rcall .-44 ; 0x1f12 <getch>
|
|
|
+ 1f3e: 80 93 82 01 sts 0x0182, r24
|
|
|
+ return getch();
|
|
|
+}
|
|
|
+ 1f42: e7 cf rjmp .-50 ; 0x1f12 <getch>
|
|
|
+
|
|
|
+00001f44 <watchdogConfig>:
|
|
|
+ "wdr\n"
|
|
|
+ );
|
|
|
+}
|
|
|
+
|
|
|
+void watchdogConfig(uint8_t x) {
|
|
|
+ WDTCSR = _BV(WDCE) | _BV(WDE);
|
|
|
+ 1f44: 98 e1 ldi r25, 0x18 ; 24
|
|
|
+ 1f46: 91 bd out 0x21, r25 ; 33
|
|
|
+ WDTCSR = x;
|
|
|
+ 1f48: 81 bd out 0x21, r24 ; 33
|
|
|
+}
|
|
|
+ 1f4a: 08 95 ret
|
|
|
+
|
|
|
+00001f4c <appStart>:
|
|
|
+
|
|
|
+void appStart() {
|
|
|
+ watchdogConfig(WATCHDOG_OFF);
|
|
|
+ 1f4c: 80 e0 ldi r24, 0x00 ; 0
|
|
|
+ 1f4e: fa df rcall .-12 ; 0x1f44 <watchdogConfig>
|
|
|
+ __asm__ __volatile__ (
|
|
|
+ 1f50: e4 e0 ldi r30, 0x04 ; 4
|
|
|
+ 1f52: ff 27 eor r31, r31
|
|
|
+ 1f54: 09 94 ijmp
|
|
|
+
|
|
|
+00001f56 <verifySpace>:
|
|
|
+ do getch(); while (--count);
|
|
|
+ verifySpace();
|
|
|
+}
|
|
|
+
|
|
|
+void verifySpace() {
|
|
|
+ if (getch() != CRC_EOP) appStart();
|
|
|
+ 1f56: dd df rcall .-70 ; 0x1f12 <getch>
|
|
|
+ 1f58: 80 32 cpi r24, 0x20 ; 32
|
|
|
+ 1f5a: 09 f0 breq .+2 ; 0x1f5e <verifySpace+0x8>
|
|
|
+ 1f5c: f7 df rcall .-18 ; 0x1f4c <appStart>
|
|
|
+ putch(STK_INSYNC);
|
|
|
+ 1f5e: 84 e1 ldi r24, 0x14 ; 20
|
|
|
+}
|
|
|
+ 1f60: c9 cf rjmp .-110 ; 0x1ef4 <putch>
|
|
|
+ ::[count] "M" (UART_B_VALUE)
|
|
|
+ );
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
+void getNch(uint8_t count) {
|
|
|
+ 1f62: 1f 93 push r17
|
|
|
+ 1f64: 18 2f mov r17, r24
|
|
|
+
|
|
|
+00001f66 <getNch>:
|
|
|
+ do getch(); while (--count);
|
|
|
+ 1f66: d5 df rcall .-86 ; 0x1f12 <getch>
|
|
|
+ 1f68: 11 50 subi r17, 0x01 ; 1
|
|
|
+ 1f6a: e9 f7 brne .-6 ; 0x1f66 <getNch>
|
|
|
+ verifySpace();
|
|
|
+ 1f6c: f4 df rcall .-24 ; 0x1f56 <verifySpace>
|
|
|
+}
|
|
|
+ 1f6e: 1f 91 pop r17
|
|
|
+ 1f70: 08 95 ret
|