optiboot_pro_8MHz.lst 19 KB

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