root / arduino-1.0 / hardware / arduino / bootloaders / optiboot / optiboot_atmega168.lst @ 58d82c77
History | View | Annotate | Download (19.1 KB)
1 | 58d82c77 | Tom Mullins | |
---|---|---|---|
2 | optiboot_atmega168.elf: file format elf32-avr |
||
3 | |||
4 | Sections: |
||
5 | Idx Name Size VMA LMA File off Algn |
||
6 | 0 .text 000001f4 00003e00 00003e00 00000054 2**1 |
||
7 | CONTENTS, ALLOC, LOAD, READONLY, CODE |
||
8 | 1 .version 00000002 00003ffe 00003ffe 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 | 00003e00 <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 | 3e00: 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 | 3e02: 84 b7 in r24, 0x34 ; 52 |
||
46 | MCUSR = 0; |
||
47 | 3e04: 14 be out 0x34, r1 ; 52 |
||
48 | if (!(ch & _BV(EXTRF))) appStart(); |
||
49 | 3e06: 81 ff sbrs r24, 1 |
||
50 | 3e08: f0 d0 rcall .+480 ; 0x3fea <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 | 3e0a: 85 e0 ldi r24, 0x05 ; 5 |
||
56 | 3e0c: 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 | 3e10: 82 e0 ldi r24, 0x02 ; 2 |
||
64 | 3e12: 80 93 c0 00 sts 0x00C0, r24 |
||
65 | UCSR0B = _BV(RXEN0) | _BV(TXEN0); |
||
66 | 3e16: 88 e1 ldi r24, 0x18 ; 24 |
||
67 | 3e18: 80 93 c1 00 sts 0x00C1, r24 |
||
68 | UCSR0C = _BV(UCSZ00) | _BV(UCSZ01); |
||
69 | 3e1c: 86 e0 ldi r24, 0x06 ; 6 |
||
70 | 3e1e: 80 93 c2 00 sts 0x00C2, r24 |
||
71 | UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); |
||
72 | 3e22: 80 e1 ldi r24, 0x10 ; 16 |
||
73 | 3e24: 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 | 3e28: 8e e0 ldi r24, 0x0E ; 14 |
||
80 | 3e2a: c9 d0 rcall .+402 ; 0x3fbe <watchdogConfig> |
||
81 | |||
82 | /* Set LED pin as output */ |
||
83 | LED_DDR |= _BV(LED); |
||
84 | 3e2c: 25 9a sbi 0x04, 5 ; 4 |
||
85 | 3e2e: 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 | 3e30: 20 e3 ldi r18, 0x30 ; 48 |
||
93 | 3e32: 3c ef ldi r19, 0xFC ; 252 |
||
94 | TIFR1 = _BV(TOV1); |
||
95 | 3e34: 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 | 3e36: 30 93 85 00 sts 0x0085, r19 |
||
103 | 3e3a: 20 93 84 00 sts 0x0084, r18 |
||
104 | TIFR1 = _BV(TOV1); |
||
105 | 3e3e: 96 bb out 0x16, r25 ; 22 |
||
106 | while(!(TIFR1 & _BV(TOV1))); |
||
107 | 3e40: b0 9b sbis 0x16, 0 ; 22 |
||
108 | 3e42: fe cf rjmp .-4 ; 0x3e40 <main+0x40> |
||
109 | #ifdef __AVR_ATmega8__ |
||
110 | LED_PORT ^= _BV(LED); |
||
111 | #else |
||
112 | LED_PIN |= _BV(LED); |
||
113 | 3e44: 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 | 3e46: a8 95 wdr |
||
121 | LED_PORT ^= _BV(LED); |
||
122 | #else |
||
123 | LED_PIN |= _BV(LED); |
||
124 | #endif |
||
125 | watchdogReset(); |
||
126 | } while (--count); |
||
127 | 3e48: 81 50 subi r24, 0x01 ; 1 |
||
128 | 3e4a: a9 f7 brne .-22 ; 0x3e36 <main+0x36> |
||
129 | 3e4c: cc 24 eor r12, r12 |
||
130 | 3e4e: 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 | 3e50: 88 24 eor r8, r8 |
||
138 | 3e52: 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 | 3e54: b5 e0 ldi r27, 0x05 ; 5 |
||
145 | 3e56: 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 | 3e58: a1 e1 ldi r26, 0x11 ; 17 |
||
152 | 3e5a: 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 | 3e5c: f3 e0 ldi r31, 0x03 ; 3 |
||
160 | 3e5e: bf 2e mov r11, r31 |
||
161 | #endif |
||
162 | |||
163 | /* Forever loop */ |
||
164 | for (;;) { |
||
165 | /* get character from UART */ |
||
166 | ch = getch(); |
||
167 | 3e60: a2 d0 rcall .+324 ; 0x3fa6 <getch> |
||
168 | |||
169 | if(ch == STK_GET_PARAMETER) { |
||
170 | 3e62: 81 34 cpi r24, 0x41 ; 65 |
||
171 | 3e64: 61 f4 brne .+24 ; 0x3e7e <main+0x7e> |
||
172 | unsigned char which = getch(); |
||
173 | 3e66: 9f d0 rcall .+318 ; 0x3fa6 <getch> |
||
174 | 3e68: 08 2f mov r16, r24 |
||
175 | verifySpace(); |
||
176 | 3e6a: af d0 rcall .+350 ; 0x3fca <verifySpace> |
||
177 | if (which == 0x82) { |
||
178 | 3e6c: 02 38 cpi r16, 0x82 ; 130 |
||
179 | 3e6e: 11 f0 breq .+4 ; 0x3e74 <main+0x74> |
||
180 | /* |
||
181 | * Send optiboot version as "minor SW version" |
||
182 | */ |
||
183 | putch(OPTIBOOT_MINVER); |
||
184 | } else if (which == 0x81) { |
||
185 | 3e70: 01 38 cpi r16, 0x81 ; 129 |
||
186 | 3e72: 11 f4 brne .+4 ; 0x3e78 <main+0x78> |
||
187 | putch(OPTIBOOT_MAJVER); |
||
188 | 3e74: 84 e0 ldi r24, 0x04 ; 4 |
||
189 | 3e76: 01 c0 rjmp .+2 ; 0x3e7a <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 | 3e78: 83 e0 ldi r24, 0x03 ; 3 |
||
197 | 3e7a: 8d d0 rcall .+282 ; 0x3f96 <putch> |
||
198 | 3e7c: 89 c0 rjmp .+274 ; 0x3f90 <main+0x190> |
||
199 | } |
||
200 | } |
||
201 | else if(ch == STK_SET_DEVICE) { |
||
202 | 3e7e: 82 34 cpi r24, 0x42 ; 66 |
||
203 | 3e80: 11 f4 brne .+4 ; 0x3e86 <main+0x86> |
||
204 | // SET DEVICE is ignored |
||
205 | getNch(20); |
||
206 | 3e82: 84 e1 ldi r24, 0x14 ; 20 |
||
207 | 3e84: 03 c0 rjmp .+6 ; 0x3e8c <main+0x8c> |
||
208 | } |
||
209 | else if(ch == STK_SET_DEVICE_EXT) { |
||
210 | 3e86: 85 34 cpi r24, 0x45 ; 69 |
||
211 | 3e88: 19 f4 brne .+6 ; 0x3e90 <main+0x90> |
||
212 | // SET DEVICE EXT is ignored |
||
213 | getNch(5); |
||
214 | 3e8a: 85 e0 ldi r24, 0x05 ; 5 |
||
215 | 3e8c: a6 d0 rcall .+332 ; 0x3fda <getNch> |
||
216 | 3e8e: 80 c0 rjmp .+256 ; 0x3f90 <main+0x190> |
||
217 | } |
||
218 | else if(ch == STK_LOAD_ADDRESS) { |
||
219 | 3e90: 85 35 cpi r24, 0x55 ; 85 |
||
220 | 3e92: 79 f4 brne .+30 ; 0x3eb2 <main+0xb2> |
||
221 | // LOAD ADDRESS |
||
222 | uint16_t newAddress; |
||
223 | newAddress = getch(); |
||
224 | 3e94: 88 d0 rcall .+272 ; 0x3fa6 <getch> |
||
225 | newAddress = (newAddress & 0xff) | (getch() << 8); |
||
226 | 3e96: e8 2e mov r14, r24 |
||
227 | 3e98: ff 24 eor r15, r15 |
||
228 | 3e9a: 85 d0 rcall .+266 ; 0x3fa6 <getch> |
||
229 | 3e9c: 08 2f mov r16, r24 |
||
230 | 3e9e: 10 e0 ldi r17, 0x00 ; 0 |
||
231 | 3ea0: 10 2f mov r17, r16 |
||
232 | 3ea2: 00 27 eor r16, r16 |
||
233 | 3ea4: 0e 29 or r16, r14 |
||
234 | 3ea6: 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 | 3ea8: 00 0f add r16, r16 |
||
241 | 3eaa: 11 1f adc r17, r17 |
||
242 | address = newAddress; |
||
243 | verifySpace(); |
||
244 | 3eac: 8e d0 rcall .+284 ; 0x3fca <verifySpace> |
||
245 | 3eae: 68 01 movw r12, r16 |
||
246 | 3eb0: 6f c0 rjmp .+222 ; 0x3f90 <main+0x190> |
||
247 | } |
||
248 | else if(ch == STK_UNIVERSAL) { |
||
249 | 3eb2: 86 35 cpi r24, 0x56 ; 86 |
||
250 | 3eb4: 21 f4 brne .+8 ; 0x3ebe <main+0xbe> |
||
251 | // UNIVERSAL command is ignored |
||
252 | getNch(4); |
||
253 | 3eb6: 84 e0 ldi r24, 0x04 ; 4 |
||
254 | 3eb8: 90 d0 rcall .+288 ; 0x3fda <getNch> |
||
255 | putch(0x00); |
||
256 | 3eba: 80 e0 ldi r24, 0x00 ; 0 |
||
257 | 3ebc: de cf rjmp .-68 ; 0x3e7a <main+0x7a> |
||
258 | } |
||
259 | /* Write memory, length is big endian and is in bytes */ |
||
260 | else if(ch == STK_PROG_PAGE) { |
||
261 | 3ebe: 84 36 cpi r24, 0x64 ; 100 |
||
262 | 3ec0: 09 f0 breq .+2 ; 0x3ec4 <main+0xc4> |
||
263 | 3ec2: 40 c0 rjmp .+128 ; 0x3f44 <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 | 3ec4: 70 d0 rcall .+224 ; 0x3fa6 <getch> |
||
270 | length = getch(); |
||
271 | 3ec6: 6f d0 rcall .+222 ; 0x3fa6 <getch> |
||
272 | 3ec8: 08 2f mov r16, r24 |
||
273 | getch(); |
||
274 | 3eca: 6d d0 rcall .+218 ; 0x3fa6 <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 | 3ecc: 80 e0 ldi r24, 0x00 ; 0 |
||
279 | 3ece: c8 16 cp r12, r24 |
||
280 | 3ed0: 88 e3 ldi r24, 0x38 ; 56 |
||
281 | 3ed2: d8 06 cpc r13, r24 |
||
282 | 3ed4: 18 f4 brcc .+6 ; 0x3edc <main+0xdc> |
||
283 | 3ed6: f6 01 movw r30, r12 |
||
284 | 3ed8: b7 be out 0x37, r11 ; 55 |
||
285 | 3eda: e8 95 spm |
||
286 | 3edc: c0 e0 ldi r28, 0x00 ; 0 |
||
287 | 3ede: 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 | 3ee0: 62 d0 rcall .+196 ; 0x3fa6 <getch> |
||
293 | 3ee2: 89 93 st Y+, r24 |
||
294 | while (--length); |
||
295 | 3ee4: 0c 17 cp r16, r28 |
||
296 | 3ee6: e1 f7 brne .-8 ; 0x3ee0 <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 | 3ee8: f0 e0 ldi r31, 0x00 ; 0 |
||
302 | 3eea: cf 16 cp r12, r31 |
||
303 | 3eec: f8 e3 ldi r31, 0x38 ; 56 |
||
304 | 3eee: df 06 cpc r13, r31 |
||
305 | 3ef0: 18 f0 brcs .+6 ; 0x3ef8 <main+0xf8> |
||
306 | 3ef2: f6 01 movw r30, r12 |
||
307 | 3ef4: b7 be out 0x37, r11 ; 55 |
||
308 | 3ef6: e8 95 spm |
||
309 | |||
310 | // Read command terminator, start reply |
||
311 | verifySpace(); |
||
312 | 3ef8: 68 d0 rcall .+208 ; 0x3fca <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 | 3efa: 07 b6 in r0, 0x37 ; 55 |
||
318 | 3efc: 00 fc sbrc r0, 0 |
||
319 | 3efe: fd cf rjmp .-6 ; 0x3efa <main+0xfa> |
||
320 | 3f00: a6 01 movw r20, r12 |
||
321 | 3f02: a0 e0 ldi r26, 0x00 ; 0 |
||
322 | 3f04: 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 | 3f06: 2c 91 ld r18, X |
||
330 | 3f08: 30 e0 ldi r19, 0x00 ; 0 |
||
331 | a |= (*bufPtr++) << 8; |
||
332 | 3f0a: 11 96 adiw r26, 0x01 ; 1 |
||
333 | 3f0c: 8c 91 ld r24, X |
||
334 | 3f0e: 11 97 sbiw r26, 0x01 ; 1 |
||
335 | 3f10: 90 e0 ldi r25, 0x00 ; 0 |
||
336 | 3f12: 98 2f mov r25, r24 |
||
337 | 3f14: 88 27 eor r24, r24 |
||
338 | 3f16: 82 2b or r24, r18 |
||
339 | 3f18: 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 | 3f1a: 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 | 3f1c: fa 01 movw r30, r20 |
||
354 | 3f1e: 0c 01 movw r0, r24 |
||
355 | 3f20: 87 be out 0x37, r8 ; 55 |
||
356 | 3f22: e8 95 spm |
||
357 | 3f24: 11 24 eor r1, r1 |
||
358 | addrPtr += 2; |
||
359 | 3f26: 4e 5f subi r20, 0xFE ; 254 |
||
360 | 3f28: 5f 4f sbci r21, 0xFF ; 255 |
||
361 | } while (--ch); |
||
362 | 3f2a: f1 e0 ldi r31, 0x01 ; 1 |
||
363 | 3f2c: a0 38 cpi r26, 0x80 ; 128 |
||
364 | 3f2e: bf 07 cpc r27, r31 |
||
365 | 3f30: 51 f7 brne .-44 ; 0x3f06 <main+0x106> |
||
366 | |||
367 | // Write from programming buffer |
||
368 | __boot_page_write_short((uint16_t)(void*)address); |
||
369 | 3f32: f6 01 movw r30, r12 |
||
370 | 3f34: a7 be out 0x37, r10 ; 55 |
||
371 | 3f36: e8 95 spm |
||
372 | boot_spm_busy_wait(); |
||
373 | 3f38: 07 b6 in r0, 0x37 ; 55 |
||
374 | 3f3a: 00 fc sbrc r0, 0 |
||
375 | 3f3c: fd cf rjmp .-6 ; 0x3f38 <main+0x138> |
||
376 | |||
377 | #if defined(RWWSRE) |
||
378 | // Reenable read access to flash |
||
379 | boot_rww_enable(); |
||
380 | 3f3e: 97 be out 0x37, r9 ; 55 |
||
381 | 3f40: e8 95 spm |
||
382 | 3f42: 26 c0 rjmp .+76 ; 0x3f90 <main+0x190> |
||
383 | #endif |
||
384 | |||
385 | } |
||
386 | /* Read memory block mode, length is big endian. */ |
||
387 | else if(ch == STK_READ_PAGE) { |
||
388 | 3f44: 84 37 cpi r24, 0x74 ; 116 |
||
389 | 3f46: b1 f4 brne .+44 ; 0x3f74 <main+0x174> |
||
390 | // READ PAGE - we only read flash |
||
391 | getch(); /* getlen() */ |
||
392 | 3f48: 2e d0 rcall .+92 ; 0x3fa6 <getch> |
||
393 | length = getch(); |
||
394 | 3f4a: 2d d0 rcall .+90 ; 0x3fa6 <getch> |
||
395 | 3f4c: f8 2e mov r15, r24 |
||
396 | getch(); |
||
397 | 3f4e: 2b d0 rcall .+86 ; 0x3fa6 <getch> |
||
398 | |||
399 | verifySpace(); |
||
400 | 3f50: 3c d0 rcall .+120 ; 0x3fca <verifySpace> |
||
401 | 3f52: f6 01 movw r30, r12 |
||
402 | 3f54: 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 | 3f56: 8f 01 movw r16, r30 |
||
410 | 3f58: 0f 5f subi r16, 0xFF ; 255 |
||
411 | 3f5a: 1f 4f sbci r17, 0xFF ; 255 |
||
412 | 3f5c: 84 91 lpm r24, Z+ |
||
413 | 3f5e: 1b d0 rcall .+54 ; 0x3f96 <putch> |
||
414 | while (--length); |
||
415 | 3f60: ea 94 dec r14 |
||
416 | 3f62: f8 01 movw r30, r16 |
||
417 | 3f64: c1 f7 brne .-16 ; 0x3f56 <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 | 3f66: 08 94 sec |
||
425 | 3f68: c1 1c adc r12, r1 |
||
426 | 3f6a: d1 1c adc r13, r1 |
||
427 | 3f6c: fa 94 dec r15 |
||
428 | 3f6e: cf 0c add r12, r15 |
||
429 | 3f70: d1 1c adc r13, r1 |
||
430 | 3f72: 0e c0 rjmp .+28 ; 0x3f90 <main+0x190> |
||
431 | #endif |
||
432 | #endif |
||
433 | } |
||
434 | |||
435 | /* Get device signature bytes */ |
||
436 | else if(ch == STK_READ_SIGN) { |
||
437 | 3f74: 85 37 cpi r24, 0x75 ; 117 |
||
438 | 3f76: 39 f4 brne .+14 ; 0x3f86 <main+0x186> |
||
439 | // READ SIGN - return what Avrdude wants to hear |
||
440 | verifySpace(); |
||
441 | 3f78: 28 d0 rcall .+80 ; 0x3fca <verifySpace> |
||
442 | putch(SIGNATURE_0); |
||
443 | 3f7a: 8e e1 ldi r24, 0x1E ; 30 |
||
444 | 3f7c: 0c d0 rcall .+24 ; 0x3f96 <putch> |
||
445 | putch(SIGNATURE_1); |
||
446 | 3f7e: 84 e9 ldi r24, 0x94 ; 148 |
||
447 | 3f80: 0a d0 rcall .+20 ; 0x3f96 <putch> |
||
448 | putch(SIGNATURE_2); |
||
449 | 3f82: 86 e0 ldi r24, 0x06 ; 6 |
||
450 | 3f84: 7a cf rjmp .-268 ; 0x3e7a <main+0x7a> |
||
451 | } |
||
452 | else if (ch == 'Q') { |
||
453 | 3f86: 81 35 cpi r24, 0x51 ; 81 |
||
454 | 3f88: 11 f4 brne .+4 ; 0x3f8e <main+0x18e> |
||
455 | // Adaboot no-wait mod |
||
456 | watchdogConfig(WATCHDOG_16MS); |
||
457 | 3f8a: 88 e0 ldi r24, 0x08 ; 8 |
||
458 | 3f8c: 18 d0 rcall .+48 ; 0x3fbe <watchdogConfig> |
||
459 | verifySpace(); |
||
460 | } |
||
461 | else { |
||
462 | // This covers the response to commands like STK_ENTER_PROGMODE |
||
463 | verifySpace(); |
||
464 | 3f8e: 1d d0 rcall .+58 ; 0x3fca <verifySpace> |
||
465 | } |
||
466 | putch(STK_OK); |
||
467 | 3f90: 80 e1 ldi r24, 0x10 ; 16 |
||
468 | 3f92: 01 d0 rcall .+2 ; 0x3f96 <putch> |
||
469 | 3f94: 65 cf rjmp .-310 ; 0x3e60 <main+0x60> |
||
470 | |||
471 | 00003f96 <putch>: |
||
472 | } |
||
473 | } |
||
474 | |||
475 | void putch(char ch) { |
||
476 | 3f96: 98 2f mov r25, r24 |
||
477 | #ifndef SOFT_UART |
||
478 | while (!(UCSR0A & _BV(UDRE0))); |
||
479 | 3f98: 80 91 c0 00 lds r24, 0x00C0 |
||
480 | 3f9c: 85 ff sbrs r24, 5 |
||
481 | 3f9e: fc cf rjmp .-8 ; 0x3f98 <putch+0x2> |
||
482 | UDR0 = ch; |
||
483 | 3fa0: 90 93 c6 00 sts 0x00C6, r25 |
||
484 | [uartBit] "I" (UART_TX_BIT) |
||
485 | : |
||
486 | "r25" |
||
487 | ); |
||
488 | #endif |
||
489 | } |
||
490 | 3fa4: 08 95 ret |
||
491 | |||
492 | 00003fa6 <getch>: |
||
493 | [uartBit] "I" (UART_RX_BIT) |
||
494 | : |
||
495 | "r25" |
||
496 | ); |
||
497 | #else |
||
498 | while(!(UCSR0A & _BV(RXC0))) |
||
499 | 3fa6: 80 91 c0 00 lds r24, 0x00C0 |
||
500 | 3faa: 87 ff sbrs r24, 7 |
||
501 | 3fac: fc cf rjmp .-8 ; 0x3fa6 <getch> |
||
502 | ; |
||
503 | if (!(UCSR0A & _BV(FE0))) { |
||
504 | 3fae: 80 91 c0 00 lds r24, 0x00C0 |
||
505 | 3fb2: 84 fd sbrc r24, 4 |
||
506 | 3fb4: 01 c0 rjmp .+2 ; 0x3fb8 <getch+0x12> |
||
507 | } |
||
508 | #endif |
||
509 | |||
510 | // Watchdog functions. These are only safe with interrupts turned off. |
||
511 | void watchdogReset() { |
||
512 | __asm__ __volatile__ ( |
||
513 | 3fb6: a8 95 wdr |
||
514 | * don't care that an invalid char is returned...) |
||
515 | */ |
||
516 | watchdogReset(); |
||
517 | } |
||
518 | |||
519 | ch = UDR0; |
||
520 | 3fb8: 80 91 c6 00 lds r24, 0x00C6 |
||
521 | LED_PIN |= _BV(LED); |
||
522 | #endif |
||
523 | #endif |
||
524 | |||
525 | return ch; |
||
526 | } |
||
527 | 3fbc: 08 95 ret |
||
528 | |||
529 | 00003fbe <watchdogConfig>: |
||
530 | "wdr\n" |
||
531 | ); |
||
532 | } |
||
533 | |||
534 | void watchdogConfig(uint8_t x) { |
||
535 | WDTCSR = _BV(WDCE) | _BV(WDE); |
||
536 | 3fbe: e0 e6 ldi r30, 0x60 ; 96 |
||
537 | 3fc0: f0 e0 ldi r31, 0x00 ; 0 |
||
538 | 3fc2: 98 e1 ldi r25, 0x18 ; 24 |
||
539 | 3fc4: 90 83 st Z, r25 |
||
540 | WDTCSR = x; |
||
541 | 3fc6: 80 83 st Z, r24 |
||
542 | } |
||
543 | 3fc8: 08 95 ret |
||
544 | |||
545 | 00003fca <verifySpace>: |
||
546 | do getch(); while (--count); |
||
547 | verifySpace(); |
||
548 | } |
||
549 | |||
550 | void verifySpace() { |
||
551 | if (getch() != CRC_EOP) { |
||
552 | 3fca: ed df rcall .-38 ; 0x3fa6 <getch> |
||
553 | 3fcc: 80 32 cpi r24, 0x20 ; 32 |
||
554 | 3fce: 19 f0 breq .+6 ; 0x3fd6 <verifySpace+0xc> |
||
555 | watchdogConfig(WATCHDOG_16MS); // shorten WD timeout |
||
556 | 3fd0: 88 e0 ldi r24, 0x08 ; 8 |
||
557 | 3fd2: f5 df rcall .-22 ; 0x3fbe <watchdogConfig> |
||
558 | 3fd4: ff cf rjmp .-2 ; 0x3fd4 <verifySpace+0xa> |
||
559 | while (1) // and busy-loop so that WD causes |
||
560 | ; // a reset and app start. |
||
561 | } |
||
562 | putch(STK_INSYNC); |
||
563 | 3fd6: 84 e1 ldi r24, 0x14 ; 20 |
||
564 | } |
||
565 | 3fd8: de cf rjmp .-68 ; 0x3f96 <putch> |
||
566 | |||
567 | 00003fda <getNch>: |
||
568 | ::[count] "M" (UART_B_VALUE) |
||
569 | ); |
||
570 | } |
||
571 | #endif |
||
572 | |||
573 | void getNch(uint8_t count) { |
||
574 | 3fda: 1f 93 push r17 |
||
575 | 3fdc: 18 2f mov r17, r24 |
||
576 | do getch(); while (--count); |
||
577 | 3fde: e3 df rcall .-58 ; 0x3fa6 <getch> |
||
578 | 3fe0: 11 50 subi r17, 0x01 ; 1 |
||
579 | 3fe2: e9 f7 brne .-6 ; 0x3fde <getNch+0x4> |
||
580 | verifySpace(); |
||
581 | 3fe4: f2 df rcall .-28 ; 0x3fca <verifySpace> |
||
582 | } |
||
583 | 3fe6: 1f 91 pop r17 |
||
584 | 3fe8: 08 95 ret |
||
585 | |||
586 | 00003fea <appStart>: |
||
587 | WDTCSR = _BV(WDCE) | _BV(WDE); |
||
588 | WDTCSR = x; |
||
589 | } |
||
590 | |||
591 | void appStart() { |
||
592 | watchdogConfig(WATCHDOG_OFF); |
||
593 | 3fea: 80 e0 ldi r24, 0x00 ; 0 |
||
594 | 3fec: e8 df rcall .-48 ; 0x3fbe <watchdogConfig> |
||
595 | __asm__ __volatile__ ( |
||
596 | 3fee: ee 27 eor r30, r30 |
||
597 | 3ff0: ff 27 eor r31, r31 |
||
598 | 3ff2: 09 94 ijmp |