Project

General

Profile

Statistics
| Branch: | Revision:

root / arduino-1.0 / hardware / arduino / bootloaders / optiboot / optiboot_atmega328.lst @ 58d82c77

History | View | Annotate | Download (19.1 KB)

1

    
2
optiboot_atmega328.elf:     file format elf32-avr
3

    
4
Sections:
5
Idx Name          Size      VMA       LMA       File off  Algn
6
  0 .text         000001f4  00007e00  00007e00  00000054  2**1
7
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
8
  1 .version      00000002  00007ffe  00007ffe  00000248  2**0
9
                  CONTENTS, READONLY
10
  2 .debug_aranges 00000028  00000000  00000000  0000024a  2**0
11
                  CONTENTS, READONLY, DEBUGGING
12
  3 .debug_pubnames 0000005f  00000000  00000000  00000272  2**0
13
                  CONTENTS, READONLY, DEBUGGING
14
  4 .debug_info   000002a8  00000000  00000000  000002d1  2**0
15
                  CONTENTS, READONLY, DEBUGGING
16
  5 .debug_abbrev 00000178  00000000  00000000  00000579  2**0
17
                  CONTENTS, READONLY, DEBUGGING
18
  6 .debug_line   00000488  00000000  00000000  000006f1  2**0
19
                  CONTENTS, READONLY, DEBUGGING
20
  7 .debug_frame  00000080  00000000  00000000  00000b7c  2**2
21
                  CONTENTS, READONLY, DEBUGGING
22
  8 .debug_str    0000014f  00000000  00000000  00000bfc  2**0
23
                  CONTENTS, READONLY, DEBUGGING
24
  9 .debug_loc    000002d8  00000000  00000000  00000d4b  2**0
25
                  CONTENTS, READONLY, DEBUGGING
26
 10 .debug_ranges 00000078  00000000  00000000  00001023  2**0
27
                  CONTENTS, READONLY, DEBUGGING
28

    
29
Disassembly of section .text:
30

    
31
00007e00 <main>:
32
#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4))
33
#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6))
34
#endif
35

    
36
/* main program starts here */
37
int main(void) {
38
    7e00:	11 24       	eor	r1, r1
39
#ifdef __AVR_ATmega8__
40
  SP=RAMEND;  // This is done by hardware reset
41
#endif
42

    
43
  // Adaboot no-wait mod
44
  ch = MCUSR;
45
    7e02:	84 b7       	in	r24, 0x34	; 52
46
  MCUSR = 0;
47
    7e04:	14 be       	out	0x34, r1	; 52
48
  if (!(ch & _BV(EXTRF))) appStart();
49
    7e06:	81 ff       	sbrs	r24, 1
50
    7e08:	f0 d0       	rcall	.+480    	; 0x7fea <appStart>
51

    
52
#if LED_START_FLASHES > 0
53
  // Set up Timer 1 for timeout counter
54
  TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
55
    7e0a:	85 e0       	ldi	r24, 0x05	; 5
56
    7e0c:	80 93 81 00 	sts	0x0081, r24
57
  UCSRA = _BV(U2X); //Double speed mode USART
58
  UCSRB = _BV(RXEN) | _BV(TXEN);  // enable Rx & Tx
59
  UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0);  // config USART; 8N1
60
  UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
61
#else
62
  UCSR0A = _BV(U2X0); //Double speed mode USART0
63
    7e10:	82 e0       	ldi	r24, 0x02	; 2
64
    7e12:	80 93 c0 00 	sts	0x00C0, r24
65
  UCSR0B = _BV(RXEN0) | _BV(TXEN0);
66
    7e16:	88 e1       	ldi	r24, 0x18	; 24
67
    7e18:	80 93 c1 00 	sts	0x00C1, r24
68
  UCSR0C = _BV(UCSZ00) | _BV(UCSZ01);
69
    7e1c:	86 e0       	ldi	r24, 0x06	; 6
70
    7e1e:	80 93 c2 00 	sts	0x00C2, r24
71
  UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
72
    7e22:	80 e1       	ldi	r24, 0x10	; 16
73
    7e24:	80 93 c4 00 	sts	0x00C4, r24
74
#endif
75
#endif
76

    
77
  // Set up watchdog to trigger after 500ms
78
  watchdogConfig(WATCHDOG_1S);
79
    7e28:	8e e0       	ldi	r24, 0x0E	; 14
80
    7e2a:	c9 d0       	rcall	.+402    	; 0x7fbe <watchdogConfig>
81

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

    
88
#if LED_START_FLASHES > 0
89
void flash_led(uint8_t count) {
90
  do {
91
    TCNT1 = -(F_CPU/(1024*16));
92
    7e30:	20 e3       	ldi	r18, 0x30	; 48
93
    7e32:	3c ef       	ldi	r19, 0xFC	; 252
94
    TIFR1 = _BV(TOV1);
95
    7e34:	91 e0       	ldi	r25, 0x01	; 1
96
}
97

    
98
#if LED_START_FLASHES > 0
99
void flash_led(uint8_t count) {
100
  do {
101
    TCNT1 = -(F_CPU/(1024*16));
102
    7e36:	30 93 85 00 	sts	0x0085, r19
103
    7e3a:	20 93 84 00 	sts	0x0084, r18
104
    TIFR1 = _BV(TOV1);
105
    7e3e:	96 bb       	out	0x16, r25	; 22
106
    while(!(TIFR1 & _BV(TOV1)));
107
    7e40:	b0 9b       	sbis	0x16, 0	; 22
108
    7e42:	fe cf       	rjmp	.-4      	; 0x7e40 <main+0x40>
109
#ifdef __AVR_ATmega8__
110
    LED_PORT ^= _BV(LED);
111
#else
112
    LED_PIN |= _BV(LED);
113
    7e44:	1d 9a       	sbi	0x03, 5	; 3
114
}
115
#endif
116

    
117
// Watchdog functions. These are only safe with interrupts turned off.
118
void watchdogReset() {
119
  __asm__ __volatile__ (
120
    7e46:	a8 95       	wdr
121
    LED_PORT ^= _BV(LED);
122
#else
123
    LED_PIN |= _BV(LED);
124
#endif
125
    watchdogReset();
126
  } while (--count);
127
    7e48:	81 50       	subi	r24, 0x01	; 1
128
    7e4a:	a9 f7       	brne	.-22     	; 0x7e36 <main+0x36>
129
    7e4c:	cc 24       	eor	r12, r12
130
    7e4e:	dd 24       	eor	r13, r13
131
      ch = SPM_PAGESIZE / 2;
132
      do {
133
        uint16_t a;
134
        a = *bufPtr++;
135
        a |= (*bufPtr++) << 8;
136
        __boot_page_fill_short((uint16_t)(void*)addrPtr,a);
137
    7e50:	88 24       	eor	r8, r8
138
    7e52:	83 94       	inc	r8
139
        addrPtr += 2;
140
      } while (--ch);
141

    
142
      // Write from programming buffer
143
      __boot_page_write_short((uint16_t)(void*)address);
144
    7e54:	b5 e0       	ldi	r27, 0x05	; 5
145
    7e56:	ab 2e       	mov	r10, r27
146
      boot_spm_busy_wait();
147

    
148
#if defined(RWWSRE)
149
      // Reenable read access to flash
150
      boot_rww_enable();
151
    7e58:	a1 e1       	ldi	r26, 0x11	; 17
152
    7e5a:	9a 2e       	mov	r9, r26
153
      do *bufPtr++ = getch();
154
      while (--length);
155

    
156
      // If we are in NRWW section, page erase has to be delayed until now.
157
      // Todo: Take RAMPZ into account
158
      if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address);
159
    7e5c:	f3 e0       	ldi	r31, 0x03	; 3
160
    7e5e:	bf 2e       	mov	r11, r31
161
#endif
162

    
163
  /* Forever loop */
164
  for (;;) {
165
    /* get character from UART */
166
    ch = getch();
167
    7e60:	a2 d0       	rcall	.+324    	; 0x7fa6 <getch>
168

    
169
    if(ch == STK_GET_PARAMETER) {
170
    7e62:	81 34       	cpi	r24, 0x41	; 65
171
    7e64:	61 f4       	brne	.+24     	; 0x7e7e <main+0x7e>
172
      unsigned char which = getch();
173
    7e66:	9f d0       	rcall	.+318    	; 0x7fa6 <getch>
174
    7e68:	08 2f       	mov	r16, r24
175
      verifySpace();
176
    7e6a:	af d0       	rcall	.+350    	; 0x7fca <verifySpace>
177
      if (which == 0x82) {
178
    7e6c:	02 38       	cpi	r16, 0x82	; 130
179
    7e6e:	11 f0       	breq	.+4      	; 0x7e74 <main+0x74>
180
	/*
181
	 * Send optiboot version as "minor SW version"
182
	 */
183
	putch(OPTIBOOT_MINVER);
184
      } else if (which == 0x81) {
185
    7e70:	01 38       	cpi	r16, 0x81	; 129
186
    7e72:	11 f4       	brne	.+4      	; 0x7e78 <main+0x78>
187
	  putch(OPTIBOOT_MAJVER);
188
    7e74:	84 e0       	ldi	r24, 0x04	; 4
189
    7e76:	01 c0       	rjmp	.+2      	; 0x7e7a <main+0x7a>
190
      } else {
191
	/*
192
	 * GET PARAMETER returns a generic 0x03 reply for
193
         * other parameters - enough to keep Avrdude happy
194
	 */
195
	putch(0x03);
196
    7e78:	83 e0       	ldi	r24, 0x03	; 3
197
    7e7a:	8d d0       	rcall	.+282    	; 0x7f96 <putch>
198
    7e7c:	89 c0       	rjmp	.+274    	; 0x7f90 <main+0x190>
199
      }
200
    }
201
    else if(ch == STK_SET_DEVICE) {
202
    7e7e:	82 34       	cpi	r24, 0x42	; 66
203
    7e80:	11 f4       	brne	.+4      	; 0x7e86 <main+0x86>
204
      // SET DEVICE is ignored
205
      getNch(20);
206
    7e82:	84 e1       	ldi	r24, 0x14	; 20
207
    7e84:	03 c0       	rjmp	.+6      	; 0x7e8c <main+0x8c>
208
    }
209
    else if(ch == STK_SET_DEVICE_EXT) {
210
    7e86:	85 34       	cpi	r24, 0x45	; 69
211
    7e88:	19 f4       	brne	.+6      	; 0x7e90 <main+0x90>
212
      // SET DEVICE EXT is ignored
213
      getNch(5);
214
    7e8a:	85 e0       	ldi	r24, 0x05	; 5
215
    7e8c:	a6 d0       	rcall	.+332    	; 0x7fda <getNch>
216
    7e8e:	80 c0       	rjmp	.+256    	; 0x7f90 <main+0x190>
217
    }
218
    else if(ch == STK_LOAD_ADDRESS) {
219
    7e90:	85 35       	cpi	r24, 0x55	; 85
220
    7e92:	79 f4       	brne	.+30     	; 0x7eb2 <main+0xb2>
221
      // LOAD ADDRESS
222
      uint16_t newAddress;
223
      newAddress = getch();
224
    7e94:	88 d0       	rcall	.+272    	; 0x7fa6 <getch>
225
      newAddress = (newAddress & 0xff) | (getch() << 8);
226
    7e96:	e8 2e       	mov	r14, r24
227
    7e98:	ff 24       	eor	r15, r15
228
    7e9a:	85 d0       	rcall	.+266    	; 0x7fa6 <getch>
229
    7e9c:	08 2f       	mov	r16, r24
230
    7e9e:	10 e0       	ldi	r17, 0x00	; 0
231
    7ea0:	10 2f       	mov	r17, r16
232
    7ea2:	00 27       	eor	r16, r16
233
    7ea4:	0e 29       	or	r16, r14
234
    7ea6:	1f 29       	or	r17, r15
235
#ifdef RAMPZ
236
      // Transfer top bit to RAMPZ
237
      RAMPZ = (newAddress & 0x8000) ? 1 : 0;
238
#endif
239
      newAddress += newAddress; // Convert from word address to byte address
240
    7ea8:	00 0f       	add	r16, r16
241
    7eaa:	11 1f       	adc	r17, r17
242
      address = newAddress;
243
      verifySpace();
244
    7eac:	8e d0       	rcall	.+284    	; 0x7fca <verifySpace>
245
    7eae:	68 01       	movw	r12, r16
246
    7eb0:	6f c0       	rjmp	.+222    	; 0x7f90 <main+0x190>
247
    }
248
    else if(ch == STK_UNIVERSAL) {
249
    7eb2:	86 35       	cpi	r24, 0x56	; 86
250
    7eb4:	21 f4       	brne	.+8      	; 0x7ebe <main+0xbe>
251
      // UNIVERSAL command is ignored
252
      getNch(4);
253
    7eb6:	84 e0       	ldi	r24, 0x04	; 4
254
    7eb8:	90 d0       	rcall	.+288    	; 0x7fda <getNch>
255
      putch(0x00);
256
    7eba:	80 e0       	ldi	r24, 0x00	; 0
257
    7ebc:	de cf       	rjmp	.-68     	; 0x7e7a <main+0x7a>
258
    }
259
    /* Write memory, length is big endian and is in bytes */
260
    else if(ch == STK_PROG_PAGE) {
261
    7ebe:	84 36       	cpi	r24, 0x64	; 100
262
    7ec0:	09 f0       	breq	.+2      	; 0x7ec4 <main+0xc4>
263
    7ec2:	40 c0       	rjmp	.+128    	; 0x7f44 <main+0x144>
264
      // PROGRAM PAGE - we support flash programming only, not EEPROM
265
      uint8_t *bufPtr;
266
      uint16_t addrPtr;
267

    
268
      getch();			/* getlen() */
269
    7ec4:	70 d0       	rcall	.+224    	; 0x7fa6 <getch>
270
      length = getch();
271
    7ec6:	6f d0       	rcall	.+222    	; 0x7fa6 <getch>
272
    7ec8:	08 2f       	mov	r16, r24
273
      getch();
274
    7eca:	6d d0       	rcall	.+218    	; 0x7fa6 <getch>
275

    
276
      // If we are in RWW section, immediately start page erase
277
      if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address);
278
    7ecc:	80 e0       	ldi	r24, 0x00	; 0
279
    7ece:	c8 16       	cp	r12, r24
280
    7ed0:	80 e7       	ldi	r24, 0x70	; 112
281
    7ed2:	d8 06       	cpc	r13, r24
282
    7ed4:	18 f4       	brcc	.+6      	; 0x7edc <main+0xdc>
283
    7ed6:	f6 01       	movw	r30, r12
284
    7ed8:	b7 be       	out	0x37, r11	; 55
285
    7eda:	e8 95       	spm
286
    7edc:	c0 e0       	ldi	r28, 0x00	; 0
287
    7ede:	d1 e0       	ldi	r29, 0x01	; 1
288

    
289
      // While that is going on, read in page contents
290
      bufPtr = buff;
291
      do *bufPtr++ = getch();
292
    7ee0:	62 d0       	rcall	.+196    	; 0x7fa6 <getch>
293
    7ee2:	89 93       	st	Y+, r24
294
      while (--length);
295
    7ee4:	0c 17       	cp	r16, r28
296
    7ee6:	e1 f7       	brne	.-8      	; 0x7ee0 <main+0xe0>
297

    
298
      // If we are in NRWW section, page erase has to be delayed until now.
299
      // Todo: Take RAMPZ into account
300
      if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address);
301
    7ee8:	f0 e0       	ldi	r31, 0x00	; 0
302
    7eea:	cf 16       	cp	r12, r31
303
    7eec:	f0 e7       	ldi	r31, 0x70	; 112
304
    7eee:	df 06       	cpc	r13, r31
305
    7ef0:	18 f0       	brcs	.+6      	; 0x7ef8 <main+0xf8>
306
    7ef2:	f6 01       	movw	r30, r12
307
    7ef4:	b7 be       	out	0x37, r11	; 55
308
    7ef6:	e8 95       	spm
309

    
310
      // Read command terminator, start reply
311
      verifySpace();
312
    7ef8:	68 d0       	rcall	.+208    	; 0x7fca <verifySpace>
313

    
314
      // If only a partial page is to be programmed, the erase might not be complete.
315
      // So check that here
316
      boot_spm_busy_wait();
317
    7efa:	07 b6       	in	r0, 0x37	; 55
318
    7efc:	00 fc       	sbrc	r0, 0
319
    7efe:	fd cf       	rjmp	.-6      	; 0x7efa <main+0xfa>
320
    7f00:	a6 01       	movw	r20, r12
321
    7f02:	a0 e0       	ldi	r26, 0x00	; 0
322
    7f04:	b1 e0       	ldi	r27, 0x01	; 1
323
      bufPtr = buff;
324
      addrPtr = (uint16_t)(void*)address;
325
      ch = SPM_PAGESIZE / 2;
326
      do {
327
        uint16_t a;
328
        a = *bufPtr++;
329
    7f06:	2c 91       	ld	r18, X
330
    7f08:	30 e0       	ldi	r19, 0x00	; 0
331
        a |= (*bufPtr++) << 8;
332
    7f0a:	11 96       	adiw	r26, 0x01	; 1
333
    7f0c:	8c 91       	ld	r24, X
334
    7f0e:	11 97       	sbiw	r26, 0x01	; 1
335
    7f10:	90 e0       	ldi	r25, 0x00	; 0
336
    7f12:	98 2f       	mov	r25, r24
337
    7f14:	88 27       	eor	r24, r24
338
    7f16:	82 2b       	or	r24, r18
339
    7f18:	93 2b       	or	r25, r19
340
#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4))
341
#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6))
342
#endif
343

    
344
/* main program starts here */
345
int main(void) {
346
    7f1a:	12 96       	adiw	r26, 0x02	; 2
347
      ch = SPM_PAGESIZE / 2;
348
      do {
349
        uint16_t a;
350
        a = *bufPtr++;
351
        a |= (*bufPtr++) << 8;
352
        __boot_page_fill_short((uint16_t)(void*)addrPtr,a);
353
    7f1c:	fa 01       	movw	r30, r20
354
    7f1e:	0c 01       	movw	r0, r24
355
    7f20:	87 be       	out	0x37, r8	; 55
356
    7f22:	e8 95       	spm
357
    7f24:	11 24       	eor	r1, r1
358
        addrPtr += 2;
359
    7f26:	4e 5f       	subi	r20, 0xFE	; 254
360
    7f28:	5f 4f       	sbci	r21, 0xFF	; 255
361
      } while (--ch);
362
    7f2a:	f1 e0       	ldi	r31, 0x01	; 1
363
    7f2c:	a0 38       	cpi	r26, 0x80	; 128
364
    7f2e:	bf 07       	cpc	r27, r31
365
    7f30:	51 f7       	brne	.-44     	; 0x7f06 <main+0x106>
366

    
367
      // Write from programming buffer
368
      __boot_page_write_short((uint16_t)(void*)address);
369
    7f32:	f6 01       	movw	r30, r12
370
    7f34:	a7 be       	out	0x37, r10	; 55
371
    7f36:	e8 95       	spm
372
      boot_spm_busy_wait();
373
    7f38:	07 b6       	in	r0, 0x37	; 55
374
    7f3a:	00 fc       	sbrc	r0, 0
375
    7f3c:	fd cf       	rjmp	.-6      	; 0x7f38 <main+0x138>
376

    
377
#if defined(RWWSRE)
378
      // Reenable read access to flash
379
      boot_rww_enable();
380
    7f3e:	97 be       	out	0x37, r9	; 55
381
    7f40:	e8 95       	spm
382
    7f42:	26 c0       	rjmp	.+76     	; 0x7f90 <main+0x190>
383
#endif
384

    
385
    }
386
    /* Read memory block mode, length is big endian.  */
387
    else if(ch == STK_READ_PAGE) {
388
    7f44:	84 37       	cpi	r24, 0x74	; 116
389
    7f46:	b1 f4       	brne	.+44     	; 0x7f74 <main+0x174>
390
      // READ PAGE - we only read flash
391
      getch();			/* getlen() */
392
    7f48:	2e d0       	rcall	.+92     	; 0x7fa6 <getch>
393
      length = getch();
394
    7f4a:	2d d0       	rcall	.+90     	; 0x7fa6 <getch>
395
    7f4c:	f8 2e       	mov	r15, r24
396
      getch();
397
    7f4e:	2b d0       	rcall	.+86     	; 0x7fa6 <getch>
398

    
399
      verifySpace();
400
    7f50:	3c d0       	rcall	.+120    	; 0x7fca <verifySpace>
401
    7f52:	f6 01       	movw	r30, r12
402
    7f54:	ef 2c       	mov	r14, r15
403
        putch(result);
404
        address++;
405
      }
406
      while (--length);
407
#else
408
      do putch(pgm_read_byte_near(address++));
409
    7f56:	8f 01       	movw	r16, r30
410
    7f58:	0f 5f       	subi	r16, 0xFF	; 255
411
    7f5a:	1f 4f       	sbci	r17, 0xFF	; 255
412
    7f5c:	84 91       	lpm	r24, Z+
413
    7f5e:	1b d0       	rcall	.+54     	; 0x7f96 <putch>
414
      while (--length);
415
    7f60:	ea 94       	dec	r14
416
    7f62:	f8 01       	movw	r30, r16
417
    7f64:	c1 f7       	brne	.-16     	; 0x7f56 <main+0x156>
418
#define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4))
419
#define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6))
420
#endif
421

    
422
/* main program starts here */
423
int main(void) {
424
    7f66:	08 94       	sec
425
    7f68:	c1 1c       	adc	r12, r1
426
    7f6a:	d1 1c       	adc	r13, r1
427
    7f6c:	fa 94       	dec	r15
428
    7f6e:	cf 0c       	add	r12, r15
429
    7f70:	d1 1c       	adc	r13, r1
430
    7f72:	0e c0       	rjmp	.+28     	; 0x7f90 <main+0x190>
431
#endif
432
#endif
433
    }
434

    
435
    /* Get device signature bytes  */
436
    else if(ch == STK_READ_SIGN) {
437
    7f74:	85 37       	cpi	r24, 0x75	; 117
438
    7f76:	39 f4       	brne	.+14     	; 0x7f86 <main+0x186>
439
      // READ SIGN - return what Avrdude wants to hear
440
      verifySpace();
441
    7f78:	28 d0       	rcall	.+80     	; 0x7fca <verifySpace>
442
      putch(SIGNATURE_0);
443
    7f7a:	8e e1       	ldi	r24, 0x1E	; 30
444
    7f7c:	0c d0       	rcall	.+24     	; 0x7f96 <putch>
445
      putch(SIGNATURE_1);
446
    7f7e:	85 e9       	ldi	r24, 0x95	; 149
447
    7f80:	0a d0       	rcall	.+20     	; 0x7f96 <putch>
448
      putch(SIGNATURE_2);
449
    7f82:	8f e0       	ldi	r24, 0x0F	; 15
450
    7f84:	7a cf       	rjmp	.-268    	; 0x7e7a <main+0x7a>
451
    }
452
    else if (ch == 'Q') {
453
    7f86:	81 35       	cpi	r24, 0x51	; 81
454
    7f88:	11 f4       	brne	.+4      	; 0x7f8e <main+0x18e>
455
      // Adaboot no-wait mod
456
      watchdogConfig(WATCHDOG_16MS);
457
    7f8a:	88 e0       	ldi	r24, 0x08	; 8
458
    7f8c:	18 d0       	rcall	.+48     	; 0x7fbe <watchdogConfig>
459
      verifySpace();
460
    }
461
    else {
462
      // This covers the response to commands like STK_ENTER_PROGMODE
463
      verifySpace();
464
    7f8e:	1d d0       	rcall	.+58     	; 0x7fca <verifySpace>
465
    }
466
    putch(STK_OK);
467
    7f90:	80 e1       	ldi	r24, 0x10	; 16
468
    7f92:	01 d0       	rcall	.+2      	; 0x7f96 <putch>
469
    7f94:	65 cf       	rjmp	.-310    	; 0x7e60 <main+0x60>
470

    
471
00007f96 <putch>:
472
  }
473
}
474

    
475
void putch(char ch) {
476
    7f96:	98 2f       	mov	r25, r24
477
#ifndef SOFT_UART
478
  while (!(UCSR0A & _BV(UDRE0)));
479
    7f98:	80 91 c0 00 	lds	r24, 0x00C0
480
    7f9c:	85 ff       	sbrs	r24, 5
481
    7f9e:	fc cf       	rjmp	.-8      	; 0x7f98 <putch+0x2>
482
  UDR0 = ch;
483
    7fa0:	90 93 c6 00 	sts	0x00C6, r25
484
      [uartBit] "I" (UART_TX_BIT)
485
    :
486
      "r25"
487
  );
488
#endif
489
}
490
    7fa4:	08 95       	ret
491

    
492
00007fa6 <getch>:
493
      [uartBit] "I" (UART_RX_BIT)
494
    :
495
      "r25"
496
);
497
#else
498
  while(!(UCSR0A & _BV(RXC0)))
499
    7fa6:	80 91 c0 00 	lds	r24, 0x00C0
500
    7faa:	87 ff       	sbrs	r24, 7
501
    7fac:	fc cf       	rjmp	.-8      	; 0x7fa6 <getch>
502
    ;
503
  if (!(UCSR0A & _BV(FE0))) {
504
    7fae:	80 91 c0 00 	lds	r24, 0x00C0
505
    7fb2:	84 fd       	sbrc	r24, 4
506
    7fb4:	01 c0       	rjmp	.+2      	; 0x7fb8 <getch+0x12>
507
}
508
#endif
509

    
510
// Watchdog functions. These are only safe with interrupts turned off.
511
void watchdogReset() {
512
  __asm__ __volatile__ (
513
    7fb6:	a8 95       	wdr
514
       * don't care that an invalid char is returned...)
515
       */
516
    watchdogReset();
517
  }
518
  
519
  ch = UDR0;
520
    7fb8:	80 91 c6 00 	lds	r24, 0x00C6
521
  LED_PIN |= _BV(LED);
522
#endif
523
#endif
524

    
525
  return ch;
526
}
527
    7fbc:	08 95       	ret
528

    
529
00007fbe <watchdogConfig>:
530
    "wdr\n"
531
  );
532
}
533

    
534
void watchdogConfig(uint8_t x) {
535
  WDTCSR = _BV(WDCE) | _BV(WDE);
536
    7fbe:	e0 e6       	ldi	r30, 0x60	; 96
537
    7fc0:	f0 e0       	ldi	r31, 0x00	; 0
538
    7fc2:	98 e1       	ldi	r25, 0x18	; 24
539
    7fc4:	90 83       	st	Z, r25
540
  WDTCSR = x;
541
    7fc6:	80 83       	st	Z, r24
542
}
543
    7fc8:	08 95       	ret
544

    
545
00007fca <verifySpace>:
546
  do getch(); while (--count);
547
  verifySpace();
548
}
549

    
550
void verifySpace() {
551
  if (getch() != CRC_EOP) {
552
    7fca:	ed df       	rcall	.-38     	; 0x7fa6 <getch>
553
    7fcc:	80 32       	cpi	r24, 0x20	; 32
554
    7fce:	19 f0       	breq	.+6      	; 0x7fd6 <verifySpace+0xc>
555
    watchdogConfig(WATCHDOG_16MS);    // shorten WD timeout
556
    7fd0:	88 e0       	ldi	r24, 0x08	; 8
557
    7fd2:	f5 df       	rcall	.-22     	; 0x7fbe <watchdogConfig>
558
    7fd4:	ff cf       	rjmp	.-2      	; 0x7fd4 <verifySpace+0xa>
559
    while (1)			      // and busy-loop so that WD causes
560
      ;				      //  a reset and app start.
561
  }
562
  putch(STK_INSYNC);
563
    7fd6:	84 e1       	ldi	r24, 0x14	; 20
564
}
565
    7fd8:	de cf       	rjmp	.-68     	; 0x7f96 <putch>
566

    
567
00007fda <getNch>:
568
    ::[count] "M" (UART_B_VALUE)
569
  );
570
}
571
#endif
572

    
573
void getNch(uint8_t count) {
574
    7fda:	1f 93       	push	r17
575
    7fdc:	18 2f       	mov	r17, r24
576
  do getch(); while (--count);
577
    7fde:	e3 df       	rcall	.-58     	; 0x7fa6 <getch>
578
    7fe0:	11 50       	subi	r17, 0x01	; 1
579
    7fe2:	e9 f7       	brne	.-6      	; 0x7fde <getNch+0x4>
580
  verifySpace();
581
    7fe4:	f2 df       	rcall	.-28     	; 0x7fca <verifySpace>
582
}
583
    7fe6:	1f 91       	pop	r17
584
    7fe8:	08 95       	ret
585

    
586
00007fea <appStart>:
587
  WDTCSR = _BV(WDCE) | _BV(WDE);
588
  WDTCSR = x;
589
}
590

    
591
void appStart() {
592
  watchdogConfig(WATCHDOG_OFF);
593
    7fea:	80 e0       	ldi	r24, 0x00	; 0
594
    7fec:	e8 df       	rcall	.-48     	; 0x7fbe <watchdogConfig>
595
  __asm__ __volatile__ (
596
    7fee:	ee 27       	eor	r30, r30
597
    7ff0:	ff 27       	eor	r31, r31
598
    7ff2:	09 94       	ijmp