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
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
|
optiboot_atmega328.elf: file format elf32-avr
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 000001f4 00007e00 00007e00 00000054 2**1
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .version 00000002 00007ffe 00007ffe 00000248 2**0
CONTENTS, READONLY
2 .debug_aranges 00000028 00000000 00000000 0000024a 2**0
CONTENTS, READONLY, DEBUGGING
3 .debug_pubnames 0000005f 00000000 00000000 00000272 2**0
CONTENTS, READONLY, DEBUGGING
4 .debug_info 000002a8 00000000 00000000 000002d1 2**0
CONTENTS, READONLY, DEBUGGING
5 .debug_abbrev 00000178 00000000 00000000 00000579 2**0
CONTENTS, READONLY, DEBUGGING
6 .debug_line 00000488 00000000 00000000 000006f1 2**0
CONTENTS, READONLY, DEBUGGING
7 .debug_frame 00000080 00000000 00000000 00000b7c 2**2
CONTENTS, READONLY, DEBUGGING
8 .debug_str 0000014f 00000000 00000000 00000bfc 2**0
CONTENTS, READONLY, DEBUGGING
9 .debug_loc 000002d8 00000000 00000000 00000d4b 2**0
CONTENTS, READONLY, DEBUGGING
10 .debug_ranges 00000078 00000000 00000000 00001023 2**0
CONTENTS, READONLY, DEBUGGING
Disassembly of section .text:
00007e00 <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) {
7e00: 11 24 eor r1, r1
#ifdef __AVR_ATmega8__
SP=RAMEND; // This is done by hardware reset
#endif
// Adaboot no-wait mod
ch = MCUSR;
7e02: 84 b7 in r24, 0x34 ; 52
MCUSR = 0;
7e04: 14 be out 0x34, r1 ; 52
if (!(ch & _BV(EXTRF))) appStart();
7e06: 81 ff sbrs r24, 1
7e08: f0 d0 rcall .+480 ; 0x7fea <appStart>
#if LED_START_FLASHES > 0
// Set up Timer 1 for timeout counter
TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
7e0a: 85 e0 ldi r24, 0x05 ; 5
7e0c: 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
7e10: 82 e0 ldi r24, 0x02 ; 2
7e12: 80 93 c0 00 sts 0x00C0, r24
UCSR0B = _BV(RXEN0) | _BV(TXEN0);
7e16: 88 e1 ldi r24, 0x18 ; 24
7e18: 80 93 c1 00 sts 0x00C1, r24
UCSR0C = _BV(UCSZ00) | _BV(UCSZ01);
7e1c: 86 e0 ldi r24, 0x06 ; 6
7e1e: 80 93 c2 00 sts 0x00C2, r24
UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
7e22: 80 e1 ldi r24, 0x10 ; 16
7e24: 80 93 c4 00 sts 0x00C4, r24
#endif
#endif
// Set up watchdog to trigger after 500ms
watchdogConfig(WATCHDOG_1S);
7e28: 8e e0 ldi r24, 0x0E ; 14
7e2a: c9 d0 rcall .+402 ; 0x7fbe <watchdogConfig>
/* Set LED pin as output */
LED_DDR |= _BV(LED);
7e2c: 25 9a sbi 0x04, 5 ; 4
7e2e: 86 e0 ldi r24, 0x06 ; 6
}
#if LED_START_FLASHES > 0
void flash_led(uint8_t count) {
do {
TCNT1 = -(F_CPU/(1024*16));
7e30: 20 e3 ldi r18, 0x30 ; 48
7e32: 3c ef ldi r19, 0xFC ; 252
TIFR1 = _BV(TOV1);
7e34: 91 e0 ldi r25, 0x01 ; 1
}
#if LED_START_FLASHES > 0
void flash_led(uint8_t count) {
do {
TCNT1 = -(F_CPU/(1024*16));
7e36: 30 93 85 00 sts 0x0085, r19
7e3a: 20 93 84 00 sts 0x0084, r18
TIFR1 = _BV(TOV1);
7e3e: 96 bb out 0x16, r25 ; 22
while(!(TIFR1 & _BV(TOV1)));
7e40: b0 9b sbis 0x16, 0 ; 22
7e42: fe cf rjmp .-4 ; 0x7e40 <main+0x40>
#ifdef __AVR_ATmega8__
LED_PORT ^= _BV(LED);
#else
LED_PIN |= _BV(LED);
7e44: 1d 9a sbi 0x03, 5 ; 3
}
#endif
// Watchdog functions. These are only safe with interrupts turned off.
void watchdogReset() {
__asm__ __volatile__ (
7e46: a8 95 wdr
LED_PORT ^= _BV(LED);
#else
LED_PIN |= _BV(LED);
#endif
watchdogReset();
} while (--count);
7e48: 81 50 subi r24, 0x01 ; 1
7e4a: a9 f7 brne .-22 ; 0x7e36 <main+0x36>
7e4c: cc 24 eor r12, r12
7e4e: dd 24 eor r13, r13
ch = SPM_PAGESIZE / 2;
do {
uint16_t a;
a = *bufPtr++;
a |= (*bufPtr++) << 8;
__boot_page_fill_short((uint16_t)(void*)addrPtr,a);
7e50: 88 24 eor r8, r8
7e52: 83 94 inc r8
addrPtr += 2;
} while (--ch);
// Write from programming buffer
__boot_page_write_short((uint16_t)(void*)address);
7e54: b5 e0 ldi r27, 0x05 ; 5
7e56: ab 2e mov r10, r27
boot_spm_busy_wait();
#if defined(RWWSRE)
// Reenable read access to flash
boot_rww_enable();
7e58: a1 e1 ldi r26, 0x11 ; 17
7e5a: 9a 2e mov r9, r26
do *bufPtr++ = getch();
while (--length);
// 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);
7e5c: f3 e0 ldi r31, 0x03 ; 3
7e5e: bf 2e mov r11, r31
#endif
/* Forever loop */
for (;;) {
/* get character from UART */
ch = getch();
7e60: a2 d0 rcall .+324 ; 0x7fa6 <getch>
if(ch == STK_GET_PARAMETER) {
7e62: 81 34 cpi r24, 0x41 ; 65
7e64: 61 f4 brne .+24 ; 0x7e7e <main+0x7e>
unsigned char which = getch();
7e66: 9f d0 rcall .+318 ; 0x7fa6 <getch>
7e68: 08 2f mov r16, r24
verifySpace();
7e6a: af d0 rcall .+350 ; 0x7fca <verifySpace>
if (which == 0x82) {
7e6c: 02 38 cpi r16, 0x82 ; 130
7e6e: 11 f0 breq .+4 ; 0x7e74 <main+0x74>
/*
* Send optiboot version as "minor SW version"
*/
putch(OPTIBOOT_MINVER);
} else if (which == 0x81) {
7e70: 01 38 cpi r16, 0x81 ; 129
7e72: 11 f4 brne .+4 ; 0x7e78 <main+0x78>
putch(OPTIBOOT_MAJVER);
7e74: 84 e0 ldi r24, 0x04 ; 4
7e76: 01 c0 rjmp .+2 ; 0x7e7a <main+0x7a>
} else {
/*
* GET PARAMETER returns a generic 0x03 reply for
* other parameters - enough to keep Avrdude happy
*/
putch(0x03);
7e78: 83 e0 ldi r24, 0x03 ; 3
7e7a: 8d d0 rcall .+282 ; 0x7f96 <putch>
7e7c: 89 c0 rjmp .+274 ; 0x7f90 <main+0x190>
}
}
else if(ch == STK_SET_DEVICE) {
7e7e: 82 34 cpi r24, 0x42 ; 66
7e80: 11 f4 brne .+4 ; 0x7e86 <main+0x86>
// SET DEVICE is ignored
getNch(20);
7e82: 84 e1 ldi r24, 0x14 ; 20
7e84: 03 c0 rjmp .+6 ; 0x7e8c <main+0x8c>
}
else if(ch == STK_SET_DEVICE_EXT) {
7e86: 85 34 cpi r24, 0x45 ; 69
7e88: 19 f4 brne .+6 ; 0x7e90 <main+0x90>
// SET DEVICE EXT is ignored
getNch(5);
7e8a: 85 e0 ldi r24, 0x05 ; 5
7e8c: a6 d0 rcall .+332 ; 0x7fda <getNch>
7e8e: 80 c0 rjmp .+256 ; 0x7f90 <main+0x190>
}
else if(ch == STK_LOAD_ADDRESS) {
7e90: 85 35 cpi r24, 0x55 ; 85
7e92: 79 f4 brne .+30 ; 0x7eb2 <main+0xb2>
// LOAD ADDRESS
uint16_t newAddress;
newAddress = getch();
7e94: 88 d0 rcall .+272 ; 0x7fa6 <getch>
newAddress = (newAddress & 0xff) | (getch() << 8);
7e96: e8 2e mov r14, r24
7e98: ff 24 eor r15, r15
7e9a: 85 d0 rcall .+266 ; 0x7fa6 <getch>
7e9c: 08 2f mov r16, r24
7e9e: 10 e0 ldi r17, 0x00 ; 0
7ea0: 10 2f mov r17, r16
7ea2: 00 27 eor r16, r16
7ea4: 0e 29 or r16, r14
7ea6: 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
7ea8: 00 0f add r16, r16
7eaa: 11 1f adc r17, r17
address = newAddress;
verifySpace();
7eac: 8e d0 rcall .+284 ; 0x7fca <verifySpace>
7eae: 68 01 movw r12, r16
7eb0: 6f c0 rjmp .+222 ; 0x7f90 <main+0x190>
}
else if(ch == STK_UNIVERSAL) {
7eb2: 86 35 cpi r24, 0x56 ; 86
7eb4: 21 f4 brne .+8 ; 0x7ebe <main+0xbe>
// UNIVERSAL command is ignored
getNch(4);
7eb6: 84 e0 ldi r24, 0x04 ; 4
7eb8: 90 d0 rcall .+288 ; 0x7fda <getNch>
putch(0x00);
7eba: 80 e0 ldi r24, 0x00 ; 0
7ebc: de cf rjmp .-68 ; 0x7e7a <main+0x7a>
}
/* Write memory, length is big endian and is in bytes */
else if(ch == STK_PROG_PAGE) {
7ebe: 84 36 cpi r24, 0x64 ; 100
7ec0: 09 f0 breq .+2 ; 0x7ec4 <main+0xc4>
7ec2: 40 c0 rjmp .+128 ; 0x7f44 <main+0x144>
// PROGRAM PAGE - we support flash programming only, not EEPROM
uint8_t *bufPtr;
uint16_t addrPtr;
getch(); /* getlen() */
7ec4: 70 d0 rcall .+224 ; 0x7fa6 <getch>
length = getch();
7ec6: 6f d0 rcall .+222 ; 0x7fa6 <getch>
7ec8: 08 2f mov r16, r24
getch();
7eca: 6d d0 rcall .+218 ; 0x7fa6 <getch>
// If we are in RWW section, immediately start page erase
if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address);
7ecc: 80 e0 ldi r24, 0x00 ; 0
7ece: c8 16 cp r12, r24
7ed0: 80 e7 ldi r24, 0x70 ; 112
7ed2: d8 06 cpc r13, r24
7ed4: 18 f4 brcc .+6 ; 0x7edc <main+0xdc>
7ed6: f6 01 movw r30, r12
7ed8: b7 be out 0x37, r11 ; 55
7eda: e8 95 spm
7edc: c0 e0 ldi r28, 0x00 ; 0
7ede: d1 e0 ldi r29, 0x01 ; 1
// While that is going on, read in page contents
bufPtr = buff;
do *bufPtr++ = getch();
7ee0: 62 d0 rcall .+196 ; 0x7fa6 <getch>
7ee2: 89 93 st Y+, r24
while (--length);
7ee4: 0c 17 cp r16, r28
7ee6: e1 f7 brne .-8 ; 0x7ee0 <main+0xe0>
// 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);
7ee8: f0 e0 ldi r31, 0x00 ; 0
7eea: cf 16 cp r12, r31
7eec: f0 e7 ldi r31, 0x70 ; 112
7eee: df 06 cpc r13, r31
7ef0: 18 f0 brcs .+6 ; 0x7ef8 <main+0xf8>
7ef2: f6 01 movw r30, r12
7ef4: b7 be out 0x37, r11 ; 55
7ef6: e8 95 spm
// Read command terminator, start reply
verifySpace();
7ef8: 68 d0 rcall .+208 ; 0x7fca <verifySpace>
// If only a partial page is to be programmed, the erase might not be complete.
// So check that here
boot_spm_busy_wait();
7efa: 07 b6 in r0, 0x37 ; 55
7efc: 00 fc sbrc r0, 0
7efe: fd cf rjmp .-6 ; 0x7efa <main+0xfa>
7f00: a6 01 movw r20, r12
7f02: a0 e0 ldi r26, 0x00 ; 0
7f04: b1 e0 ldi r27, 0x01 ; 1
bufPtr = buff;
addrPtr = (uint16_t)(void*)address;
ch = SPM_PAGESIZE / 2;
do {
uint16_t a;
a = *bufPtr++;
7f06: 2c 91 ld r18, X
7f08: 30 e0 ldi r19, 0x00 ; 0
a |= (*bufPtr++) << 8;
7f0a: 11 96 adiw r26, 0x01 ; 1
7f0c: 8c 91 ld r24, X
7f0e: 11 97 sbiw r26, 0x01 ; 1
7f10: 90 e0 ldi r25, 0x00 ; 0
7f12: 98 2f mov r25, r24
7f14: 88 27 eor r24, r24
7f16: 82 2b or r24, r18
7f18: 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) {
7f1a: 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);
7f1c: fa 01 movw r30, r20
7f1e: 0c 01 movw r0, r24
7f20: 87 be out 0x37, r8 ; 55
7f22: e8 95 spm
7f24: 11 24 eor r1, r1
addrPtr += 2;
7f26: 4e 5f subi r20, 0xFE ; 254
7f28: 5f 4f sbci r21, 0xFF ; 255
} while (--ch);
7f2a: f1 e0 ldi r31, 0x01 ; 1
7f2c: a0 38 cpi r26, 0x80 ; 128
7f2e: bf 07 cpc r27, r31
7f30: 51 f7 brne .-44 ; 0x7f06 <main+0x106>
// Write from programming buffer
__boot_page_write_short((uint16_t)(void*)address);
7f32: f6 01 movw r30, r12
7f34: a7 be out 0x37, r10 ; 55
7f36: e8 95 spm
boot_spm_busy_wait();
7f38: 07 b6 in r0, 0x37 ; 55
7f3a: 00 fc sbrc r0, 0
7f3c: fd cf rjmp .-6 ; 0x7f38 <main+0x138>
#if defined(RWWSRE)
// Reenable read access to flash
boot_rww_enable();
7f3e: 97 be out 0x37, r9 ; 55
7f40: e8 95 spm
7f42: 26 c0 rjmp .+76 ; 0x7f90 <main+0x190>
#endif
}
/* Read memory block mode, length is big endian. */
else if(ch == STK_READ_PAGE) {
7f44: 84 37 cpi r24, 0x74 ; 116
7f46: b1 f4 brne .+44 ; 0x7f74 <main+0x174>
// READ PAGE - we only read flash
getch(); /* getlen() */
7f48: 2e d0 rcall .+92 ; 0x7fa6 <getch>
length = getch();
7f4a: 2d d0 rcall .+90 ; 0x7fa6 <getch>
7f4c: f8 2e mov r15, r24
getch();
7f4e: 2b d0 rcall .+86 ; 0x7fa6 <getch>
verifySpace();
7f50: 3c d0 rcall .+120 ; 0x7fca <verifySpace>
7f52: f6 01 movw r30, r12
7f54: ef 2c mov r14, r15
putch(result);
address++;
}
while (--length);
#else
do putch(pgm_read_byte_near(address++));
7f56: 8f 01 movw r16, r30
7f58: 0f 5f subi r16, 0xFF ; 255
7f5a: 1f 4f sbci r17, 0xFF ; 255
7f5c: 84 91 lpm r24, Z+
7f5e: 1b d0 rcall .+54 ; 0x7f96 <putch>
while (--length);
7f60: ea 94 dec r14
7f62: f8 01 movw r30, r16
7f64: c1 f7 brne .-16 ; 0x7f56 <main+0x156>
#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) {
7f66: 08 94 sec
7f68: c1 1c adc r12, r1
7f6a: d1 1c adc r13, r1
7f6c: fa 94 dec r15
7f6e: cf 0c add r12, r15
7f70: d1 1c adc r13, r1
7f72: 0e c0 rjmp .+28 ; 0x7f90 <main+0x190>
#endif
#endif
}
/* Get device signature bytes */
else if(ch == STK_READ_SIGN) {
7f74: 85 37 cpi r24, 0x75 ; 117
7f76: 39 f4 brne .+14 ; 0x7f86 <main+0x186>
// READ SIGN - return what Avrdude wants to hear
verifySpace();
7f78: 28 d0 rcall .+80 ; 0x7fca <verifySpace>
putch(SIGNATURE_0);
7f7a: 8e e1 ldi r24, 0x1E ; 30
7f7c: 0c d0 rcall .+24 ; 0x7f96 <putch>
putch(SIGNATURE_1);
7f7e: 85 e9 ldi r24, 0x95 ; 149
7f80: 0a d0 rcall .+20 ; 0x7f96 <putch>
putch(SIGNATURE_2);
7f82: 8f e0 ldi r24, 0x0F ; 15
7f84: 7a cf rjmp .-268 ; 0x7e7a <main+0x7a>
}
else if (ch == 'Q') {
7f86: 81 35 cpi r24, 0x51 ; 81
7f88: 11 f4 brne .+4 ; 0x7f8e <main+0x18e>
// Adaboot no-wait mod
watchdogConfig(WATCHDOG_16MS);
7f8a: 88 e0 ldi r24, 0x08 ; 8
7f8c: 18 d0 rcall .+48 ; 0x7fbe <watchdogConfig>
verifySpace();
}
else {
// This covers the response to commands like STK_ENTER_PROGMODE
verifySpace();
7f8e: 1d d0 rcall .+58 ; 0x7fca <verifySpace>
}
putch(STK_OK);
7f90: 80 e1 ldi r24, 0x10 ; 16
7f92: 01 d0 rcall .+2 ; 0x7f96 <putch>
7f94: 65 cf rjmp .-310 ; 0x7e60 <main+0x60>
00007f96 <putch>:
}
}
void putch(char ch) {
7f96: 98 2f mov r25, r24
#ifndef SOFT_UART
while (!(UCSR0A & _BV(UDRE0)));
7f98: 80 91 c0 00 lds r24, 0x00C0
7f9c: 85 ff sbrs r24, 5
7f9e: fc cf rjmp .-8 ; 0x7f98 <putch+0x2>
UDR0 = ch;
7fa0: 90 93 c6 00 sts 0x00C6, r25
[uartBit] "I" (UART_TX_BIT)
:
"r25"
);
#endif
}
7fa4: 08 95 ret
00007fa6 <getch>:
[uartBit] "I" (UART_RX_BIT)
:
"r25"
);
#else
while(!(UCSR0A & _BV(RXC0)))
7fa6: 80 91 c0 00 lds r24, 0x00C0
7faa: 87 ff sbrs r24, 7
7fac: fc cf rjmp .-8 ; 0x7fa6 <getch>
;
if (!(UCSR0A & _BV(FE0))) {
7fae: 80 91 c0 00 lds r24, 0x00C0
7fb2: 84 fd sbrc r24, 4
7fb4: 01 c0 rjmp .+2 ; 0x7fb8 <getch+0x12>
}
#endif
// Watchdog functions. These are only safe with interrupts turned off.
void watchdogReset() {
__asm__ __volatile__ (
7fb6: a8 95 wdr
* don't care that an invalid char is returned...)
*/
watchdogReset();
}
ch = UDR0;
7fb8: 80 91 c6 00 lds r24, 0x00C6
LED_PIN |= _BV(LED);
#endif
#endif
return ch;
}
7fbc: 08 95 ret
00007fbe <watchdogConfig>:
"wdr\n"
);
}
void watchdogConfig(uint8_t x) {
WDTCSR = _BV(WDCE) | _BV(WDE);
7fbe: e0 e6 ldi r30, 0x60 ; 96
7fc0: f0 e0 ldi r31, 0x00 ; 0
7fc2: 98 e1 ldi r25, 0x18 ; 24
7fc4: 90 83 st Z, r25
WDTCSR = x;
7fc6: 80 83 st Z, r24
}
7fc8: 08 95 ret
00007fca <verifySpace>:
do getch(); while (--count);
verifySpace();
}
void verifySpace() {
if (getch() != CRC_EOP) {
7fca: ed df rcall .-38 ; 0x7fa6 <getch>
7fcc: 80 32 cpi r24, 0x20 ; 32
7fce: 19 f0 breq .+6 ; 0x7fd6 <verifySpace+0xc>
watchdogConfig(WATCHDOG_16MS); // shorten WD timeout
7fd0: 88 e0 ldi r24, 0x08 ; 8
7fd2: f5 df rcall .-22 ; 0x7fbe <watchdogConfig>
7fd4: ff cf rjmp .-2 ; 0x7fd4 <verifySpace+0xa>
while (1) // and busy-loop so that WD causes
; // a reset and app start.
}
putch(STK_INSYNC);
7fd6: 84 e1 ldi r24, 0x14 ; 20
}
7fd8: de cf rjmp .-68 ; 0x7f96 <putch>
00007fda <getNch>:
::[count] "M" (UART_B_VALUE)
);
}
#endif
void getNch(uint8_t count) {
7fda: 1f 93 push r17
7fdc: 18 2f mov r17, r24
do getch(); while (--count);
7fde: e3 df rcall .-58 ; 0x7fa6 <getch>
7fe0: 11 50 subi r17, 0x01 ; 1
7fe2: e9 f7 brne .-6 ; 0x7fde <getNch+0x4>
verifySpace();
7fe4: f2 df rcall .-28 ; 0x7fca <verifySpace>
}
7fe6: 1f 91 pop r17
7fe8: 08 95 ret
00007fea <appStart>:
WDTCSR = _BV(WDCE) | _BV(WDE);
WDTCSR = x;
}
void appStart() {
watchdogConfig(WATCHDOG_OFF);
7fea: 80 e0 ldi r24, 0x00 ; 0
7fec: e8 df rcall .-48 ; 0x7fbe <watchdogConfig>
__asm__ __volatile__ (
7fee: ee 27 eor r30, r30
7ff0: ff 27 eor r31, r31
7ff2: 09 94 ijmp
|