You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1642 lines
58 KiB

11 months ago
stk500boot_v2_mega2560.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .data 00000004 00800200 0003e77a 0000084e 2**0
CONTENTS, ALLOC, LOAD, DATA
1 .text 0000077a 0003e000 0003e000 000000d4 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
2 .bss 00000002 00800204 00800204 00000852 2**0
ALLOC
3 .fuse 00000003 00820000 00820000 00000852 2**0
CONTENTS, ALLOC, LOAD, DATA
4 .lock 00000001 00830000 00830000 00000855 2**0
CONTENTS, ALLOC, LOAD, DATA
5 .comment 00000030 00000000 00000000 00000856 2**0
CONTENTS, READONLY
6 .note.gnu.avr.deviceinfo 00000040 00000000 00000000 00000888 2**2
CONTENTS, READONLY
7 .debug_aranges 00000058 00000000 00000000 000008c8 2**3
CONTENTS, READONLY, DEBUGGING
8 .debug_info 00001367 00000000 00000000 00000920 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_abbrev 00000dac 00000000 00000000 00001c87 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_line 00000988 00000000 00000000 00002a33 2**0
CONTENTS, READONLY, DEBUGGING
11 .debug_frame 00000068 00000000 00000000 000033bc 2**2
CONTENTS, READONLY, DEBUGGING
12 .debug_str 000006f2 00000000 00000000 00003424 2**0
CONTENTS, READONLY, DEBUGGING
13 .debug_loc 00000aa4 00000000 00000000 00003b16 2**0
CONTENTS, READONLY, DEBUGGING
14 .debug_ranges 00000058 00000000 00000000 000045ba 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
0003e000 <__vectors>:
3e000: 95 c0 rjmp .+298 ; 0x3e12c <__ctors_end>
3e002: 00 00 nop
3e004: b9 c0 rjmp .+370 ; 0x3e178 <__bad_interrupt>
3e006: 00 00 nop
3e008: b7 c0 rjmp .+366 ; 0x3e178 <__bad_interrupt>
3e00a: 00 00 nop
3e00c: b5 c0 rjmp .+362 ; 0x3e178 <__bad_interrupt>
3e00e: 00 00 nop
3e010: b3 c0 rjmp .+358 ; 0x3e178 <__bad_interrupt>
3e012: 00 00 nop
3e014: b1 c0 rjmp .+354 ; 0x3e178 <__bad_interrupt>
3e016: 00 00 nop
3e018: af c0 rjmp .+350 ; 0x3e178 <__bad_interrupt>
3e01a: 00 00 nop
3e01c: ad c0 rjmp .+346 ; 0x3e178 <__bad_interrupt>
3e01e: 00 00 nop
3e020: ab c0 rjmp .+342 ; 0x3e178 <__bad_interrupt>
3e022: 00 00 nop
3e024: a9 c0 rjmp .+338 ; 0x3e178 <__bad_interrupt>
3e026: 00 00 nop
3e028: a7 c0 rjmp .+334 ; 0x3e178 <__bad_interrupt>
3e02a: 00 00 nop
3e02c: a5 c0 rjmp .+330 ; 0x3e178 <__bad_interrupt>
3e02e: 00 00 nop
3e030: a3 c0 rjmp .+326 ; 0x3e178 <__bad_interrupt>
3e032: 00 00 nop
3e034: a1 c0 rjmp .+322 ; 0x3e178 <__bad_interrupt>
3e036: 00 00 nop
3e038: 9f c0 rjmp .+318 ; 0x3e178 <__bad_interrupt>
3e03a: 00 00 nop
3e03c: 9d c0 rjmp .+314 ; 0x3e178 <__bad_interrupt>
3e03e: 00 00 nop
3e040: 9b c0 rjmp .+310 ; 0x3e178 <__bad_interrupt>
3e042: 00 00 nop
3e044: 99 c0 rjmp .+306 ; 0x3e178 <__bad_interrupt>
3e046: 00 00 nop
3e048: 97 c0 rjmp .+302 ; 0x3e178 <__bad_interrupt>
3e04a: 00 00 nop
3e04c: 95 c0 rjmp .+298 ; 0x3e178 <__bad_interrupt>
3e04e: 00 00 nop
3e050: 93 c0 rjmp .+294 ; 0x3e178 <__bad_interrupt>
3e052: 00 00 nop
3e054: 91 c0 rjmp .+290 ; 0x3e178 <__bad_interrupt>
3e056: 00 00 nop
3e058: 8f c0 rjmp .+286 ; 0x3e178 <__bad_interrupt>
3e05a: 00 00 nop
3e05c: 8d c0 rjmp .+282 ; 0x3e178 <__bad_interrupt>
3e05e: 00 00 nop
3e060: 8b c0 rjmp .+278 ; 0x3e178 <__bad_interrupt>
3e062: 00 00 nop
3e064: 89 c0 rjmp .+274 ; 0x3e178 <__bad_interrupt>
3e066: 00 00 nop
3e068: 87 c0 rjmp .+270 ; 0x3e178 <__bad_interrupt>
3e06a: 00 00 nop
3e06c: 85 c0 rjmp .+266 ; 0x3e178 <__bad_interrupt>
3e06e: 00 00 nop
3e070: 83 c0 rjmp .+262 ; 0x3e178 <__bad_interrupt>
3e072: 00 00 nop
3e074: 81 c0 rjmp .+258 ; 0x3e178 <__bad_interrupt>
3e076: 00 00 nop
3e078: 7f c0 rjmp .+254 ; 0x3e178 <__bad_interrupt>
3e07a: 00 00 nop
3e07c: 7d c0 rjmp .+250 ; 0x3e178 <__bad_interrupt>
3e07e: 00 00 nop
3e080: 7b c0 rjmp .+246 ; 0x3e178 <__bad_interrupt>
3e082: 00 00 nop
3e084: 79 c0 rjmp .+242 ; 0x3e178 <__bad_interrupt>
3e086: 00 00 nop
3e088: 77 c0 rjmp .+238 ; 0x3e178 <__bad_interrupt>
3e08a: 00 00 nop
3e08c: 75 c0 rjmp .+234 ; 0x3e178 <__bad_interrupt>
3e08e: 00 00 nop
3e090: 73 c0 rjmp .+230 ; 0x3e178 <__bad_interrupt>
3e092: 00 00 nop
3e094: 71 c0 rjmp .+226 ; 0x3e178 <__bad_interrupt>
3e096: 00 00 nop
3e098: 6f c0 rjmp .+222 ; 0x3e178 <__bad_interrupt>
3e09a: 00 00 nop
3e09c: 6d c0 rjmp .+218 ; 0x3e178 <__bad_interrupt>
3e09e: 00 00 nop
3e0a0: 6b c0 rjmp .+214 ; 0x3e178 <__bad_interrupt>
3e0a2: 00 00 nop
3e0a4: 69 c0 rjmp .+210 ; 0x3e178 <__bad_interrupt>
3e0a6: 00 00 nop
3e0a8: 67 c0 rjmp .+206 ; 0x3e178 <__bad_interrupt>
3e0aa: 00 00 nop
3e0ac: 65 c0 rjmp .+202 ; 0x3e178 <__bad_interrupt>
3e0ae: 00 00 nop
3e0b0: 63 c0 rjmp .+198 ; 0x3e178 <__bad_interrupt>
3e0b2: 00 00 nop
3e0b4: 61 c0 rjmp .+194 ; 0x3e178 <__bad_interrupt>
3e0b6: 00 00 nop
3e0b8: 5f c0 rjmp .+190 ; 0x3e178 <__bad_interrupt>
3e0ba: 00 00 nop
3e0bc: 5d c0 rjmp .+186 ; 0x3e178 <__bad_interrupt>
3e0be: 00 00 nop
3e0c0: 5b c0 rjmp .+182 ; 0x3e178 <__bad_interrupt>
3e0c2: 00 00 nop
3e0c4: 59 c0 rjmp .+178 ; 0x3e178 <__bad_interrupt>
3e0c6: 00 00 nop
3e0c8: 57 c0 rjmp .+174 ; 0x3e178 <__bad_interrupt>
3e0ca: 00 00 nop
3e0cc: 55 c0 rjmp .+170 ; 0x3e178 <__bad_interrupt>
3e0ce: 00 00 nop
3e0d0: 53 c0 rjmp .+166 ; 0x3e178 <__bad_interrupt>
3e0d2: 00 00 nop
3e0d4: 51 c0 rjmp .+162 ; 0x3e178 <__bad_interrupt>
3e0d6: 00 00 nop
3e0d8: 4f c0 rjmp .+158 ; 0x3e178 <__bad_interrupt>
3e0da: 00 00 nop
3e0dc: 4d c0 rjmp .+154 ; 0x3e178 <__bad_interrupt>
3e0de: 00 00 nop
3e0e0: 4b c0 rjmp .+150 ; 0x3e178 <__bad_interrupt>
3e0e2: 00 00 nop
3e0e4: 6b f1 brvs .+90 ; 0x3e140 <__do_copy_data+0x4>
3e0e6: 71 f1 breq .+92 ; 0x3e144 <__do_copy_data+0x8>
3e0e8: 79 f1 breq .+94 ; 0x3e148 <__do_copy_data+0xc>
3e0ea: 80 f1 brcs .+96 ; 0x3e14c <__do_copy_data+0x10>
3e0ec: 84 f1 brlt .+96 ; 0x3e14e <__do_copy_data+0x12>
3e0ee: 8c f1 brlt .+98 ; 0x3e152 <__do_copy_data+0x16>
3e0f0: 9d f1 brhs .+102 ; 0x3e158 <__do_clear_bss+0x2>
3e0f2: dd f1 brhs .+118 ; 0x3e16a <__jumpMain>
3e0f4: b0 f1 brcs .+108 ; 0x3e162 <.do_clear_bss_start+0x2>
3e0f6: f4 f1 brlt .+124 ; 0x3e174 <__jumpMain+0xa>
3e0f8: 1e f3 brts .-58 ; 0x3e0c0 <__vectors+0xc0>
3e0fa: 1e f3 brts .-58 ; 0x3e0c2 <__vectors+0xc2>
3e0fc: 3e f2 brts .-114 ; 0x3e08c <__vectors+0x8c>
3e0fe: 1e f3 brts .-58 ; 0x3e0c6 <__vectors+0xc6>
3e100: 1e f3 brts .-58 ; 0x3e0c8 <__vectors+0xc8>
3e102: 1e f3 brts .-58 ; 0x3e0ca <__vectors+0xca>
3e104: 1e f3 brts .-58 ; 0x3e0cc <__vectors+0xcc>
3e106: 1e f3 brts .-58 ; 0x3e0ce <__vectors+0xce>
3e108: 1e f3 brts .-58 ; 0x3e0d0 <__vectors+0xd0>
3e10a: 1e f3 brts .-58 ; 0x3e0d2 <__vectors+0xd2>
3e10c: 1e f3 brts .-58 ; 0x3e0d4 <__vectors+0xd4>
3e10e: 1e f3 brts .-58 ; 0x3e0d6 <__vectors+0xd6>
3e110: b0 f1 brcs .+108 ; 0x3e17e <sendchar+0x4>
3e112: 04 f2 brlt .-128 ; 0x3e094 <__vectors+0x94>
3e114: 35 f2 brhs .-116 ; 0x3e0a2 <__vectors+0xa2>
3e116: 4b f2 brvs .-110 ; 0x3e0aa <__vectors+0xaa>
3e118: c5 f2 brhs .-80 ; 0x3e0ca <__vectors+0xca>
3e11a: 4b f2 brvs .-110 ; 0x3e0ae <__vectors+0xae>
3e11c: c5 f2 brhs .-80 ; 0x3e0ce <__vectors+0xce>
3e11e: 1e f3 brts .-58 ; 0x3e0e6 <__vectors+0xe6>
3e120: 20 f2 brcs .-120 ; 0x3e0aa <__vectors+0xaa>
3e122: 1e f3 brts .-58 ; 0x3e0ea <__vectors+0xea>
3e124: 13 f2 brvs .-124 ; 0x3e0aa <__vectors+0xaa>
3e126: 08 f2 brcs .-126 ; 0x3e0aa <__vectors+0xaa>
3e128: 1e f3 brts .-58 ; 0x3e0f0 <__vectors+0xf0>
3e12a: b2 f1 brmi .+108 ; 0x3e198 <main+0x6>
0003e12c <__ctors_end>:
3e12c: 11 24 eor r1, r1
3e12e: 1f be out 0x3f, r1 ; 63
3e130: cf ef ldi r28, 0xFF ; 255
3e132: d1 e2 ldi r29, 0x21 ; 33
3e134: de bf out 0x3e, r29 ; 62
3e136: cd bf out 0x3d, r28 ; 61
3e138: 01 e0 ldi r16, 0x01 ; 1
3e13a: 0c bf out 0x3c, r16 ; 60
0003e13c <__do_copy_data>:
3e13c: 12 e0 ldi r17, 0x02 ; 2
3e13e: a0 e0 ldi r26, 0x00 ; 0
3e140: b2 e0 ldi r27, 0x02 ; 2
3e142: ea e7 ldi r30, 0x7A ; 122
3e144: f7 ee ldi r31, 0xE7 ; 231
3e146: 03 e0 ldi r16, 0x03 ; 3
3e148: 0b bf out 0x3b, r16 ; 59
3e14a: 02 c0 rjmp .+4 ; 0x3e150 <__do_copy_data+0x14>
3e14c: 07 90 elpm r0, Z+
3e14e: 0d 92 st X+, r0
3e150: a4 30 cpi r26, 0x04 ; 4
3e152: b1 07 cpc r27, r17
3e154: d9 f7 brne .-10 ; 0x3e14c <__do_copy_data+0x10>
0003e156 <__do_clear_bss>:
3e156: 22 e0 ldi r18, 0x02 ; 2
3e158: a4 e0 ldi r26, 0x04 ; 4
3e15a: b2 e0 ldi r27, 0x02 ; 2
3e15c: 01 c0 rjmp .+2 ; 0x3e160 <.do_clear_bss_start>
0003e15e <.do_clear_bss_loop>:
3e15e: 1d 92 st X+, r1
0003e160 <.do_clear_bss_start>:
3e160: a6 30 cpi r26, 0x06 ; 6
3e162: b2 07 cpc r27, r18
3e164: e1 f7 brne .-8 ; 0x3e15e <.do_clear_bss_loop>
3e166: 15 d0 rcall .+42 ; 0x3e192 <main>
3e168: 06 c3 rjmp .+1548 ; 0x3e776 <_exit>
0003e16a <__jumpMain>:
3e16a: 01 e2 ldi r16, 0x21 ; 33
unsigned int i;
for (i=0;i<timedelay;i++)
{
_delay_ms(0.5);
}
}
3e16c: 0e bf out 0x3e, r16 ; 62
3e16e: 0f ef ldi r16, 0xFF ; 255
3e170: 0d bf out 0x3d, r16 ; 61
3e172: 11 24 eor r1, r1
3e174: 1f be out 0x3f, r1 ; 63
3e176: 0d c0 rjmp .+26 ; 0x3e192 <main>
0003e178 <__bad_interrupt>:
3e178: 43 cf rjmp .-378 ; 0x3e000 <__vectors>
0003e17a <sendchar>:
3e17a: 80 93 c6 00 sts 0x00C6, r24 ; 0x8000c6 <__TEXT_REGION_LENGTH__+0x7c00c6>
3e17e: 80 91 c0 00 lds r24, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7c00c0>
3e182: 86 ff sbrs r24, 6
3e184: fc cf rjmp .-8 ; 0x3e17e <sendchar+0x4>
3e186: 80 91 c0 00 lds r24, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7c00c0>
3e18a: 80 64 ori r24, 0x40 ; 64
3e18c: 80 93 c0 00 sts 0x00C0, r24 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7c00c0>
3e190: 08 95 ret
0003e192 <main>:
void (*app_start)(void) = 0x0000;
//*****************************************************************************
int main(void)
{
3e192: cf 93 push r28
3e194: df 93 push r29
3e196: cd b7 in r28, 0x3d ; 61
3e198: de b7 in r29, 0x3e ; 62
3e19a: c0 52 subi r28, 0x20 ; 32
3e19c: d1 40 sbci r29, 0x01 ; 1
3e19e: 0f b6 in r0, 0x3f ; 63
3e1a0: f8 94 cli
3e1a2: de bf out 0x3e, r29 ; 62
3e1a4: 0f be out 0x3f, r0 ; 63
3e1a6: cd bf out 0x3d, r28 ; 61
unsigned int rcvdCharCntr = 0;
#endif
//* some chips dont set the stack properly
asm volatile ( ".set __stack, %0" :: "i" (RAMEND) );
asm volatile ( "ldi 16, %0" :: "i" (RAMEND >> 8) );
3e1a8: 01 e2 ldi r16, 0x21 ; 33
asm volatile ( "out %0,16" :: "i" (AVR_STACK_POINTER_HI_ADDR) );
3e1aa: 0e bf out 0x3e, r16 ; 62
asm volatile ( "ldi 16, %0" :: "i" (RAMEND & 0x0ff) );
3e1ac: 0f ef ldi r16, 0xFF ; 255
asm volatile ( "out %0,16" :: "i" (AVR_STACK_POINTER_LO_ADDR) );
3e1ae: 0d bf out 0x3d, r16 ; 61
#ifdef _FIX_ISSUE_181_
//************************************************************************
//* Dec 29, 2011 <MLS> Issue #181, added watch dog timmer support
//* handle the watch dog timer
uint8_t mcuStatusReg;
mcuStatusReg = MCUSR;
3e1b0: 94 b7 in r25, 0x34 ; 52
__asm__ __volatile__ ("cli");
3e1b2: f8 94 cli
__asm__ __volatile__ ("wdr");
3e1b4: a8 95 wdr
MCUSR = 0;
3e1b6: 14 be out 0x34, r1 ; 52
WDTCSR |= _BV(WDCE) | _BV(WDE);
3e1b8: 80 91 60 00 lds r24, 0x0060 ; 0x800060 <__TEXT_REGION_LENGTH__+0x7c0060>
3e1bc: 88 61 ori r24, 0x18 ; 24
3e1be: 80 93 60 00 sts 0x0060, r24 ; 0x800060 <__TEXT_REGION_LENGTH__+0x7c0060>
WDTCSR = 0;
3e1c2: 10 92 60 00 sts 0x0060, r1 ; 0x800060 <__TEXT_REGION_LENGTH__+0x7c0060>
__asm__ __volatile__ ("sei");
3e1c6: 78 94 sei
// check if WDT generated the reset, if so, go straight to app
if (mcuStatusReg & _BV(WDRF))
3e1c8: 93 ff sbrs r25, 3
3e1ca: 05 c0 rjmp .+10 ; 0x3e1d6 <main+0x44>
{
app_start();
3e1cc: e0 91 04 02 lds r30, 0x0204 ; 0x800204 <__data_end>
3e1d0: f0 91 05 02 lds r31, 0x0205 ; 0x800205 <__data_end+0x1>
3e1d4: 19 95 eicall
/*
* Init UART
* set baudrate and enable USART receiver and transmiter without interrupts
*/
#if UART_BAUDRATE_DOUBLE_SPEED
UART_STATUS_REG |= (1 <<UART_DOUBLE_SPEED);
3e1d6: 80 91 c0 00 lds r24, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7c00c0>
3e1da: 82 60 ori r24, 0x02 ; 2
3e1dc: 80 93 c0 00 sts 0x00C0, r24 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7c00c0>
#endif
UART_BAUD_RATE_LOW = UART_BAUD_SELECT(BAUDRATE,F_CPU);
3e1e0: 80 e1 ldi r24, 0x10 ; 16
3e1e2: 80 93 c4 00 sts 0x00C4, r24 ; 0x8000c4 <__TEXT_REGION_LENGTH__+0x7c00c4>
UART_CONTROL_REG = (1 << UART_ENABLE_RECEIVER) | (1 << UART_ENABLE_TRANSMITTER);
3e1e6: 88 e1 ldi r24, 0x18 ; 24
3e1e8: 80 93 c1 00 sts 0x00C1, r24 ; 0x8000c1 <__TEXT_REGION_LENGTH__+0x7c00c1>
asm volatile ("nop"); // wait until port has changed
3e1ec: 00 00 nop
3e1ee: 00 e0 ldi r16, 0x00 ; 0
3e1f0: 10 e0 ldi r17, 0x00 ; 0
3e1f2: c1 2c mov r12, r1
3e1f4: d1 2c mov r13, r1
3e1f6: 76 01 movw r14, r12
if (boot_timer > boot_timeout)
{
boot_state = 1; // (after ++ -> boot_state=2 bootloader timeout, jump to main 0x00000 )
}
#ifdef BLINK_LED_WHILE_WAITING
if ((boot_timer % _BLINK_LOOP_COUNT_) == 0)
3e1f8: 97 ec ldi r25, 0xC7 ; 199
3e1fa: 89 2e mov r8, r25
3e1fc: 9b e1 ldi r25, 0x1B ; 27
3e1fe: 99 2e mov r9, r25
3e200: a1 2c mov r10, r1
3e202: b1 2c mov r11, r1
{
//* toggle the LED
PROGLED_PORT ^= (1<<PROGLED_PIN); // turn LED ON
3e204: 24 e0 ldi r18, 0x04 ; 4
3e206: 72 2e mov r7, r18
//************************************************************************
static int Serial_Available(void)
{
return(UART_STATUS_REG & (1 << UART_RECEIVE_COMPLETE)); // wait for data
3e208: 80 91 c0 00 lds r24, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7c00c0>
delay_ms(100);
#endif
while (boot_state==0)
{
while ((!(Serial_Available())) && (boot_state == 0)) // wait for data
3e20c: 87 fd sbrc r24, 7
3e20e: 25 c0 rjmp .+74 ; 0x3e25a <main+0xc8>
3e210: 01 15 cp r16, r1
3e212: 11 05 cpc r17, r1
3e214: 11 f5 brne .+68 ; 0x3e25a <main+0xc8>
#else
//round up by default
__ticks_dc = (uint32_t)(ceil(fabs(__tmp)));
#endif
__builtin_avr_delay_cycles(__ticks_dc);
3e216: 25 e0 ldi r18, 0x05 ; 5
3e218: 2a 95 dec r18
3e21a: f1 f7 brne .-4 ; 0x3e218 <main+0x86>
3e21c: 00 00 nop
{
_delay_ms(0.001);
boot_timer++;
3e21e: 3f ef ldi r19, 0xFF ; 255
3e220: c3 1a sub r12, r19
3e222: d3 0a sbc r13, r19
3e224: e3 0a sbc r14, r19
3e226: f3 0a sbc r15, r19
if (boot_timer > boot_timeout)
{
boot_state = 1; // (after ++ -> boot_state=2 bootloader timeout, jump to main 0x00000 )
3e228: 91 e0 ldi r25, 0x01 ; 1
3e22a: 80 e0 ldi r24, 0x00 ; 0
3e22c: 41 e2 ldi r20, 0x21 ; 33
3e22e: c4 16 cp r12, r20
3e230: 4e e4 ldi r20, 0x4E ; 78
3e232: d4 06 cpc r13, r20
3e234: e1 04 cpc r14, r1
3e236: f1 04 cpc r15, r1
3e238: 08 f4 brcc .+2 ; 0x3e23c <main+0xaa>
3e23a: 90 e0 ldi r25, 0x00 ; 0
3e23c: 09 2f mov r16, r25
3e23e: 18 2f mov r17, r24
}
#ifdef BLINK_LED_WHILE_WAITING
if ((boot_timer % _BLINK_LOOP_COUNT_) == 0)
3e240: c7 01 movw r24, r14
3e242: b6 01 movw r22, r12
3e244: a5 01 movw r20, r10
3e246: 94 01 movw r18, r8
3e248: 57 d2 rcall .+1198 ; 0x3e6f8 <__udivmodsi4>
3e24a: 67 2b or r22, r23
3e24c: 68 2b or r22, r24
3e24e: 69 2b or r22, r25
3e250: d9 f6 brne .-74 ; 0x3e208 <main+0x76>
{
//* toggle the LED
PROGLED_PORT ^= (1<<PROGLED_PIN); // turn LED ON
3e252: 84 b3 in r24, 0x14 ; 20
3e254: 87 25 eor r24, r7
3e256: 84 bb out 0x14, r24 ; 20
3e258: d7 cf rjmp .-82 ; 0x3e208 <main+0x76>
}
#endif
}
boot_state++; // ( if boot_state=1 bootloader received byte from UART, enter bootloader mode)
3e25a: 0f 5f subi r16, 0xFF ; 255
3e25c: 1f 4f sbci r17, 0xFF ; 255
}
if (boot_state==1)
3e25e: 01 30 cpi r16, 0x01 ; 1
3e260: 11 05 cpc r17, r1
3e262: 09 f0 breq .+2 ; 0x3e266 <main+0xd4>
3e264: 32 c2 rjmp .+1124 ; 0x3e6ca <main+0x538>
3e266: c2 5e subi r28, 0xE2 ; 226
3e268: de 4f sbci r29, 0xFE ; 254
3e26a: 18 82 st Y, r1
3e26c: ce 51 subi r28, 0x1E ; 30
3e26e: d1 40 sbci r29, 0x01 ; 1
3e270: d1 2c mov r13, r1
3e272: 21 2c mov r2, r1
3e274: 31 2c mov r3, r1
3e276: 81 2c mov r8, r1
3e278: 91 2c mov r9, r1
3e27a: 54 01 movw r10, r8
3e27c: 41 2c mov r4, r1
3e27e: 51 2c mov r5, r1
3e280: 32 01 movw r6, r4
UART_STATUS_REG |= (1 <<UART_DOUBLE_SPEED);
#endif
UART_BAUD_RATE_LOW = UART_BAUD_SELECT(BAUDRATE,F_CPU);
UART_CONTROL_REG = (1 << UART_ENABLE_RECEIVER) | (1 << UART_ENABLE_TRANSMITTER);
asm volatile ("nop"); // wait until port has changed
3e282: 40 e0 ldi r20, 0x00 ; 0
3e284: 50 e0 ldi r21, 0x00 ; 0
3e286: 20 e0 ldi r18, 0x00 ; 0
* Collect received bytes to a complete message
*/
msgParseState = ST_START;
while ( msgParseState != ST_PROCESS )
{
if (boot_state==1)
3e288: 01 30 cpi r16, 0x01 ; 1
3e28a: 11 05 cpc r17, r1
3e28c: b1 f0 breq .+44 ; 0x3e2ba <main+0x128>
UART_STATUS_REG |= (1 <<UART_DOUBLE_SPEED);
#endif
UART_BAUD_RATE_LOW = UART_BAUD_SELECT(BAUDRATE,F_CPU);
UART_CONTROL_REG = (1 << UART_ENABLE_RECEIVER) | (1 << UART_ENABLE_TRANSMITTER);
asm volatile ("nop"); // wait until port has changed
3e28e: 81 e0 ldi r24, 0x01 ; 1
3e290: 92 e1 ldi r25, 0x12 ; 18
3e292: aa e7 ldi r26, 0x7A ; 122
3e294: b0 e0 ldi r27, 0x00 ; 0
//*****************************************************************************
static unsigned char recchar_timeout(void)
{
uint32_t count = 0;
while (!(UART_STATUS_REG & (1 << UART_RECEIVE_COMPLETE)))
3e296: 30 91 c0 00 lds r19, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7c00c0>
3e29a: 37 fd sbrc r19, 7
3e29c: 0e c0 rjmp .+28 ; 0x3e2ba <main+0x128>
3e29e: 01 97 sbiw r24, 0x01 ; 1
3e2a0: a1 09 sbc r26, r1
3e2a2: b1 09 sbc r27, r1
{
// wait for data
count++;
if (count > MAX_TIME_COUNT)
3e2a4: c1 f7 brne .-16 ; 0x3e296 <main+0x104>
{
unsigned int data;
#if (FLASHEND > 0x10000)
data = pgm_read_word_far(0); //* get the first word of the user program
3e2a6: ab bf out 0x3b, r26 ; 59
3e2a8: fc 01 movw r30, r24
3e2aa: 87 91 elpm r24, Z+
3e2ac: 96 91 elpm r25, Z
#else
data = pgm_read_word_near(0); //* get the first word of the user program
#endif
if (data != 0xffff) //* make sure its valid before jumping to it.
3e2ae: 01 96 adiw r24, 0x01 ; 1
3e2b0: 71 f3 breq .-36 ; 0x3e28e <main+0xfc>
{
asm volatile(
3e2b2: ee 27 eor r30, r30
3e2b4: ff 27 eor r31, r31
3e2b6: 09 94 ijmp
3e2b8: ea cf rjmp .-44 ; 0x3e28e <main+0xfc>
);
}
count = 0;
}
}
return UART_DATA_REG;
3e2ba: 90 91 c6 00 lds r25, 0x00C6 ; 0x8000c6 <__TEXT_REGION_LENGTH__+0x7c00c6>
// c = recchar();
c = recchar_timeout();
}
switch (msgParseState)
3e2be: e2 2e mov r14, r18
3e2c0: f1 2c mov r15, r1
3e2c2: f7 e0 ldi r31, 0x07 ; 7
3e2c4: ef 16 cp r14, r31
3e2c6: f1 04 cpc r15, r1
3e2c8: d8 f5 brcc .+118 ; 0x3e340 <main+0x1ae>
3e2ca: f7 01 movw r30, r14
3e2cc: 88 27 eor r24, r24
3e2ce: ee 58 subi r30, 0x8E ; 142
3e2d0: ff 40 sbci r31, 0x0F ; 15
3e2d2: 8e 4f sbci r24, 0xFE ; 254
3e2d4: 33 c2 rjmp .+1126 ; 0x3e73c <__tablejump2__>
{
case ST_START:
if ( c == MESSAGE_START )
3e2d6: 9b 31 cpi r25, 0x1B ; 27
3e2d8: 09 f4 brne .+2 ; 0x3e2dc <main+0x14a>
3e2da: 05 c2 rjmp .+1034 ; 0x3e6e6 <main+0x554>
3e2dc: 00 e0 ldi r16, 0x00 ; 0
3e2de: 10 e0 ldi r17, 0x00 ; 0
3e2e0: d3 cf rjmp .-90 ; 0x3e288 <main+0xf6>
case ST_GET_SEQ_NUM:
#ifdef _FIX_ISSUE_505_
seqNum = c;
msgParseState = ST_MSG_SIZE_1;
checksum ^= c;
3e2e2: d9 26 eor r13, r25
else
{
msgParseState = ST_START;
}
#endif
break;
3e2e4: c2 5e subi r28, 0xE2 ; 226
3e2e6: de 4f sbci r29, 0xFE ; 254
3e2e8: 98 83 st Y, r25
3e2ea: ce 51 subi r28, 0x1E ; 30
3e2ec: d1 40 sbci r29, 0x01 ; 1
break;
case ST_GET_SEQ_NUM:
#ifdef _FIX_ISSUE_505_
seqNum = c;
msgParseState = ST_MSG_SIZE_1;
3e2ee: 22 e0 ldi r18, 0x02 ; 2
else
{
msgParseState = ST_START;
}
#endif
break;
3e2f0: f5 cf rjmp .-22 ; 0x3e2dc <main+0x14a>
case ST_MSG_SIZE_1:
msgLength = c<<8;
3e2f2: 49 2f mov r20, r25
3e2f4: 50 e0 ldi r21, 0x00 ; 0
3e2f6: 54 2f mov r21, r20
3e2f8: 44 27 eor r20, r20
msgParseState = ST_MSG_SIZE_2;
checksum ^= c;
3e2fa: d9 26 eor r13, r25
#endif
break;
case ST_MSG_SIZE_1:
msgLength = c<<8;
msgParseState = ST_MSG_SIZE_2;
3e2fc: 23 e0 ldi r18, 0x03 ; 3
checksum ^= c;
break;
3e2fe: ee cf rjmp .-36 ; 0x3e2dc <main+0x14a>
case ST_MSG_SIZE_2:
msgLength |= c;
3e300: 49 2b or r20, r25
msgParseState = ST_GET_TOKEN;
checksum ^= c;
3e302: d9 26 eor r13, r25
checksum ^= c;
break;
case ST_MSG_SIZE_2:
msgLength |= c;
msgParseState = ST_GET_TOKEN;
3e304: 24 e0 ldi r18, 0x04 ; 4
checksum ^= c;
break;
3e306: ea cf rjmp .-44 ; 0x3e2dc <main+0x14a>
case ST_GET_TOKEN:
if ( c == TOKEN )
3e308: 9e 30 cpi r25, 0x0E ; 14
3e30a: 09 f0 breq .+2 ; 0x3e30e <main+0x17c>
3e30c: f0 c1 rjmp .+992 ; 0x3e6ee <main+0x55c>
{
msgParseState = ST_GET_DATA;
checksum ^= c;
3e30e: d9 26 eor r13, r25
ii = 0;
3e310: 21 2c mov r2, r1
3e312: 31 2c mov r3, r1
break;
case ST_GET_TOKEN:
if ( c == TOKEN )
{
msgParseState = ST_GET_DATA;
3e314: 25 e0 ldi r18, 0x05 ; 5
3e316: e2 cf rjmp .-60 ; 0x3e2dc <main+0x14a>
msgParseState = ST_START;
}
break;
case ST_GET_DATA:
msgBuffer[ii++] = c;
3e318: b1 01 movw r22, r2
3e31a: 6f 5f subi r22, 0xFF ; 255
3e31c: 7f 4f sbci r23, 0xFF ; 255
3e31e: e1 e0 ldi r30, 0x01 ; 1
3e320: f0 e0 ldi r31, 0x00 ; 0
3e322: ec 0f add r30, r28
3e324: fd 1f adc r31, r29
3e326: e2 0d add r30, r2
3e328: f3 1d adc r31, r3
3e32a: 90 83 st Z, r25
checksum ^= c;
3e32c: d9 26 eor r13, r25
if (ii == msgLength )
3e32e: 46 17 cp r20, r22
3e330: 57 07 cpc r21, r23
3e332: 09 f4 brne .+2 ; 0x3e336 <main+0x1a4>
3e334: de c1 rjmp .+956 ; 0x3e6f2 <main+0x560>
3e336: 1b 01 movw r2, r22
3e338: d1 cf rjmp .-94 ; 0x3e2dc <main+0x14a>
msgParseState = ST_GET_CHECK;
}
break;
case ST_GET_CHECK:
if ( c == checksum )
3e33a: 9d 11 cpse r25, r13
3e33c: d8 c1 rjmp .+944 ; 0x3e6ee <main+0x55c>
3e33e: 02 c0 rjmp .+4 ; 0x3e344 <main+0x1b2>
{
/*
* Collect received bytes to a complete message
*/
msgParseState = ST_START;
while ( msgParseState != ST_PROCESS )
3e340: 27 30 cpi r18, 0x07 ; 7
3e342: 61 f6 brne .-104 ; 0x3e2dc <main+0x14a>
/*
* Now process the STK500 commands, see Atmel Appnote AVR068
*/
switch (msgBuffer[0])
3e344: 29 81 ldd r18, Y+1 ; 0x01
3e346: 82 2f mov r24, r18
3e348: 90 e0 ldi r25, 0x00 ; 0
3e34a: fc 01 movw r30, r24
3e34c: 31 97 sbiw r30, 0x01 ; 1
3e34e: ed 31 cpi r30, 0x1D ; 29
3e350: f1 05 cpc r31, r1
3e352: 08 f0 brcs .+2 ; 0x3e356 <main+0x1c4>
3e354: 73 c1 rjmp .+742 ; 0x3e63c <main+0x4aa>
3e356: 88 27 eor r24, r24
3e358: e7 58 subi r30, 0x87 ; 135
3e35a: ff 40 sbci r31, 0x0F ; 15
3e35c: 8e 4f sbci r24, 0xFE ; 254
3e35e: ee c1 rjmp .+988 ; 0x3e73c <__tablejump2__>
3e360: c1 2c mov r12, r1
3e362: 54 c0 rjmp .+168 ; 0x3e40c <main+0x27a>
case CMD_SPI_MULTI:
{
unsigned char answerByte;
unsigned char flag=0;
if ( msgBuffer[4]== 0x30 )
3e364: 9d 81 ldd r25, Y+5 ; 0x05
3e366: 90 33 cpi r25, 0x30 ; 48
3e368: 39 f4 brne .+14 ; 0x3e378 <main+0x1e6>
{
unsigned char signatureIndex = msgBuffer[6];
3e36a: 8f 81 ldd r24, Y+7 ; 0x07
if ( signatureIndex == 0 )
3e36c: 88 23 and r24, r24
3e36e: b1 f0 breq .+44 ; 0x3e39c <main+0x20a>
{
answerByte = (SIGNATURE_BYTES >> 16) & 0x000000FF;
}
else if ( signatureIndex == 1 )
3e370: 81 30 cpi r24, 0x01 ; 1
3e372: b1 f4 brne .+44 ; 0x3e3a0 <main+0x20e>
{
answerByte = (SIGNATURE_BYTES >> 8) & 0x000000FF;
3e374: 88 e9 ldi r24, 0x98 ; 152
3e376: 17 c0 rjmp .+46 ; 0x3e3a6 <main+0x214>
else
{
answerByte = SIGNATURE_BYTES & 0x000000FF;
}
}
else if ( msgBuffer[4] & 0x50 )
3e378: 89 2f mov r24, r25
3e37a: 80 75 andi r24, 0x50 ; 80
3e37c: 99 f0 breq .+38 ; 0x3e3a4 <main+0x212>
//* Issue 544: stk500v2 bootloader doesn't support reading fuses
//* I cant find the docs that say what these are supposed to be but this was figured out by trial and error
// answerByte = boot_lock_fuse_bits_get(GET_LOW_FUSE_BITS);
// answerByte = boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS);
// answerByte = boot_lock_fuse_bits_get(GET_EXTENDED_FUSE_BITS);
if (msgBuffer[4] == 0x50)
3e37e: 90 35 cpi r25, 0x50 ; 80
3e380: 21 f4 brne .+8 ; 0x3e38a <main+0x1f8>
{
answerByte = boot_lock_fuse_bits_get(GET_LOW_FUSE_BITS);
3e382: 89 e0 ldi r24, 0x09 ; 9
3e384: e0 e0 ldi r30, 0x00 ; 0
3e386: f0 e0 ldi r31, 0x00 ; 0
3e388: 05 c0 rjmp .+10 ; 0x3e394 <main+0x202>
}
else if (msgBuffer[4] == 0x58)
3e38a: 98 35 cpi r25, 0x58 ; 88
3e38c: 59 f4 brne .+22 ; 0x3e3a4 <main+0x212>
{
answerByte = boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS);
3e38e: e3 e0 ldi r30, 0x03 ; 3
3e390: f0 e0 ldi r31, 0x00 ; 0
3e392: 89 e0 ldi r24, 0x09 ; 9
3e394: 80 93 57 00 sts 0x0057, r24 ; 0x800057 <__TEXT_REGION_LENGTH__+0x7c0057>
3e398: 84 91 lpm r24, Z
3e39a: 05 c0 rjmp .+10 ; 0x3e3a6 <main+0x214>
{
unsigned char signatureIndex = msgBuffer[6];
if ( signatureIndex == 0 )
{
answerByte = (SIGNATURE_BYTES >> 16) & 0x000000FF;
3e39c: 8e e1 ldi r24, 0x1E ; 30
3e39e: 03 c0 rjmp .+6 ; 0x3e3a6 <main+0x214>
{
answerByte = (SIGNATURE_BYTES >> 8) & 0x000000FF;
}
else
{
answerByte = SIGNATURE_BYTES & 0x000000FF;
3e3a0: 81 e0 ldi r24, 0x01 ; 1
3e3a2: 01 c0 rjmp .+2 ; 0x3e3a6 <main+0x214>
answerByte = 0;
}
}
else
{
answerByte = 0; // for all others command are not implemented, return dummy value for AVRDUDE happy <Worapoht>
3e3a4: 80 e0 ldi r24, 0x00 ; 0
}
if ( !flag )
{
msgLength = 7;
msgBuffer[1] = STATUS_CMD_OK;
3e3a6: 1a 82 std Y+2, r1 ; 0x02
msgBuffer[2] = 0;
3e3a8: 1b 82 std Y+3, r1 ; 0x03
msgBuffer[3] = msgBuffer[4];
3e3aa: 9c 83 std Y+4, r25 ; 0x04
msgBuffer[4] = 0;
3e3ac: 1d 82 std Y+5, r1 ; 0x05
msgBuffer[5] = answerByte;
3e3ae: 8e 83 std Y+6, r24 ; 0x06
msgBuffer[6] = STATUS_CMD_OK;
3e3b0: 1f 82 std Y+7, r1 ; 0x07
3e3b2: c1 2c mov r12, r1
{
answerByte = 0; // for all others command are not implemented, return dummy value for AVRDUDE happy <Worapoht>
}
if ( !flag )
{
msgLength = 7;
3e3b4: 07 e0 ldi r16, 0x07 ; 7
3e3b6: 10 e0 ldi r17, 0x00 ; 0
3e3b8: 46 c1 rjmp .+652 ; 0x3e646 <main+0x4b4>
}
break;
#endif
case CMD_SIGN_ON:
msgLength = 11;
msgBuffer[1] = STATUS_CMD_OK;
3e3ba: 1a 82 std Y+2, r1 ; 0x02
msgBuffer[2] = 8;
3e3bc: 88 e0 ldi r24, 0x08 ; 8
3e3be: 8b 83 std Y+3, r24 ; 0x03
msgBuffer[3] = 'A';
3e3c0: 81 e4 ldi r24, 0x41 ; 65
3e3c2: 8c 83 std Y+4, r24 ; 0x04
msgBuffer[4] = 'V';
3e3c4: 86 e5 ldi r24, 0x56 ; 86
3e3c6: 8d 83 std Y+5, r24 ; 0x05
msgBuffer[5] = 'R';
3e3c8: 82 e5 ldi r24, 0x52 ; 82
3e3ca: 8e 83 std Y+6, r24 ; 0x06
msgBuffer[6] = 'I';
3e3cc: 89 e4 ldi r24, 0x49 ; 73
3e3ce: 8f 83 std Y+7, r24 ; 0x07
msgBuffer[7] = 'S';
3e3d0: 83 e5 ldi r24, 0x53 ; 83
3e3d2: 88 87 std Y+8, r24 ; 0x08
msgBuffer[8] = 'P';
3e3d4: 80 e5 ldi r24, 0x50 ; 80
3e3d6: 89 87 std Y+9, r24 ; 0x09
msgBuffer[9] = '_';
3e3d8: 8f e5 ldi r24, 0x5F ; 95
3e3da: 8a 87 std Y+10, r24 ; 0x0a
msgBuffer[10] = '2';
3e3dc: 82 e3 ldi r24, 0x32 ; 50
3e3de: 8b 87 std Y+11, r24 ; 0x0b
break;
3e3e0: c1 2c mov r12, r1
}
}
break;
#endif
case CMD_SIGN_ON:
msgLength = 11;
3e3e2: 0b e0 ldi r16, 0x0B ; 11
3e3e4: 10 e0 ldi r17, 0x00 ; 0
msgBuffer[6] = 'I';
msgBuffer[7] = 'S';
msgBuffer[8] = 'P';
msgBuffer[9] = '_';
msgBuffer[10] = '2';
break;
3e3e6: 2f c1 rjmp .+606 ; 0x3e646 <main+0x4b4>
3e3e8: ea 81 ldd r30, Y+2 ; 0x02
3e3ea: e0 59 subi r30, 0x90 ; 144
3e3ec: e3 30 cpi r30, 0x03 ; 3
3e3ee: 28 f4 brcc .+10 ; 0x3e3fa <main+0x268>
3e3f0: f0 e0 ldi r31, 0x00 ; 0
3e3f2: e0 50 subi r30, 0x00 ; 0
3e3f4: fe 4f sbci r31, 0xFE ; 254
3e3f6: 80 81 ld r24, Z
3e3f8: 01 c0 rjmp .+2 ; 0x3e3fc <main+0x26a>
case CMD_GET_PARAMETER:
{
unsigned char value;
switch(msgBuffer[1])
3e3fa: 80 e0 ldi r24, 0x00 ; 0
default:
value = 0;
break;
}
msgLength = 3;
msgBuffer[1] = STATUS_CMD_OK;
3e3fc: 1a 82 std Y+2, r1 ; 0x02
msgBuffer[2] = value;
3e3fe: 8b 83 std Y+3, r24 ; 0x03
}
break;
3e400: c1 2c mov r12, r1
break;
default:
value = 0;
break;
}
msgLength = 3;
3e402: 03 e0 ldi r16, 0x03 ; 3
3e404: 10 e0 ldi r17, 0x00 ; 0
msgBuffer[1] = STATUS_CMD_OK;
msgBuffer[2] = value;
}
break;
3e406: 1f c1 rjmp .+574 ; 0x3e646 <main+0x4b4>
case CMD_LEAVE_PROGMODE_ISP:
isLeave = 1;
3e408: cc 24 eor r12, r12
3e40a: c3 94 inc r12
//* fall thru
case CMD_SET_PARAMETER:
case CMD_ENTER_PROGMODE_ISP:
msgLength = 2;
msgBuffer[1] = STATUS_CMD_OK;
3e40c: 1a 82 std Y+2, r1 ; 0x02
3e40e: 19 c1 rjmp .+562 ; 0x3e642 <main+0x4b0>
break;
case CMD_READ_SIGNATURE_ISP:
{
unsigned char signatureIndex = msgBuffer[4];
3e410: 8d 81 ldd r24, Y+5 ; 0x05
unsigned char signature;
if ( signatureIndex == 0 )
3e412: 88 23 and r24, r24
3e414: 21 f0 breq .+8 ; 0x3e41e <main+0x28c>
signature = (SIGNATURE_BYTES >>16) & 0x000000FF;
else if ( signatureIndex == 1 )
3e416: 81 30 cpi r24, 0x01 ; 1
3e418: 21 f4 brne .+8 ; 0x3e422 <main+0x290>
signature = (SIGNATURE_BYTES >> 8) & 0x000000FF;
3e41a: 88 e9 ldi r24, 0x98 ; 152
3e41c: 24 c0 rjmp .+72 ; 0x3e466 <main+0x2d4>
{
unsigned char signatureIndex = msgBuffer[4];
unsigned char signature;
if ( signatureIndex == 0 )
signature = (SIGNATURE_BYTES >>16) & 0x000000FF;
3e41e: 8e e1 ldi r24, 0x1E ; 30
3e420: 22 c0 rjmp .+68 ; 0x3e466 <main+0x2d4>
else if ( signatureIndex == 1 )
signature = (SIGNATURE_BYTES >> 8) & 0x000000FF;
else
signature = SIGNATURE_BYTES & 0x000000FF;
3e422: 81 e0 ldi r24, 0x01 ; 1
3e424: 20 c0 rjmp .+64 ; 0x3e466 <main+0x2d4>
}
break;
case CMD_READ_LOCK_ISP:
msgLength = 4;
msgBuffer[1] = STATUS_CMD_OK;
3e426: 1a 82 std Y+2, r1 ; 0x02
msgBuffer[2] = boot_lock_fuse_bits_get( GET_LOCK_BITS );
3e428: e1 e0 ldi r30, 0x01 ; 1
3e42a: f0 e0 ldi r31, 0x00 ; 0
3e42c: 89 e0 ldi r24, 0x09 ; 9
3e42e: 80 93 57 00 sts 0x0057, r24 ; 0x800057 <__TEXT_REGION_LENGTH__+0x7c0057>
3e432: 84 91 lpm r24, Z
3e434: 8b 83 std Y+3, r24 ; 0x03
msgBuffer[3] = STATUS_CMD_OK;
3e436: 1c 82 std Y+4, r1 ; 0x04
break;
3e438: c1 2c mov r12, r1
msgBuffer[3] = STATUS_CMD_OK;
}
break;
case CMD_READ_LOCK_ISP:
msgLength = 4;
3e43a: 04 e0 ldi r16, 0x04 ; 4
3e43c: 10 e0 ldi r17, 0x00 ; 0
msgBuffer[1] = STATUS_CMD_OK;
msgBuffer[2] = boot_lock_fuse_bits_get( GET_LOCK_BITS );
msgBuffer[3] = STATUS_CMD_OK;
break;
3e43e: 03 c1 rjmp .+518 ; 0x3e646 <main+0x4b4>
case CMD_READ_FUSE_ISP:
{
unsigned char fuseBits;
if ( msgBuffer[2] == 0x50 )
3e440: 8b 81 ldd r24, Y+3 ; 0x03
3e442: 80 35 cpi r24, 0x50 ; 80
3e444: 51 f4 brne .+20 ; 0x3e45a <main+0x2c8>
{
if ( msgBuffer[3] == 0x08 )
3e446: 8c 81 ldd r24, Y+4 ; 0x04
3e448: 88 30 cpi r24, 0x08 ; 8
3e44a: 19 f4 brne .+6 ; 0x3e452 <main+0x2c0>
fuseBits = boot_lock_fuse_bits_get( GET_EXTENDED_FUSE_BITS );
3e44c: e2 e0 ldi r30, 0x02 ; 2
3e44e: f0 e0 ldi r31, 0x00 ; 0
3e450: 06 c0 rjmp .+12 ; 0x3e45e <main+0x2cc>
else
fuseBits = boot_lock_fuse_bits_get( GET_LOW_FUSE_BITS );
3e452: 89 e0 ldi r24, 0x09 ; 9
3e454: e0 e0 ldi r30, 0x00 ; 0
3e456: f0 e0 ldi r31, 0x00 ; 0
3e458: 03 c0 rjmp .+6 ; 0x3e460 <main+0x2ce>
}
else
{
fuseBits = boot_lock_fuse_bits_get( GET_HIGH_FUSE_BITS );
3e45a: e3 e0 ldi r30, 0x03 ; 3
3e45c: f0 e0 ldi r31, 0x00 ; 0
3e45e: 89 e0 ldi r24, 0x09 ; 9
3e460: 80 93 57 00 sts 0x0057, r24 ; 0x800057 <__TEXT_REGION_LENGTH__+0x7c0057>
3e464: 84 91 lpm r24, Z
}
msgLength = 4;
msgBuffer[1] = STATUS_CMD_OK;
3e466: 1a 82 std Y+2, r1 ; 0x02
3e468: e5 cf rjmp .-54 ; 0x3e434 <main+0x2a2>
#endif
case CMD_CHIP_ERASE_ISP:
eraseAddress = 0;
msgLength = 2;
// msgBuffer[1] = STATUS_CMD_OK;
msgBuffer[1] = STATUS_CMD_FAILED; //* isue 543, return FAILED instead of OK
3e46a: 80 ec ldi r24, 0xC0 ; 192
3e46c: 8a 83 std Y+2, r24 ; 0x02
break;
3e46e: c1 2c mov r12, r1
}
break;
#endif
case CMD_CHIP_ERASE_ISP:
eraseAddress = 0;
msgLength = 2;
3e470: 02 e0 ldi r16, 0x02 ; 2
3e472: 10 e0 ldi r17, 0x00 ; 0
msgBuffer[2] = STATUS_CMD_OK;
}
break;
#endif
case CMD_CHIP_ERASE_ISP:
eraseAddress = 0;
3e474: 81 2c mov r8, r1
3e476: 91 2c mov r9, r1
3e478: 54 01 movw r10, r8
msgLength = 2;
// msgBuffer[1] = STATUS_CMD_OK;
msgBuffer[1] = STATUS_CMD_FAILED; //* isue 543, return FAILED instead of OK
break;
3e47a: e5 c0 rjmp .+458 ; 0x3e646 <main+0x4b4>
3e47c: 6a 81 ldd r22, Y+2 ; 0x02
3e47e: 7b 81 ldd r23, Y+3 ; 0x03
3e480: 8c 81 ldd r24, Y+4 ; 0x04
3e482: 9d 81 ldd r25, Y+5 ; 0x05
3e484: 63 d1 rcall .+710 ; 0x3e74c <__bswapsi2>
case CMD_LOAD_ADDRESS:
#if defined(RAMPZ)
address = ( ((address_t)(msgBuffer[1])<<24)|((address_t)(msgBuffer[2])<<16)|((address_t)(msgBuffer[3])<<8)|(msgBuffer[4]) )<<1;
3e486: 2b 01 movw r4, r22
3e488: 3c 01 movw r6, r24
3e48a: 44 0c add r4, r4
3e48c: 55 1c adc r5, r5
3e48e: 66 1c adc r6, r6
3e490: 77 1c adc r7, r7
#else
address = ( ((msgBuffer[3])<<8)|(msgBuffer[4]) )<<1; //convert word to byte address
#endif
msgLength = 2;
msgBuffer[1] = STATUS_CMD_OK;
3e492: 1a 82 std Y+2, r1 ; 0x02
3e494: d5 c0 rjmp .+426 ; 0x3e640 <main+0x4ae>
3e496: ea 80 ldd r14, Y+2 ; 0x02
3e498: fb 80 ldd r15, Y+3 ; 0x03
3e49a: fe 24 eor r15, r14
3e49c: ef 24 eor r14, r15
3e49e: fe 24 eor r15, r14
unsigned int data;
unsigned char highByte, lowByte;
address_t tempaddress = address;
if ( msgBuffer[0] == CMD_PROGRAM_FLASH_ISP )
3e4a0: 23 31 cpi r18, 0x13 ; 19
3e4a2: 09 f0 breq .+2 ; 0x3e4a6 <main+0x314>
3e4a4: 3c c0 rjmp .+120 ; 0x3e51e <main+0x38c>
{
// erase only main section (bootloader protection)
while (eraseAddress < APP_END )
3e4a6: 81 14 cp r8, r1
3e4a8: 40 ec ldi r20, 0xC0 ; 192
3e4aa: 94 06 cpc r9, r20
3e4ac: 43 e0 ldi r20, 0x03 ; 3
3e4ae: a4 06 cpc r10, r20
3e4b0: b1 04 cpc r11, r1
3e4b2: 78 f4 brcc .+30 ; 0x3e4d2 <main+0x340>
{
boot_page_erase(eraseAddress); // Perform page erase
3e4b4: 23 e0 ldi r18, 0x03 ; 3
3e4b6: f4 01 movw r30, r8
3e4b8: a0 92 5b 00 sts 0x005B, r10 ; 0x80005b <__TEXT_REGION_LENGTH__+0x7c005b>
3e4bc: 20 93 57 00 sts 0x0057, r18 ; 0x800057 <__TEXT_REGION_LENGTH__+0x7c0057>
3e4c0: e8 95 spm
boot_spm_busy_wait(); // Wait until the memory is erased.
3e4c2: 07 b6 in r0, 0x37 ; 55
3e4c4: 00 fc sbrc r0, 0
3e4c6: fd cf rjmp .-6 ; 0x3e4c2 <main+0x330>
eraseAddress += SPM_PAGESIZE; // point to next page to be erase
3e4c8: 3f ef ldi r19, 0xFF ; 255
3e4ca: 93 1a sub r9, r19
3e4cc: a3 0a sbc r10, r19
3e4ce: b3 0a sbc r11, r19
3e4d0: ea cf rjmp .-44 ; 0x3e4a6 <main+0x314>
3e4d2: 93 01 movw r18, r6
3e4d4: 82 01 movw r16, r4
3e4d6: de 01 movw r26, r28
3e4d8: 1b 96 adiw r26, 0x0b ; 11
3e4da: 8d 91 ld r24, X+
3e4dc: 9d 91 ld r25, X+
do {
lowByte = *p++;
highByte = *p++;
data = (highByte << 8) | lowByte;
boot_page_fill(address,data);
3e4de: 41 e0 ldi r20, 0x01 ; 1
3e4e0: 0c 01 movw r0, r24
3e4e2: f8 01 movw r30, r16
3e4e4: 20 93 5b 00 sts 0x005B, r18 ; 0x80005b <__TEXT_REGION_LENGTH__+0x7c005b>
3e4e8: 40 93 57 00 sts 0x0057, r20 ; 0x800057 <__TEXT_REGION_LENGTH__+0x7c0057>
3e4ec: e8 95 spm
3e4ee: 11 24 eor r1, r1
address = address + 2; // Select next word in memory
3e4f0: 0e 5f subi r16, 0xFE ; 254
3e4f2: 1f 4f sbci r17, 0xFF ; 255
3e4f4: 2f 4f sbci r18, 0xFF ; 255
3e4f6: 3f 4f sbci r19, 0xFF ; 255
size -= 2; // Reduce number of bytes to write by two
3e4f8: 82 e0 ldi r24, 0x02 ; 2
3e4fa: e8 1a sub r14, r24
3e4fc: f1 08 sbc r15, r1
} while (size); // Loop until all bytes written
3e4fe: 69 f7 brne .-38 ; 0x3e4da <main+0x348>
boot_page_write(tempaddress);
3e500: 95 e0 ldi r25, 0x05 ; 5
3e502: f2 01 movw r30, r4
3e504: 60 92 5b 00 sts 0x005B, r6 ; 0x80005b <__TEXT_REGION_LENGTH__+0x7c005b>
3e508: 90 93 57 00 sts 0x0057, r25 ; 0x800057 <__TEXT_REGION_LENGTH__+0x7c0057>
3e50c: e8 95 spm
boot_spm_busy_wait();
3e50e: 07 b6 in r0, 0x37 ; 55
3e510: 00 fc sbrc r0, 0
3e512: fd cf rjmp .-6 ; 0x3e50e <main+0x37c>
boot_rww_enable(); // Re-enable the RWW section
3e514: 81 e1 ldi r24, 0x11 ; 17
3e516: 80 93 57 00 sts 0x0057, r24 ; 0x800057 <__TEXT_REGION_LENGTH__+0x7c0057>
3e51a: e8 95 spm
3e51c: 32 c0 rjmp .+100 ; 0x3e582 <main+0x3f0>
}
else
{
//* issue 543, this should work, It has not been tested.
uint16_t ii = address >> 1;
3e51e: d3 01 movw r26, r6
3e520: c2 01 movw r24, r4
3e522: b6 95 lsr r27
3e524: a7 95 ror r26
3e526: 97 95 ror r25
3e528: 87 95 ror r24
3e52a: 6c 01 movw r12, r24
3e52c: fe 01 movw r30, r28
3e52e: 3b 96 adiw r30, 0x0b ; 11
3e530: c1 5e subi r28, 0xE1 ; 225
3e532: de 4f sbci r29, 0xFE ; 254
3e534: f9 83 std Y+1, r31 ; 0x01
3e536: e8 83 st Y, r30
3e538: cf 51 subi r28, 0x1F ; 31
3e53a: d1 40 sbci r29, 0x01 ; 1
/* write EEPROM */
while (size) {
3e53c: 00 e0 ldi r16, 0x00 ; 0
3e53e: 10 e0 ldi r17, 0x00 ; 0
3e540: 0e 15 cp r16, r14
3e542: 1f 05 cpc r17, r15
3e544: a1 f0 breq .+40 ; 0x3e56e <main+0x3dc>
eeprom_write_byte((uint8_t*)ii, *p++);
3e546: c1 5e subi r28, 0xE1 ; 225
3e548: de 4f sbci r29, 0xFE ; 254
3e54a: e8 81 ld r30, Y
3e54c: f9 81 ldd r31, Y+1 ; 0x01
3e54e: cf 51 subi r28, 0x1F ; 31
3e550: d1 40 sbci r29, 0x01 ; 1
3e552: 61 91 ld r22, Z+
3e554: c1 5e subi r28, 0xE1 ; 225
3e556: de 4f sbci r29, 0xFE ; 254
3e558: f9 83 std Y+1, r31 ; 0x01
3e55a: e8 83 st Y, r30
3e55c: cf 51 subi r28, 0x1F ; 31
3e55e: d1 40 sbci r29, 0x01 ; 1
3e560: c8 01 movw r24, r16
3e562: 8c 0d add r24, r12
3e564: 9d 1d adc r25, r13
3e566: f9 d0 rcall .+498 ; 0x3e75a <eeprom_write_byte>
3e568: 0f 5f subi r16, 0xFF ; 255
3e56a: 1f 4f sbci r17, 0xFF ; 255
3e56c: e9 cf rjmp .-46 ; 0x3e540 <main+0x3ae>
3e56e: 20 e0 ldi r18, 0x00 ; 0
3e570: 30 e0 ldi r19, 0x00 ; 0
3e572: 00 0f add r16, r16
3e574: 11 1f adc r17, r17
3e576: 22 1f adc r18, r18
3e578: 33 1f adc r19, r19
3e57a: 04 0d add r16, r4
3e57c: 15 1d adc r17, r5
3e57e: 26 1d adc r18, r6
3e580: 37 1d adc r19, r7
ii++;
size--;
}
}
msgLength = 2;
msgBuffer[1] = STATUS_CMD_OK;
3e582: 1a 82 std Y+2, r1 ; 0x02
}
break;
3e584: 28 01 movw r4, r16
3e586: 39 01 movw r6, r18
3e588: 5b c0 rjmp .+182 ; 0x3e640 <main+0x4ae>
3e58a: 8a 81 ldd r24, Y+2 ; 0x02
3e58c: 9b 81 ldd r25, Y+3 ; 0x03
3e58e: 98 27 eor r25, r24
3e590: 89 27 eor r24, r25
3e592: 98 27 eor r25, r24
case CMD_READ_FLASH_ISP:
case CMD_READ_EEPROM_ISP:
{
unsigned int size = ((msgBuffer[1])<<8) | msgBuffer[2];
unsigned char *p = msgBuffer+1;
msgLength = size+3;
3e594: 8c 01 movw r16, r24
3e596: 0d 5f subi r16, 0xFD ; 253
3e598: 1f 4f sbci r17, 0xFF ; 255
*p++ = STATUS_CMD_OK;
3e59a: 1a 82 std Y+2, r1 ; 0x02
if (msgBuffer[0] == CMD_READ_FLASH_ISP )
3e59c: 24 31 cpi r18, 0x14 ; 20
3e59e: 01 f5 brne .+64 ; 0x3e5e0 <main+0x44e>
{
//Read protection
if (eraseAddress < APP_END) {
3e5a0: 81 14 cp r8, r1
3e5a2: f0 ec ldi r31, 0xC0 ; 192
3e5a4: 9f 06 cpc r9, r31
3e5a6: f3 e0 ldi r31, 0x03 ; 3
3e5a8: af 06 cpc r10, r31
3e5aa: b1 04 cpc r11, r1
3e5ac: 08 f4 brcc .+2 ; 0x3e5b0 <main+0x41e>
3e5ae: 46 c0 rjmp .+140 ; 0x3e63c <main+0x4aa>
3e5b0: de 01 movw r26, r28
3e5b2: 11 96 adiw r26, 0x01 ; 1
// Read FLASH
do {
//#if defined(RAMPZ)
#if (FLASHEND > 0x10000)
data = pgm_read_word_far(address);
3e5b4: 6b be out 0x3b, r6 ; 59
3e5b6: f2 01 movw r30, r4
3e5b8: 27 91 elpm r18, Z+
3e5ba: 36 91 elpm r19, Z
#else
data = pgm_read_word_near(address);
#endif
*p++ = (unsigned char)data; //LSB
3e5bc: 12 96 adiw r26, 0x02 ; 2
3e5be: 2c 93 st X, r18
3e5c0: 12 97 sbiw r26, 0x02 ; 2
3e5c2: fd 01 movw r30, r26
3e5c4: 34 96 adiw r30, 0x04 ; 4
*p++ = (unsigned char)(data >> 8); //MSB
3e5c6: 13 96 adiw r26, 0x03 ; 3
3e5c8: 3c 93 st X, r19
3e5ca: 13 97 sbiw r26, 0x03 ; 3
address += 2; // Select next word in memory
3e5cc: 22 e0 ldi r18, 0x02 ; 2
3e5ce: 42 0e add r4, r18
3e5d0: 51 1c adc r5, r1
3e5d2: 61 1c adc r6, r1
3e5d4: 71 1c adc r7, r1
size -= 2;
3e5d6: 02 97 sbiw r24, 0x02 ; 2
3e5d8: 12 96 adiw r26, 0x02 ; 2
}while (size);
3e5da: 00 97 sbiw r24, 0x00 ; 0
3e5dc: 59 f7 brne .-42 ; 0x3e5b4 <main+0x422>
3e5de: 2b c0 rjmp .+86 ; 0x3e636 <main+0x4a4>
3e5e0: fe 01 movw r30, r28
3e5e2: 31 96 adiw r30, 0x01 ; 1
3e5e4: 9f 01 movw r18, r30
3e5e6: 28 0f add r18, r24
3e5e8: 39 1f adc r19, r25
unsigned int size = ((msgBuffer[1])<<8) | msgBuffer[2];
unsigned char *p = msgBuffer+1;
msgLength = size+3;
*p++ = STATUS_CMD_OK;
if (msgBuffer[0] == CMD_READ_FLASH_ISP )
3e5ea: b3 01 movw r22, r6
3e5ec: a2 01 movw r20, r4
}
else
{
/* Read EEPROM */
do {
EEARL = address; // Setup EEPROM address
3e5ee: 41 bd out 0x21, r20 ; 33
EEARH = ((address >> 8));
3e5f0: c5 2e mov r12, r21
3e5f2: d6 2e mov r13, r22
3e5f4: e7 2e mov r14, r23
3e5f6: ff 24 eor r15, r15
3e5f8: c2 bc out 0x22, r12 ; 34
address++; // Select next EEPROM byte
3e5fa: 4f 5f subi r20, 0xFF ; 255
3e5fc: 5f 4f sbci r21, 0xFF ; 255
3e5fe: 6f 4f sbci r22, 0xFF ; 255
3e600: 7f 4f sbci r23, 0xFF ; 255
EECR |= (1<<EERE); // Read EEPROM
3e602: f8 9a sbi 0x1f, 0 ; 31
*p++ = EEDR; // Send EEPROM data
3e604: a0 b5 in r26, 0x20 ; 32
3e606: a2 83 std Z+2, r26 ; 0x02
3e608: 31 96 adiw r30, 0x01 ; 1
size--;
} while (size);
3e60a: 2e 17 cp r18, r30
3e60c: 3f 07 cpc r19, r31
3e60e: 79 f7 brne .-34 ; 0x3e5ee <main+0x45c>
3e610: ac 01 movw r20, r24
3e612: 41 50 subi r20, 0x01 ; 1
3e614: 51 09 sbc r21, r1
3e616: 60 e0 ldi r22, 0x00 ; 0
3e618: 70 e0 ldi r23, 0x00 ; 0
3e61a: 4f 5f subi r20, 0xFF ; 255
3e61c: 5f 4f sbci r21, 0xFF ; 255
3e61e: 6f 4f sbci r22, 0xFF ; 255
3e620: 7f 4f sbci r23, 0xFF ; 255
3e622: 44 0e add r4, r20
3e624: 55 1e adc r5, r21
3e626: 66 1e adc r6, r22
3e628: 77 1e adc r7, r23
3e62a: e3 e0 ldi r30, 0x03 ; 3
3e62c: f0 e0 ldi r31, 0x00 ; 0
3e62e: ec 0f add r30, r28
3e630: fd 1f adc r31, r29
3e632: e8 0f add r30, r24
3e634: f9 1f adc r31, r25
}
*p++ = STATUS_CMD_OK;
3e636: 10 82 st Z, r1
}
break;
3e638: c1 2c mov r12, r1
3e63a: 05 c0 rjmp .+10 ; 0x3e646 <main+0x4b4>
default:
msgLength = 2;
msgBuffer[1] = STATUS_CMD_FAILED;
3e63c: 80 ec ldi r24, 0xC0 ; 192
break;
3e63e: 8a 83 std Y+2, r24 ; 0x02
*p++ = STATUS_CMD_OK;
}
break;
default:
msgLength = 2;
3e640: c1 2c mov r12, r1
3e642: 02 e0 ldi r16, 0x02 ; 2
}
/*
* Now send answer message back
*/
sendchar(MESSAGE_START);
3e644: 10 e0 ldi r17, 0x00 ; 0
3e646: 8b e1 ldi r24, 0x1B ; 27
checksum = MESSAGE_START^0;
sendchar(seqNum);
3e648: 98 dd rcall .-1232 ; 0x3e17a <sendchar>
3e64a: c2 5e subi r28, 0xE2 ; 226
3e64c: de 4f sbci r29, 0xFE ; 254
3e64e: 88 81 ld r24, Y
3e650: ce 51 subi r28, 0x1E ; 30
checksum ^= seqNum;
c = ((msgLength>>8)&0xFF);
sendchar(c);
3e652: d1 40 sbci r29, 0x01 ; 1
3e654: 92 dd rcall .-1244 ; 0x3e17a <sendchar>
3e656: 81 2f mov r24, r17
checksum ^= c;
c = msgLength&0x00FF;
sendchar(c);
3e658: 90 dd rcall .-1248 ; 0x3e17a <sendchar>
3e65a: 80 2f mov r24, r16
3e65c: 8e dd rcall .-1252 ; 0x3e17a <sendchar>
3e65e: 85 e1 ldi r24, 0x15 ; 21
3e660: c2 5e subi r28, 0xE2 ; 226
3e662: de 4f sbci r29, 0xFE ; 254
3e664: d8 80 ld r13, Y
3e666: ce 51 subi r28, 0x1E ; 30
3e668: d1 40 sbci r29, 0x01 ; 1
3e66a: d8 26 eor r13, r24
checksum ^= c;
sendchar(TOKEN);
3e66c: d0 26 eor r13, r16
3e66e: 8e e0 ldi r24, 0x0E ; 14
3e670: 84 dd rcall .-1272 ; 0x3e17a <sendchar>
checksum ^= TOKEN;
3e672: d1 26 eor r13, r17
3e674: ce 01 movw r24, r28
3e676: 01 96 adiw r24, 0x01 ; 1
3e678: 7c 01 movw r14, r24
3e67a: 08 0f add r16, r24
3e67c: 19 1f adc r17, r25
p = msgBuffer;
while ( msgLength )
3e67e: 0e 15 cp r16, r14
3e680: 1f 05 cpc r17, r15
{
c = *p++;
3e682: 89 f0 breq .+34 ; 0x3e6a6 <main+0x514>
3e684: f7 01 movw r30, r14
3e686: 21 91 ld r18, Z+
3e688: 7f 01 movw r14, r30
3e68a: c1 5e subi r28, 0xE1 ; 225
3e68c: de 4f sbci r29, 0xFE ; 254
3e68e: 28 83 st Y, r18
3e690: cf 51 subi r28, 0x1F ; 31
sendchar(c);
3e692: d1 40 sbci r29, 0x01 ; 1
3e694: 82 2f mov r24, r18
checksum ^=c;
3e696: 71 dd rcall .-1310 ; 0x3e17a <sendchar>
3e698: c1 5e subi r28, 0xE1 ; 225
3e69a: de 4f sbci r29, 0xFE ; 254
3e69c: 38 81 ld r19, Y
3e69e: cf 51 subi r28, 0x1F ; 31
3e6a0: d1 40 sbci r29, 0x01 ; 1
3e6a2: d3 26 eor r13, r19
msgLength--;
}
sendchar(checksum);
3e6a4: ec cf rjmp .-40 ; 0x3e67e <main+0x4ec>
3e6a6: 8d 2d mov r24, r13
3e6a8: 68 dd rcall .-1328 ; 0x3e17a <sendchar>
seqNum++;
3e6aa: c2 5e subi r28, 0xE2 ; 226
3e6ac: de 4f sbci r29, 0xFE ; 254
3e6ae: 48 81 ld r20, Y
3e6b0: ce 51 subi r28, 0x1E ; 30
3e6b2: d1 40 sbci r29, 0x01 ; 1
3e6b4: 4f 5f subi r20, 0xFF ; 255
3e6b6: c2 5e subi r28, 0xE2 ; 226
3e6b8: de 4f sbci r29, 0xFE ; 254
3e6ba: 48 83 st Y, r20
3e6bc: ce 51 subi r28, 0x1E ; 30
3e6be: d1 40 sbci r29, 0x01 ; 1
3e6c0: 00 e0 ldi r16, 0x00 ; 0
3e6c2: 10 e0 ldi r17, 0x00 ; 0
if (boot_state==1)
{
//* main loop
while (!isLeave)
3e6c4: cc 20 and r12, r12
3e6c6: 09 f4 brne .+2 ; 0x3e6ca <main+0x538>
3e6c8: dc cd rjmp .-1096 ; 0x3e282 <main+0xf0>
// PROGLED_PORT |= (1<<PROGLED_PIN); // active high LED OFf
delay_ms(100); // delay after exit
#endif
asm volatile ("nop"); // wait until port has changed
3e6ca: 00 00 nop
/*
* Now leave bootloader
*/
UART_STATUS_REG &= 0xfd;
3e6cc: 80 91 c0 00 lds r24, 0x00C0 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7c00c0>
3e6d0: 8d 7f andi r24, 0xFD ; 253
3e6d2: 80 93 c0 00 sts 0x00C0, r24 ; 0x8000c0 <__TEXT_REGION_LENGTH__+0x7c00c0>
boot_rww_enable(); // enable application section
3e6d6: 81 e1 ldi r24, 0x11 ; 17
3e6d8: 80 93 57 00 sts 0x0057, r24 ; 0x800057 <__TEXT_REGION_LENGTH__+0x7c0057>
3e6dc: e8 95 spm
asm volatile(
3e6de: ee 27 eor r30, r30
3e6e0: ff 27 eor r31, r31
3e6e2: 09 94 ijmp
3e6e4: ff cf rjmp .-2 ; 0x3e6e4 <main+0x552>
{
case ST_START:
if ( c == MESSAGE_START )
{
msgParseState = ST_GET_SEQ_NUM;
checksum = MESSAGE_START^0;
3e6e6: 8b e1 ldi r24, 0x1B ; 27
3e6e8: d8 2e mov r13, r24
switch (msgParseState)
{
case ST_START:
if ( c == MESSAGE_START )
{
msgParseState = ST_GET_SEQ_NUM;
3e6ea: 21 e0 ldi r18, 0x01 ; 1
3e6ec: f7 cd rjmp .-1042 ; 0x3e2dc <main+0x14a>
checksum ^= c;
ii = 0;
}
else
{
msgParseState = ST_START;
3e6ee: 20 e0 ldi r18, 0x00 ; 0
3e6f0: f5 cd rjmp .-1046 ; 0x3e2dc <main+0x14a>
3e6f2: 1a 01 movw r2, r20
case ST_GET_DATA:
msgBuffer[ii++] = c;
checksum ^= c;
if (ii == msgLength )
{
msgParseState = ST_GET_CHECK;
3e6f4: 26 e0 ldi r18, 0x06 ; 6
3e6f6: f2 cd rjmp .-1052 ; 0x3e2dc <main+0x14a>
0003e6f8 <__udivmodsi4>:
3e6f8: a1 e2 ldi r26, 0x21 ; 33
3e6fa: 1a 2e mov r1, r26
3e6fc: aa 1b sub r26, r26
3e6fe: bb 1b sub r27, r27
3e700: fd 01 movw r30, r26
3e702: 0d c0 rjmp .+26 ; 0x3e71e <__udivmodsi4_ep>
0003e704 <__udivmodsi4_loop>:
3e704: aa 1f adc r26, r26
3e706: bb 1f adc r27, r27
3e708: ee 1f adc r30, r30
3e70a: ff 1f adc r31, r31
3e70c: a2 17 cp r26, r18
3e70e: b3 07 cpc r27, r19
3e710: e4 07 cpc r30, r20
3e712: f5 07 cpc r31, r21
3e714: 20 f0 brcs .+8 ; 0x3e71e <__udivmodsi4_ep>
3e716: a2 1b sub r26, r18
3e718: b3 0b sbc r27, r19
3e71a: e4 0b sbc r30, r20
3e71c: f5 0b sbc r31, r21
0003e71e <__udivmodsi4_ep>:
3e71e: 66 1f adc r22, r22
3e720: 77 1f adc r23, r23
3e722: 88 1f adc r24, r24
3e724: 99 1f adc r25, r25
3e726: 1a 94 dec r1
3e728: 69 f7 brne .-38 ; 0x3e704 <__udivmodsi4_loop>
3e72a: 60 95 com r22
3e72c: 70 95 com r23
3e72e: 80 95 com r24
3e730: 90 95 com r25
3e732: 9b 01 movw r18, r22
3e734: ac 01 movw r20, r24
3e736: bd 01 movw r22, r26
3e738: cf 01 movw r24, r30
3e73a: 08 95 ret
0003e73c <__tablejump2__>:
3e73c: ee 0f add r30, r30
3e73e: ff 1f adc r31, r31
3e740: 88 1f adc r24, r24
3e742: 8b bf out 0x3b, r24 ; 59
3e744: 07 90 elpm r0, Z+
3e746: f6 91 elpm r31, Z
3e748: e0 2d mov r30, r0
3e74a: 19 94 eijmp
0003e74c <__bswapsi2>:
3e74c: 69 27 eor r22, r25
3e74e: 96 27 eor r25, r22
3e750: 69 27 eor r22, r25
3e752: 78 27 eor r23, r24
3e754: 87 27 eor r24, r23
3e756: 78 27 eor r23, r24
3e758: 08 95 ret
0003e75a <eeprom_write_byte>:
3e75a: 26 2f mov r18, r22
0003e75c <eeprom_write_r18>:
3e75c: f9 99 sbic 0x1f, 1 ; 31
3e75e: fe cf rjmp .-4 ; 0x3e75c <eeprom_write_r18>
3e760: 1f ba out 0x1f, r1 ; 31
3e762: 92 bd out 0x22, r25 ; 34
3e764: 81 bd out 0x21, r24 ; 33
3e766: 20 bd out 0x20, r18 ; 32
3e768: 0f b6 in r0, 0x3f ; 63
3e76a: f8 94 cli
3e76c: fa 9a sbi 0x1f, 2 ; 31
3e76e: f9 9a sbi 0x1f, 1 ; 31
3e770: 0f be out 0x3f, r0 ; 63
3e772: 01 96 adiw r24, 0x01 ; 1
3e774: 08 95 ret
0003e776 <_exit>:
3e776: f8 94 cli
0003e778 <__stop_program>:
3e778: ff cf rjmp .-2 ; 0x3e778 <__stop_program>