aboutsummaryrefslogtreecommitdiff
path: root/bootloaders/optiboot/optiboot_pro_20mhz.lst
blob: ba7b6b6ff86c5a1e4e044696d7cbb3ae2a1edc87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
optiboot_pro_20mhz.elf:     file format elf32-avr

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         000001fc  00003e00  00003e00  00000054  2**1
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .version      00000002  00003ffe  00003ffe  00000250  2**0
                  CONTENTS, READONLY
  2 .debug_aranges 00000028  00000000  00000000  00000252  2**0
                  CONTENTS, READONLY, DEBUGGING
  3 .debug_pubnames 0000006a  00000000  00000000  0000027a  2**0
                  CONTENTS, READONLY, DEBUGGING
  4 .debug_info   00000285  00000000  00000000  000002e4  2**0
                  CONTENTS, READONLY, DEBUGGING
  5 .debug_abbrev 0000019f  00000000  00000000  00000569  2**0
                  CONTENTS, READONLY, DEBUGGING
  6 .debug_line   00000453  00000000  00000000  00000708  2**0
                  CONTENTS, READONLY, DEBUGGING
  7 .debug_frame  00000090  00000000  00000000  00000b5c  2**2
                  CONTENTS, READONLY, DEBUGGING
  8 .debug_str    00000141  00000000  00000000  00000bec  2**0
                  CONTENTS, READONLY, DEBUGGING
  9 .debug_loc    000001e1  00000000  00000000  00000d2d  2**0
                  CONTENTS, READONLY, DEBUGGING
 10 .debug_ranges 00000068  00000000  00000000  00000f0e  2**0
                  CONTENTS, READONLY, DEBUGGING

Disassembly of section .text:

00003e00 <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) {
    3e00:	11 24       	eor	r1, r1
#ifdef __AVR_ATmega8__
  SP=RAMEND;  // This is done by hardware reset
#endif

  // Adaboot no-wait mod
  ch = MCUSR;
    3e02:	84 b7       	in	r24, 0x34	; 52
  MCUSR = 0;
    3e04:	14 be       	out	0x34, r1	; 52
  if (!(ch & _BV(EXTRF))) appStart();
    3e06:	81 ff       	sbrs	r24, 1
    3e08:	e6 d0       	rcall	.+460    	; 0x3fd6 <appStart>

#if LED_START_FLASHES > 0
  // Set up Timer 1 for timeout counter
  TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
    3e0a:	85 e0       	ldi	r24, 0x05	; 5
    3e0c:	80 93 81 00 	sts	0x0081, r24
  UCSRA = _BV(U2X); //Double speed mode USART
  UCSRB = _BV(RXEN) | _BV(TXEN);  // enable Rx & Tx
  UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0);  // config USART; 8N1
  UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
#else
  UCSR0A = _BV(U2X0); //Double speed mode USART0
    3e10:	82 e0       	ldi	r24, 0x02	; 2
    3e12:	80 93 c0 00 	sts	0x00C0, r24
  UCSR0B = _BV(RXEN0) | _BV(TXEN0);
    3e16:	88 e1       	ldi	r24, 0x18	; 24
    3e18:	80 93 c1 00 	sts	0x00C1, r24
  UCSR0C = _BV(UCSZ00) | _BV(UCSZ01);
    3e1c:	86 e0       	ldi	r24, 0x06	; 6
    3e1e:	80 93 c2 00 	sts	0x00C2, r24
  UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
    3e22:	85 e1       	ldi	r24, 0x15	; 21
    3e24:	80 93 c4 00 	sts	0x00C4, r24
#endif
#endif

  // Set up watchdog to trigger after 500ms
  watchdogConfig(WATCHDOG_1S);
    3e28:	8e e0       	ldi	r24, 0x0E	; 14
    3e2a:	cf d0       	rcall	.+414    	; 0x3fca <watchdogConfig>

  /* Set LED pin as output */
  LED_DDR |= _BV(LED);
    3e2c:	25 9a       	sbi	0x04, 5	; 4
    3e2e:	86 e0       	ldi	r24, 0x06	; 6
}

#if LED_START_FLASHES > 0
void flash_led(uint8_t count) {
  do {
    TCNT1 = -(F_CPU/(1024*16));
    3e30:	2c e3       	ldi	r18, 0x3C	; 60
    3e32:	3b ef       	ldi	r19, 0xFB	; 251
    TIFR1 = _BV(TOV1);
    3e34:	91 e0       	ldi	r25, 0x01	; 1
}

#if LED_START_FLASHES > 0
void flash_led(uint8_t count) {
  do {
    TCNT1 = -(F_CPU/(1024*16));
    3e36:	30 93 85 00 	sts	0x0085, r19
    3e3a:	20 93 84 00 	sts	0x0084, r18
    TIFR1 = _BV(TOV1);
    3e3e:	96 bb       	out	0x16, r25	; 22
    while(!(TIFR1 & _BV(TOV1)));
    3e40:	b0 9b       	sbis	0x16, 0	; 22
    3e42:	fe cf       	rjmp	.-4      	; 0x3e40 <main+0x40>
#ifdef __AVR_ATmega8__
    LED_PORT ^= _BV(LED);
#else
    LED_PIN |= _BV(LED);
    3e44:	1d 9a       	sbi	0x03, 5	; 3
  return getch();
}

// Watchdog functions. These are only safe with interrupts turned off.
void watchdogReset() {
  __asm__ __volatile__ (
    3e46:	a8 95       	wdr
    LED_PORT ^= _BV(LED);
#else
    LED_PIN |= _BV(LED);
#endif
    watchdogReset();
  } while (--count);
    3e48:	81 50       	subi	r24, 0x01	; 1
    3e4a:	a9 f7       	brne	.-22     	; 0x3e36 <main+0x36>
    /* get character from UART */
    ch = getch();

    if(ch == STK_GET_PARAMETER) {
      // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy
      getNch(1);
    3e4c:	dd 24       	eor	r13, r13
    3e4e:	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);
    3e50:	a5 e0       	ldi	r26, 0x05	; 5
    3e52:	ea 2e       	mov	r14, r26
      boot_spm_busy_wait();

#if defined(RWWSRE)
      // Reenable read access to flash
      boot_rww_enable();
    3e54:	f1 e1       	ldi	r31, 0x11	; 17
    3e56:	ff 2e       	mov	r15, r31
#endif

  /* Forever loop */
  for (;;) {
    /* get character from UART */
    ch = getch();
    3e58:	ab d0       	rcall	.+342    	; 0x3fb0 <getch>

    if(ch == STK_GET_PARAMETER) {
    3e5a:	81 34       	cpi	r24, 0x41	; 65
    3e5c:	21 f4       	brne	.+8      	; 0x3e66 <main+0x66>
      // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy
      getNch(1);
    3e5e:	81 e0       	ldi	r24, 0x01	; 1
    3e60:	c5 d0       	rcall	.+394    	; 0x3fec <getNch>
      putch(0x03);
    3e62:	83 e0       	ldi	r24, 0x03	; 3
    3e64:	20 c0       	rjmp	.+64     	; 0x3ea6 <main+0xa6>
    }
    else if(ch == STK_SET_DEVICE) {
    3e66:	82 34       	cpi	r24, 0x42	; 66
    3e68:	11 f4       	brne	.+4      	; 0x3e6e <main+0x6e>
      // SET DEVICE is ignored
      getNch(20);
    3e6a:	84 e1       	ldi	r24, 0x14	; 20
    3e6c:	03 c0       	rjmp	.+6      	; 0x3e74 <main+0x74>
    }
    else if(ch == STK_SET_DEVICE_EXT) {
    3e6e:	85 34       	cpi	r24, 0x45	; 69
    3e70:	19 f4       	brne	.+6      	; 0x3e78 <main+0x78>
      // SET DEVICE EXT is ignored
      getNch(5);
    3e72:	85 e0       	ldi	r24, 0x05	; 5
    3e74:	bb d0       	rcall	.+374    	; 0x3fec <getNch>
    3e76:	91 c0       	rjmp	.+290    	; 0x3f9a <main+0x19a>
    }
    else if(ch == STK_LOAD_ADDRESS) {
    3e78:	85 35       	cpi	r24, 0x55	; 85
    3e7a:	81 f4       	brne	.+32     	; 0x3e9c <main+0x9c>
      // LOAD ADDRESS
      uint16_t newAddress;
      newAddress = getch();
    3e7c:	99 d0       	rcall	.+306    	; 0x3fb0 <getch>
      newAddress = (newAddress & 0xff) | (getch() << 8);
    3e7e:	08 2f       	mov	r16, r24
    3e80:	10 e0       	ldi	r17, 0x00	; 0
    3e82:	96 d0       	rcall	.+300    	; 0x3fb0 <getch>
    3e84:	90 e0       	ldi	r25, 0x00	; 0
    3e86:	98 2f       	mov	r25, r24
    3e88:	88 27       	eor	r24, r24
    3e8a:	80 2b       	or	r24, r16
    3e8c:	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
    3e8e:	88 0f       	add	r24, r24
    3e90:	99 1f       	adc	r25, r25
      address = newAddress;
    3e92:	90 93 01 02 	sts	0x0201, r25
    3e96:	80 93 00 02 	sts	0x0200, r24
    3e9a:	7e c0       	rjmp	.+252    	; 0x3f98 <main+0x198>
      verifySpace();
    }
    else if(ch == STK_UNIVERSAL) {
    3e9c:	86 35       	cpi	r24, 0x56	; 86
    3e9e:	29 f4       	brne	.+10     	; 0x3eaa <main+0xaa>
      // UNIVERSAL command is ignored
      getNch(4);
    3ea0:	84 e0       	ldi	r24, 0x04	; 4
    3ea2:	a4 d0       	rcall	.+328    	; 0x3fec <getNch>
      putch(0x00);
    3ea4:	80 e0       	ldi	r24, 0x00	; 0
    3ea6:	7c d0       	rcall	.+248    	; 0x3fa0 <putch>
    3ea8:	78 c0       	rjmp	.+240    	; 0x3f9a <main+0x19a>
    }
    /* Write memory, length is big endian and is in bytes */
    else if(ch == STK_PROG_PAGE) {
    3eaa:	84 36       	cpi	r24, 0x64	; 100
    3eac:	09 f0       	breq	.+2      	; 0x3eb0 <main+0xb0>
    3eae:	4e c0       	rjmp	.+156    	; 0x3f4c <main+0x14c>
      // PROGRAM PAGE - we support flash programming only, not EEPROM
      uint8_t *bufPtr;
      uint16_t addrPtr;

      getLen();
    3eb0:	87 d0       	rcall	.+270    	; 0x3fc0 <getLen>

      // If we are in RWW section, immediately start page erase
      if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address);
    3eb2:	e0 91 00 02 	lds	r30, 0x0200
    3eb6:	f0 91 01 02 	lds	r31, 0x0201
    3eba:	88 e3       	ldi	r24, 0x38	; 56
    3ebc:	e0 30       	cpi	r30, 0x00	; 0
    3ebe:	f8 07       	cpc	r31, r24
    3ec0:	18 f4       	brcc	.+6      	; 0x3ec8 <main+0xc8>
    3ec2:	83 e0       	ldi	r24, 0x03	; 3
    3ec4:	87 bf       	out	0x37, r24	; 55
    3ec6:	e8 95       	spm
    3ec8:	c0 e0       	ldi	r28, 0x00	; 0
    3eca:	d1 e0       	ldi	r29, 0x01	; 1

      // While that is going on, read in page contents
      bufPtr = buff;
      do *bufPtr++ = getch();
    3ecc:	71 d0       	rcall	.+226    	; 0x3fb0 <getch>
    3ece:	89 93       	st	Y+, r24
      while (--length);
    3ed0:	80 91 02 02 	lds	r24, 0x0202
    3ed4:	81 50       	subi	r24, 0x01	; 1
    3ed6:	80 93 02 02 	sts	0x0202, r24
    3eda:	88 23       	and	r24, r24
    3edc:	b9 f7       	brne	.-18     	; 0x3ecc <main+0xcc>

      // If we are in NRWW section, page erase has to be delayed until now.
      // Todo: Take RAMPZ into account
      if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address);
    3ede:	e0 91 00 02 	lds	r30, 0x0200
    3ee2:	f0 91 01 02 	lds	r31, 0x0201
    3ee6:	88 e3       	ldi	r24, 0x38	; 56
    3ee8:	e0 30       	cpi	r30, 0x00	; 0
    3eea:	f8 07       	cpc	r31, r24
    3eec:	18 f0       	brcs	.+6      	; 0x3ef4 <main+0xf4>
    3eee:	83 e0       	ldi	r24, 0x03	; 3
    3ef0:	87 bf       	out	0x37, r24	; 55
    3ef2:	e8 95       	spm

      // Read command terminator, start reply
      verifySpace();
    3ef4:	75 d0       	rcall	.+234    	; 0x3fe0 <verifySpace>

      // If only a partial page is to be programmed, the erase might not be complete.
      // So check that here
      boot_spm_busy_wait();
    3ef6:	07 b6       	in	r0, 0x37	; 55
    3ef8:	00 fc       	sbrc	r0, 0
    3efa:	fd cf       	rjmp	.-6      	; 0x3ef6 <main+0xf6>
      }
#endif

      // Copy buffer into programming buffer
      bufPtr = buff;
      addrPtr = (uint16_t)(void*)address;
    3efc:	40 91 00 02 	lds	r20, 0x0200
    3f00:	50 91 01 02 	lds	r21, 0x0201
    3f04:	a0 e0       	ldi	r26, 0x00	; 0
    3f06:	b1 e0       	ldi	r27, 0x01	; 1
      ch = SPM_PAGESIZE / 2;
      do {
        uint16_t a;
        a = *bufPtr++;
    3f08:	2c 91       	ld	r18, X
    3f0a:	30 e0       	ldi	r19, 0x00	; 0
        a |= (*bufPtr++) << 8;
    3f0c:	11 96       	adiw	r26, 0x01	; 1
    3f0e:	8c 91       	ld	r24, X
    3f10:	11 97       	sbiw	r26, 0x01	; 1
    3f12:	90 e0       	ldi	r25, 0x00	; 0
    3f14:	98 2f       	mov	r25, r24
    3f16:	88 27       	eor	r24, r24
    3f18:	82 2b       	or	r24, r18
    3f1a:	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) {
    3f1c:	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);
    3f1e:	fa 01       	movw	r30, r20
    3f20:	0c 01       	movw	r0, r24
    3f22:	d7 be       	out	0x37, r13	; 55
    3f24:	e8 95       	spm
    3f26:	11 24       	eor	r1, r1
        addrPtr += 2;
    3f28:	4e 5f       	subi	r20, 0xFE	; 254
    3f2a:	5f 4f       	sbci	r21, 0xFF	; 255
      } while (--ch);
    3f2c:	f1 e0       	ldi	r31, 0x01	; 1
    3f2e:	a0 38       	cpi	r26, 0x80	; 128
    3f30:	bf 07       	cpc	r27, r31
    3f32:	51 f7       	brne	.-44     	; 0x3f08 <main+0x108>

      // Write from programming buffer
      __boot_page_write_short((uint16_t)(void*)address);
    3f34:	e0 91 00 02 	lds	r30, 0x0200
    3f38:	f0 91 01 02 	lds	r31, 0x0201
    3f3c:	e7 be       	out	0x37, r14	; 55
    3f3e:	e8 95       	spm
      boot_spm_busy_wait();
    3f40:	07 b6       	in	r0, 0x37	; 55
    3f42:	00 fc       	sbrc	r0, 0
    3f44:	fd cf       	rjmp	.-6      	; 0x3f40 <main+0x140>

#if defined(RWWSRE)
      // Reenable read access to flash
      boot_rww_enable();
    3f46:	f7 be       	out	0x37, r15	; 55
    3f48:	e8 95       	spm
    3f4a:	27 c0       	rjmp	.+78     	; 0x3f9a <main+0x19a>
#endif

    }
    /* Read memory block mode, length is big endian.  */
    else if(ch == STK_READ_PAGE) {
    3f4c:	84 37       	cpi	r24, 0x74	; 116
    3f4e:	b9 f4       	brne	.+46     	; 0x3f7e <main+0x17e>
      // READ PAGE - we only read flash
      getLen();
    3f50:	37 d0       	rcall	.+110    	; 0x3fc0 <getLen>
      verifySpace();
    3f52:	46 d0       	rcall	.+140    	; 0x3fe0 <verifySpace>
        putch(result);
        address++;
      }
      while (--length);
#else
      do putch(pgm_read_byte_near(address++));
    3f54:	e0 91 00 02 	lds	r30, 0x0200
    3f58:	f0 91 01 02 	lds	r31, 0x0201
    3f5c:	31 96       	adiw	r30, 0x01	; 1
    3f5e:	f0 93 01 02 	sts	0x0201, r31
    3f62:	e0 93 00 02 	sts	0x0200, r30
    3f66:	31 97       	sbiw	r30, 0x01	; 1
    3f68:	e4 91       	lpm	r30, Z+
    3f6a:	8e 2f       	mov	r24, r30
    3f6c:	19 d0       	rcall	.+50     	; 0x3fa0 <putch>
      while (--length);
    3f6e:	80 91 02 02 	lds	r24, 0x0202
    3f72:	81 50       	subi	r24, 0x01	; 1
    3f74:	80 93 02 02 	sts	0x0202, r24
    3f78:	88 23       	and	r24, r24
    3f7a:	61 f7       	brne	.-40     	; 0x3f54 <main+0x154>
    3f7c:	0e c0       	rjmp	.+28     	; 0x3f9a <main+0x19a>
#endif
#endif
    }

    /* Get device signature bytes  */
    else if(ch == STK_READ_SIGN) {
    3f7e:	85 37       	cpi	r24, 0x75	; 117
    3f80:	39 f4       	brne	.+14     	; 0x3f90 <main+0x190>
      // READ SIGN - return what Avrdude wants to hear
      verifySpace();
    3f82:	2e d0       	rcall	.+92     	; 0x3fe0 <verifySpace>
      putch(SIGNATURE_0);
    3f84:	8e e1       	ldi	r24, 0x1E	; 30
    3f86:	0c d0       	rcall	.+24     	; 0x3fa0 <putch>
      putch(SIGNATURE_1);
    3f88:	84 e9       	ldi	r24, 0x94	; 148
    3f8a:	0a d0       	rcall	.+20     	; 0x3fa0 <putch>
      putch(SIGNATURE_2);
    3f8c:	86 e0       	ldi	r24, 0x06	; 6
    3f8e:	8b cf       	rjmp	.-234    	; 0x3ea6 <main+0xa6>
    }
    else if (ch == 'Q') {
    3f90:	81 35       	cpi	r24, 0x51	; 81
    3f92:	11 f4       	brne	.+4      	; 0x3f98 <main+0x198>
      // Adaboot no-wait mod
      watchdogConfig(WATCHDOG_16MS);
    3f94:	88 e0       	ldi	r24, 0x08	; 8
    3f96:	19 d0       	rcall	.+50     	; 0x3fca <watchdogConfig>
      verifySpace();
    }
    else {
      // This covers the response to commands like STK_ENTER_PROGMODE
      verifySpace();
    3f98:	23 d0       	rcall	.+70     	; 0x3fe0 <verifySpace>
    }
    putch(STK_OK);
    3f9a:	80 e1       	ldi	r24, 0x10	; 16
    3f9c:	01 d0       	rcall	.+2      	; 0x3fa0 <putch>
    3f9e:	5c cf       	rjmp	.-328    	; 0x3e58 <main+0x58>

00003fa0 <putch>:
  }
}

void putch(char ch) {
    3fa0:	98 2f       	mov	r25, r24
#ifndef SOFT_UART
  while (!(UCSR0A & _BV(UDRE0)));
    3fa2:	80 91 c0 00 	lds	r24, 0x00C0
    3fa6:	85 ff       	sbrs	r24, 5
    3fa8:	fc cf       	rjmp	.-8      	; 0x3fa2 <putch+0x2>
  UDR0 = ch;
    3faa:	90 93 c6 00 	sts	0x00C6, r25
      [uartBit] "I" (UART_TX_BIT)
    :
      "r25"
  );
#endif
}
    3fae:	08 95       	ret

00003fb0 <getch>:
  return getch();
}

// Watchdog functions. These are only safe with interrupts turned off.
void watchdogReset() {
  __asm__ __volatile__ (
    3fb0:	a8 95       	wdr
      [uartBit] "I" (UART_RX_BIT)
    :
      "r25"
);
#else
  while(!(UCSR0A & _BV(RXC0)));
    3fb2:	80 91 c0 00 	lds	r24, 0x00C0
    3fb6:	87 ff       	sbrs	r24, 7
    3fb8:	fc cf       	rjmp	.-8      	; 0x3fb2 <getch+0x2>
  ch = UDR0;
    3fba:	80 91 c6 00 	lds	r24, 0x00C6
  LED_PIN |= _BV(LED);
#endif
#endif

  return ch;
}
    3fbe:	08 95       	ret

00003fc0 <getLen>:
  } while (--count);
}
#endif

uint8_t getLen() {
  getch();
    3fc0:	f7 df       	rcall	.-18     	; 0x3fb0 <getch>
  length = getch();
    3fc2:	f6 df       	rcall	.-20     	; 0x3fb0 <getch>
    3fc4:	80 93 02 02 	sts	0x0202, r24
  return getch();
}
    3fc8:	f3 cf       	rjmp	.-26     	; 0x3fb0 <getch>

00003fca <watchdogConfig>:
    "wdr\n"
  );
}

void watchdogConfig(uint8_t x) {
  WDTCSR = _BV(WDCE) | _BV(WDE);
    3fca:	e0 e6       	ldi	r30, 0x60	; 96
    3fcc:	f0 e0       	ldi	r31, 0x00	; 0
    3fce:	98 e1       	ldi	r25, 0x18	; 24
    3fd0:	90 83       	st	Z, r25
  WDTCSR = x;
    3fd2:	80 83       	st	Z, r24
}
    3fd4:	08 95       	ret

00003fd6 <appStart>:

void appStart() {
  watchdogConfig(WATCHDOG_OFF);
    3fd6:	80 e0       	ldi	r24, 0x00	; 0
    3fd8:	f8 df       	rcall	.-16     	; 0x3fca <watchdogConfig>
  __asm__ __volatile__ (
    3fda:	ee 27       	eor	r30, r30
    3fdc:	ff 27       	eor	r31, r31
    3fde:	09 94       	ijmp

00003fe0 <verifySpace>:
  do getch(); while (--count);
  verifySpace();
}

void verifySpace() {
  if (getch() != CRC_EOP) appStart();
    3fe0:	e7 df       	rcall	.-50     	; 0x3fb0 <getch>
    3fe2:	80 32       	cpi	r24, 0x20	; 32
    3fe4:	09 f0       	breq	.+2      	; 0x3fe8 <verifySpace+0x8>
    3fe6:	f7 df       	rcall	.-18     	; 0x3fd6 <appStart>
  putch(STK_INSYNC);
    3fe8:	84 e1       	ldi	r24, 0x14	; 20
}
    3fea:	da cf       	rjmp	.-76     	; 0x3fa0 <putch>

00003fec <getNch>:
    ::[count] "M" (UART_B_VALUE)
  );
}
#endif

void getNch(uint8_t count) {
    3fec:	1f 93       	push	r17
    3fee:	18 2f       	mov	r17, r24
  do getch(); while (--count);
    3ff0:	df df       	rcall	.-66     	; 0x3fb0 <getch>
    3ff2:	11 50       	subi	r17, 0x01	; 1
    3ff4:	e9 f7       	brne	.-6      	; 0x3ff0 <getNch+0x4>
  verifySpace();
    3ff6:	f4 df       	rcall	.-24     	; 0x3fe0 <verifySpace>
}
    3ff8:	1f 91       	pop	r17
    3ffa:	08 95       	ret