Browse Source

Include lst and hex files for build

Peter Knight 14 years ago
parent
commit
834898dad0

+ 6 - 0
optiboot/bootloaders/optiboot/Makefile

@@ -79,6 +79,7 @@ virboot328: $(PROGRAM)_atmega328.lst
 #
 
 pro20: TARGET = pro_20mhz
+pro20: MCU_TARGET = atmega168
 pro20: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
 pro20: AVR_FREQ = 20000000L
 pro20: $(PROGRAM)_pro_20mhz.hex
@@ -99,6 +100,7 @@ pro20_isp: isp
 #
 
 pro16: TARGET = pro_16MHz
+pro16: MCU_TARGET = atmega168
 pro16: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
 pro16: AVR_FREQ = 16000000L
 pro16: $(PROGRAM)_pro_16MHz.hex
@@ -115,6 +117,7 @@ pro16_isp: isp
 
 # Diecimila and NG use identical bootloaders
 diecimila: TARGET = diecimila
+diecimila: MCU_TARGET = atmega168
 diecimila: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
 diecimila: AVR_FREQ = 16000000L 
 diecimila: $(PROGRAM)_diecimila.hex
@@ -227,6 +230,7 @@ atmega88_isp: isp
 #
 
 lilypad: TARGET = lilypad
+lilypad: MCU_TARGET = atmega168
 lilypad: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
 lilypad: AVR_FREQ = 8000000L
 lilypad: $(PROGRAM)_lilypad.hex
@@ -242,6 +246,7 @@ lilypad_isp: EFUSE = 02
 lilypad_isp: isp
 
 lilypad_resonator: TARGET = lilypad_resonator
+lilypad_resonator: MCU_TARGET = atmega168
 lilypad_resonator: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
 lilypad_resonator: AVR_FREQ = 8000000L
 lilypad_resonator: $(PROGRAM)_lilypad_resonator.hex
@@ -257,6 +262,7 @@ lilypad_resonator_isp: EFUSE = 02
 lilypad_resonator_isp: isp
 
 pro8: TARGET = pro_8MHz
+pro8: MCU_TARGET = atmega168
 pro8: CFLAGS += '-DLED_START_FLASHES=3' '-DBAUD_RATE=115200'
 pro8: AVR_FREQ = 8000000L
 pro8: $(PROGRAM)_pro_8MHz.hex

+ 0 - 13
optiboot/bootloaders/optiboot/makeall

@@ -12,16 +12,3 @@ make mega
 make atmega8
 make atmega88
 make luminet
-
-lilypad: TARGET = lilypad
-lilypad_resonator: TARGET = lilypad_resonator
-pro8: TARGET = pro_8MHz
-pro16: TARGET = pro_16MHz
-pro20: TARGET = pro_20mhz
-diecimila: TARGET = diecimila
-atmega328: TARGET = atmega328
-sanguino: TARGET = atmega644p
-mega: TARGET = atmega1280
-atmega8: TARGET = atmega8
-atmega328_pro8: TARGET = atmega328_pro_8MHz
-luminet: TARGET = luminet

+ 4 - 1
optiboot/bootloaders/optiboot/optiboot.c

@@ -201,6 +201,9 @@ void appStart() __attribute__ ((naked));
 #elif defined(__AVR_ATmega1280__)
 #define RAMSTART (0x200)
 #define NRWWSTART (0xE000)
+#elif defined(__AVR_ATmega8__) || defined(__AVR_ATmega88__)
+#define RAMSTART (0x100)
+#define NRWWSTART (0x1800)
 #endif
 
 /* C zero initialises all global variables. However, that requires */
@@ -258,7 +261,7 @@ int main(void) {
 #endif
 
   // Set up watchdog to trigger after 500ms
-  watchdogConfig(WATCHDOG_1MS);
+  watchdogConfig(WATCHDOG_1S);
 
   /* Set LED pin as output */
   LED_DDR |= _BV(LED);

+ 3 - 3
optiboot/bootloaders/optiboot/optiboot_atmega1280.hex

@@ -1,7 +1,7 @@
 :020000021000EC
-:10FC000085E08093810082E08093C00088E180934A
-:10FC1000C10086E08093C20080E18093C40084B775
-:10FC200014BE81FFDED08DE0D6D0279A86E020E397
+:10FC000084B714BE81FFEDD085E08093810082E04F
+:10FC10008093C00088E18093C10086E08093C20099
+:10FC200080E18093C4008EE0D6D0279A86E020E35E
 :10FC30003CEF91E0309385002093840096BBB09B0D
 :10FC4000FECF1F9AA8958150A9F7EE24E394A5E072
 :10FC5000DA2EF1E1FF2EB2D0813419F481E0CCD05C

+ 48 - 38
optiboot/bootloaders/optiboot/optiboot_atmega1280.lst

@@ -13,15 +13,15 @@ Idx Name          Size      VMA       LMA       File off  Algn
                   CONTENTS, READONLY, DEBUGGING
   4 .debug_abbrev 000001a1  00000000  00000000  00000566  2**0
                   CONTENTS, READONLY, DEBUGGING
-  5 .debug_line   000003f3  00000000  00000000  00000707  2**0
+  5 .debug_line   000003f4  00000000  00000000  00000707  2**0
                   CONTENTS, READONLY, DEBUGGING
   6 .debug_frame  00000090  00000000  00000000  00000afc  2**2
                   CONTENTS, READONLY, DEBUGGING
-  7 .debug_str    00000135  00000000  00000000  00000b8c  2**0
+  7 .debug_str    00000136  00000000  00000000  00000b8c  2**0
                   CONTENTS, READONLY, DEBUGGING
-  8 .debug_loc    000001b1  00000000  00000000  00000cc1  2**0
+  8 .debug_loc    000001b1  00000000  00000000  00000cc2  2**0
                   CONTENTS, READONLY, DEBUGGING
-  9 .debug_ranges 00000068  00000000  00000000  00000e72  2**0
+  9 .debug_ranges 00000068  00000000  00000000  00000e73  2**0
                   CONTENTS, READONLY, DEBUGGING
 
 Disassembly of section .text:
@@ -33,39 +33,46 @@ Disassembly of section .text:
 
 /* main program starts here */
 int main(void) {
-   1fc00:	85 e0       	ldi	r24, 0x05	; 5
-   1fc02:	80 93 81 00 	sts	0x0081, r24
+   1fc00:	84 b7       	in	r24, 0x34	; 52
+
+  uint8_t ch;
+
+  // Adaboot no-wait mod
+  ch = MCUSR;
+  MCUSR = 0;
+   1fc02:	14 be       	out	0x34, r1	; 52
+  if (!(ch & _BV(EXTRF))) appStart();
+   1fc04:	81 ff       	sbrs	r24, 1
+   1fc06:	ed d0       	rcall	.+474    	; 0x1fde2 <appStart>
+
 #if LED_START_FLASHES > 0
   // Set up Timer 1 for timeout counter
   TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
-#endif
-#ifndef SOFT_UART
+   1fc08:	85 e0       	ldi	r24, 0x05	; 5
+   1fc0a:	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
-   1fc06:	82 e0       	ldi	r24, 0x02	; 2
-   1fc08:	80 93 c0 00 	sts	0x00C0, r24
+   1fc0e:	82 e0       	ldi	r24, 0x02	; 2
+   1fc10:	80 93 c0 00 	sts	0x00C0, r24
   UCSR0B = _BV(RXEN0) | _BV(TXEN0);
-   1fc0c:	88 e1       	ldi	r24, 0x18	; 24
-   1fc0e:	80 93 c1 00 	sts	0x00C1, r24
+   1fc14:	88 e1       	ldi	r24, 0x18	; 24
+   1fc16:	80 93 c1 00 	sts	0x00C1, r24
   UCSR0C = _BV(UCSZ00) | _BV(UCSZ01);
-   1fc12:	86 e0       	ldi	r24, 0x06	; 6
-   1fc14:	80 93 c2 00 	sts	0x00C2, r24
+   1fc1a:	86 e0       	ldi	r24, 0x06	; 6
+   1fc1c:	80 93 c2 00 	sts	0x00C2, r24
   UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
-   1fc18:	80 e1       	ldi	r24, 0x10	; 16
-   1fc1a:	80 93 c4 00 	sts	0x00C4, r24
+   1fc20:	80 e1       	ldi	r24, 0x10	; 16
+   1fc22:	80 93 c4 00 	sts	0x00C4, r24
+#endif
 #endif
-
-  // Adaboot no-wait mod
-  ch = MCUSR;
-   1fc1e:	84 b7       	in	r24, 0x34	; 52
-  MCUSR = 0;
-   1fc20:	14 be       	out	0x34, r1	; 52
-  if (!(ch & _BV(EXTRF))) appStart();
-   1fc22:	81 ff       	sbrs	r24, 1
-   1fc24:	de d0       	rcall	.+444    	; 0x1fde2 <appStart>
 
   // Set up watchdog to trigger after 500ms
-  watchdogConfig(WATCHDOG_500MS);
-   1fc26:	8d e0       	ldi	r24, 0x0D	; 13
+  watchdogConfig(WATCHDOG_1S);
+   1fc26:	8e e0       	ldi	r24, 0x0E	; 14
    1fc28:	d6 d0       	rcall	.+428    	; 0x1fdd6 <watchdogConfig>
 
   /* Set LED pin as output */
@@ -95,6 +102,9 @@ void flash_led(uint8_t count) {
     while(!(TIFR1 & _BV(TOV1)));
    1fc3e:	b0 9b       	sbis	0x16, 0	; 22
    1fc40:	fe cf       	rjmp	.-4      	; 0x1fc3e <main+0x3e>
+#ifdef __AVR_ATmega8__
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
    1fc42:	1f 9a       	sbi	0x03, 7	; 3
   return getch();
@@ -104,10 +114,10 @@ void flash_led(uint8_t count) {
 void watchdogReset() {
   __asm__ __volatile__ (
    1fc44:	a8 95       	wdr
-    TCNT1 = -(F_CPU/(1024*16));
-    TIFR1 = _BV(TOV1);
-    while(!(TIFR1 & _BV(TOV1)));
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
+#endif
     watchdogReset();
   } while (--count);
    1fc46:	81 50       	subi	r24, 0x01	; 1
@@ -149,7 +159,7 @@ void watchdogReset() {
       // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy
       getNch(1);
    1fc5c:	81 e0       	ldi	r24, 0x01	; 1
-   1fc5e:	cc d0       	rcall	.+408    	; 0x1fdf8 <verifySpace+0xc>
+   1fc5e:	cc d0       	rcall	.+408    	; 0x1fdf8 <getNch>
    1fc60:	9b c0       	rjmp	.+310    	; 0x1fd98 <main+0x198>
       putch(0x03);
     }
@@ -167,7 +177,7 @@ void watchdogReset() {
       // SET DEVICE EXT is ignored
       getNch(5);
    1fc6e:	85 e0       	ldi	r24, 0x05	; 5
-   1fc70:	c3 d0       	rcall	.+390    	; 0x1fdf8 <verifySpace+0xc>
+   1fc70:	c3 d0       	rcall	.+390    	; 0x1fdf8 <getNch>
    1fc72:	99 c0       	rjmp	.+306    	; 0x1fda6 <main+0x1a6>
     }
     else if(ch == STK_LOAD_ADDRESS) {
@@ -210,13 +220,13 @@ void watchdogReset() {
       // UNIVERSAL command is ignored
       getNch(4);
    1fca6:	84 e0       	ldi	r24, 0x04	; 4
-   1fca8:	a7 d0       	rcall	.+334    	; 0x1fdf8 <verifySpace+0xc>
+   1fca8:	a7 d0       	rcall	.+334    	; 0x1fdf8 <getNch>
       putch(0x00);
    1fcaa:	80 e0       	ldi	r24, 0x00	; 0
    1fcac:	7f d0       	rcall	.+254    	; 0x1fdac <putch>
    1fcae:	7b c0       	rjmp	.+246    	; 0x1fda6 <main+0x1a6>
     }
-    /* Write memory, length is big endian and is in bytes  */
+    /* Write memory, length is big endian and is in bytes */
     else if(ch == STK_PROG_PAGE) {
    1fcb0:	84 36       	cpi	r24, 0x64	; 100
    1fcb2:	09 f0       	breq	.+2      	; 0x1fcb6 <main+0xb6>
@@ -464,8 +474,8 @@ void watchdogReset() {
    1fdc4:	fc cf       	rjmp	.-8      	; 0x1fdbe <getch+0x2>
   ch = UDR0;
    1fdc6:	80 91 c6 00 	lds	r24, 0x00C6
-#ifdef LED_DATA_FLASH
   LED_PIN |= _BV(LED);
+#endif
 #endif
 
   return ch;
@@ -529,6 +539,8 @@ void verifySpace() {
    1fdf4:	84 e1       	ldi	r24, 0x14	; 20
 }
    1fdf6:	da cf       	rjmp	.-76     	; 0x1fdac <putch>
+
+0001fdf8 <getNch>:
     ::[count] "M" (UART_B_VALUE)
   );
 }
@@ -537,12 +549,10 @@ void verifySpace() {
 void getNch(uint8_t count) {
    1fdf8:	1f 93       	push	r17
    1fdfa:	18 2f       	mov	r17, r24
-
-0001fdfc <getNch>:
   do getch(); while (--count);
    1fdfc:	df df       	rcall	.-66     	; 0x1fdbc <getch>
    1fdfe:	11 50       	subi	r17, 0x01	; 1
-   1fe00:	e9 f7       	brne	.-6      	; 0x1fdfc <getNch>
+   1fe00:	e9 f7       	brne	.-6      	; 0x1fdfc <getNch+0x4>
   verifySpace();
    1fe02:	f4 df       	rcall	.-24     	; 0x1fdec <verifySpace>
 }

+ 3 - 3
optiboot/bootloaders/optiboot/optiboot_atmega328.hex

@@ -1,6 +1,6 @@
-:107E000085E08093810082E08093C00088E18093C8
-:107E1000C10086E08093C20080E18093C40084B7F3
-:107E200014BE81FFD7D08DE0CFD0259A86E020E325
+:107E000084B714BE81FFE6D085E08093810082E0D4
+:107E10008093C00088E18093C10086E08093C20017
+:107E200080E18093C4008EE0CFD0259A86E020E3E5
 :107E30003CEF91E0309385002093840096BBB09B8B
 :107E4000FECF1D9AA8958150A9F7DD24D394A5E013
 :107E5000EA2EF1E1FF2EABD0813421F481E0C5D0D0

+ 48 - 38
optiboot/bootloaders/optiboot/optiboot_atmega328.lst

@@ -13,15 +13,15 @@ Idx Name          Size      VMA       LMA       File off  Algn
                   CONTENTS, READONLY, DEBUGGING
   4 .debug_abbrev 000001ae  00000000  00000000  00000564  2**0
                   CONTENTS, READONLY, DEBUGGING
-  5 .debug_line   000003e3  00000000  00000000  00000712  2**0
+  5 .debug_line   000003e4  00000000  00000000  00000712  2**0
                   CONTENTS, READONLY, DEBUGGING
   6 .debug_frame  00000090  00000000  00000000  00000af8  2**2
                   CONTENTS, READONLY, DEBUGGING
-  7 .debug_str    00000140  00000000  00000000  00000b88  2**0
+  7 .debug_str    00000141  00000000  00000000  00000b88  2**0
                   CONTENTS, READONLY, DEBUGGING
-  8 .debug_loc    000001e1  00000000  00000000  00000cc8  2**0
+  8 .debug_loc    000001e1  00000000  00000000  00000cc9  2**0
                   CONTENTS, READONLY, DEBUGGING
-  9 .debug_ranges 00000068  00000000  00000000  00000ea9  2**0
+  9 .debug_ranges 00000068  00000000  00000000  00000eaa  2**0
                   CONTENTS, READONLY, DEBUGGING
 
 Disassembly of section .text:
@@ -33,39 +33,46 @@ Disassembly of section .text:
 
 /* main program starts here */
 int main(void) {
-    7e00:	85 e0       	ldi	r24, 0x05	; 5
-    7e02:	80 93 81 00 	sts	0x0081, r24
+    7e00:	84 b7       	in	r24, 0x34	; 52
+
+  uint8_t ch;
+
+  // Adaboot no-wait mod
+  ch = MCUSR;
+  MCUSR = 0;
+    7e02:	14 be       	out	0x34, r1	; 52
+  if (!(ch & _BV(EXTRF))) appStart();
+    7e04:	81 ff       	sbrs	r24, 1
+    7e06:	e6 d0       	rcall	.+460    	; 0x7fd4 <appStart>
+
 #if LED_START_FLASHES > 0
   // Set up Timer 1 for timeout counter
   TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
-#endif
-#ifndef SOFT_UART
+    7e08:	85 e0       	ldi	r24, 0x05	; 5
+    7e0a:	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
-    7e06:	82 e0       	ldi	r24, 0x02	; 2
-    7e08:	80 93 c0 00 	sts	0x00C0, r24
+    7e0e:	82 e0       	ldi	r24, 0x02	; 2
+    7e10:	80 93 c0 00 	sts	0x00C0, r24
   UCSR0B = _BV(RXEN0) | _BV(TXEN0);
-    7e0c:	88 e1       	ldi	r24, 0x18	; 24
-    7e0e:	80 93 c1 00 	sts	0x00C1, r24
+    7e14:	88 e1       	ldi	r24, 0x18	; 24
+    7e16:	80 93 c1 00 	sts	0x00C1, r24
   UCSR0C = _BV(UCSZ00) | _BV(UCSZ01);
-    7e12:	86 e0       	ldi	r24, 0x06	; 6
-    7e14:	80 93 c2 00 	sts	0x00C2, r24
+    7e1a:	86 e0       	ldi	r24, 0x06	; 6
+    7e1c:	80 93 c2 00 	sts	0x00C2, r24
   UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
-    7e18:	80 e1       	ldi	r24, 0x10	; 16
-    7e1a:	80 93 c4 00 	sts	0x00C4, r24
+    7e20:	80 e1       	ldi	r24, 0x10	; 16
+    7e22:	80 93 c4 00 	sts	0x00C4, r24
+#endif
 #endif
-
-  // Adaboot no-wait mod
-  ch = MCUSR;
-    7e1e:	84 b7       	in	r24, 0x34	; 52
-  MCUSR = 0;
-    7e20:	14 be       	out	0x34, r1	; 52
-  if (!(ch & _BV(EXTRF))) appStart();
-    7e22:	81 ff       	sbrs	r24, 1
-    7e24:	d7 d0       	rcall	.+430    	; 0x7fd4 <appStart>
 
   // Set up watchdog to trigger after 500ms
-  watchdogConfig(WATCHDOG_500MS);
-    7e26:	8d e0       	ldi	r24, 0x0D	; 13
+  watchdogConfig(WATCHDOG_1S);
+    7e26:	8e e0       	ldi	r24, 0x0E	; 14
     7e28:	cf d0       	rcall	.+414    	; 0x7fc8 <watchdogConfig>
 
   /* Set LED pin as output */
@@ -95,6 +102,9 @@ void flash_led(uint8_t count) {
     while(!(TIFR1 & _BV(TOV1)));
     7e3e:	b0 9b       	sbis	0x16, 0	; 22
     7e40:	fe cf       	rjmp	.-4      	; 0x7e3e <main+0x3e>
+#ifdef __AVR_ATmega8__
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
     7e42:	1d 9a       	sbi	0x03, 5	; 3
   return getch();
@@ -104,10 +114,10 @@ void flash_led(uint8_t count) {
 void watchdogReset() {
   __asm__ __volatile__ (
     7e44:	a8 95       	wdr
-    TCNT1 = -(F_CPU/(1024*16));
-    TIFR1 = _BV(TOV1);
-    while(!(TIFR1 & _BV(TOV1)));
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
+#endif
     watchdogReset();
   } while (--count);
     7e46:	81 50       	subi	r24, 0x01	; 1
@@ -149,7 +159,7 @@ void watchdogReset() {
       // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy
       getNch(1);
     7e5c:	81 e0       	ldi	r24, 0x01	; 1
-    7e5e:	c5 d0       	rcall	.+394    	; 0x7fea <verifySpace+0xc>
+    7e5e:	c5 d0       	rcall	.+394    	; 0x7fea <getNch>
       putch(0x03);
     7e60:	83 e0       	ldi	r24, 0x03	; 3
     7e62:	20 c0       	rjmp	.+64     	; 0x7ea4 <main+0xa4>
@@ -168,7 +178,7 @@ void watchdogReset() {
       // SET DEVICE EXT is ignored
       getNch(5);
     7e70:	85 e0       	ldi	r24, 0x05	; 5
-    7e72:	bb d0       	rcall	.+374    	; 0x7fea <verifySpace+0xc>
+    7e72:	bb d0       	rcall	.+374    	; 0x7fea <getNch>
     7e74:	91 c0       	rjmp	.+290    	; 0x7f98 <main+0x198>
     }
     else if(ch == STK_LOAD_ADDRESS) {
@@ -206,13 +216,13 @@ void watchdogReset() {
       // UNIVERSAL command is ignored
       getNch(4);
     7e9e:	84 e0       	ldi	r24, 0x04	; 4
-    7ea0:	a4 d0       	rcall	.+328    	; 0x7fea <verifySpace+0xc>
+    7ea0:	a4 d0       	rcall	.+328    	; 0x7fea <getNch>
       putch(0x00);
     7ea2:	80 e0       	ldi	r24, 0x00	; 0
     7ea4:	7c d0       	rcall	.+248    	; 0x7f9e <putch>
     7ea6:	78 c0       	rjmp	.+240    	; 0x7f98 <main+0x198>
     }
-    /* Write memory, length is big endian and is in bytes  */
+    /* Write memory, length is big endian and is in bytes */
     else if(ch == STK_PROG_PAGE) {
     7ea8:	84 36       	cpi	r24, 0x64	; 100
     7eaa:	09 f0       	breq	.+2      	; 0x7eae <main+0xae>
@@ -456,8 +466,8 @@ void watchdogReset() {
     7fb6:	fc cf       	rjmp	.-8      	; 0x7fb0 <getch+0x2>
   ch = UDR0;
     7fb8:	80 91 c6 00 	lds	r24, 0x00C6
-#ifdef LED_DATA_FLASH
   LED_PIN |= _BV(LED);
+#endif
 #endif
 
   return ch;
@@ -521,6 +531,8 @@ void verifySpace() {
     7fe6:	84 e1       	ldi	r24, 0x14	; 20
 }
     7fe8:	da cf       	rjmp	.-76     	; 0x7f9e <putch>
+
+00007fea <getNch>:
     ::[count] "M" (UART_B_VALUE)
   );
 }
@@ -529,12 +541,10 @@ void verifySpace() {
 void getNch(uint8_t count) {
     7fea:	1f 93       	push	r17
     7fec:	18 2f       	mov	r17, r24
-
-00007fee <getNch>:
   do getch(); while (--count);
     7fee:	df df       	rcall	.-66     	; 0x7fae <getch>
     7ff0:	11 50       	subi	r17, 0x01	; 1
-    7ff2:	e9 f7       	brne	.-6      	; 0x7fee <getNch>
+    7ff2:	e9 f7       	brne	.-6      	; 0x7fee <getNch+0x4>
   verifySpace();
     7ff4:	f4 df       	rcall	.-24     	; 0x7fde <verifySpace>
 }

+ 3 - 3
optiboot/bootloaders/optiboot/optiboot_atmega644p.hex

@@ -1,6 +1,6 @@
-:10FC000085E08093810082E08093C00088E180934A
-:10FC1000C10086E08093C20080E18093C40084B775
-:10FC200014BE81FFD7D08DE0CFD0209A86E020E3AC
+:10FC000084B714BE81FFE6D085E08093810082E056
+:10FC10008093C00088E18093C10086E08093C20099
+:10FC200080E18093C4008EE0CFD0209A86E020E36C
 :10FC30003CEF91E0309385002093840096BBB09B0D
 :10FC4000FECF189AA8958150A9F7DD24D394A5E09A
 :10FC5000EA2EF1E1FF2EABD0813421F481E0C5D052

+ 48 - 38
optiboot/bootloaders/optiboot/optiboot_atmega644p.lst

@@ -13,15 +13,15 @@ Idx Name          Size      VMA       LMA       File off  Algn
                   CONTENTS, READONLY, DEBUGGING
   4 .debug_abbrev 000001ae  00000000  00000000  00000564  2**0
                   CONTENTS, READONLY, DEBUGGING
-  5 .debug_line   000003e3  00000000  00000000  00000712  2**0
+  5 .debug_line   000003e4  00000000  00000000  00000712  2**0
                   CONTENTS, READONLY, DEBUGGING
   6 .debug_frame  00000090  00000000  00000000  00000af8  2**2
                   CONTENTS, READONLY, DEBUGGING
-  7 .debug_str    00000140  00000000  00000000  00000b88  2**0
+  7 .debug_str    00000141  00000000  00000000  00000b88  2**0
                   CONTENTS, READONLY, DEBUGGING
-  8 .debug_loc    000001e1  00000000  00000000  00000cc8  2**0
+  8 .debug_loc    000001e1  00000000  00000000  00000cc9  2**0
                   CONTENTS, READONLY, DEBUGGING
-  9 .debug_ranges 00000068  00000000  00000000  00000ea9  2**0
+  9 .debug_ranges 00000068  00000000  00000000  00000eaa  2**0
                   CONTENTS, READONLY, DEBUGGING
 
 Disassembly of section .text:
@@ -33,39 +33,46 @@ Disassembly of section .text:
 
 /* main program starts here */
 int main(void) {
-    fc00:	85 e0       	ldi	r24, 0x05	; 5
-    fc02:	80 93 81 00 	sts	0x0081, r24
+    fc00:	84 b7       	in	r24, 0x34	; 52
+
+  uint8_t ch;
+
+  // Adaboot no-wait mod
+  ch = MCUSR;
+  MCUSR = 0;
+    fc02:	14 be       	out	0x34, r1	; 52
+  if (!(ch & _BV(EXTRF))) appStart();
+    fc04:	81 ff       	sbrs	r24, 1
+    fc06:	e6 d0       	rcall	.+460    	; 0xfdd4 <appStart>
+
 #if LED_START_FLASHES > 0
   // Set up Timer 1 for timeout counter
   TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
-#endif
-#ifndef SOFT_UART
+    fc08:	85 e0       	ldi	r24, 0x05	; 5
+    fc0a:	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
-    fc06:	82 e0       	ldi	r24, 0x02	; 2
-    fc08:	80 93 c0 00 	sts	0x00C0, r24
+    fc0e:	82 e0       	ldi	r24, 0x02	; 2
+    fc10:	80 93 c0 00 	sts	0x00C0, r24
   UCSR0B = _BV(RXEN0) | _BV(TXEN0);
-    fc0c:	88 e1       	ldi	r24, 0x18	; 24
-    fc0e:	80 93 c1 00 	sts	0x00C1, r24
+    fc14:	88 e1       	ldi	r24, 0x18	; 24
+    fc16:	80 93 c1 00 	sts	0x00C1, r24
   UCSR0C = _BV(UCSZ00) | _BV(UCSZ01);
-    fc12:	86 e0       	ldi	r24, 0x06	; 6
-    fc14:	80 93 c2 00 	sts	0x00C2, r24
+    fc1a:	86 e0       	ldi	r24, 0x06	; 6
+    fc1c:	80 93 c2 00 	sts	0x00C2, r24
   UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
-    fc18:	80 e1       	ldi	r24, 0x10	; 16
-    fc1a:	80 93 c4 00 	sts	0x00C4, r24
+    fc20:	80 e1       	ldi	r24, 0x10	; 16
+    fc22:	80 93 c4 00 	sts	0x00C4, r24
+#endif
 #endif
-
-  // Adaboot no-wait mod
-  ch = MCUSR;
-    fc1e:	84 b7       	in	r24, 0x34	; 52
-  MCUSR = 0;
-    fc20:	14 be       	out	0x34, r1	; 52
-  if (!(ch & _BV(EXTRF))) appStart();
-    fc22:	81 ff       	sbrs	r24, 1
-    fc24:	d7 d0       	rcall	.+430    	; 0xfdd4 <appStart>
 
   // Set up watchdog to trigger after 500ms
-  watchdogConfig(WATCHDOG_500MS);
-    fc26:	8d e0       	ldi	r24, 0x0D	; 13
+  watchdogConfig(WATCHDOG_1S);
+    fc26:	8e e0       	ldi	r24, 0x0E	; 14
     fc28:	cf d0       	rcall	.+414    	; 0xfdc8 <watchdogConfig>
 
   /* Set LED pin as output */
@@ -95,6 +102,9 @@ void flash_led(uint8_t count) {
     while(!(TIFR1 & _BV(TOV1)));
     fc3e:	b0 9b       	sbis	0x16, 0	; 22
     fc40:	fe cf       	rjmp	.-4      	; 0xfc3e <main+0x3e>
+#ifdef __AVR_ATmega8__
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
     fc42:	18 9a       	sbi	0x03, 0	; 3
   return getch();
@@ -104,10 +114,10 @@ void flash_led(uint8_t count) {
 void watchdogReset() {
   __asm__ __volatile__ (
     fc44:	a8 95       	wdr
-    TCNT1 = -(F_CPU/(1024*16));
-    TIFR1 = _BV(TOV1);
-    while(!(TIFR1 & _BV(TOV1)));
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
+#endif
     watchdogReset();
   } while (--count);
     fc46:	81 50       	subi	r24, 0x01	; 1
@@ -149,7 +159,7 @@ void watchdogReset() {
       // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy
       getNch(1);
     fc5c:	81 e0       	ldi	r24, 0x01	; 1
-    fc5e:	c5 d0       	rcall	.+394    	; 0xfdea <verifySpace+0xc>
+    fc5e:	c5 d0       	rcall	.+394    	; 0xfdea <getNch>
       putch(0x03);
     fc60:	83 e0       	ldi	r24, 0x03	; 3
     fc62:	20 c0       	rjmp	.+64     	; 0xfca4 <main+0xa4>
@@ -168,7 +178,7 @@ void watchdogReset() {
       // SET DEVICE EXT is ignored
       getNch(5);
     fc70:	85 e0       	ldi	r24, 0x05	; 5
-    fc72:	bb d0       	rcall	.+374    	; 0xfdea <verifySpace+0xc>
+    fc72:	bb d0       	rcall	.+374    	; 0xfdea <getNch>
     fc74:	91 c0       	rjmp	.+290    	; 0xfd98 <main+0x198>
     }
     else if(ch == STK_LOAD_ADDRESS) {
@@ -206,13 +216,13 @@ void watchdogReset() {
       // UNIVERSAL command is ignored
       getNch(4);
     fc9e:	84 e0       	ldi	r24, 0x04	; 4
-    fca0:	a4 d0       	rcall	.+328    	; 0xfdea <verifySpace+0xc>
+    fca0:	a4 d0       	rcall	.+328    	; 0xfdea <getNch>
       putch(0x00);
     fca2:	80 e0       	ldi	r24, 0x00	; 0
     fca4:	7c d0       	rcall	.+248    	; 0xfd9e <putch>
     fca6:	78 c0       	rjmp	.+240    	; 0xfd98 <main+0x198>
     }
-    /* Write memory, length is big endian and is in bytes  */
+    /* Write memory, length is big endian and is in bytes */
     else if(ch == STK_PROG_PAGE) {
     fca8:	84 36       	cpi	r24, 0x64	; 100
     fcaa:	09 f0       	breq	.+2      	; 0xfcae <main+0xae>
@@ -456,8 +466,8 @@ void watchdogReset() {
     fdb6:	fc cf       	rjmp	.-8      	; 0xfdb0 <getch+0x2>
   ch = UDR0;
     fdb8:	80 91 c6 00 	lds	r24, 0x00C6
-#ifdef LED_DATA_FLASH
   LED_PIN |= _BV(LED);
+#endif
 #endif
 
   return ch;
@@ -521,6 +531,8 @@ void verifySpace() {
     fde6:	84 e1       	ldi	r24, 0x14	; 20
 }
     fde8:	da cf       	rjmp	.-76     	; 0xfd9e <putch>
+
+0000fdea <getNch>:
     ::[count] "M" (UART_B_VALUE)
   );
 }
@@ -529,12 +541,10 @@ void verifySpace() {
 void getNch(uint8_t count) {
     fdea:	1f 93       	push	r17
     fdec:	18 2f       	mov	r17, r24
-
-0000fdee <getNch>:
   do getch(); while (--count);
     fdee:	df df       	rcall	.-66     	; 0xfdae <getch>
     fdf0:	11 50       	subi	r17, 0x01	; 1
-    fdf2:	e9 f7       	brne	.-6      	; 0xfdee <getNch>
+    fdf2:	e9 f7       	brne	.-6      	; 0xfdee <getNch+0x4>
   verifySpace();
     fdf4:	f4 df       	rcall	.-24     	; 0xfdde <verifySpace>
 }

+ 3 - 3
optiboot/bootloaders/optiboot/optiboot_diecimila.hex

@@ -1,6 +1,6 @@
-:103E000085E08093810082E08093C00088E1809308
-:103E1000C10086E08093C20080E18093C40084B733
-:103E200014BE81FFD7D08DE0CFD0259A86E020E365
+:103E000084B714BE81FFE6D085E08093810082E014
+:103E10008093C00088E18093C10086E08093C20057
+:103E200080E18093C4008EE0CFD0259A86E020E325
 :103E30003CEF91E0309385002093840096BBB09BCB
 :103E4000FECF1D9AA8958150A9F7DD24D394A5E053
 :103E5000EA2EF1E1FF2EABD0813421F481E0C5D010

+ 48 - 38
optiboot/bootloaders/optiboot/optiboot_diecimila.lst

@@ -13,15 +13,15 @@ Idx Name          Size      VMA       LMA       File off  Algn
                   CONTENTS, READONLY, DEBUGGING
   4 .debug_abbrev 000001ae  00000000  00000000  00000564  2**0
                   CONTENTS, READONLY, DEBUGGING
-  5 .debug_line   000003e3  00000000  00000000  00000712  2**0
+  5 .debug_line   000003e4  00000000  00000000  00000712  2**0
                   CONTENTS, READONLY, DEBUGGING
   6 .debug_frame  00000090  00000000  00000000  00000af8  2**2
                   CONTENTS, READONLY, DEBUGGING
-  7 .debug_str    00000140  00000000  00000000  00000b88  2**0
+  7 .debug_str    00000141  00000000  00000000  00000b88  2**0
                   CONTENTS, READONLY, DEBUGGING
-  8 .debug_loc    000001e1  00000000  00000000  00000cc8  2**0
+  8 .debug_loc    000001e1  00000000  00000000  00000cc9  2**0
                   CONTENTS, READONLY, DEBUGGING
-  9 .debug_ranges 00000068  00000000  00000000  00000ea9  2**0
+  9 .debug_ranges 00000068  00000000  00000000  00000eaa  2**0
                   CONTENTS, READONLY, DEBUGGING
 
 Disassembly of section .text:
@@ -33,39 +33,46 @@ Disassembly of section .text:
 
 /* main program starts here */
 int main(void) {
-    3e00:	85 e0       	ldi	r24, 0x05	; 5
-    3e02:	80 93 81 00 	sts	0x0081, r24
+    3e00:	84 b7       	in	r24, 0x34	; 52
+
+  uint8_t ch;
+
+  // Adaboot no-wait mod
+  ch = MCUSR;
+  MCUSR = 0;
+    3e02:	14 be       	out	0x34, r1	; 52
+  if (!(ch & _BV(EXTRF))) appStart();
+    3e04:	81 ff       	sbrs	r24, 1
+    3e06:	e6 d0       	rcall	.+460    	; 0x3fd4 <appStart>
+
 #if LED_START_FLASHES > 0
   // Set up Timer 1 for timeout counter
   TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
-#endif
-#ifndef SOFT_UART
+    3e08:	85 e0       	ldi	r24, 0x05	; 5
+    3e0a:	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
-    3e06:	82 e0       	ldi	r24, 0x02	; 2
-    3e08:	80 93 c0 00 	sts	0x00C0, r24
+    3e0e:	82 e0       	ldi	r24, 0x02	; 2
+    3e10:	80 93 c0 00 	sts	0x00C0, r24
   UCSR0B = _BV(RXEN0) | _BV(TXEN0);
-    3e0c:	88 e1       	ldi	r24, 0x18	; 24
-    3e0e:	80 93 c1 00 	sts	0x00C1, r24
+    3e14:	88 e1       	ldi	r24, 0x18	; 24
+    3e16:	80 93 c1 00 	sts	0x00C1, r24
   UCSR0C = _BV(UCSZ00) | _BV(UCSZ01);
-    3e12:	86 e0       	ldi	r24, 0x06	; 6
-    3e14:	80 93 c2 00 	sts	0x00C2, r24
+    3e1a:	86 e0       	ldi	r24, 0x06	; 6
+    3e1c:	80 93 c2 00 	sts	0x00C2, r24
   UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
-    3e18:	80 e1       	ldi	r24, 0x10	; 16
-    3e1a:	80 93 c4 00 	sts	0x00C4, r24
+    3e20:	80 e1       	ldi	r24, 0x10	; 16
+    3e22:	80 93 c4 00 	sts	0x00C4, r24
+#endif
 #endif
-
-  // Adaboot no-wait mod
-  ch = MCUSR;
-    3e1e:	84 b7       	in	r24, 0x34	; 52
-  MCUSR = 0;
-    3e20:	14 be       	out	0x34, r1	; 52
-  if (!(ch & _BV(EXTRF))) appStart();
-    3e22:	81 ff       	sbrs	r24, 1
-    3e24:	d7 d0       	rcall	.+430    	; 0x3fd4 <appStart>
 
   // Set up watchdog to trigger after 500ms
-  watchdogConfig(WATCHDOG_500MS);
-    3e26:	8d e0       	ldi	r24, 0x0D	; 13
+  watchdogConfig(WATCHDOG_1S);
+    3e26:	8e e0       	ldi	r24, 0x0E	; 14
     3e28:	cf d0       	rcall	.+414    	; 0x3fc8 <watchdogConfig>
 
   /* Set LED pin as output */
@@ -95,6 +102,9 @@ void flash_led(uint8_t count) {
     while(!(TIFR1 & _BV(TOV1)));
     3e3e:	b0 9b       	sbis	0x16, 0	; 22
     3e40:	fe cf       	rjmp	.-4      	; 0x3e3e <main+0x3e>
+#ifdef __AVR_ATmega8__
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
     3e42:	1d 9a       	sbi	0x03, 5	; 3
   return getch();
@@ -104,10 +114,10 @@ void flash_led(uint8_t count) {
 void watchdogReset() {
   __asm__ __volatile__ (
     3e44:	a8 95       	wdr
-    TCNT1 = -(F_CPU/(1024*16));
-    TIFR1 = _BV(TOV1);
-    while(!(TIFR1 & _BV(TOV1)));
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
+#endif
     watchdogReset();
   } while (--count);
     3e46:	81 50       	subi	r24, 0x01	; 1
@@ -149,7 +159,7 @@ void watchdogReset() {
       // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy
       getNch(1);
     3e5c:	81 e0       	ldi	r24, 0x01	; 1
-    3e5e:	c5 d0       	rcall	.+394    	; 0x3fea <verifySpace+0xc>
+    3e5e:	c5 d0       	rcall	.+394    	; 0x3fea <getNch>
       putch(0x03);
     3e60:	83 e0       	ldi	r24, 0x03	; 3
     3e62:	20 c0       	rjmp	.+64     	; 0x3ea4 <main+0xa4>
@@ -168,7 +178,7 @@ void watchdogReset() {
       // SET DEVICE EXT is ignored
       getNch(5);
     3e70:	85 e0       	ldi	r24, 0x05	; 5
-    3e72:	bb d0       	rcall	.+374    	; 0x3fea <verifySpace+0xc>
+    3e72:	bb d0       	rcall	.+374    	; 0x3fea <getNch>
     3e74:	91 c0       	rjmp	.+290    	; 0x3f98 <main+0x198>
     }
     else if(ch == STK_LOAD_ADDRESS) {
@@ -206,13 +216,13 @@ void watchdogReset() {
       // UNIVERSAL command is ignored
       getNch(4);
     3e9e:	84 e0       	ldi	r24, 0x04	; 4
-    3ea0:	a4 d0       	rcall	.+328    	; 0x3fea <verifySpace+0xc>
+    3ea0:	a4 d0       	rcall	.+328    	; 0x3fea <getNch>
       putch(0x00);
     3ea2:	80 e0       	ldi	r24, 0x00	; 0
     3ea4:	7c d0       	rcall	.+248    	; 0x3f9e <putch>
     3ea6:	78 c0       	rjmp	.+240    	; 0x3f98 <main+0x198>
     }
-    /* Write memory, length is big endian and is in bytes  */
+    /* Write memory, length is big endian and is in bytes */
     else if(ch == STK_PROG_PAGE) {
     3ea8:	84 36       	cpi	r24, 0x64	; 100
     3eaa:	09 f0       	breq	.+2      	; 0x3eae <main+0xae>
@@ -456,8 +466,8 @@ void watchdogReset() {
     3fb6:	fc cf       	rjmp	.-8      	; 0x3fb0 <getch+0x2>
   ch = UDR0;
     3fb8:	80 91 c6 00 	lds	r24, 0x00C6
-#ifdef LED_DATA_FLASH
   LED_PIN |= _BV(LED);
+#endif
 #endif
 
   return ch;
@@ -521,6 +531,8 @@ void verifySpace() {
     3fe6:	84 e1       	ldi	r24, 0x14	; 20
 }
     3fe8:	da cf       	rjmp	.-76     	; 0x3f9e <putch>
+
+00003fea <getNch>:
     ::[count] "M" (UART_B_VALUE)
   );
 }
@@ -529,12 +541,10 @@ void verifySpace() {
 void getNch(uint8_t count) {
     3fea:	1f 93       	push	r17
     3fec:	18 2f       	mov	r17, r24
-
-00003fee <getNch>:
   do getch(); while (--count);
     3fee:	df df       	rcall	.-66     	; 0x3fae <getch>
     3ff0:	11 50       	subi	r17, 0x01	; 1
-    3ff2:	e9 f7       	brne	.-6      	; 0x3fee <getNch>
+    3ff2:	e9 f7       	brne	.-6      	; 0x3fee <getNch+0x4>
   verifySpace();
     3ff4:	f4 df       	rcall	.-24     	; 0x3fde <verifySpace>
 }

+ 3 - 3
optiboot/bootloaders/optiboot/optiboot_lilypad.hex

@@ -1,6 +1,6 @@
-:103E000085E08093810082E08093C00088E1809308
-:103E1000C10086E08093C20088E08093C40084B72C
-:103E200014BE81FFD7D08DE0CFD0259A86E028E15F
+:103E000084B714BE81FFE6D085E08093810082E014
+:103E10008093C00088E18093C10086E08093C20057
+:103E200088E08093C4008EE0CFD0259A86E028E118
 :103E30003EEF91E0309385002093840096BBB09BC9
 :103E4000FECF1D9AA8958150A9F7DD24D394A5E053
 :103E5000EA2EF1E1FF2EABD0813421F481E0C5D010

+ 48 - 38
optiboot/bootloaders/optiboot/optiboot_lilypad.lst

@@ -13,15 +13,15 @@ Idx Name          Size      VMA       LMA       File off  Algn
                   CONTENTS, READONLY, DEBUGGING
   4 .debug_abbrev 000001ae  00000000  00000000  00000564  2**0
                   CONTENTS, READONLY, DEBUGGING
-  5 .debug_line   000003e3  00000000  00000000  00000712  2**0
+  5 .debug_line   000003e4  00000000  00000000  00000712  2**0
                   CONTENTS, READONLY, DEBUGGING
   6 .debug_frame  00000090  00000000  00000000  00000af8  2**2
                   CONTENTS, READONLY, DEBUGGING
-  7 .debug_str    00000140  00000000  00000000  00000b88  2**0
+  7 .debug_str    00000141  00000000  00000000  00000b88  2**0
                   CONTENTS, READONLY, DEBUGGING
-  8 .debug_loc    000001e1  00000000  00000000  00000cc8  2**0
+  8 .debug_loc    000001e1  00000000  00000000  00000cc9  2**0
                   CONTENTS, READONLY, DEBUGGING
-  9 .debug_ranges 00000068  00000000  00000000  00000ea9  2**0
+  9 .debug_ranges 00000068  00000000  00000000  00000eaa  2**0
                   CONTENTS, READONLY, DEBUGGING
 
 Disassembly of section .text:
@@ -33,39 +33,46 @@ Disassembly of section .text:
 
 /* main program starts here */
 int main(void) {
-    3e00:	85 e0       	ldi	r24, 0x05	; 5
-    3e02:	80 93 81 00 	sts	0x0081, r24
+    3e00:	84 b7       	in	r24, 0x34	; 52
+
+  uint8_t ch;
+
+  // Adaboot no-wait mod
+  ch = MCUSR;
+  MCUSR = 0;
+    3e02:	14 be       	out	0x34, r1	; 52
+  if (!(ch & _BV(EXTRF))) appStart();
+    3e04:	81 ff       	sbrs	r24, 1
+    3e06:	e6 d0       	rcall	.+460    	; 0x3fd4 <appStart>
+
 #if LED_START_FLASHES > 0
   // Set up Timer 1 for timeout counter
   TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
-#endif
-#ifndef SOFT_UART
+    3e08:	85 e0       	ldi	r24, 0x05	; 5
+    3e0a:	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
-    3e06:	82 e0       	ldi	r24, 0x02	; 2
-    3e08:	80 93 c0 00 	sts	0x00C0, r24
+    3e0e:	82 e0       	ldi	r24, 0x02	; 2
+    3e10:	80 93 c0 00 	sts	0x00C0, r24
   UCSR0B = _BV(RXEN0) | _BV(TXEN0);
-    3e0c:	88 e1       	ldi	r24, 0x18	; 24
-    3e0e:	80 93 c1 00 	sts	0x00C1, r24
+    3e14:	88 e1       	ldi	r24, 0x18	; 24
+    3e16:	80 93 c1 00 	sts	0x00C1, r24
   UCSR0C = _BV(UCSZ00) | _BV(UCSZ01);
-    3e12:	86 e0       	ldi	r24, 0x06	; 6
-    3e14:	80 93 c2 00 	sts	0x00C2, r24
+    3e1a:	86 e0       	ldi	r24, 0x06	; 6
+    3e1c:	80 93 c2 00 	sts	0x00C2, r24
   UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
-    3e18:	88 e0       	ldi	r24, 0x08	; 8
-    3e1a:	80 93 c4 00 	sts	0x00C4, r24
+    3e20:	88 e0       	ldi	r24, 0x08	; 8
+    3e22:	80 93 c4 00 	sts	0x00C4, r24
+#endif
 #endif
-
-  // Adaboot no-wait mod
-  ch = MCUSR;
-    3e1e:	84 b7       	in	r24, 0x34	; 52
-  MCUSR = 0;
-    3e20:	14 be       	out	0x34, r1	; 52
-  if (!(ch & _BV(EXTRF))) appStart();
-    3e22:	81 ff       	sbrs	r24, 1
-    3e24:	d7 d0       	rcall	.+430    	; 0x3fd4 <appStart>
 
   // Set up watchdog to trigger after 500ms
-  watchdogConfig(WATCHDOG_500MS);
-    3e26:	8d e0       	ldi	r24, 0x0D	; 13
+  watchdogConfig(WATCHDOG_1S);
+    3e26:	8e e0       	ldi	r24, 0x0E	; 14
     3e28:	cf d0       	rcall	.+414    	; 0x3fc8 <watchdogConfig>
 
   /* Set LED pin as output */
@@ -95,6 +102,9 @@ void flash_led(uint8_t count) {
     while(!(TIFR1 & _BV(TOV1)));
     3e3e:	b0 9b       	sbis	0x16, 0	; 22
     3e40:	fe cf       	rjmp	.-4      	; 0x3e3e <main+0x3e>
+#ifdef __AVR_ATmega8__
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
     3e42:	1d 9a       	sbi	0x03, 5	; 3
   return getch();
@@ -104,10 +114,10 @@ void flash_led(uint8_t count) {
 void watchdogReset() {
   __asm__ __volatile__ (
     3e44:	a8 95       	wdr
-    TCNT1 = -(F_CPU/(1024*16));
-    TIFR1 = _BV(TOV1);
-    while(!(TIFR1 & _BV(TOV1)));
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
+#endif
     watchdogReset();
   } while (--count);
     3e46:	81 50       	subi	r24, 0x01	; 1
@@ -149,7 +159,7 @@ void watchdogReset() {
       // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy
       getNch(1);
     3e5c:	81 e0       	ldi	r24, 0x01	; 1
-    3e5e:	c5 d0       	rcall	.+394    	; 0x3fea <verifySpace+0xc>
+    3e5e:	c5 d0       	rcall	.+394    	; 0x3fea <getNch>
       putch(0x03);
     3e60:	83 e0       	ldi	r24, 0x03	; 3
     3e62:	20 c0       	rjmp	.+64     	; 0x3ea4 <main+0xa4>
@@ -168,7 +178,7 @@ void watchdogReset() {
       // SET DEVICE EXT is ignored
       getNch(5);
     3e70:	85 e0       	ldi	r24, 0x05	; 5
-    3e72:	bb d0       	rcall	.+374    	; 0x3fea <verifySpace+0xc>
+    3e72:	bb d0       	rcall	.+374    	; 0x3fea <getNch>
     3e74:	91 c0       	rjmp	.+290    	; 0x3f98 <main+0x198>
     }
     else if(ch == STK_LOAD_ADDRESS) {
@@ -206,13 +216,13 @@ void watchdogReset() {
       // UNIVERSAL command is ignored
       getNch(4);
     3e9e:	84 e0       	ldi	r24, 0x04	; 4
-    3ea0:	a4 d0       	rcall	.+328    	; 0x3fea <verifySpace+0xc>
+    3ea0:	a4 d0       	rcall	.+328    	; 0x3fea <getNch>
       putch(0x00);
     3ea2:	80 e0       	ldi	r24, 0x00	; 0
     3ea4:	7c d0       	rcall	.+248    	; 0x3f9e <putch>
     3ea6:	78 c0       	rjmp	.+240    	; 0x3f98 <main+0x198>
     }
-    /* Write memory, length is big endian and is in bytes  */
+    /* Write memory, length is big endian and is in bytes */
     else if(ch == STK_PROG_PAGE) {
     3ea8:	84 36       	cpi	r24, 0x64	; 100
     3eaa:	09 f0       	breq	.+2      	; 0x3eae <main+0xae>
@@ -456,8 +466,8 @@ void watchdogReset() {
     3fb6:	fc cf       	rjmp	.-8      	; 0x3fb0 <getch+0x2>
   ch = UDR0;
     3fb8:	80 91 c6 00 	lds	r24, 0x00C6
-#ifdef LED_DATA_FLASH
   LED_PIN |= _BV(LED);
+#endif
 #endif
 
   return ch;
@@ -521,6 +531,8 @@ void verifySpace() {
     3fe6:	84 e1       	ldi	r24, 0x14	; 20
 }
     3fe8:	da cf       	rjmp	.-76     	; 0x3f9e <putch>
+
+00003fea <getNch>:
     ::[count] "M" (UART_B_VALUE)
   );
 }
@@ -529,12 +541,10 @@ void verifySpace() {
 void getNch(uint8_t count) {
     3fea:	1f 93       	push	r17
     3fec:	18 2f       	mov	r17, r24
-
-00003fee <getNch>:
   do getch(); while (--count);
     3fee:	df df       	rcall	.-66     	; 0x3fae <getch>
     3ff0:	11 50       	subi	r17, 0x01	; 1
-    3ff2:	e9 f7       	brne	.-6      	; 0x3fee <getNch>
+    3ff2:	e9 f7       	brne	.-6      	; 0x3fee <getNch+0x4>
   verifySpace();
     3ff4:	f4 df       	rcall	.-24     	; 0x3fde <verifySpace>
 }

+ 3 - 3
optiboot/bootloaders/optiboot/optiboot_lilypad_resonator.hex

@@ -1,6 +1,6 @@
-:103E000085E08093810082E08093C00088E1809308
-:103E1000C10086E08093C20088E08093C40084B72C
-:103E200014BE81FFD7D08DE0CFD0259A86E028E15F
+:103E000084B714BE81FFE6D085E08093810082E014
+:103E10008093C00088E18093C10086E08093C20057
+:103E200088E08093C4008EE0CFD0259A86E028E118
 :103E30003EEF91E0309385002093840096BBB09BC9
 :103E4000FECF1D9AA8958150A9F7DD24D394A5E053
 :103E5000EA2EF1E1FF2EABD0813421F481E0C5D010

+ 48 - 38
optiboot/bootloaders/optiboot/optiboot_lilypad_resonator.lst

@@ -13,15 +13,15 @@ Idx Name          Size      VMA       LMA       File off  Algn
                   CONTENTS, READONLY, DEBUGGING
   4 .debug_abbrev 000001ae  00000000  00000000  00000564  2**0
                   CONTENTS, READONLY, DEBUGGING
-  5 .debug_line   000003e3  00000000  00000000  00000712  2**0
+  5 .debug_line   000003e4  00000000  00000000  00000712  2**0
                   CONTENTS, READONLY, DEBUGGING
   6 .debug_frame  00000090  00000000  00000000  00000af8  2**2
                   CONTENTS, READONLY, DEBUGGING
-  7 .debug_str    00000140  00000000  00000000  00000b88  2**0
+  7 .debug_str    00000141  00000000  00000000  00000b88  2**0
                   CONTENTS, READONLY, DEBUGGING
-  8 .debug_loc    000001e1  00000000  00000000  00000cc8  2**0
+  8 .debug_loc    000001e1  00000000  00000000  00000cc9  2**0
                   CONTENTS, READONLY, DEBUGGING
-  9 .debug_ranges 00000068  00000000  00000000  00000ea9  2**0
+  9 .debug_ranges 00000068  00000000  00000000  00000eaa  2**0
                   CONTENTS, READONLY, DEBUGGING
 
 Disassembly of section .text:
@@ -33,39 +33,46 @@ Disassembly of section .text:
 
 /* main program starts here */
 int main(void) {
-    3e00:	85 e0       	ldi	r24, 0x05	; 5
-    3e02:	80 93 81 00 	sts	0x0081, r24
+    3e00:	84 b7       	in	r24, 0x34	; 52
+
+  uint8_t ch;
+
+  // Adaboot no-wait mod
+  ch = MCUSR;
+  MCUSR = 0;
+    3e02:	14 be       	out	0x34, r1	; 52
+  if (!(ch & _BV(EXTRF))) appStart();
+    3e04:	81 ff       	sbrs	r24, 1
+    3e06:	e6 d0       	rcall	.+460    	; 0x3fd4 <appStart>
+
 #if LED_START_FLASHES > 0
   // Set up Timer 1 for timeout counter
   TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
-#endif
-#ifndef SOFT_UART
+    3e08:	85 e0       	ldi	r24, 0x05	; 5
+    3e0a:	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
-    3e06:	82 e0       	ldi	r24, 0x02	; 2
-    3e08:	80 93 c0 00 	sts	0x00C0, r24
+    3e0e:	82 e0       	ldi	r24, 0x02	; 2
+    3e10:	80 93 c0 00 	sts	0x00C0, r24
   UCSR0B = _BV(RXEN0) | _BV(TXEN0);
-    3e0c:	88 e1       	ldi	r24, 0x18	; 24
-    3e0e:	80 93 c1 00 	sts	0x00C1, r24
+    3e14:	88 e1       	ldi	r24, 0x18	; 24
+    3e16:	80 93 c1 00 	sts	0x00C1, r24
   UCSR0C = _BV(UCSZ00) | _BV(UCSZ01);
-    3e12:	86 e0       	ldi	r24, 0x06	; 6
-    3e14:	80 93 c2 00 	sts	0x00C2, r24
+    3e1a:	86 e0       	ldi	r24, 0x06	; 6
+    3e1c:	80 93 c2 00 	sts	0x00C2, r24
   UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
-    3e18:	88 e0       	ldi	r24, 0x08	; 8
-    3e1a:	80 93 c4 00 	sts	0x00C4, r24
+    3e20:	88 e0       	ldi	r24, 0x08	; 8
+    3e22:	80 93 c4 00 	sts	0x00C4, r24
+#endif
 #endif
-
-  // Adaboot no-wait mod
-  ch = MCUSR;
-    3e1e:	84 b7       	in	r24, 0x34	; 52
-  MCUSR = 0;
-    3e20:	14 be       	out	0x34, r1	; 52
-  if (!(ch & _BV(EXTRF))) appStart();
-    3e22:	81 ff       	sbrs	r24, 1
-    3e24:	d7 d0       	rcall	.+430    	; 0x3fd4 <appStart>
 
   // Set up watchdog to trigger after 500ms
-  watchdogConfig(WATCHDOG_500MS);
-    3e26:	8d e0       	ldi	r24, 0x0D	; 13
+  watchdogConfig(WATCHDOG_1S);
+    3e26:	8e e0       	ldi	r24, 0x0E	; 14
     3e28:	cf d0       	rcall	.+414    	; 0x3fc8 <watchdogConfig>
 
   /* Set LED pin as output */
@@ -95,6 +102,9 @@ void flash_led(uint8_t count) {
     while(!(TIFR1 & _BV(TOV1)));
     3e3e:	b0 9b       	sbis	0x16, 0	; 22
     3e40:	fe cf       	rjmp	.-4      	; 0x3e3e <main+0x3e>
+#ifdef __AVR_ATmega8__
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
     3e42:	1d 9a       	sbi	0x03, 5	; 3
   return getch();
@@ -104,10 +114,10 @@ void flash_led(uint8_t count) {
 void watchdogReset() {
   __asm__ __volatile__ (
     3e44:	a8 95       	wdr
-    TCNT1 = -(F_CPU/(1024*16));
-    TIFR1 = _BV(TOV1);
-    while(!(TIFR1 & _BV(TOV1)));
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
+#endif
     watchdogReset();
   } while (--count);
     3e46:	81 50       	subi	r24, 0x01	; 1
@@ -149,7 +159,7 @@ void watchdogReset() {
       // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy
       getNch(1);
     3e5c:	81 e0       	ldi	r24, 0x01	; 1
-    3e5e:	c5 d0       	rcall	.+394    	; 0x3fea <verifySpace+0xc>
+    3e5e:	c5 d0       	rcall	.+394    	; 0x3fea <getNch>
       putch(0x03);
     3e60:	83 e0       	ldi	r24, 0x03	; 3
     3e62:	20 c0       	rjmp	.+64     	; 0x3ea4 <main+0xa4>
@@ -168,7 +178,7 @@ void watchdogReset() {
       // SET DEVICE EXT is ignored
       getNch(5);
     3e70:	85 e0       	ldi	r24, 0x05	; 5
-    3e72:	bb d0       	rcall	.+374    	; 0x3fea <verifySpace+0xc>
+    3e72:	bb d0       	rcall	.+374    	; 0x3fea <getNch>
     3e74:	91 c0       	rjmp	.+290    	; 0x3f98 <main+0x198>
     }
     else if(ch == STK_LOAD_ADDRESS) {
@@ -206,13 +216,13 @@ void watchdogReset() {
       // UNIVERSAL command is ignored
       getNch(4);
     3e9e:	84 e0       	ldi	r24, 0x04	; 4
-    3ea0:	a4 d0       	rcall	.+328    	; 0x3fea <verifySpace+0xc>
+    3ea0:	a4 d0       	rcall	.+328    	; 0x3fea <getNch>
       putch(0x00);
     3ea2:	80 e0       	ldi	r24, 0x00	; 0
     3ea4:	7c d0       	rcall	.+248    	; 0x3f9e <putch>
     3ea6:	78 c0       	rjmp	.+240    	; 0x3f98 <main+0x198>
     }
-    /* Write memory, length is big endian and is in bytes  */
+    /* Write memory, length is big endian and is in bytes */
     else if(ch == STK_PROG_PAGE) {
     3ea8:	84 36       	cpi	r24, 0x64	; 100
     3eaa:	09 f0       	breq	.+2      	; 0x3eae <main+0xae>
@@ -456,8 +466,8 @@ void watchdogReset() {
     3fb6:	fc cf       	rjmp	.-8      	; 0x3fb0 <getch+0x2>
   ch = UDR0;
     3fb8:	80 91 c6 00 	lds	r24, 0x00C6
-#ifdef LED_DATA_FLASH
   LED_PIN |= _BV(LED);
+#endif
 #endif
 
   return ch;
@@ -521,6 +531,8 @@ void verifySpace() {
     3fe6:	84 e1       	ldi	r24, 0x14	; 20
 }
     3fe8:	da cf       	rjmp	.-76     	; 0x3f9e <putch>
+
+00003fea <getNch>:
     ::[count] "M" (UART_B_VALUE)
   );
 }
@@ -529,12 +541,10 @@ void verifySpace() {
 void getNch(uint8_t count) {
     3fea:	1f 93       	push	r17
     3fec:	18 2f       	mov	r17, r24
-
-00003fee <getNch>:
   do getch(); while (--count);
     3fee:	df df       	rcall	.-66     	; 0x3fae <getch>
     3ff0:	11 50       	subi	r17, 0x01	; 1
-    3ff2:	e9 f7       	brne	.-6      	; 0x3fee <getNch>
+    3ff2:	e9 f7       	brne	.-6      	; 0x3fee <getNch+0x4>
   verifySpace();
     3ff4:	f4 df       	rcall	.-24     	; 0x3fde <verifySpace>
 }

+ 1 - 1
optiboot/bootloaders/optiboot/optiboot_luminet.hex

@@ -1,4 +1,4 @@
-:101D000085E08EBD84B714BE81FF20D18DE01AD14D
+:101D000084B714BE81FF22D185E08EBD8EE01AD14A
 :101D1000D49AD29A86E023EC3FEF91E03DBD2CBDF2
 :101D20009BB9589BFECFCC9AA8958150B9F7DD247A
 :101D3000D39485E0C82E0FE7F02E1EECE12EE9D0FB

+ 34 - 25
optiboot/bootloaders/optiboot/optiboot_luminet.lst

@@ -17,11 +17,11 @@ Idx Name          Size      VMA       LMA       File off  Algn
                   CONTENTS, READONLY, DEBUGGING
   6 .debug_frame  000000a0  00000000  00000000  00000bf4  2**2
                   CONTENTS, READONLY, DEBUGGING
-  7 .debug_str    0000014f  00000000  00000000  00000c94  2**0
+  7 .debug_str    00000150  00000000  00000000  00000c94  2**0
                   CONTENTS, READONLY, DEBUGGING
-  8 .debug_loc    00000194  00000000  00000000  00000de3  2**0
+  8 .debug_loc    00000194  00000000  00000000  00000de4  2**0
                   CONTENTS, READONLY, DEBUGGING
-  9 .debug_ranges 00000088  00000000  00000000  00000f77  2**0
+  9 .debug_ranges 00000088  00000000  00000000  00000f78  2**0
                   CONTENTS, READONLY, DEBUGGING
 
 Disassembly of section .text:
@@ -33,24 +33,30 @@ Disassembly of section .text:
 
 /* main program starts here */
 int main(void) {
-    1d00:	85 e0       	ldi	r24, 0x05	; 5
-    1d02:	8e bd       	out	0x2e, r24	; 46
-  UCSR0C = _BV(UCSZ00) | _BV(UCSZ01);
-  UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
-#endif
+    1d00:	84 b7       	in	r24, 0x34	; 52
+
+  uint8_t ch;
 
   // Adaboot no-wait mod
   ch = MCUSR;
-    1d04:	84 b7       	in	r24, 0x34	; 52
   MCUSR = 0;
-    1d06:	14 be       	out	0x34, r1	; 52
+    1d02:	14 be       	out	0x34, r1	; 52
   if (!(ch & _BV(EXTRF))) appStart();
-    1d08:	81 ff       	sbrs	r24, 1
-    1d0a:	20 d1       	rcall	.+576    	; 0x1f4c <appStart>
+    1d04:	81 ff       	sbrs	r24, 1
+    1d06:	22 d1       	rcall	.+580    	; 0x1f4c <appStart>
+
+#if LED_START_FLASHES > 0
+  // Set up Timer 1 for timeout counter
+  TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
+    1d08:	85 e0       	ldi	r24, 0x05	; 5
+    1d0a:	8e bd       	out	0x2e, r24	; 46
+  UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
+#endif
+#endif
 
   // Set up watchdog to trigger after 500ms
-  watchdogConfig(WATCHDOG_500MS);
-    1d0c:	8d e0       	ldi	r24, 0x0D	; 13
+  watchdogConfig(WATCHDOG_1S);
+    1d0c:	8e e0       	ldi	r24, 0x0E	; 14
     1d0e:	1a d1       	rcall	.+564    	; 0x1f44 <watchdogConfig>
 
   /* Set LED pin as output */
@@ -85,6 +91,9 @@ void flash_led(uint8_t count) {
     while(!(TIFR1 & _BV(TOV1)));
     1d22:	58 9b       	sbis	0x0b, 0	; 11
     1d24:	fe cf       	rjmp	.-4      	; 0x1d22 <main+0x22>
+#ifdef __AVR_ATmega8__
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
     1d26:	cc 9a       	sbi	0x19, 4	; 25
   return getch();
@@ -94,10 +103,10 @@ void flash_led(uint8_t count) {
 void watchdogReset() {
   __asm__ __volatile__ (
     1d28:	a8 95       	wdr
-    TCNT1 = -(F_CPU/(1024*16));
-    TIFR1 = _BV(TOV1);
-    while(!(TIFR1 & _BV(TOV1)));
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
+#endif
     watchdogReset();
   } while (--count);
     1d2a:	81 50       	subi	r24, 0x01	; 1
@@ -143,7 +152,7 @@ void watchdogReset() {
       // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy
       getNch(1);
     1d44:	81 e0       	ldi	r24, 0x01	; 1
-    1d46:	0d d1       	rcall	.+538    	; 0x1f62 <verifySpace+0xc>
+    1d46:	0d d1       	rcall	.+538    	; 0x1f62 <getNch>
       putch(0x03);
     1d48:	83 e0       	ldi	r24, 0x03	; 3
     1d4a:	20 c0       	rjmp	.+64     	; 0x1d8c <main+0x8c>
@@ -162,7 +171,7 @@ void watchdogReset() {
       // SET DEVICE EXT is ignored
       getNch(5);
     1d58:	85 e0       	ldi	r24, 0x05	; 5
-    1d5a:	03 d1       	rcall	.+518    	; 0x1f62 <verifySpace+0xc>
+    1d5a:	03 d1       	rcall	.+518    	; 0x1f62 <getNch>
     1d5c:	c8 c0       	rjmp	.+400    	; 0x1eee <main+0x1ee>
     }
     else if(ch == STK_LOAD_ADDRESS) {
@@ -200,13 +209,13 @@ void watchdogReset() {
       // UNIVERSAL command is ignored
       getNch(4);
     1d86:	84 e0       	ldi	r24, 0x04	; 4
-    1d88:	ec d0       	rcall	.+472    	; 0x1f62 <verifySpace+0xc>
+    1d88:	ec d0       	rcall	.+472    	; 0x1f62 <getNch>
       putch(0x00);
     1d8a:	80 e0       	ldi	r24, 0x00	; 0
     1d8c:	b3 d0       	rcall	.+358    	; 0x1ef4 <putch>
     1d8e:	af c0       	rjmp	.+350    	; 0x1eee <main+0x1ee>
     }
-    /* Write memory, length is big endian and is in bytes  */
+    /* Write memory, length is big endian and is in bytes */
     else if(ch == STK_PROG_PAGE) {
     1d90:	84 36       	cpi	r24, 0x64	; 100
     1d92:	09 f0       	breq	.+2      	; 0x1d96 <main+0x96>
@@ -501,8 +510,8 @@ void putch(char ch) {
 void watchdogReset() {
   __asm__ __volatile__ (
     1f12:	a8 95       	wdr
-#ifdef LED_DATA_FLASH
   LED_PIN |= _BV(LED);
+#endif
 #endif
 
   return ch;
@@ -590,6 +599,8 @@ void verifySpace() {
     1f5e:	84 e1       	ldi	r24, 0x14	; 20
 }
     1f60:	c9 cf       	rjmp	.-110    	; 0x1ef4 <putch>
+
+00001f62 <getNch>:
     ::[count] "M" (UART_B_VALUE)
   );
 }
@@ -598,12 +609,10 @@ void verifySpace() {
 void getNch(uint8_t count) {
     1f62:	1f 93       	push	r17
     1f64:	18 2f       	mov	r17, r24
-
-00001f66 <getNch>:
   do getch(); while (--count);
     1f66:	d5 df       	rcall	.-86     	; 0x1f12 <getch>
     1f68:	11 50       	subi	r17, 0x01	; 1
-    1f6a:	e9 f7       	brne	.-6      	; 0x1f66 <getNch>
+    1f6a:	e9 f7       	brne	.-6      	; 0x1f66 <getNch+0x4>
   verifySpace();
     1f6c:	f4 df       	rcall	.-24     	; 0x1f56 <verifySpace>
 }

+ 3 - 3
optiboot/bootloaders/optiboot/optiboot_pro_16MHz.hex

@@ -1,6 +1,6 @@
-:103E000085E08093810082E08093C00088E1809308
-:103E1000C10086E08093C20080E18093C40084B733
-:103E200014BE81FFD7D08DE0CFD0259A86E020E365
+:103E000084B714BE81FFE6D085E08093810082E014
+:103E10008093C00088E18093C10086E08093C20057
+:103E200080E18093C4008EE0CFD0259A86E020E325
 :103E30003CEF91E0309385002093840096BBB09BCB
 :103E4000FECF1D9AA8958150A9F7DD24D394A5E053
 :103E5000EA2EF1E1FF2EABD0813421F481E0C5D010

+ 48 - 38
optiboot/bootloaders/optiboot/optiboot_pro_16MHz.lst

@@ -13,15 +13,15 @@ Idx Name          Size      VMA       LMA       File off  Algn
                   CONTENTS, READONLY, DEBUGGING
   4 .debug_abbrev 000001ae  00000000  00000000  00000564  2**0
                   CONTENTS, READONLY, DEBUGGING
-  5 .debug_line   000003e3  00000000  00000000  00000712  2**0
+  5 .debug_line   000003e4  00000000  00000000  00000712  2**0
                   CONTENTS, READONLY, DEBUGGING
   6 .debug_frame  00000090  00000000  00000000  00000af8  2**2
                   CONTENTS, READONLY, DEBUGGING
-  7 .debug_str    00000140  00000000  00000000  00000b88  2**0
+  7 .debug_str    00000141  00000000  00000000  00000b88  2**0
                   CONTENTS, READONLY, DEBUGGING
-  8 .debug_loc    000001e1  00000000  00000000  00000cc8  2**0
+  8 .debug_loc    000001e1  00000000  00000000  00000cc9  2**0
                   CONTENTS, READONLY, DEBUGGING
-  9 .debug_ranges 00000068  00000000  00000000  00000ea9  2**0
+  9 .debug_ranges 00000068  00000000  00000000  00000eaa  2**0
                   CONTENTS, READONLY, DEBUGGING
 
 Disassembly of section .text:
@@ -33,39 +33,46 @@ Disassembly of section .text:
 
 /* main program starts here */
 int main(void) {
-    3e00:	85 e0       	ldi	r24, 0x05	; 5
-    3e02:	80 93 81 00 	sts	0x0081, r24
+    3e00:	84 b7       	in	r24, 0x34	; 52
+
+  uint8_t ch;
+
+  // Adaboot no-wait mod
+  ch = MCUSR;
+  MCUSR = 0;
+    3e02:	14 be       	out	0x34, r1	; 52
+  if (!(ch & _BV(EXTRF))) appStart();
+    3e04:	81 ff       	sbrs	r24, 1
+    3e06:	e6 d0       	rcall	.+460    	; 0x3fd4 <appStart>
+
 #if LED_START_FLASHES > 0
   // Set up Timer 1 for timeout counter
   TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
-#endif
-#ifndef SOFT_UART
+    3e08:	85 e0       	ldi	r24, 0x05	; 5
+    3e0a:	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
-    3e06:	82 e0       	ldi	r24, 0x02	; 2
-    3e08:	80 93 c0 00 	sts	0x00C0, r24
+    3e0e:	82 e0       	ldi	r24, 0x02	; 2
+    3e10:	80 93 c0 00 	sts	0x00C0, r24
   UCSR0B = _BV(RXEN0) | _BV(TXEN0);
-    3e0c:	88 e1       	ldi	r24, 0x18	; 24
-    3e0e:	80 93 c1 00 	sts	0x00C1, r24
+    3e14:	88 e1       	ldi	r24, 0x18	; 24
+    3e16:	80 93 c1 00 	sts	0x00C1, r24
   UCSR0C = _BV(UCSZ00) | _BV(UCSZ01);
-    3e12:	86 e0       	ldi	r24, 0x06	; 6
-    3e14:	80 93 c2 00 	sts	0x00C2, r24
+    3e1a:	86 e0       	ldi	r24, 0x06	; 6
+    3e1c:	80 93 c2 00 	sts	0x00C2, r24
   UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
-    3e18:	80 e1       	ldi	r24, 0x10	; 16
-    3e1a:	80 93 c4 00 	sts	0x00C4, r24
+    3e20:	80 e1       	ldi	r24, 0x10	; 16
+    3e22:	80 93 c4 00 	sts	0x00C4, r24
+#endif
 #endif
-
-  // Adaboot no-wait mod
-  ch = MCUSR;
-    3e1e:	84 b7       	in	r24, 0x34	; 52
-  MCUSR = 0;
-    3e20:	14 be       	out	0x34, r1	; 52
-  if (!(ch & _BV(EXTRF))) appStart();
-    3e22:	81 ff       	sbrs	r24, 1
-    3e24:	d7 d0       	rcall	.+430    	; 0x3fd4 <appStart>
 
   // Set up watchdog to trigger after 500ms
-  watchdogConfig(WATCHDOG_500MS);
-    3e26:	8d e0       	ldi	r24, 0x0D	; 13
+  watchdogConfig(WATCHDOG_1S);
+    3e26:	8e e0       	ldi	r24, 0x0E	; 14
     3e28:	cf d0       	rcall	.+414    	; 0x3fc8 <watchdogConfig>
 
   /* Set LED pin as output */
@@ -95,6 +102,9 @@ void flash_led(uint8_t count) {
     while(!(TIFR1 & _BV(TOV1)));
     3e3e:	b0 9b       	sbis	0x16, 0	; 22
     3e40:	fe cf       	rjmp	.-4      	; 0x3e3e <main+0x3e>
+#ifdef __AVR_ATmega8__
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
     3e42:	1d 9a       	sbi	0x03, 5	; 3
   return getch();
@@ -104,10 +114,10 @@ void flash_led(uint8_t count) {
 void watchdogReset() {
   __asm__ __volatile__ (
     3e44:	a8 95       	wdr
-    TCNT1 = -(F_CPU/(1024*16));
-    TIFR1 = _BV(TOV1);
-    while(!(TIFR1 & _BV(TOV1)));
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
+#endif
     watchdogReset();
   } while (--count);
     3e46:	81 50       	subi	r24, 0x01	; 1
@@ -149,7 +159,7 @@ void watchdogReset() {
       // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy
       getNch(1);
     3e5c:	81 e0       	ldi	r24, 0x01	; 1
-    3e5e:	c5 d0       	rcall	.+394    	; 0x3fea <verifySpace+0xc>
+    3e5e:	c5 d0       	rcall	.+394    	; 0x3fea <getNch>
       putch(0x03);
     3e60:	83 e0       	ldi	r24, 0x03	; 3
     3e62:	20 c0       	rjmp	.+64     	; 0x3ea4 <main+0xa4>
@@ -168,7 +178,7 @@ void watchdogReset() {
       // SET DEVICE EXT is ignored
       getNch(5);
     3e70:	85 e0       	ldi	r24, 0x05	; 5
-    3e72:	bb d0       	rcall	.+374    	; 0x3fea <verifySpace+0xc>
+    3e72:	bb d0       	rcall	.+374    	; 0x3fea <getNch>
     3e74:	91 c0       	rjmp	.+290    	; 0x3f98 <main+0x198>
     }
     else if(ch == STK_LOAD_ADDRESS) {
@@ -206,13 +216,13 @@ void watchdogReset() {
       // UNIVERSAL command is ignored
       getNch(4);
     3e9e:	84 e0       	ldi	r24, 0x04	; 4
-    3ea0:	a4 d0       	rcall	.+328    	; 0x3fea <verifySpace+0xc>
+    3ea0:	a4 d0       	rcall	.+328    	; 0x3fea <getNch>
       putch(0x00);
     3ea2:	80 e0       	ldi	r24, 0x00	; 0
     3ea4:	7c d0       	rcall	.+248    	; 0x3f9e <putch>
     3ea6:	78 c0       	rjmp	.+240    	; 0x3f98 <main+0x198>
     }
-    /* Write memory, length is big endian and is in bytes  */
+    /* Write memory, length is big endian and is in bytes */
     else if(ch == STK_PROG_PAGE) {
     3ea8:	84 36       	cpi	r24, 0x64	; 100
     3eaa:	09 f0       	breq	.+2      	; 0x3eae <main+0xae>
@@ -456,8 +466,8 @@ void watchdogReset() {
     3fb6:	fc cf       	rjmp	.-8      	; 0x3fb0 <getch+0x2>
   ch = UDR0;
     3fb8:	80 91 c6 00 	lds	r24, 0x00C6
-#ifdef LED_DATA_FLASH
   LED_PIN |= _BV(LED);
+#endif
 #endif
 
   return ch;
@@ -521,6 +531,8 @@ void verifySpace() {
     3fe6:	84 e1       	ldi	r24, 0x14	; 20
 }
     3fe8:	da cf       	rjmp	.-76     	; 0x3f9e <putch>
+
+00003fea <getNch>:
     ::[count] "M" (UART_B_VALUE)
   );
 }
@@ -529,12 +541,10 @@ void verifySpace() {
 void getNch(uint8_t count) {
     3fea:	1f 93       	push	r17
     3fec:	18 2f       	mov	r17, r24
-
-00003fee <getNch>:
   do getch(); while (--count);
     3fee:	df df       	rcall	.-66     	; 0x3fae <getch>
     3ff0:	11 50       	subi	r17, 0x01	; 1
-    3ff2:	e9 f7       	brne	.-6      	; 0x3fee <getNch>
+    3ff2:	e9 f7       	brne	.-6      	; 0x3fee <getNch+0x4>
   verifySpace();
     3ff4:	f4 df       	rcall	.-24     	; 0x3fde <verifySpace>
 }

+ 3 - 3
optiboot/bootloaders/optiboot/optiboot_pro_20mhz.hex

@@ -1,6 +1,6 @@
-:103E000085E08093810082E08093C00088E1809308
-:103E1000C10086E08093C20085E18093C40084B72E
-:103E200014BE81FFD7D08DE0CFD0259A86E02CE359
+:103E000084B714BE81FFE6D085E08093810082E014
+:103E10008093C00088E18093C10086E08093C20057
+:103E200085E18093C4008EE0CFD0259A86E02CE314
 :103E30003BEF91E0309385002093840096BBB09BCC
 :103E4000FECF1D9AA8958150A9F7DD24D394A5E053
 :103E5000EA2EF1E1FF2EABD0813421F481E0C5D010

+ 48 - 38
optiboot/bootloaders/optiboot/optiboot_pro_20mhz.lst

@@ -13,15 +13,15 @@ Idx Name          Size      VMA       LMA       File off  Algn
                   CONTENTS, READONLY, DEBUGGING
   4 .debug_abbrev 000001ae  00000000  00000000  00000564  2**0
                   CONTENTS, READONLY, DEBUGGING
-  5 .debug_line   000003e3  00000000  00000000  00000712  2**0
+  5 .debug_line   000003e4  00000000  00000000  00000712  2**0
                   CONTENTS, READONLY, DEBUGGING
   6 .debug_frame  00000090  00000000  00000000  00000af8  2**2
                   CONTENTS, READONLY, DEBUGGING
-  7 .debug_str    00000140  00000000  00000000  00000b88  2**0
+  7 .debug_str    00000141  00000000  00000000  00000b88  2**0
                   CONTENTS, READONLY, DEBUGGING
-  8 .debug_loc    000001e1  00000000  00000000  00000cc8  2**0
+  8 .debug_loc    000001e1  00000000  00000000  00000cc9  2**0
                   CONTENTS, READONLY, DEBUGGING
-  9 .debug_ranges 00000068  00000000  00000000  00000ea9  2**0
+  9 .debug_ranges 00000068  00000000  00000000  00000eaa  2**0
                   CONTENTS, READONLY, DEBUGGING
 
 Disassembly of section .text:
@@ -33,39 +33,46 @@ Disassembly of section .text:
 
 /* main program starts here */
 int main(void) {
-    3e00:	85 e0       	ldi	r24, 0x05	; 5
-    3e02:	80 93 81 00 	sts	0x0081, r24
+    3e00:	84 b7       	in	r24, 0x34	; 52
+
+  uint8_t ch;
+
+  // Adaboot no-wait mod
+  ch = MCUSR;
+  MCUSR = 0;
+    3e02:	14 be       	out	0x34, r1	; 52
+  if (!(ch & _BV(EXTRF))) appStart();
+    3e04:	81 ff       	sbrs	r24, 1
+    3e06:	e6 d0       	rcall	.+460    	; 0x3fd4 <appStart>
+
 #if LED_START_FLASHES > 0
   // Set up Timer 1 for timeout counter
   TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
-#endif
-#ifndef SOFT_UART
+    3e08:	85 e0       	ldi	r24, 0x05	; 5
+    3e0a:	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
-    3e06:	82 e0       	ldi	r24, 0x02	; 2
-    3e08:	80 93 c0 00 	sts	0x00C0, r24
+    3e0e:	82 e0       	ldi	r24, 0x02	; 2
+    3e10:	80 93 c0 00 	sts	0x00C0, r24
   UCSR0B = _BV(RXEN0) | _BV(TXEN0);
-    3e0c:	88 e1       	ldi	r24, 0x18	; 24
-    3e0e:	80 93 c1 00 	sts	0x00C1, r24
+    3e14:	88 e1       	ldi	r24, 0x18	; 24
+    3e16:	80 93 c1 00 	sts	0x00C1, r24
   UCSR0C = _BV(UCSZ00) | _BV(UCSZ01);
-    3e12:	86 e0       	ldi	r24, 0x06	; 6
-    3e14:	80 93 c2 00 	sts	0x00C2, r24
+    3e1a:	86 e0       	ldi	r24, 0x06	; 6
+    3e1c:	80 93 c2 00 	sts	0x00C2, r24
   UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
-    3e18:	85 e1       	ldi	r24, 0x15	; 21
-    3e1a:	80 93 c4 00 	sts	0x00C4, r24
+    3e20:	85 e1       	ldi	r24, 0x15	; 21
+    3e22:	80 93 c4 00 	sts	0x00C4, r24
+#endif
 #endif
-
-  // Adaboot no-wait mod
-  ch = MCUSR;
-    3e1e:	84 b7       	in	r24, 0x34	; 52
-  MCUSR = 0;
-    3e20:	14 be       	out	0x34, r1	; 52
-  if (!(ch & _BV(EXTRF))) appStart();
-    3e22:	81 ff       	sbrs	r24, 1
-    3e24:	d7 d0       	rcall	.+430    	; 0x3fd4 <appStart>
 
   // Set up watchdog to trigger after 500ms
-  watchdogConfig(WATCHDOG_500MS);
-    3e26:	8d e0       	ldi	r24, 0x0D	; 13
+  watchdogConfig(WATCHDOG_1S);
+    3e26:	8e e0       	ldi	r24, 0x0E	; 14
     3e28:	cf d0       	rcall	.+414    	; 0x3fc8 <watchdogConfig>
 
   /* Set LED pin as output */
@@ -95,6 +102,9 @@ void flash_led(uint8_t count) {
     while(!(TIFR1 & _BV(TOV1)));
     3e3e:	b0 9b       	sbis	0x16, 0	; 22
     3e40:	fe cf       	rjmp	.-4      	; 0x3e3e <main+0x3e>
+#ifdef __AVR_ATmega8__
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
     3e42:	1d 9a       	sbi	0x03, 5	; 3
   return getch();
@@ -104,10 +114,10 @@ void flash_led(uint8_t count) {
 void watchdogReset() {
   __asm__ __volatile__ (
     3e44:	a8 95       	wdr
-    TCNT1 = -(F_CPU/(1024*16));
-    TIFR1 = _BV(TOV1);
-    while(!(TIFR1 & _BV(TOV1)));
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
+#endif
     watchdogReset();
   } while (--count);
     3e46:	81 50       	subi	r24, 0x01	; 1
@@ -149,7 +159,7 @@ void watchdogReset() {
       // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy
       getNch(1);
     3e5c:	81 e0       	ldi	r24, 0x01	; 1
-    3e5e:	c5 d0       	rcall	.+394    	; 0x3fea <verifySpace+0xc>
+    3e5e:	c5 d0       	rcall	.+394    	; 0x3fea <getNch>
       putch(0x03);
     3e60:	83 e0       	ldi	r24, 0x03	; 3
     3e62:	20 c0       	rjmp	.+64     	; 0x3ea4 <main+0xa4>
@@ -168,7 +178,7 @@ void watchdogReset() {
       // SET DEVICE EXT is ignored
       getNch(5);
     3e70:	85 e0       	ldi	r24, 0x05	; 5
-    3e72:	bb d0       	rcall	.+374    	; 0x3fea <verifySpace+0xc>
+    3e72:	bb d0       	rcall	.+374    	; 0x3fea <getNch>
     3e74:	91 c0       	rjmp	.+290    	; 0x3f98 <main+0x198>
     }
     else if(ch == STK_LOAD_ADDRESS) {
@@ -206,13 +216,13 @@ void watchdogReset() {
       // UNIVERSAL command is ignored
       getNch(4);
     3e9e:	84 e0       	ldi	r24, 0x04	; 4
-    3ea0:	a4 d0       	rcall	.+328    	; 0x3fea <verifySpace+0xc>
+    3ea0:	a4 d0       	rcall	.+328    	; 0x3fea <getNch>
       putch(0x00);
     3ea2:	80 e0       	ldi	r24, 0x00	; 0
     3ea4:	7c d0       	rcall	.+248    	; 0x3f9e <putch>
     3ea6:	78 c0       	rjmp	.+240    	; 0x3f98 <main+0x198>
     }
-    /* Write memory, length is big endian and is in bytes  */
+    /* Write memory, length is big endian and is in bytes */
     else if(ch == STK_PROG_PAGE) {
     3ea8:	84 36       	cpi	r24, 0x64	; 100
     3eaa:	09 f0       	breq	.+2      	; 0x3eae <main+0xae>
@@ -456,8 +466,8 @@ void watchdogReset() {
     3fb6:	fc cf       	rjmp	.-8      	; 0x3fb0 <getch+0x2>
   ch = UDR0;
     3fb8:	80 91 c6 00 	lds	r24, 0x00C6
-#ifdef LED_DATA_FLASH
   LED_PIN |= _BV(LED);
+#endif
 #endif
 
   return ch;
@@ -521,6 +531,8 @@ void verifySpace() {
     3fe6:	84 e1       	ldi	r24, 0x14	; 20
 }
     3fe8:	da cf       	rjmp	.-76     	; 0x3f9e <putch>
+
+00003fea <getNch>:
     ::[count] "M" (UART_B_VALUE)
   );
 }
@@ -529,12 +541,10 @@ void verifySpace() {
 void getNch(uint8_t count) {
     3fea:	1f 93       	push	r17
     3fec:	18 2f       	mov	r17, r24
-
-00003fee <getNch>:
   do getch(); while (--count);
     3fee:	df df       	rcall	.-66     	; 0x3fae <getch>
     3ff0:	11 50       	subi	r17, 0x01	; 1
-    3ff2:	e9 f7       	brne	.-6      	; 0x3fee <getNch>
+    3ff2:	e9 f7       	brne	.-6      	; 0x3fee <getNch+0x4>
   verifySpace();
     3ff4:	f4 df       	rcall	.-24     	; 0x3fde <verifySpace>
 }

+ 3 - 3
optiboot/bootloaders/optiboot/optiboot_pro_8MHz.hex

@@ -1,6 +1,6 @@
-:103E000085E08093810082E08093C00088E1809308
-:103E1000C10086E08093C20088E08093C40084B72C
-:103E200014BE81FFD7D08DE0CFD0259A86E028E15F
+:103E000084B714BE81FFE6D085E08093810082E014
+:103E10008093C00088E18093C10086E08093C20057
+:103E200088E08093C4008EE0CFD0259A86E028E118
 :103E30003EEF91E0309385002093840096BBB09BC9
 :103E4000FECF1D9AA8958150A9F7DD24D394A5E053
 :103E5000EA2EF1E1FF2EABD0813421F481E0C5D010

+ 48 - 38
optiboot/bootloaders/optiboot/optiboot_pro_8MHz.lst

@@ -13,15 +13,15 @@ Idx Name          Size      VMA       LMA       File off  Algn
                   CONTENTS, READONLY, DEBUGGING
   4 .debug_abbrev 000001ae  00000000  00000000  00000564  2**0
                   CONTENTS, READONLY, DEBUGGING
-  5 .debug_line   000003e3  00000000  00000000  00000712  2**0
+  5 .debug_line   000003e4  00000000  00000000  00000712  2**0
                   CONTENTS, READONLY, DEBUGGING
   6 .debug_frame  00000090  00000000  00000000  00000af8  2**2
                   CONTENTS, READONLY, DEBUGGING
-  7 .debug_str    00000140  00000000  00000000  00000b88  2**0
+  7 .debug_str    00000141  00000000  00000000  00000b88  2**0
                   CONTENTS, READONLY, DEBUGGING
-  8 .debug_loc    000001e1  00000000  00000000  00000cc8  2**0
+  8 .debug_loc    000001e1  00000000  00000000  00000cc9  2**0
                   CONTENTS, READONLY, DEBUGGING
-  9 .debug_ranges 00000068  00000000  00000000  00000ea9  2**0
+  9 .debug_ranges 00000068  00000000  00000000  00000eaa  2**0
                   CONTENTS, READONLY, DEBUGGING
 
 Disassembly of section .text:
@@ -33,39 +33,46 @@ Disassembly of section .text:
 
 /* main program starts here */
 int main(void) {
-    3e00:	85 e0       	ldi	r24, 0x05	; 5
-    3e02:	80 93 81 00 	sts	0x0081, r24
+    3e00:	84 b7       	in	r24, 0x34	; 52
+
+  uint8_t ch;
+
+  // Adaboot no-wait mod
+  ch = MCUSR;
+  MCUSR = 0;
+    3e02:	14 be       	out	0x34, r1	; 52
+  if (!(ch & _BV(EXTRF))) appStart();
+    3e04:	81 ff       	sbrs	r24, 1
+    3e06:	e6 d0       	rcall	.+460    	; 0x3fd4 <appStart>
+
 #if LED_START_FLASHES > 0
   // Set up Timer 1 for timeout counter
   TCCR1B = _BV(CS12) | _BV(CS10); // div 1024
-#endif
-#ifndef SOFT_UART
+    3e08:	85 e0       	ldi	r24, 0x05	; 5
+    3e0a:	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
-    3e06:	82 e0       	ldi	r24, 0x02	; 2
-    3e08:	80 93 c0 00 	sts	0x00C0, r24
+    3e0e:	82 e0       	ldi	r24, 0x02	; 2
+    3e10:	80 93 c0 00 	sts	0x00C0, r24
   UCSR0B = _BV(RXEN0) | _BV(TXEN0);
-    3e0c:	88 e1       	ldi	r24, 0x18	; 24
-    3e0e:	80 93 c1 00 	sts	0x00C1, r24
+    3e14:	88 e1       	ldi	r24, 0x18	; 24
+    3e16:	80 93 c1 00 	sts	0x00C1, r24
   UCSR0C = _BV(UCSZ00) | _BV(UCSZ01);
-    3e12:	86 e0       	ldi	r24, 0x06	; 6
-    3e14:	80 93 c2 00 	sts	0x00C2, r24
+    3e1a:	86 e0       	ldi	r24, 0x06	; 6
+    3e1c:	80 93 c2 00 	sts	0x00C2, r24
   UBRR0L = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L) - 1 );
-    3e18:	88 e0       	ldi	r24, 0x08	; 8
-    3e1a:	80 93 c4 00 	sts	0x00C4, r24
+    3e20:	88 e0       	ldi	r24, 0x08	; 8
+    3e22:	80 93 c4 00 	sts	0x00C4, r24
+#endif
 #endif
-
-  // Adaboot no-wait mod
-  ch = MCUSR;
-    3e1e:	84 b7       	in	r24, 0x34	; 52
-  MCUSR = 0;
-    3e20:	14 be       	out	0x34, r1	; 52
-  if (!(ch & _BV(EXTRF))) appStart();
-    3e22:	81 ff       	sbrs	r24, 1
-    3e24:	d7 d0       	rcall	.+430    	; 0x3fd4 <appStart>
 
   // Set up watchdog to trigger after 500ms
-  watchdogConfig(WATCHDOG_500MS);
-    3e26:	8d e0       	ldi	r24, 0x0D	; 13
+  watchdogConfig(WATCHDOG_1S);
+    3e26:	8e e0       	ldi	r24, 0x0E	; 14
     3e28:	cf d0       	rcall	.+414    	; 0x3fc8 <watchdogConfig>
 
   /* Set LED pin as output */
@@ -95,6 +102,9 @@ void flash_led(uint8_t count) {
     while(!(TIFR1 & _BV(TOV1)));
     3e3e:	b0 9b       	sbis	0x16, 0	; 22
     3e40:	fe cf       	rjmp	.-4      	; 0x3e3e <main+0x3e>
+#ifdef __AVR_ATmega8__
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
     3e42:	1d 9a       	sbi	0x03, 5	; 3
   return getch();
@@ -104,10 +114,10 @@ void flash_led(uint8_t count) {
 void watchdogReset() {
   __asm__ __volatile__ (
     3e44:	a8 95       	wdr
-    TCNT1 = -(F_CPU/(1024*16));
-    TIFR1 = _BV(TOV1);
-    while(!(TIFR1 & _BV(TOV1)));
+    LED_PORT ^= _BV(LED);
+#else
     LED_PIN |= _BV(LED);
+#endif
     watchdogReset();
   } while (--count);
     3e46:	81 50       	subi	r24, 0x01	; 1
@@ -149,7 +159,7 @@ void watchdogReset() {
       // GET PARAMETER returns a generic 0x03 reply - enough to keep Avrdude happy
       getNch(1);
     3e5c:	81 e0       	ldi	r24, 0x01	; 1
-    3e5e:	c5 d0       	rcall	.+394    	; 0x3fea <verifySpace+0xc>
+    3e5e:	c5 d0       	rcall	.+394    	; 0x3fea <getNch>
       putch(0x03);
     3e60:	83 e0       	ldi	r24, 0x03	; 3
     3e62:	20 c0       	rjmp	.+64     	; 0x3ea4 <main+0xa4>
@@ -168,7 +178,7 @@ void watchdogReset() {
       // SET DEVICE EXT is ignored
       getNch(5);
     3e70:	85 e0       	ldi	r24, 0x05	; 5
-    3e72:	bb d0       	rcall	.+374    	; 0x3fea <verifySpace+0xc>
+    3e72:	bb d0       	rcall	.+374    	; 0x3fea <getNch>
     3e74:	91 c0       	rjmp	.+290    	; 0x3f98 <main+0x198>
     }
     else if(ch == STK_LOAD_ADDRESS) {
@@ -206,13 +216,13 @@ void watchdogReset() {
       // UNIVERSAL command is ignored
       getNch(4);
     3e9e:	84 e0       	ldi	r24, 0x04	; 4
-    3ea0:	a4 d0       	rcall	.+328    	; 0x3fea <verifySpace+0xc>
+    3ea0:	a4 d0       	rcall	.+328    	; 0x3fea <getNch>
       putch(0x00);
     3ea2:	80 e0       	ldi	r24, 0x00	; 0
     3ea4:	7c d0       	rcall	.+248    	; 0x3f9e <putch>
     3ea6:	78 c0       	rjmp	.+240    	; 0x3f98 <main+0x198>
     }
-    /* Write memory, length is big endian and is in bytes  */
+    /* Write memory, length is big endian and is in bytes */
     else if(ch == STK_PROG_PAGE) {
     3ea8:	84 36       	cpi	r24, 0x64	; 100
     3eaa:	09 f0       	breq	.+2      	; 0x3eae <main+0xae>
@@ -456,8 +466,8 @@ void watchdogReset() {
     3fb6:	fc cf       	rjmp	.-8      	; 0x3fb0 <getch+0x2>
   ch = UDR0;
     3fb8:	80 91 c6 00 	lds	r24, 0x00C6
-#ifdef LED_DATA_FLASH
   LED_PIN |= _BV(LED);
+#endif
 #endif
 
   return ch;
@@ -521,6 +531,8 @@ void verifySpace() {
     3fe6:	84 e1       	ldi	r24, 0x14	; 20
 }
     3fe8:	da cf       	rjmp	.-76     	; 0x3f9e <putch>
+
+00003fea <getNch>:
     ::[count] "M" (UART_B_VALUE)
   );
 }
@@ -529,12 +541,10 @@ void verifySpace() {
 void getNch(uint8_t count) {
     3fea:	1f 93       	push	r17
     3fec:	18 2f       	mov	r17, r24
-
-00003fee <getNch>:
   do getch(); while (--count);
     3fee:	df df       	rcall	.-66     	; 0x3fae <getch>
     3ff0:	11 50       	subi	r17, 0x01	; 1
-    3ff2:	e9 f7       	brne	.-6      	; 0x3fee <getNch>
+    3ff2:	e9 f7       	brne	.-6      	; 0x3fee <getNch+0x4>
   verifySpace();
     3ff4:	f4 df       	rcall	.-24     	; 0x3fde <verifySpace>
 }

+ 1 - 2
optiboot/bootloaders/optiboot/pin_defs.h

@@ -1,4 +1,4 @@
-#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega88) || defined(__AVR_ATmega8__)
+#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega88) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega88__)
 /* Onboard LED is connected to pin PB5 in Arduino NG, Diecimila, and Duemilanove */ 
 #define LED_DDR     DDRB
 #define LED_PORT    PORTB
@@ -25,7 +25,6 @@
   #define WDTCSR	WDTCR
 #endif
 
-
 /* Luminet support */
 #if defined(__AVR_ATtiny84__)
 /* Red LED is connected to pin PA4 */