root / arduino-1.0 / hardware / arduino / bootloaders / optiboot / optiboot_atmega8.lst @ 58d82c77
History | View | Annotate | Download (19.3 KB)
1 | 58d82c77 | Tom Mullins | |
---|---|---|---|
2 | optiboot_atmega8.elf: file format elf32-avr |
||
3 | |||
4 | Sections: |
||
5 | Idx Name Size VMA LMA File off Algn |
||
6 | 0 .text 000001e0 00001e00 00001e00 00000054 2**1 |
||
7 | CONTENTS, ALLOC, LOAD, READONLY, CODE |
||
8 | 1 .version 00000002 00001ffe 00001ffe 00000234 2**0 |
||
9 | CONTENTS, READONLY |
||
10 | 2 .debug_aranges 00000028 00000000 00000000 00000236 2**0 |
||
11 | CONTENTS, READONLY, DEBUGGING |
||
12 | 3 .debug_pubnames 0000005f 00000000 00000000 0000025e 2**0 |
||
13 | CONTENTS, READONLY, DEBUGGING |
||
14 | 4 .debug_info 000002a6 00000000 00000000 000002bd 2**0 |
||
15 | CONTENTS, READONLY, DEBUGGING |
||
16 | 5 .debug_abbrev 00000169 00000000 00000000 00000563 2**0 |
||
17 | CONTENTS, READONLY, DEBUGGING |
||
18 | 6 .debug_line 00000498 00000000 00000000 000006cc 2**0 |
||
19 | CONTENTS, READONLY, DEBUGGING |
||
20 | 7 .debug_frame 00000080 00000000 00000000 00000b64 2**2 |
||
21 | CONTENTS, READONLY, DEBUGGING |
||
22 | 8 .debug_str 0000014f 00000000 00000000 00000be4 2**0 |
||
23 | CONTENTS, READONLY, DEBUGGING |
||
24 | 9 .debug_loc 000002ba 00000000 00000000 00000d33 2**0 |
||
25 | CONTENTS, READONLY, DEBUGGING |
||
26 | 10 .debug_ranges 00000078 00000000 00000000 00000fed 2**0 |
||
27 | CONTENTS, READONLY, DEBUGGING |
||
28 | |||
29 | Disassembly of section .text: |
||
30 | |||
31 | 00001e00 <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 | 1e00: 11 24 eor r1, r1 |
||
39 | // |
||
40 | // If not, uncomment the following instructions: |
||
41 | // cli(); |
||
42 | asm volatile ("clr __zero_reg__"); |
||
43 | #ifdef __AVR_ATmega8__ |
||
44 | SP=RAMEND; // This is done by hardware reset |
||
45 | 1e02: 8f e5 ldi r24, 0x5F ; 95 |
||
46 | 1e04: 94 e0 ldi r25, 0x04 ; 4 |
||
47 | 1e06: 9e bf out 0x3e, r25 ; 62 |
||
48 | 1e08: 8d bf out 0x3d, r24 ; 61 |
||
49 | #endif |
||
50 | |||
51 | // Adaboot no-wait mod |
||
52 | ch = MCUSR; |
||
53 | 1e0a: 84 b7 in r24, 0x34 ; 52 |
||
54 | MCUSR = 0; |
||
55 | 1e0c: 14 be out 0x34, r1 ; 52 |
||
56 | if (!(ch & _BV(EXTRF))) appStart(); |
||
57 | 1e0e: 81 ff sbrs r24, 1 |
||
58 | 1e10: e2 d0 rcall .+452 ; 0x1fd6 <appStart> |
||
59 | |||
60 | #if LED_START_FLASHES > 0 |
||
61 | // Set up Timer 1 for timeout counter |
||
62 | TCCR1B = _BV(CS12) | _BV(CS10); // div 1024 |
||
63 | 1e12: 85 e0 ldi r24, 0x05 ; 5 |
||
64 | 1e14: 8e bd out 0x2e, r24 ; 46 |
||
65 | #endif |
||
66 | #ifndef SOFT_UART |
||
67 | #ifdef __AVR_ATmega8__ |
||
68 | UCSRA = _BV(U2X); //Double speed mode USART |
||
69 | 1e16: 82 e0 ldi r24, 0x02 ; 2 |
||
70 | 1e18: 8b b9 out 0x0b, r24 ; 11 |
||
71 | UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx |
||
72 | 1e1a: 88 e1 ldi r24, 0x18 ; 24 |
||
73 | 1e1c: 8a b9 out 0x0a, r24 ; 10 |
||
74 | UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1 |
||
75 | 1e1e: 86 e8 ldi r24, 0x86 ; 134 |
||
76 | 1e20: 80 bd out 0x20, r24 ; 32 |
||
77 | UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); |
||
78 | 1e22: 80 e1 ldi r24, 0x10 ; 16 |
||
79 | 1e24: 89 b9 out 0x09, r24 ; 9 |
||
80 | UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 ); |
||
81 | #endif |
||
82 | #endif |
||
83 | |||
84 | // Set up watchdog to trigger after 500ms |
||
85 | watchdogConfig(WATCHDOG_1S); |
||
86 | 1e26: 8e e0 ldi r24, 0x0E ; 14 |
||
87 | 1e28: c2 d0 rcall .+388 ; 0x1fae <watchdogConfig> |
||
88 | |||
89 | /* Set LED pin as output */ |
||
90 | LED_DDR |= _BV(LED); |
||
91 | 1e2a: bd 9a sbi 0x17, 5 ; 23 |
||
92 | 1e2c: 96 e0 ldi r25, 0x06 ; 6 |
||
93 | } |
||
94 | |||
95 | #if LED_START_FLASHES > 0 |
||
96 | void flash_led(uint8_t count) { |
||
97 | do { |
||
98 | TCNT1 = -(F_CPU/(1024*16)); |
||
99 | 1e2e: 20 e3 ldi r18, 0x30 ; 48 |
||
100 | 1e30: 3c ef ldi r19, 0xFC ; 252 |
||
101 | TIFR1 = _BV(TOV1); |
||
102 | 1e32: 54 e0 ldi r21, 0x04 ; 4 |
||
103 | while(!(TIFR1 & _BV(TOV1))); |
||
104 | #ifdef __AVR_ATmega8__ |
||
105 | LED_PORT ^= _BV(LED); |
||
106 | 1e34: 40 e2 ldi r20, 0x20 ; 32 |
||
107 | } |
||
108 | |||
109 | #if LED_START_FLASHES > 0 |
||
110 | void flash_led(uint8_t count) { |
||
111 | do { |
||
112 | TCNT1 = -(F_CPU/(1024*16)); |
||
113 | 1e36: 3d bd out 0x2d, r19 ; 45 |
||
114 | 1e38: 2c bd out 0x2c, r18 ; 44 |
||
115 | TIFR1 = _BV(TOV1); |
||
116 | 1e3a: 58 bf out 0x38, r21 ; 56 |
||
117 | while(!(TIFR1 & _BV(TOV1))); |
||
118 | 1e3c: 08 b6 in r0, 0x38 ; 56 |
||
119 | 1e3e: 02 fe sbrs r0, 2 |
||
120 | 1e40: fd cf rjmp .-6 ; 0x1e3c <main+0x3c> |
||
121 | #ifdef __AVR_ATmega8__ |
||
122 | LED_PORT ^= _BV(LED); |
||
123 | 1e42: 88 b3 in r24, 0x18 ; 24 |
||
124 | 1e44: 84 27 eor r24, r20 |
||
125 | 1e46: 88 bb out 0x18, r24 ; 24 |
||
126 | } |
||
127 | #endif |
||
128 | |||
129 | // Watchdog functions. These are only safe with interrupts turned off. |
||
130 | void watchdogReset() { |
||
131 | __asm__ __volatile__ ( |
||
132 | 1e48: a8 95 wdr |
||
133 | LED_PORT ^= _BV(LED); |
||
134 | #else |
||
135 | LED_PIN |= _BV(LED); |
||
136 | #endif |
||
137 | watchdogReset(); |
||
138 | } while (--count); |
||
139 | 1e4a: 91 50 subi r25, 0x01 ; 1 |
||
140 | 1e4c: a1 f7 brne .-24 ; 0x1e36 <main+0x36> |
||
141 | 1e4e: cc 24 eor r12, r12 |
||
142 | 1e50: dd 24 eor r13, r13 |
||
143 | ch = SPM_PAGESIZE / 2; |
||
144 | do { |
||
145 | uint16_t a; |
||
146 | a = *bufPtr++; |
||
147 | a |= (*bufPtr++) << 8; |
||
148 | __boot_page_fill_short((uint16_t)(void*)addrPtr,a); |
||
149 | 1e52: 88 24 eor r8, r8 |
||
150 | 1e54: 83 94 inc r8 |
||
151 | addrPtr += 2; |
||
152 | } while (--ch); |
||
153 | |||
154 | // Write from programming buffer |
||
155 | __boot_page_write_short((uint16_t)(void*)address); |
||
156 | 1e56: b5 e0 ldi r27, 0x05 ; 5 |
||
157 | 1e58: ab 2e mov r10, r27 |
||
158 | boot_spm_busy_wait(); |
||
159 | |||
160 | #if defined(RWWSRE) |
||
161 | // Reenable read access to flash |
||
162 | boot_rww_enable(); |
||
163 | 1e5a: a1 e1 ldi r26, 0x11 ; 17 |
||
164 | 1e5c: 9a 2e mov r9, r26 |
||
165 | do *bufPtr++ = getch(); |
||
166 | while (--length); |
||
167 | |||
168 | // If we are in NRWW section, page erase has to be delayed until now. |
||
169 | // Todo: Take RAMPZ into account |
||
170 | if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); |
||
171 | 1e5e: f3 e0 ldi r31, 0x03 ; 3 |
||
172 | 1e60: bf 2e mov r11, r31 |
||
173 | #endif |
||
174 | |||
175 | /* Forever loop */ |
||
176 | for (;;) { |
||
177 | /* get character from UART */ |
||
178 | ch = getch(); |
||
179 | 1e62: 9e d0 rcall .+316 ; 0x1fa0 <getch> |
||
180 | |||
181 | if(ch == STK_GET_PARAMETER) { |
||
182 | 1e64: 81 34 cpi r24, 0x41 ; 65 |
||
183 | 1e66: 61 f4 brne .+24 ; 0x1e80 <main+0x80> |
||
184 | unsigned char which = getch(); |
||
185 | 1e68: 9b d0 rcall .+310 ; 0x1fa0 <getch> |
||
186 | 1e6a: 08 2f mov r16, r24 |
||
187 | verifySpace(); |
||
188 | 1e6c: a4 d0 rcall .+328 ; 0x1fb6 <verifySpace> |
||
189 | if (which == 0x82) { |
||
190 | 1e6e: 02 38 cpi r16, 0x82 ; 130 |
||
191 | 1e70: 11 f0 breq .+4 ; 0x1e76 <main+0x76> |
||
192 | /* |
||
193 | * Send optiboot version as "minor SW version" |
||
194 | */ |
||
195 | putch(OPTIBOOT_MINVER); |
||
196 | } else if (which == 0x81) { |
||
197 | 1e72: 01 38 cpi r16, 0x81 ; 129 |
||
198 | 1e74: 11 f4 brne .+4 ; 0x1e7a <main+0x7a> |
||
199 | putch(OPTIBOOT_MAJVER); |
||
200 | 1e76: 84 e0 ldi r24, 0x04 ; 4 |
||
201 | 1e78: 01 c0 rjmp .+2 ; 0x1e7c <main+0x7c> |
||
202 | } else { |
||
203 | /* |
||
204 | * GET PARAMETER returns a generic 0x03 reply for |
||
205 | * other parameters - enough to keep Avrdude happy |
||
206 | */ |
||
207 | putch(0x03); |
||
208 | 1e7a: 83 e0 ldi r24, 0x03 ; 3 |
||
209 | 1e7c: 8d d0 rcall .+282 ; 0x1f98 <putch> |
||
210 | 1e7e: 89 c0 rjmp .+274 ; 0x1f92 <main+0x192> |
||
211 | } |
||
212 | } |
||
213 | else if(ch == STK_SET_DEVICE) { |
||
214 | 1e80: 82 34 cpi r24, 0x42 ; 66 |
||
215 | 1e82: 11 f4 brne .+4 ; 0x1e88 <main+0x88> |
||
216 | // SET DEVICE is ignored |
||
217 | getNch(20); |
||
218 | 1e84: 84 e1 ldi r24, 0x14 ; 20 |
||
219 | 1e86: 03 c0 rjmp .+6 ; 0x1e8e <main+0x8e> |
||
220 | } |
||
221 | else if(ch == STK_SET_DEVICE_EXT) { |
||
222 | 1e88: 85 34 cpi r24, 0x45 ; 69 |
||
223 | 1e8a: 19 f4 brne .+6 ; 0x1e92 <main+0x92> |
||
224 | // SET DEVICE EXT is ignored |
||
225 | getNch(5); |
||
226 | 1e8c: 85 e0 ldi r24, 0x05 ; 5 |
||
227 | 1e8e: 9b d0 rcall .+310 ; 0x1fc6 <getNch> |
||
228 | 1e90: 80 c0 rjmp .+256 ; 0x1f92 <main+0x192> |
||
229 | } |
||
230 | else if(ch == STK_LOAD_ADDRESS) { |
||
231 | 1e92: 85 35 cpi r24, 0x55 ; 85 |
||
232 | 1e94: 79 f4 brne .+30 ; 0x1eb4 <main+0xb4> |
||
233 | // LOAD ADDRESS |
||
234 | uint16_t newAddress; |
||
235 | newAddress = getch(); |
||
236 | 1e96: 84 d0 rcall .+264 ; 0x1fa0 <getch> |
||
237 | newAddress = (newAddress & 0xff) | (getch() << 8); |
||
238 | 1e98: e8 2e mov r14, r24 |
||
239 | 1e9a: ff 24 eor r15, r15 |
||
240 | 1e9c: 81 d0 rcall .+258 ; 0x1fa0 <getch> |
||
241 | 1e9e: 08 2f mov r16, r24 |
||
242 | 1ea0: 10 e0 ldi r17, 0x00 ; 0 |
||
243 | 1ea2: 10 2f mov r17, r16 |
||
244 | 1ea4: 00 27 eor r16, r16 |
||
245 | 1ea6: 0e 29 or r16, r14 |
||
246 | 1ea8: 1f 29 or r17, r15 |
||
247 | #ifdef RAMPZ |
||
248 | // Transfer top bit to RAMPZ |
||
249 | RAMPZ = (newAddress & 0x8000) ? 1 : 0; |
||
250 | #endif |
||
251 | newAddress += newAddress; // Convert from word address to byte address |
||
252 | 1eaa: 00 0f add r16, r16 |
||
253 | 1eac: 11 1f adc r17, r17 |
||
254 | address = newAddress; |
||
255 | verifySpace(); |
||
256 | 1eae: 83 d0 rcall .+262 ; 0x1fb6 <verifySpace> |
||
257 | 1eb0: 68 01 movw r12, r16 |
||
258 | 1eb2: 6f c0 rjmp .+222 ; 0x1f92 <main+0x192> |
||
259 | } |
||
260 | else if(ch == STK_UNIVERSAL) { |
||
261 | 1eb4: 86 35 cpi r24, 0x56 ; 86 |
||
262 | 1eb6: 21 f4 brne .+8 ; 0x1ec0 <main+0xc0> |
||
263 | // UNIVERSAL command is ignored |
||
264 | getNch(4); |
||
265 | 1eb8: 84 e0 ldi r24, 0x04 ; 4 |
||
266 | 1eba: 85 d0 rcall .+266 ; 0x1fc6 <getNch> |
||
267 | putch(0x00); |
||
268 | 1ebc: 80 e0 ldi r24, 0x00 ; 0 |
||
269 | 1ebe: de cf rjmp .-68 ; 0x1e7c <main+0x7c> |
||
270 | } |
||
271 | /* Write memory, length is big endian and is in bytes */ |
||
272 | else if(ch == STK_PROG_PAGE) { |
||
273 | 1ec0: 84 36 cpi r24, 0x64 ; 100 |
||
274 | 1ec2: 09 f0 breq .+2 ; 0x1ec6 <main+0xc6> |
||
275 | 1ec4: 40 c0 rjmp .+128 ; 0x1f46 <main+0x146> |
||
276 | // PROGRAM PAGE - we support flash programming only, not EEPROM |
||
277 | uint8_t *bufPtr; |
||
278 | uint16_t addrPtr; |
||
279 | |||
280 | getch(); /* getlen() */ |
||
281 | 1ec6: 6c d0 rcall .+216 ; 0x1fa0 <getch> |
||
282 | length = getch(); |
||
283 | 1ec8: 6b d0 rcall .+214 ; 0x1fa0 <getch> |
||
284 | 1eca: 08 2f mov r16, r24 |
||
285 | getch(); |
||
286 | 1ecc: 69 d0 rcall .+210 ; 0x1fa0 <getch> |
||
287 | |||
288 | // If we are in RWW section, immediately start page erase |
||
289 | if (address < NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); |
||
290 | 1ece: 80 e0 ldi r24, 0x00 ; 0 |
||
291 | 1ed0: c8 16 cp r12, r24 |
||
292 | 1ed2: 88 e1 ldi r24, 0x18 ; 24 |
||
293 | 1ed4: d8 06 cpc r13, r24 |
||
294 | 1ed6: 18 f4 brcc .+6 ; 0x1ede <main+0xde> |
||
295 | 1ed8: f6 01 movw r30, r12 |
||
296 | 1eda: b7 be out 0x37, r11 ; 55 |
||
297 | 1edc: e8 95 spm |
||
298 | 1ede: c0 e0 ldi r28, 0x00 ; 0 |
||
299 | 1ee0: d1 e0 ldi r29, 0x01 ; 1 |
||
300 | |||
301 | // While that is going on, read in page contents |
||
302 | bufPtr = buff; |
||
303 | do *bufPtr++ = getch(); |
||
304 | 1ee2: 5e d0 rcall .+188 ; 0x1fa0 <getch> |
||
305 | 1ee4: 89 93 st Y+, r24 |
||
306 | while (--length); |
||
307 | 1ee6: 0c 17 cp r16, r28 |
||
308 | 1ee8: e1 f7 brne .-8 ; 0x1ee2 <main+0xe2> |
||
309 | |||
310 | // If we are in NRWW section, page erase has to be delayed until now. |
||
311 | // Todo: Take RAMPZ into account |
||
312 | if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address); |
||
313 | 1eea: f0 e0 ldi r31, 0x00 ; 0 |
||
314 | 1eec: cf 16 cp r12, r31 |
||
315 | 1eee: f8 e1 ldi r31, 0x18 ; 24 |
||
316 | 1ef0: df 06 cpc r13, r31 |
||
317 | 1ef2: 18 f0 brcs .+6 ; 0x1efa <main+0xfa> |
||
318 | 1ef4: f6 01 movw r30, r12 |
||
319 | 1ef6: b7 be out 0x37, r11 ; 55 |
||
320 | 1ef8: e8 95 spm |
||
321 | |||
322 | // Read command terminator, start reply |
||
323 | verifySpace(); |
||
324 | 1efa: 5d d0 rcall .+186 ; 0x1fb6 <verifySpace> |
||
325 | |||
326 | // If only a partial page is to be programmed, the erase might not be complete. |
||
327 | // So check that here |
||
328 | boot_spm_busy_wait(); |
||
329 | 1efc: 07 b6 in r0, 0x37 ; 55 |
||
330 | 1efe: 00 fc sbrc r0, 0 |
||
331 | 1f00: fd cf rjmp .-6 ; 0x1efc <main+0xfc> |
||
332 | 1f02: a6 01 movw r20, r12 |
||
333 | 1f04: a0 e0 ldi r26, 0x00 ; 0 |
||
334 | 1f06: b1 e0 ldi r27, 0x01 ; 1 |
||
335 | bufPtr = buff; |
||
336 | addrPtr = (uint16_t)(void*)address; |
||
337 | ch = SPM_PAGESIZE / 2; |
||
338 | do { |
||
339 | uint16_t a; |
||
340 | a = *bufPtr++; |
||
341 | 1f08: 2c 91 ld r18, X |
||
342 | 1f0a: 30 e0 ldi r19, 0x00 ; 0 |
||
343 | a |= (*bufPtr++) << 8; |
||
344 | 1f0c: 11 96 adiw r26, 0x01 ; 1 |
||
345 | 1f0e: 8c 91 ld r24, X |
||
346 | 1f10: 11 97 sbiw r26, 0x01 ; 1 |
||
347 | 1f12: 90 e0 ldi r25, 0x00 ; 0 |
||
348 | 1f14: 98 2f mov r25, r24 |
||
349 | 1f16: 88 27 eor r24, r24 |
||
350 | 1f18: 82 2b or r24, r18 |
||
351 | 1f1a: 93 2b or r25, r19 |
||
352 | #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) |
||
353 | #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) |
||
354 | #endif |
||
355 | |||
356 | /* main program starts here */ |
||
357 | int main(void) { |
||
358 | 1f1c: 12 96 adiw r26, 0x02 ; 2 |
||
359 | ch = SPM_PAGESIZE / 2; |
||
360 | do { |
||
361 | uint16_t a; |
||
362 | a = *bufPtr++; |
||
363 | a |= (*bufPtr++) << 8; |
||
364 | __boot_page_fill_short((uint16_t)(void*)addrPtr,a); |
||
365 | 1f1e: fa 01 movw r30, r20 |
||
366 | 1f20: 0c 01 movw r0, r24 |
||
367 | 1f22: 87 be out 0x37, r8 ; 55 |
||
368 | 1f24: e8 95 spm |
||
369 | 1f26: 11 24 eor r1, r1 |
||
370 | addrPtr += 2; |
||
371 | 1f28: 4e 5f subi r20, 0xFE ; 254 |
||
372 | 1f2a: 5f 4f sbci r21, 0xFF ; 255 |
||
373 | } while (--ch); |
||
374 | 1f2c: f1 e0 ldi r31, 0x01 ; 1 |
||
375 | 1f2e: a0 34 cpi r26, 0x40 ; 64 |
||
376 | 1f30: bf 07 cpc r27, r31 |
||
377 | 1f32: 51 f7 brne .-44 ; 0x1f08 <main+0x108> |
||
378 | |||
379 | // Write from programming buffer |
||
380 | __boot_page_write_short((uint16_t)(void*)address); |
||
381 | 1f34: f6 01 movw r30, r12 |
||
382 | 1f36: a7 be out 0x37, r10 ; 55 |
||
383 | 1f38: e8 95 spm |
||
384 | boot_spm_busy_wait(); |
||
385 | 1f3a: 07 b6 in r0, 0x37 ; 55 |
||
386 | 1f3c: 00 fc sbrc r0, 0 |
||
387 | 1f3e: fd cf rjmp .-6 ; 0x1f3a <main+0x13a> |
||
388 | |||
389 | #if defined(RWWSRE) |
||
390 | // Reenable read access to flash |
||
391 | boot_rww_enable(); |
||
392 | 1f40: 97 be out 0x37, r9 ; 55 |
||
393 | 1f42: e8 95 spm |
||
394 | 1f44: 26 c0 rjmp .+76 ; 0x1f92 <main+0x192> |
||
395 | #endif |
||
396 | |||
397 | } |
||
398 | /* Read memory block mode, length is big endian. */ |
||
399 | else if(ch == STK_READ_PAGE) { |
||
400 | 1f46: 84 37 cpi r24, 0x74 ; 116 |
||
401 | 1f48: b1 f4 brne .+44 ; 0x1f76 <main+0x176> |
||
402 | // READ PAGE - we only read flash |
||
403 | getch(); /* getlen() */ |
||
404 | 1f4a: 2a d0 rcall .+84 ; 0x1fa0 <getch> |
||
405 | length = getch(); |
||
406 | 1f4c: 29 d0 rcall .+82 ; 0x1fa0 <getch> |
||
407 | 1f4e: f8 2e mov r15, r24 |
||
408 | getch(); |
||
409 | 1f50: 27 d0 rcall .+78 ; 0x1fa0 <getch> |
||
410 | |||
411 | verifySpace(); |
||
412 | 1f52: 31 d0 rcall .+98 ; 0x1fb6 <verifySpace> |
||
413 | 1f54: f6 01 movw r30, r12 |
||
414 | 1f56: ef 2c mov r14, r15 |
||
415 | putch(result); |
||
416 | address++; |
||
417 | } |
||
418 | while (--length); |
||
419 | #else |
||
420 | do putch(pgm_read_byte_near(address++)); |
||
421 | 1f58: 8f 01 movw r16, r30 |
||
422 | 1f5a: 0f 5f subi r16, 0xFF ; 255 |
||
423 | 1f5c: 1f 4f sbci r17, 0xFF ; 255 |
||
424 | 1f5e: 84 91 lpm r24, Z+ |
||
425 | 1f60: 1b d0 rcall .+54 ; 0x1f98 <putch> |
||
426 | while (--length); |
||
427 | 1f62: ea 94 dec r14 |
||
428 | 1f64: f8 01 movw r30, r16 |
||
429 | 1f66: c1 f7 brne .-16 ; 0x1f58 <main+0x158> |
||
430 | #define rstVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+4)) |
||
431 | #define wdtVect (*(uint16_t*)(RAMSTART+SPM_PAGESIZE*2+6)) |
||
432 | #endif |
||
433 | |||
434 | /* main program starts here */ |
||
435 | int main(void) { |
||
436 | 1f68: 08 94 sec |
||
437 | 1f6a: c1 1c adc r12, r1 |
||
438 | 1f6c: d1 1c adc r13, r1 |
||
439 | 1f6e: fa 94 dec r15 |
||
440 | 1f70: cf 0c add r12, r15 |
||
441 | 1f72: d1 1c adc r13, r1 |
||
442 | 1f74: 0e c0 rjmp .+28 ; 0x1f92 <main+0x192> |
||
443 | #endif |
||
444 | #endif |
||
445 | } |
||
446 | |||
447 | /* Get device signature bytes */ |
||
448 | else if(ch == STK_READ_SIGN) { |
||
449 | 1f76: 85 37 cpi r24, 0x75 ; 117 |
||
450 | 1f78: 39 f4 brne .+14 ; 0x1f88 <main+0x188> |
||
451 | // READ SIGN - return what Avrdude wants to hear |
||
452 | verifySpace(); |
||
453 | 1f7a: 1d d0 rcall .+58 ; 0x1fb6 <verifySpace> |
||
454 | putch(SIGNATURE_0); |
||
455 | 1f7c: 8e e1 ldi r24, 0x1E ; 30 |
||
456 | 1f7e: 0c d0 rcall .+24 ; 0x1f98 <putch> |
||
457 | putch(SIGNATURE_1); |
||
458 | 1f80: 83 e9 ldi r24, 0x93 ; 147 |
||
459 | 1f82: 0a d0 rcall .+20 ; 0x1f98 <putch> |
||
460 | putch(SIGNATURE_2); |
||
461 | 1f84: 87 e0 ldi r24, 0x07 ; 7 |
||
462 | 1f86: 7a cf rjmp .-268 ; 0x1e7c <main+0x7c> |
||
463 | } |
||
464 | else if (ch == 'Q') { |
||
465 | 1f88: 81 35 cpi r24, 0x51 ; 81 |
||
466 | 1f8a: 11 f4 brne .+4 ; 0x1f90 <main+0x190> |
||
467 | // Adaboot no-wait mod |
||
468 | watchdogConfig(WATCHDOG_16MS); |
||
469 | 1f8c: 88 e0 ldi r24, 0x08 ; 8 |
||
470 | 1f8e: 0f d0 rcall .+30 ; 0x1fae <watchdogConfig> |
||
471 | verifySpace(); |
||
472 | } |
||
473 | else { |
||
474 | // This covers the response to commands like STK_ENTER_PROGMODE |
||
475 | verifySpace(); |
||
476 | 1f90: 12 d0 rcall .+36 ; 0x1fb6 <verifySpace> |
||
477 | } |
||
478 | putch(STK_OK); |
||
479 | 1f92: 80 e1 ldi r24, 0x10 ; 16 |
||
480 | 1f94: 01 d0 rcall .+2 ; 0x1f98 <putch> |
||
481 | 1f96: 65 cf rjmp .-310 ; 0x1e62 <main+0x62> |
||
482 | |||
483 | 00001f98 <putch>: |
||
484 | } |
||
485 | } |
||
486 | |||
487 | void putch(char ch) { |
||
488 | #ifndef SOFT_UART |
||
489 | while (!(UCSR0A & _BV(UDRE0))); |
||
490 | 1f98: 5d 9b sbis 0x0b, 5 ; 11 |
||
491 | 1f9a: fe cf rjmp .-4 ; 0x1f98 <putch> |
||
492 | UDR0 = ch; |
||
493 | 1f9c: 8c b9 out 0x0c, r24 ; 12 |
||
494 | [uartBit] "I" (UART_TX_BIT) |
||
495 | : |
||
496 | "r25" |
||
497 | ); |
||
498 | #endif |
||
499 | } |
||
500 | 1f9e: 08 95 ret |
||
501 | |||
502 | 00001fa0 <getch>: |
||
503 | [uartBit] "I" (UART_RX_BIT) |
||
504 | : |
||
505 | "r25" |
||
506 | ); |
||
507 | #else |
||
508 | while(!(UCSR0A & _BV(RXC0))) |
||
509 | 1fa0: 5f 9b sbis 0x0b, 7 ; 11 |
||
510 | 1fa2: fe cf rjmp .-4 ; 0x1fa0 <getch> |
||
511 | ; |
||
512 | if (!(UCSR0A & _BV(FE0))) { |
||
513 | 1fa4: 5c 99 sbic 0x0b, 4 ; 11 |
||
514 | 1fa6: 01 c0 rjmp .+2 ; 0x1faa <getch+0xa> |
||
515 | } |
||
516 | #endif |
||
517 | |||
518 | // Watchdog functions. These are only safe with interrupts turned off. |
||
519 | void watchdogReset() { |
||
520 | __asm__ __volatile__ ( |
||
521 | 1fa8: a8 95 wdr |
||
522 | * don't care that an invalid char is returned...) |
||
523 | */ |
||
524 | watchdogReset(); |
||
525 | } |
||
526 | |||
527 | ch = UDR0; |
||
528 | 1faa: 8c b1 in r24, 0x0c ; 12 |
||
529 | LED_PIN |= _BV(LED); |
||
530 | #endif |
||
531 | #endif |
||
532 | |||
533 | return ch; |
||
534 | } |
||
535 | 1fac: 08 95 ret |
||
536 | |||
537 | 00001fae <watchdogConfig>: |
||
538 | "wdr\n" |
||
539 | ); |
||
540 | } |
||
541 | |||
542 | void watchdogConfig(uint8_t x) { |
||
543 | WDTCSR = _BV(WDCE) | _BV(WDE); |
||
544 | 1fae: 98 e1 ldi r25, 0x18 ; 24 |
||
545 | 1fb0: 91 bd out 0x21, r25 ; 33 |
||
546 | WDTCSR = x; |
||
547 | 1fb2: 81 bd out 0x21, r24 ; 33 |
||
548 | } |
||
549 | 1fb4: 08 95 ret |
||
550 | |||
551 | 00001fb6 <verifySpace>: |
||
552 | do getch(); while (--count); |
||
553 | verifySpace(); |
||
554 | } |
||
555 | |||
556 | void verifySpace() { |
||
557 | if (getch() != CRC_EOP) { |
||
558 | 1fb6: f4 df rcall .-24 ; 0x1fa0 <getch> |
||
559 | 1fb8: 80 32 cpi r24, 0x20 ; 32 |
||
560 | 1fba: 19 f0 breq .+6 ; 0x1fc2 <verifySpace+0xc> |
||
561 | watchdogConfig(WATCHDOG_16MS); // shorten WD timeout |
||
562 | 1fbc: 88 e0 ldi r24, 0x08 ; 8 |
||
563 | 1fbe: f7 df rcall .-18 ; 0x1fae <watchdogConfig> |
||
564 | 1fc0: ff cf rjmp .-2 ; 0x1fc0 <verifySpace+0xa> |
||
565 | while (1) // and busy-loop so that WD causes |
||
566 | ; // a reset and app start. |
||
567 | } |
||
568 | putch(STK_INSYNC); |
||
569 | 1fc2: 84 e1 ldi r24, 0x14 ; 20 |
||
570 | } |
||
571 | 1fc4: e9 cf rjmp .-46 ; 0x1f98 <putch> |
||
572 | |||
573 | 00001fc6 <getNch>: |
||
574 | ::[count] "M" (UART_B_VALUE) |
||
575 | ); |
||
576 | } |
||
577 | #endif |
||
578 | |||
579 | void getNch(uint8_t count) { |
||
580 | 1fc6: 1f 93 push r17 |
||
581 | 1fc8: 18 2f mov r17, r24 |
||
582 | do getch(); while (--count); |
||
583 | 1fca: ea df rcall .-44 ; 0x1fa0 <getch> |
||
584 | 1fcc: 11 50 subi r17, 0x01 ; 1 |
||
585 | 1fce: e9 f7 brne .-6 ; 0x1fca <getNch+0x4> |
||
586 | verifySpace(); |
||
587 | 1fd0: f2 df rcall .-28 ; 0x1fb6 <verifySpace> |
||
588 | } |
||
589 | 1fd2: 1f 91 pop r17 |
||
590 | 1fd4: 08 95 ret |
||
591 | |||
592 | 00001fd6 <appStart>: |
||
593 | WDTCSR = _BV(WDCE) | _BV(WDE); |
||
594 | WDTCSR = x; |
||
595 | } |
||
596 | |||
597 | void appStart() { |
||
598 | watchdogConfig(WATCHDOG_OFF); |
||
599 | 1fd6: 80 e0 ldi r24, 0x00 ; 0 |
||
600 | 1fd8: ea df rcall .-44 ; 0x1fae <watchdogConfig> |
||
601 | __asm__ __volatile__ ( |
||
602 | 1fda: ee 27 eor r30, r30 |
||
603 | 1fdc: ff 27 eor r31, r31 |
||
604 | 1fde: 09 94 ijmp |