|
@@ -1,660 +1,611 @@
|
|
|
|
|
|
-optiboot_luminet.elf: file format elf32-avr
|
|
|
+optiboot_attiny84.elf: file format elf32-avr
|
|
|
|
|
|
Sections:
|
|
|
Idx Name Size VMA LMA File off Algn
|
|
|
- 0 .text 0000025e 00001d00 00001d00 00000054 2**1
|
|
|
+ 0 .text 00000238 00001d00 00001d00 00000074 2**1
|
|
|
CONTENTS, ALLOC, LOAD, READONLY, CODE
|
|
|
- 1 .version 00000002 00001efe 00001efe 000002b2 2**0
|
|
|
- CONTENTS, READONLY
|
|
|
- 2 .debug_aranges 00000028 00000000 00000000 000002b4 2**0
|
|
|
+ 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 0000006d 00000000 00000000 000002dc 2**0
|
|
|
+ 3 .debug_pubnames 00000082 00000000 00000000 000002d6 2**0
|
|
|
CONTENTS, READONLY, DEBUGGING
|
|
|
- 4 .debug_info 000002d2 00000000 00000000 00000349 2**0
|
|
|
+ 4 .debug_info 000003e1 00000000 00000000 00000358 2**0
|
|
|
CONTENTS, READONLY, DEBUGGING
|
|
|
- 5 .debug_abbrev 00000176 00000000 00000000 0000061b 2**0
|
|
|
+ 5 .debug_abbrev 000001a5 00000000 00000000 00000739 2**0
|
|
|
CONTENTS, READONLY, DEBUGGING
|
|
|
- 6 .debug_line 00000471 00000000 00000000 00000791 2**0
|
|
|
+ 6 .debug_line 0000042a 00000000 00000000 000008de 2**0
|
|
|
CONTENTS, READONLY, DEBUGGING
|
|
|
- 7 .debug_frame 00000090 00000000 00000000 00000c04 2**2
|
|
|
+ 7 .debug_frame 00000090 00000000 00000000 00000d08 2**2
|
|
|
CONTENTS, READONLY, DEBUGGING
|
|
|
- 8 .debug_str 00000152 00000000 00000000 00000c94 2**0
|
|
|
+ 8 .debug_str 00000185 00000000 00000000 00000d98 2**0
|
|
|
CONTENTS, READONLY, DEBUGGING
|
|
|
- 9 .debug_loc 000002b4 00000000 00000000 00000de6 2**0
|
|
|
+ 9 .debug_loc 00000324 00000000 00000000 00000f1d 2**0
|
|
|
CONTENTS, READONLY, DEBUGGING
|
|
|
- 10 .debug_ranges 00000098 00000000 00000000 0000109a 2**0
|
|
|
+ 10 .debug_ranges 000000d0 00000000 00000000 00001241 2**0
|
|
|
CONTENTS, READONLY, DEBUGGING
|
|
|
|
|
|
Disassembly of section .text:
|
|
|
|
|
|
00001d00 <main>:
|
|
|
-# define UART_SRL UBRR3L
|
|
|
-# define UART_UDR UDR3
|
|
|
+#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6))
|
|
|
#endif
|
|
|
|
|
|
+
|
|
|
/* main program starts here */
|
|
|
int main(void) {
|
|
|
1d00: 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
|
|
|
+ * 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: 84 b7 in r24, 0x34 ; 52
|
|
|
+ 1d02: 94 b7 in r25, 0x34 ; 52
|
|
|
MCUSR = 0;
|
|
|
1d04: 14 be out 0x34, r1 ; 52
|
|
|
- if (!(ch & _BV(EXTRF))) appStart(ch);
|
|
|
- 1d06: 81 ff sbrs r24, 1
|
|
|
- 1d08: 24 d1 rcall .+584 ; 0x1f52 <appStart>
|
|
|
-
|
|
|
-#if LED_START_FLASHES > 0
|
|
|
- // Set up Timer 1 for timeout counter
|
|
|
- TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
|
|
|
- 1d0a: 85 e0 ldi r24, 0x05 ; 5
|
|
|
- 1d0c: 8e bd out 0x2e, r24 ; 46
|
|
|
+ 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 <main+0x10>
|
|
|
+ appStart(ch);
|
|
|
+ 1d0c: 89 2f mov r24, r25
|
|
|
+ 1d0e: 0e d1 rcall .+540 ; 0x1f2c <appStart>
|
|
|
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);
|
|
|
- 1d0e: 8e e0 ldi r24, 0x0E ; 14
|
|
|
- 1d10: 0c d1 rcall .+536 ; 0x1f2a <watchdogConfig>
|
|
|
-
|
|
|
-#if (LED_START_FLASHES > 0) || defined(LED_DATA_FLASH)
|
|
|
- /* Set LED pin as output */
|
|
|
+ 1d10: 8e e0 ldi r24, 0x0E ; 14
|
|
|
+ 1d12: f8 d0 rcall .+496 ; 0x1f04 <watchdogConfig>
|
|
|
LED_DDR |= _BV(LED);
|
|
|
- 1d12: d4 9a sbi 0x1a, 4 ; 26
|
|
|
#endif
|
|
|
|
|
|
#ifdef SOFT_UART
|
|
|
/* Set TX pin as output */
|
|
|
UART_DDR |= _BV(UART_TX_BIT);
|
|
|
1d14: d2 9a sbi 0x1a, 2 ; 26
|
|
|
- 1d16: 86 e0 ldi r24, 0x06 ; 6
|
|
|
-}
|
|
|
-
|
|
|
-#if LED_START_FLASHES > 0
|
|
|
-void flash_led(uint8_t count) {
|
|
|
- do {
|
|
|
- TCNT1 = -(F_CPU/(1024*16));
|
|
|
- 1d18: 23 ec ldi r18, 0xC3 ; 195
|
|
|
- 1d1a: 3f ef ldi r19, 0xFF ; 255
|
|
|
- TIFR1 = _BV(TOV1);
|
|
|
- 1d1c: 91 e0 ldi r25, 0x01 ; 1
|
|
|
-}
|
|
|
-
|
|
|
-#if LED_START_FLASHES > 0
|
|
|
-void flash_led(uint8_t count) {
|
|
|
- do {
|
|
|
- TCNT1 = -(F_CPU/(1024*16));
|
|
|
- 1d1e: 3d bd out 0x2d, r19 ; 45
|
|
|
- 1d20: 2c bd out 0x2c, r18 ; 44
|
|
|
- TIFR1 = _BV(TOV1);
|
|
|
- 1d22: 9b b9 out 0x0b, r25 ; 11
|
|
|
- while(!(TIFR1 & _BV(TOV1)));
|
|
|
- 1d24: 58 9b sbis 0x0b, 0 ; 11
|
|
|
- 1d26: fe cf rjmp .-4 ; 0x1d24 <main+0x24>
|
|
|
-#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__)
|
|
|
- LED_PORT ^= _BV(LED);
|
|
|
-#else
|
|
|
- LED_PIN |= _BV(LED);
|
|
|
- 1d28: cc 9a sbi 0x19, 4 ; 25
|
|
|
-}
|
|
|
-#endif
|
|
|
-
|
|
|
-// Watchdog functions. These are only safe with interrupts turned off.
|
|
|
-void watchdogReset() {
|
|
|
- __asm__ __volatile__ (
|
|
|
- 1d2a: a8 95 wdr
|
|
|
- LED_PORT ^= _BV(LED);
|
|
|
-#else
|
|
|
- LED_PIN |= _BV(LED);
|
|
|
-#endif
|
|
|
- watchdogReset();
|
|
|
- } while (--count);
|
|
|
- 1d2c: 81 50 subi r24, 0x01 ; 1
|
|
|
- 1d2e: b9 f7 brne .-18 ; 0x1d1e <main+0x1e>
|
|
|
- 1d30: ee 24 eor r14, r14
|
|
|
- 1d32: ff 24 eor r15, r15
|
|
|
-
|
|
|
- // 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);
|
|
|
- 1d34: 93 e0 ldi r25, 0x03 ; 3
|
|
|
- 1d36: 99 2e mov r9, r25
|
|
|
- ch = SPM_PAGESIZE / 2;
|
|
|
- do {
|
|
|
- uint16_t a;
|
|
|
- a = *bufPtr++;
|
|
|
- a |= (*bufPtr++) << 8;
|
|
|
- __boot_page_fill_short((uint16_t)(void*)addrPtr,a);
|
|
|
- 1d38: bb 24 eor r11, r11
|
|
|
- 1d3a: b3 94 inc r11
|
|
|
- addrPtr += 2;
|
|
|
- } while (--ch);
|
|
|
-
|
|
|
- // Write from programming buffer
|
|
|
- __boot_page_write_short((uint16_t)(void*)address);
|
|
|
- 1d3c: 85 e0 ldi r24, 0x05 ; 5
|
|
|
- 1d3e: a8 2e mov r10, r24
|
|
|
+ 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;
|
|
|
- 1d40: 0f e7 ldi r16, 0x7F ; 127
|
|
|
- 1d42: d0 2e mov r13, r16
|
|
|
+ 1d26: 0f e7 ldi r16, 0x7F ; 127
|
|
|
+ 1d28: d0 2e mov r13, r16
|
|
|
buff[1] = 0xce; // rjmp 0x1d00 instruction
|
|
|
- 1d44: 1e ec ldi r17, 0xCE ; 206
|
|
|
- 1d46: c1 2e mov r12, r17
|
|
|
+ 1d2a: 1e ec ldi r17, 0xCE ; 206
|
|
|
+ 1d2c: c1 2e mov r12, r17
|
|
|
#endif
|
|
|
|
|
|
- /* Forever loop */
|
|
|
+ /* Forever loop: exits by causing WDT reset */
|
|
|
for (;;) {
|
|
|
/* get character from UART */
|
|
|
ch = getch();
|
|
|
- 1d48: dd d0 rcall .+442 ; 0x1f04 <getch>
|
|
|
+ 1d2e: d7 d0 rcall .+430 ; 0x1ede <getch>
|
|
|
|
|
|
if(ch == STK_GET_PARAMETER) {
|
|
|
- 1d4a: 81 34 cpi r24, 0x41 ; 65
|
|
|
- 1d4c: 61 f4 brne .+24 ; 0x1d66 <main+0x66>
|
|
|
+ 1d30: 81 34 cpi r24, 0x41 ; 65
|
|
|
+ 1d32: 71 f4 brne .+28 ; 0x1d50 <main+0x50>
|
|
|
unsigned char which = getch();
|
|
|
- 1d4e: da d0 rcall .+436 ; 0x1f04 <getch>
|
|
|
- 1d50: 08 2f mov r16, r24
|
|
|
+ 1d34: d4 d0 rcall .+424 ; 0x1ede <getch>
|
|
|
+ 1d36: 08 2f mov r16, r24
|
|
|
verifySpace();
|
|
|
- 1d52: ef d0 rcall .+478 ; 0x1f32 <verifySpace>
|
|
|
+ 1d38: e9 d0 rcall .+466 ; 0x1f0c <verifySpace>
|
|
|
+ /*
|
|
|
+ * Send optiboot version as "SW version"
|
|
|
+ * Note that the references to memory are optimized away.
|
|
|
+ */
|
|
|
if (which == 0x82) {
|
|
|
- 1d54: 02 38 cpi r16, 0x82 ; 130
|
|
|
- 1d56: 29 f1 breq .+74 ; 0x1da2 <main+0xa2>
|
|
|
- /*
|
|
|
- * Send optiboot version as "minor SW version"
|
|
|
- */
|
|
|
- putch(OPTIBOOT_MINVER);
|
|
|
+ 1d3a: 02 38 cpi r16, 0x82 ; 130
|
|
|
+ 1d3c: 11 f4 brne .+4 ; 0x1d42 <main+0x42>
|
|
|
+ putch(optiboot_version & 0xFF);
|
|
|
+ 1d3e: 82 e0 ldi r24, 0x02 ; 2
|
|
|
+ 1d40: 05 c0 rjmp .+10 ; 0x1d4c <main+0x4c>
|
|
|
} else if (which == 0x81) {
|
|
|
- 1d58: 01 38 cpi r16, 0x81 ; 129
|
|
|
- 1d5a: 11 f4 brne .+4 ; 0x1d60 <main+0x60>
|
|
|
- putch(OPTIBOOT_MAJVER);
|
|
|
- 1d5c: 85 e0 ldi r24, 0x05 ; 5
|
|
|
- 1d5e: 01 c0 rjmp .+2 ; 0x1d62 <main+0x62>
|
|
|
+ 1d42: 01 38 cpi r16, 0x81 ; 129
|
|
|
+ 1d44: 11 f4 brne .+4 ; 0x1d4a <main+0x4a>
|
|
|
+ putch(optiboot_version >> 8);
|
|
|
+ 1d46: 86 e0 ldi r24, 0x06 ; 6
|
|
|
+ 1d48: 01 c0 rjmp .+2 ; 0x1d4c <main+0x4c>
|
|
|
} else {
|
|
|
/*
|
|
|
* GET PARAMETER returns a generic 0x03 reply for
|
|
|
* other parameters - enough to keep Avrdude happy
|
|
|
*/
|
|
|
putch(0x03);
|
|
|
- 1d60: 83 e0 ldi r24, 0x03 ; 3
|
|
|
- 1d62: c1 d0 rcall .+386 ; 0x1ee6 <putch>
|
|
|
- 1d64: bd c0 rjmp .+378 ; 0x1ee0 <main+0x1e0>
|
|
|
+ 1d4a: 83 e0 ldi r24, 0x03 ; 3
|
|
|
+ 1d4c: b9 d0 rcall .+370 ; 0x1ec0 <putch>
|
|
|
+ 1d4e: b5 c0 rjmp .+362 ; 0x1eba <main+0x1ba>
|
|
|
}
|
|
|
}
|
|
|
else if(ch == STK_SET_DEVICE) {
|
|
|
- 1d66: 82 34 cpi r24, 0x42 ; 66
|
|
|
- 1d68: 11 f4 brne .+4 ; 0x1d6e <main+0x6e>
|
|
|
+ 1d50: 82 34 cpi r24, 0x42 ; 66
|
|
|
+ 1d52: 11 f4 brne .+4 ; 0x1d58 <main+0x58>
|
|
|
// SET DEVICE is ignored
|
|
|
getNch(20);
|
|
|
- 1d6a: 84 e1 ldi r24, 0x14 ; 20
|
|
|
- 1d6c: 03 c0 rjmp .+6 ; 0x1d74 <main+0x74>
|
|
|
+ 1d54: 84 e1 ldi r24, 0x14 ; 20
|
|
|
+ 1d56: 03 c0 rjmp .+6 ; 0x1d5e <main+0x5e>
|
|
|
}
|
|
|
else if(ch == STK_SET_DEVICE_EXT) {
|
|
|
- 1d6e: 85 34 cpi r24, 0x45 ; 69
|
|
|
- 1d70: 19 f4 brne .+6 ; 0x1d78 <main+0x78>
|
|
|
+ 1d58: 85 34 cpi r24, 0x45 ; 69
|
|
|
+ 1d5a: 19 f4 brne .+6 ; 0x1d62 <main+0x62>
|
|
|
// SET DEVICE EXT is ignored
|
|
|
getNch(5);
|
|
|
- 1d72: 85 e0 ldi r24, 0x05 ; 5
|
|
|
- 1d74: e6 d0 rcall .+460 ; 0x1f42 <getNch>
|
|
|
- 1d76: b4 c0 rjmp .+360 ; 0x1ee0 <main+0x1e0>
|
|
|
+ 1d5c: 85 e0 ldi r24, 0x05 ; 5
|
|
|
+ 1d5e: de d0 rcall .+444 ; 0x1f1c <verifySpace+0x10>
|
|
|
+ 1d60: ac c0 rjmp .+344 ; 0x1eba <main+0x1ba>
|
|
|
}
|
|
|
else if(ch == STK_LOAD_ADDRESS) {
|
|
|
- 1d78: 85 35 cpi r24, 0x55 ; 85
|
|
|
- 1d7a: 79 f4 brne .+30 ; 0x1d9a <main+0x9a>
|
|
|
+ 1d62: 85 35 cpi r24, 0x55 ; 85
|
|
|
+ 1d64: 79 f4 brne .+30 ; 0x1d84 <main+0x84>
|
|
|
// LOAD ADDRESS
|
|
|
uint16_t newAddress;
|
|
|
newAddress = getch();
|
|
|
- 1d7c: c3 d0 rcall .+390 ; 0x1f04 <getch>
|
|
|
+ 1d66: bb d0 rcall .+374 ; 0x1ede <getch>
|
|
|
newAddress = (newAddress & 0xff) | (getch() << 8);
|
|
|
- 1d7e: e8 2e mov r14, r24
|
|
|
- 1d80: ff 24 eor r15, r15
|
|
|
- 1d82: c0 d0 rcall .+384 ; 0x1f04 <getch>
|
|
|
- 1d84: 08 2f mov r16, r24
|
|
|
- 1d86: 10 e0 ldi r17, 0x00 ; 0
|
|
|
- 1d88: 10 2f mov r17, r16
|
|
|
- 1d8a: 00 27 eor r16, r16
|
|
|
- 1d8c: 0e 29 or r16, r14
|
|
|
- 1d8e: 1f 29 or r17, r15
|
|
|
+ 1d68: e8 2e mov r14, r24
|
|
|
+ 1d6a: ff 24 eor r15, r15
|
|
|
+ 1d6c: b8 d0 rcall .+368 ; 0x1ede <getch>
|
|
|
+ 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
|
|
|
- 1d90: 00 0f add r16, r16
|
|
|
- 1d92: 11 1f adc r17, r17
|
|
|
+ 1d7a: 00 0f add r16, r16
|
|
|
+ 1d7c: 11 1f adc r17, r17
|
|
|
address = newAddress;
|
|
|
verifySpace();
|
|
|
- 1d94: ce d0 rcall .+412 ; 0x1f32 <verifySpace>
|
|
|
- 1d96: 78 01 movw r14, r16
|
|
|
- 1d98: a3 c0 rjmp .+326 ; 0x1ee0 <main+0x1e0>
|
|
|
+ 1d7e: c6 d0 rcall .+396 ; 0x1f0c <verifySpace>
|
|
|
+ 1d80: 78 01 movw r14, r16
|
|
|
+ 1d82: 9b c0 rjmp .+310 ; 0x1eba <main+0x1ba>
|
|
|
}
|
|
|
else if(ch == STK_UNIVERSAL) {
|
|
|
- 1d9a: 86 35 cpi r24, 0x56 ; 86
|
|
|
- 1d9c: 21 f4 brne .+8 ; 0x1da6 <main+0xa6>
|
|
|
+ 1d84: 86 35 cpi r24, 0x56 ; 86
|
|
|
+ 1d86: 21 f4 brne .+8 ; 0x1d90 <main+0x90>
|
|
|
// UNIVERSAL command is ignored
|
|
|
getNch(4);
|
|
|
- 1d9e: 84 e0 ldi r24, 0x04 ; 4
|
|
|
- 1da0: d0 d0 rcall .+416 ; 0x1f42 <getNch>
|
|
|
+ 1d88: 84 e0 ldi r24, 0x04 ; 4
|
|
|
+ 1d8a: c8 d0 rcall .+400 ; 0x1f1c <verifySpace+0x10>
|
|
|
putch(0x00);
|
|
|
- 1da2: 80 e0 ldi r24, 0x00 ; 0
|
|
|
- 1da4: de cf rjmp .-68 ; 0x1d62 <main+0x62>
|
|
|
+ 1d8c: 80 e0 ldi r24, 0x00 ; 0
|
|
|
+ 1d8e: de cf rjmp .-68 ; 0x1d4c <main+0x4c>
|
|
|
}
|
|
|
/* Write memory, length is big endian and is in bytes */
|
|
|
else if(ch == STK_PROG_PAGE) {
|
|
|
- 1da6: 84 36 cpi r24, 0x64 ; 100
|
|
|
- 1da8: 09 f0 breq .+2 ; 0x1dac <main+0xac>
|
|
|
- 1daa: 5f c0 rjmp .+190 ; 0x1e6a <main+0x16a>
|
|
|
+ 1d90: 84 36 cpi r24, 0x64 ; 100
|
|
|
+ 1d92: 09 f0 breq .+2 ; 0x1d96 <main+0x96>
|
|
|
+ 1d94: 5e c0 rjmp .+188 ; 0x1e52 <main+0x152>
|
|
|
// PROGRAM PAGE - we support flash programming only, not EEPROM
|
|
|
+ uint8_t desttype;
|
|
|
uint8_t *bufPtr;
|
|
|
- uint16_t addrPtr;
|
|
|
-
|
|
|
- getch(); /* getlen() */
|
|
|
- 1dac: ab d0 rcall .+342 ; 0x1f04 <getch>
|
|
|
- length = getch();
|
|
|
- 1dae: aa d0 rcall .+340 ; 0x1f04 <getch>
|
|
|
- 1db0: 18 2f mov r17, r24
|
|
|
- getch();
|
|
|
- 1db2: a8 d0 rcall .+336 ; 0x1f04 <getch>
|
|
|
- 1db4: c0 e0 ldi r28, 0x00 ; 0
|
|
|
- 1db6: d1 e0 ldi r29, 0x01 ; 1
|
|
|
- // If we are in RWW section, immediately start page erase
|
|
|
- if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address);
|
|
|
-
|
|
|
- // While that is going on, read in page contents
|
|
|
+ pagelen_t savelength;
|
|
|
+
|
|
|
+ GETLENGTH(length);
|
|
|
+ 1d96: a3 d0 rcall .+326 ; 0x1ede <getch>
|
|
|
+ 1d98: a2 d0 rcall .+324 ; 0x1ede <getch>
|
|
|
+ 1d9a: 18 2f mov r17, r24
|
|
|
+ savelength = length;
|
|
|
+ desttype = getch();
|
|
|
+ 1d9c: a0 d0 rcall .+320 ; 0x1ede <getch>
|
|
|
+ 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();
|
|
|
- 1db8: a5 d0 rcall .+330 ; 0x1f04 <getch>
|
|
|
- 1dba: 89 93 st Y+, r24
|
|
|
+ 1da4: 9c d0 rcall .+312 ; 0x1ede <getch>
|
|
|
+ 1da6: 89 93 st Y+, r24
|
|
|
while (--length);
|
|
|
- 1dbc: 1c 17 cp r17, r28
|
|
|
- 1dbe: e1 f7 brne .-8 ; 0x1db8 <main+0xb8>
|
|
|
-
|
|
|
- // 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);
|
|
|
- 1dc0: f7 01 movw r30, r14
|
|
|
- 1dc2: 97 be out 0x37, r9 ; 55
|
|
|
- 1dc4: e8 95 spm
|
|
|
+ 1da8: 1c 17 cp r17, r28
|
|
|
+ 1daa: e1 f7 brne .-8 ; 0x1da4 <main+0xa4>
|
|
|
|
|
|
// Read command terminator, start reply
|
|
|
verifySpace();
|
|
|
- 1dc6: b5 d0 rcall .+362 ; 0x1f32 <verifySpace>
|
|
|
-
|
|
|
- // If only a partial page is to be programmed, the erase might not be complete.
|
|
|
- // So check that here
|
|
|
- boot_spm_busy_wait();
|
|
|
- 1dc8: 07 b6 in r0, 0x37 ; 55
|
|
|
- 1dca: 00 fc sbrc r0, 0
|
|
|
- 1dcc: fd cf rjmp .-6 ; 0x1dc8 <main+0xc8>
|
|
|
+ 1dac: af d0 rcall .+350 ; 0x1f0c <verifySpace>
|
|
|
|
|
|
#ifdef VIRTUAL_BOOT_PARTITION
|
|
|
if ((uint16_t)(void*)address == 0) {
|
|
|
- 1dce: e1 14 cp r14, r1
|
|
|
- 1dd0: f1 04 cpc r15, r1
|
|
|
- 1dd2: 11 f0 breq .+4 ; 0x1dd8 <main+0xd8>
|
|
|
- 1dd4: a7 01 movw r20, r14
|
|
|
- 1dd6: 2a c0 rjmp .+84 ; 0x1e2c <main+0x12c>
|
|
|
+ 1dae: e1 14 cp r14, r1
|
|
|
+ 1db0: f1 04 cpc r15, r1
|
|
|
+ 1db2: 41 f5 brne .+80 ; 0x1e04 <main+0x104>
|
|
|
// 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);
|
|
|
- 1dd8: 80 91 00 01 lds r24, 0x0100
|
|
|
- 1ddc: 20 91 01 01 lds r18, 0x0101
|
|
|
- 1de0: 30 e0 ldi r19, 0x00 ; 0
|
|
|
- 1de2: 32 2f mov r19, r18
|
|
|
- 1de4: 22 27 eor r18, r18
|
|
|
- 1de6: 90 e0 ldi r25, 0x00 ; 0
|
|
|
- 1de8: 28 2b or r18, r24
|
|
|
- 1dea: 39 2b or r19, r25
|
|
|
+ 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;
|
|
|
- 1dec: 30 93 85 01 sts 0x0185, r19
|
|
|
- 1df0: 20 93 84 01 sts 0x0184, r18
|
|
|
+ 1dc8: 30 93 85 01 sts 0x0185, r19
|
|
|
+ 1dcc: 20 93 84 01 sts 0x0184, r18
|
|
|
wdtVect = buff[8] | (buff[9]<<8);
|
|
|
- 1df4: 40 91 08 01 lds r20, 0x0108
|
|
|
- 1df8: 80 91 09 01 lds r24, 0x0109
|
|
|
- 1dfc: 90 e0 ldi r25, 0x00 ; 0
|
|
|
- 1dfe: 98 2f mov r25, r24
|
|
|
- 1e00: 88 27 eor r24, r24
|
|
|
- 1e02: 50 e0 ldi r21, 0x00 ; 0
|
|
|
- 1e04: 84 2b or r24, r20
|
|
|
- 1e06: 95 2b or r25, r21
|
|
|
- 1e08: 90 93 87 01 sts 0x0187, r25
|
|
|
- 1e0c: 80 93 86 01 sts 0x0186, r24
|
|
|
+ 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.
|
|
|
- 1e10: 24 50 subi r18, 0x04 ; 4
|
|
|
- 1e12: 30 40 sbci r19, 0x00 ; 0
|
|
|
+ 1dec: 24 50 subi r18, 0x04 ; 4
|
|
|
+ 1dee: 30 40 sbci r19, 0x00 ; 0
|
|
|
buff[8] = vect & 0xff;
|
|
|
- 1e14: 20 93 08 01 sts 0x0108, r18
|
|
|
+ 1df0: 20 93 08 01 sts 0x0108, r18
|
|
|
buff[9] = vect >> 8;
|
|
|
- 1e18: 23 2f mov r18, r19
|
|
|
- 1e1a: 33 27 eor r19, r19
|
|
|
- 1e1c: 20 93 09 01 sts 0x0109, r18
|
|
|
+ 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;
|
|
|
- 1e20: d0 92 00 01 sts 0x0100, r13
|
|
|
+ 1dfc: d0 92 00 01 sts 0x0100, r13
|
|
|
buff[1] = 0xce; // rjmp 0x1d00 instruction
|
|
|
- 1e24: c0 92 01 01 sts 0x0101, r12
|
|
|
- 1e28: 40 e0 ldi r20, 0x00 ; 0
|
|
|
- 1e2a: 50 e0 ldi r21, 0x00 ; 0
|
|
|
- 1e2c: a0 e0 ldi r26, 0x00 ; 0
|
|
|
- 1e2e: b1 e0 ldi r27, 0x01 ; 1
|
|
|
- bufPtr = buff;
|
|
|
- addrPtr = (uint16_t)(void*)address;
|
|
|
- ch = SPM_PAGESIZE / 2;
|
|
|
- do {
|
|
|
- uint16_t a;
|
|
|
- a = *bufPtr++;
|
|
|
- 1e30: 2c 91 ld r18, X
|
|
|
- 1e32: 30 e0 ldi r19, 0x00 ; 0
|
|
|
- a |= (*bufPtr++) << 8;
|
|
|
- 1e34: 11 96 adiw r26, 0x01 ; 1
|
|
|
- 1e36: 8c 91 ld r24, X
|
|
|
- 1e38: 11 97 sbiw r26, 0x01 ; 1
|
|
|
- 1e3a: 90 e0 ldi r25, 0x00 ; 0
|
|
|
- 1e3c: 98 2f mov r25, r24
|
|
|
- 1e3e: 88 27 eor r24, r24
|
|
|
- 1e40: 82 2b or r24, r18
|
|
|
- 1e42: 93 2b or r25, r19
|
|
|
-# define UART_SRL UBRR3L
|
|
|
-# define UART_UDR UDR3
|
|
|
+ 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 <main+0x10a>
|
|
|
+ 1e08: ff cf rjmp .-2 ; 0x1e08 <main+0x108>
|
|
|
+ * 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 <main+0x110>
|
|
|
+ 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) {
|
|
|
- 1e44: 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);
|
|
|
- 1e46: fa 01 movw r30, r20
|
|
|
- 1e48: 0c 01 movw r0, r24
|
|
|
- 1e4a: b7 be out 0x37, r11 ; 55
|
|
|
- 1e4c: e8 95 spm
|
|
|
- 1e4e: 11 24 eor r1, r1
|
|
|
- addrPtr += 2;
|
|
|
- 1e50: 4e 5f subi r20, 0xFE ; 254
|
|
|
- 1e52: 5f 4f sbci r21, 0xFF ; 255
|
|
|
- } while (--ch);
|
|
|
- 1e54: f1 e0 ldi r31, 0x01 ; 1
|
|
|
- 1e56: a0 34 cpi r26, 0x40 ; 64
|
|
|
- 1e58: bf 07 cpc r27, r31
|
|
|
- 1e5a: 51 f7 brne .-44 ; 0x1e30 <main+0x130>
|
|
|
-
|
|
|
- // Write from programming buffer
|
|
|
- __boot_page_write_short((uint16_t)(void*)address);
|
|
|
- 1e5c: f7 01 movw r30, r14
|
|
|
- 1e5e: a7 be out 0x37, r10 ; 55
|
|
|
- 1e60: e8 95 spm
|
|
|
- boot_spm_busy_wait();
|
|
|
- 1e62: 07 b6 in r0, 0x37 ; 55
|
|
|
- 1e64: 00 fc sbrc r0, 0
|
|
|
- 1e66: fd cf rjmp .-6 ; 0x1e62 <main+0x162>
|
|
|
- 1e68: 3b c0 rjmp .+118 ; 0x1ee0 <main+0x1e0>
|
|
|
- boot_rww_enable();
|
|
|
-#endif
|
|
|
+ 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 <main+0x11c>
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 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 <main+0x14a>
|
|
|
+ 1e50: 34 c0 rjmp .+104 ; 0x1eba <main+0x1ba>
|
|
|
+ writebuffer(desttype, buff, address, savelength);
|
|
|
+
|
|
|
|
|
|
}
|
|
|
/* Read memory block mode, length is big endian. */
|
|
|
else if(ch == STK_READ_PAGE) {
|
|
|
- 1e6a: 84 37 cpi r24, 0x74 ; 116
|
|
|
- 1e6c: 59 f5 brne .+86 ; 0x1ec4 <main+0x1c4>
|
|
|
- // READ PAGE - we only read flash
|
|
|
- getch(); /* getlen() */
|
|
|
- 1e6e: 4a d0 rcall .+148 ; 0x1f04 <getch>
|
|
|
- length = getch();
|
|
|
- 1e70: 49 d0 rcall .+146 ; 0x1f04 <getch>
|
|
|
- 1e72: 18 2f mov r17, r24
|
|
|
- getch();
|
|
|
- 1e74: 47 d0 rcall .+142 ; 0x1f04 <getch>
|
|
|
+ 1e52: 84 37 cpi r24, 0x74 ; 116
|
|
|
+ 1e54: 21 f5 brne .+72 ; 0x1e9e <main+0x19e>
|
|
|
+ uint8_t desttype;
|
|
|
+ GETLENGTH(length);
|
|
|
+ 1e56: 43 d0 rcall .+134 ; 0x1ede <getch>
|
|
|
+ 1e58: 42 d0 rcall .+132 ; 0x1ede <getch>
|
|
|
+ 1e5a: 08 2f mov r16, r24
|
|
|
+
|
|
|
+ desttype = getch();
|
|
|
+ 1e5c: 40 d0 rcall .+128 ; 0x1ede <getch>
|
|
|
|
|
|
verifySpace();
|
|
|
- 1e76: 5d d0 rcall .+186 ; 0x1f32 <verifySpace>
|
|
|
- 1e78: e7 01 movw r28, r14
|
|
|
- 1e7a: 01 2f mov r16, r17
|
|
|
- do {
|
|
|
+ 1e5e: 56 d0 rcall .+172 ; 0x1f0c <verifySpace>
|
|
|
+ 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;
|
|
|
- 1e7c: 20 97 sbiw r28, 0x00 ; 0
|
|
|
- 1e7e: 19 f4 brne .+6 ; 0x1e86 <main+0x186>
|
|
|
- 1e80: 80 91 84 01 lds r24, 0x0184
|
|
|
- 1e84: 14 c0 rjmp .+40 ; 0x1eae <main+0x1ae>
|
|
|
- else if (address == 1) ch=rstVect >> 8;
|
|
|
- 1e86: c1 30 cpi r28, 0x01 ; 1
|
|
|
- 1e88: d1 05 cpc r29, r1
|
|
|
- 1e8a: 19 f4 brne .+6 ; 0x1e92 <main+0x192>
|
|
|
- 1e8c: 80 91 85 01 lds r24, 0x0185
|
|
|
- 1e90: 0e c0 rjmp .+28 ; 0x1eae <main+0x1ae>
|
|
|
- else if (address == 8) ch=wdtVect & 0xff;
|
|
|
- 1e92: c8 30 cpi r28, 0x08 ; 8
|
|
|
- 1e94: d1 05 cpc r29, r1
|
|
|
- 1e96: 19 f4 brne .+6 ; 0x1e9e <main+0x19e>
|
|
|
- 1e98: 80 91 86 01 lds r24, 0x0186
|
|
|
- 1e9c: 08 c0 rjmp .+16 ; 0x1eae <main+0x1ae>
|
|
|
- else if (address == 9) ch=wdtVect >> 8;
|
|
|
- 1e9e: c9 30 cpi r28, 0x09 ; 9
|
|
|
- 1ea0: d1 05 cpc r29, r1
|
|
|
- 1ea2: 19 f4 brne .+6 ; 0x1eaa <main+0x1aa>
|
|
|
- 1ea4: 80 91 87 01 lds r24, 0x0187
|
|
|
- 1ea8: 02 c0 rjmp .+4 ; 0x1eae <main+0x1ae>
|
|
|
- else ch = pgm_read_byte_near(address);
|
|
|
- 1eaa: fe 01 movw r30, r28
|
|
|
- 1eac: 84 91 lpm r24, Z+
|
|
|
- address++;
|
|
|
- 1eae: 21 96 adiw r28, 0x01 ; 1
|
|
|
- __asm__ ("elpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address));
|
|
|
+ if (address == 0) ch=rstVect & 0xff;
|
|
|
+ 1e62: 20 97 sbiw r28, 0x00 ; 0
|
|
|
+ 1e64: 19 f4 brne .+6 ; 0x1e6c <main+0x16c>
|
|
|
+ 1e66: 80 91 84 01 lds r24, 0x0184
|
|
|
+ 1e6a: 14 c0 rjmp .+40 ; 0x1e94 <main+0x194>
|
|
|
+ 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 <main+0x178>
|
|
|
+ 1e72: 80 91 85 01 lds r24, 0x0185
|
|
|
+ 1e76: 0e c0 rjmp .+28 ; 0x1e94 <main+0x194>
|
|
|
+ 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 <main+0x184>
|
|
|
+ 1e7e: 80 91 86 01 lds r24, 0x0186
|
|
|
+ 1e82: 08 c0 rjmp .+16 ; 0x1e94 <main+0x194>
|
|
|
+ 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 <main+0x190>
|
|
|
+ 1e8a: 80 91 87 01 lds r24, 0x0187
|
|
|
+ 1e8e: 02 c0 rjmp .+4 ; 0x1e94 <main+0x194>
|
|
|
+ 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));
|
|
|
+ // read a Flash byte and increment the address
|
|
|
+ __asm__ ("lpm %0,Z+\n" : "=r" (ch), "=z" (address): "1" (address));
|
|
|
#endif
|
|
|
- putch(ch);
|
|
|
- 1eb0: 1a d0 rcall .+52 ; 0x1ee6 <putch>
|
|
|
- } while (--length);
|
|
|
- 1eb2: 01 50 subi r16, 0x01 ; 1
|
|
|
- 1eb4: 19 f7 brne .-58 ; 0x1e7c <main+0x17c>
|
|
|
-# define UART_SRL UBRR3L
|
|
|
-# define UART_UDR UDR3
|
|
|
-#endif
|
|
|
-
|
|
|
-/* main program starts here */
|
|
|
-int main(void) {
|
|
|
- 1eb6: 08 94 sec
|
|
|
- 1eb8: e1 1c adc r14, r1
|
|
|
- 1eba: f1 1c adc r15, r1
|
|
|
- 1ebc: 11 50 subi r17, 0x01 ; 1
|
|
|
- 1ebe: e1 0e add r14, r17
|
|
|
- 1ec0: f1 1c adc r15, r1
|
|
|
- 1ec2: 0e c0 rjmp .+28 ; 0x1ee0 <main+0x1e0>
|
|
|
- putch(ch);
|
|
|
- } while (--length);
|
|
|
+ putch(ch);
|
|
|
+ 1e94: 15 d0 rcall .+42 ; 0x1ec0 <putch>
|
|
|
+ } while (--length);
|
|
|
+ 1e96: 01 50 subi r16, 0x01 ; 1
|
|
|
+ 1e98: 81 f0 breq .+32 ; 0x1eba <main+0x1ba>
|
|
|
+ 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 <main+0x162>
|
|
|
+
|
|
|
+ read_mem(desttype, address, length);
|
|
|
}
|
|
|
|
|
|
/* Get device signature bytes */
|
|
|
else if(ch == STK_READ_SIGN) {
|
|
|
- 1ec4: 85 37 cpi r24, 0x75 ; 117
|
|
|
- 1ec6: 39 f4 brne .+14 ; 0x1ed6 <main+0x1d6>
|
|
|
+ 1e9e: 85 37 cpi r24, 0x75 ; 117
|
|
|
+ 1ea0: 39 f4 brne .+14 ; 0x1eb0 <main+0x1b0>
|
|
|
// READ SIGN - return what Avrdude wants to hear
|
|
|
verifySpace();
|
|
|
- 1ec8: 34 d0 rcall .+104 ; 0x1f32 <verifySpace>
|
|
|
+ 1ea2: 34 d0 rcall .+104 ; 0x1f0c <verifySpace>
|
|
|
putch(SIGNATURE_0);
|
|
|
- 1eca: 8e e1 ldi r24, 0x1E ; 30
|
|
|
- 1ecc: 0c d0 rcall .+24 ; 0x1ee6 <putch>
|
|
|
+ 1ea4: 8e e1 ldi r24, 0x1E ; 30
|
|
|
+ 1ea6: 0c d0 rcall .+24 ; 0x1ec0 <putch>
|
|
|
putch(SIGNATURE_1);
|
|
|
- 1ece: 83 e9 ldi r24, 0x93 ; 147
|
|
|
- 1ed0: 0a d0 rcall .+20 ; 0x1ee6 <putch>
|
|
|
+ 1ea8: 83 e9 ldi r24, 0x93 ; 147
|
|
|
+ 1eaa: 0a d0 rcall .+20 ; 0x1ec0 <putch>
|
|
|
putch(SIGNATURE_2);
|
|
|
- 1ed2: 8c e0 ldi r24, 0x0C ; 12
|
|
|
- 1ed4: 46 cf rjmp .-372 ; 0x1d62 <main+0x62>
|
|
|
+ 1eac: 8c e0 ldi r24, 0x0C ; 12
|
|
|
+ 1eae: 4e cf rjmp .-356 ; 0x1d4c <main+0x4c>
|
|
|
}
|
|
|
else if (ch == STK_LEAVE_PROGMODE) { /* 'Q' */
|
|
|
- 1ed6: 81 35 cpi r24, 0x51 ; 81
|
|
|
- 1ed8: 11 f4 brne .+4 ; 0x1ede <main+0x1de>
|
|
|
+ 1eb0: 81 35 cpi r24, 0x51 ; 81
|
|
|
+ 1eb2: 11 f4 brne .+4 ; 0x1eb8 <main+0x1b8>
|
|
|
// Adaboot no-wait mod
|
|
|
watchdogConfig(WATCHDOG_16MS);
|
|
|
- 1eda: 88 e0 ldi r24, 0x08 ; 8
|
|
|
- 1edc: 26 d0 rcall .+76 ; 0x1f2a <watchdogConfig>
|
|
|
+ 1eb4: 88 e0 ldi r24, 0x08 ; 8
|
|
|
+ 1eb6: 26 d0 rcall .+76 ; 0x1f04 <watchdogConfig>
|
|
|
verifySpace();
|
|
|
}
|
|
|
else {
|
|
|
// This covers the response to commands like STK_ENTER_PROGMODE
|
|
|
verifySpace();
|
|
|
- 1ede: 29 d0 rcall .+82 ; 0x1f32 <verifySpace>
|
|
|
+ 1eb8: 29 d0 rcall .+82 ; 0x1f0c <verifySpace>
|
|
|
}
|
|
|
putch(STK_OK);
|
|
|
- 1ee0: 80 e1 ldi r24, 0x10 ; 16
|
|
|
- 1ee2: 01 d0 rcall .+2 ; 0x1ee6 <putch>
|
|
|
- 1ee4: 31 cf rjmp .-414 ; 0x1d48 <main+0x48>
|
|
|
+ 1eba: 80 e1 ldi r24, 0x10 ; 16
|
|
|
+ 1ebc: 01 d0 rcall .+2 ; 0x1ec0 <putch>
|
|
|
+ 1ebe: 37 cf rjmp .-402 ; 0x1d2e <main+0x2e>
|
|
|
|
|
|
-00001ee6 <putch>:
|
|
|
+00001ec0 <putch>:
|
|
|
void putch(char ch) {
|
|
|
#ifndef SOFT_UART
|
|
|
while (!(UART_SRA & _BV(UDRE0)));
|
|
|
UART_UDR = ch;
|
|
|
#else
|
|
|
__asm__ __volatile__ (
|
|
|
- 1ee6: 2a e0 ldi r18, 0x0A ; 10
|
|
|
- 1ee8: 30 e0 ldi r19, 0x00 ; 0
|
|
|
- 1eea: 80 95 com r24
|
|
|
- 1eec: 08 94 sec
|
|
|
- 1eee: 10 f4 brcc .+4 ; 0x1ef4 <putch+0xe>
|
|
|
- 1ef0: da 98 cbi 0x1b, 2 ; 27
|
|
|
- 1ef2: 02 c0 rjmp .+4 ; 0x1ef8 <putch+0x12>
|
|
|
- 1ef4: da 9a sbi 0x1b, 2 ; 27
|
|
|
- 1ef6: 00 00 nop
|
|
|
- 1ef8: 14 d0 rcall .+40 ; 0x1f22 <uartDelay>
|
|
|
- 1efa: 13 d0 rcall .+38 ; 0x1f22 <uartDelay>
|
|
|
- 1efc: 86 95 lsr r24
|
|
|
- 1efe: 2a 95 dec r18
|
|
|
- 1f00: b1 f7 brne .-20 ; 0x1eee <putch+0x8>
|
|
|
+ 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 <putch+0xe>
|
|
|
+ 1eca: da 98 cbi 0x1b, 2 ; 27
|
|
|
+ 1ecc: 02 c0 rjmp .+4 ; 0x1ed2 <putch+0x12>
|
|
|
+ 1ece: da 9a sbi 0x1b, 2 ; 27
|
|
|
+ 1ed0: 00 00 nop
|
|
|
+ 1ed2: 14 d0 rcall .+40 ; 0x1efc <uartDelay>
|
|
|
+ 1ed4: 13 d0 rcall .+38 ; 0x1efc <uartDelay>
|
|
|
+ 1ed6: 86 95 lsr r24
|
|
|
+ 1ed8: 2a 95 dec r18
|
|
|
+ 1eda: b1 f7 brne .-20 ; 0x1ec8 <putch+0x8>
|
|
|
[uartBit] "I" (UART_TX_BIT)
|
|
|
:
|
|
|
"r25"
|
|
|
);
|
|
|
#endif
|
|
|
}
|
|
|
- 1f02: 08 95 ret
|
|
|
+ 1edc: 08 95 ret
|
|
|
|
|
|
-00001f04 <getch>:
|
|
|
+00001ede <getch>:
|
|
|
LED_PIN |= _BV(LED);
|
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
return ch;
|
|
|
}
|
|
|
- 1f04: 29 e0 ldi r18, 0x09 ; 9
|
|
|
- 1f06: 30 e0 ldi r19, 0x00 ; 0
|
|
|
- 1f08: cb 99 sbic 0x19, 3 ; 25
|
|
|
- 1f0a: fe cf rjmp .-4 ; 0x1f08 <getch+0x4>
|
|
|
- 1f0c: 0a d0 rcall .+20 ; 0x1f22 <uartDelay>
|
|
|
- 1f0e: 09 d0 rcall .+18 ; 0x1f22 <uartDelay>
|
|
|
- 1f10: 08 d0 rcall .+16 ; 0x1f22 <uartDelay>
|
|
|
- 1f12: 88 94 clc
|
|
|
- 1f14: cb 99 sbic 0x19, 3 ; 25
|
|
|
- 1f16: 08 94 sec
|
|
|
- 1f18: 2a 95 dec r18
|
|
|
- 1f1a: 11 f0 breq .+4 ; 0x1f20 <getch+0x1c>
|
|
|
- 1f1c: 87 95 ror r24
|
|
|
- 1f1e: f7 cf rjmp .-18 ; 0x1f0e <getch+0xa>
|
|
|
- 1f20: 08 95 ret
|
|
|
-
|
|
|
-00001f22 <uartDelay>:
|
|
|
+ 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 <getch+0x4>
|
|
|
+ 1ee6: 0a d0 rcall .+20 ; 0x1efc <uartDelay>
|
|
|
+ 1ee8: 09 d0 rcall .+18 ; 0x1efc <uartDelay>
|
|
|
+ 1eea: 08 d0 rcall .+16 ; 0x1efc <uartDelay>
|
|
|
+ 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 <getch+0x1c>
|
|
|
+ 1ef6: 87 95 ror r24
|
|
|
+ 1ef8: f7 cf rjmp .-18 ; 0x1ee8 <getch+0xa>
|
|
|
+ 1efa: 08 95 ret
|
|
|
+
|
|
|
+00001efc <uartDelay>:
|
|
|
#if UART_B_VALUE > 255
|
|
|
#error Baud rate too slow for soft UART
|
|
|
#endif
|
|
|
|
|
|
void uartDelay() {
|
|
|
__asm__ __volatile__ (
|
|
|
- 1f22: 9e e0 ldi r25, 0x0E ; 14
|
|
|
- 1f24: 9a 95 dec r25
|
|
|
- 1f26: f1 f7 brne .-4 ; 0x1f24 <uartDelay+0x2>
|
|
|
- 1f28: 08 95 ret
|
|
|
+ 1efc: 9e e0 ldi r25, 0x0E ; 14
|
|
|
+ 1efe: 9a 95 dec r25
|
|
|
+ 1f00: f1 f7 brne .-4 ; 0x1efe <uartDelay+0x2>
|
|
|
+ 1f02: 08 95 ret
|
|
|
|
|
|
-00001f2a <watchdogConfig>:
|
|
|
+00001f04 <watchdogConfig>:
|
|
|
"wdr\n"
|
|
|
);
|
|
|
}
|
|
|
|
|
|
void watchdogConfig(uint8_t x) {
|
|
|
WDTCSR = _BV(WDCE) | _BV(WDE);
|
|
|
- 1f2a: 98 e1 ldi r25, 0x18 ; 24
|
|
|
- 1f2c: 91 bd out 0x21, r25 ; 33
|
|
|
+ 1f04: 98 e1 ldi r25, 0x18 ; 24
|
|
|
+ 1f06: 91 bd out 0x21, r25 ; 33
|
|
|
WDTCSR = x;
|
|
|
- 1f2e: 81 bd out 0x21, r24 ; 33
|
|
|
+ 1f08: 81 bd out 0x21, r24 ; 33
|
|
|
}
|
|
|
- 1f30: 08 95 ret
|
|
|
+ 1f0a: 08 95 ret
|
|
|
|
|
|
-00001f32 <verifySpace>:
|
|
|
+00001f0c <verifySpace>:
|
|
|
do getch(); while (--count);
|
|
|
verifySpace();
|
|
|
}
|
|
|
|
|
|
void verifySpace() {
|
|
|
if (getch() != CRC_EOP) {
|
|
|
- 1f32: e8 df rcall .-48 ; 0x1f04 <getch>
|
|
|
- 1f34: 80 32 cpi r24, 0x20 ; 32
|
|
|
- 1f36: 19 f0 breq .+6 ; 0x1f3e <verifySpace+0xc>
|
|
|
+ 1f0c: e8 df rcall .-48 ; 0x1ede <getch>
|
|
|
+ 1f0e: 80 32 cpi r24, 0x20 ; 32
|
|
|
+ 1f10: 19 f0 breq .+6 ; 0x1f18 <verifySpace+0xc>
|
|
|
watchdogConfig(WATCHDOG_16MS); // shorten WD timeout
|
|
|
- 1f38: 88 e0 ldi r24, 0x08 ; 8
|
|
|
- 1f3a: f7 df rcall .-18 ; 0x1f2a <watchdogConfig>
|
|
|
- 1f3c: ff cf rjmp .-2 ; 0x1f3c <verifySpace+0xa>
|
|
|
+ 1f12: 88 e0 ldi r24, 0x08 ; 8
|
|
|
+ 1f14: f7 df rcall .-18 ; 0x1f04 <watchdogConfig>
|
|
|
+ 1f16: ff cf rjmp .-2 ; 0x1f16 <verifySpace+0xa>
|
|
|
while (1) // and busy-loop so that WD causes
|
|
|
; // a reset and app start.
|
|
|
}
|
|
|
putch(STK_INSYNC);
|
|
|
- 1f3e: 84 e1 ldi r24, 0x14 ; 20
|
|
|
+ 1f18: 84 e1 ldi r24, 0x14 ; 20
|
|
|
}
|
|
|
- 1f40: d2 cf rjmp .-92 ; 0x1ee6 <putch>
|
|
|
-
|
|
|
-00001f42 <getNch>:
|
|
|
+ 1f1a: d2 cf rjmp .-92 ; 0x1ec0 <putch>
|
|
|
::[count] "M" (UART_B_VALUE)
|
|
|
);
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
void getNch(uint8_t count) {
|
|
|
- 1f42: 1f 93 push r17
|
|
|
- 1f44: 18 2f mov r17, r24
|
|
|
+ 1f1c: 1f 93 push r17
|
|
|
+
|
|
|
+00001f1e <getNch>:
|
|
|
+ 1f1e: 18 2f mov r17, r24
|
|
|
do getch(); while (--count);
|
|
|
- 1f46: de df rcall .-68 ; 0x1f04 <getch>
|
|
|
- 1f48: 11 50 subi r17, 0x01 ; 1
|
|
|
- 1f4a: e9 f7 brne .-6 ; 0x1f46 <getNch+0x4>
|
|
|
+ 1f20: de df rcall .-68 ; 0x1ede <getch>
|
|
|
+ 1f22: 11 50 subi r17, 0x01 ; 1
|
|
|
+ 1f24: e9 f7 brne .-6 ; 0x1f20 <getNch+0x2>
|
|
|
verifySpace();
|
|
|
- 1f4c: f2 df rcall .-28 ; 0x1f32 <verifySpace>
|
|
|
+ 1f26: f2 df rcall .-28 ; 0x1f0c <verifySpace>
|
|
|
}
|
|
|
- 1f4e: 1f 91 pop r17
|
|
|
- 1f50: 08 95 ret
|
|
|
+ 1f28: 1f 91 pop r17
|
|
|
+ 1f2a: 08 95 ret
|
|
|
|
|
|
-00001f52 <appStart>:
|
|
|
+00001f2c <appStart>:
|
|
|
|
|
|
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));
|
|
|
- 1f52: 28 2e mov r2, r24
|
|
|
+ 1f2c: 28 2e mov r2, r24
|
|
|
|
|
|
watchdogConfig(WATCHDOG_OFF);
|
|
|
- 1f54: 80 e0 ldi r24, 0x00 ; 0
|
|
|
- 1f56: e9 df rcall .-46 ; 0x1f2a <watchdogConfig>
|
|
|
+ 1f2e: 80 e0 ldi r24, 0x00 ; 0
|
|
|
+ 1f30: e9 df rcall .-46 ; 0x1f04 <watchdogConfig>
|
|
|
__asm__ __volatile__ (
|
|
|
- 1f58: e4 e0 ldi r30, 0x04 ; 4
|
|
|
- 1f5a: ff 27 eor r31, r31
|
|
|
- 1f5c: 09 94 ijmp
|
|
|
+ 1f32: e4 e0 ldi r30, 0x04 ; 4
|
|
|
+ 1f34: ff 27 eor r31, r31
|
|
|
+ 1f36: 09 94 ijmp
|