|
@@ -37,15 +37,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -138,6 +139,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -300,7 +305,7 @@ void appStart(uint8_t rstFlags) __attribute__ ((naked));
|
|
#if defined(__AVR_ATmega168__)
|
|
#if defined(__AVR_ATmega168__)
|
|
#define RAMSTART (0x100)
|
|
#define RAMSTART (0x100)
|
|
#define NRWWSTART (0x3800)
|
|
#define NRWWSTART (0x3800)
|
|
-#elif defined(__AVR_ATmega328P__)
|
|
+#elif defined(__AVR_ATmega328P__) || defined(__AVR_ATmega32__)
|
|
#define RAMSTART (0x100)
|
|
#define RAMSTART (0x100)
|
|
#define NRWWSTART (0x7000)
|
|
#define NRWWSTART (0x7000)
|
|
#elif defined (__AVR_ATmega644P__)
|
|
#elif defined (__AVR_ATmega644P__)
|
|
@@ -334,7 +339,7 @@ void appStart(uint8_t rstFlags) __attribute__ ((naked));
|
|
|
|
|
|
|
|
|
|
* Handle devices with up to 4 uarts (eg m1280.) Rather inelegantly.
|
|
* Handle devices with up to 4 uarts (eg m1280.) Rather inelegantly.
|
|
- * Note that mega8 still needs special handling, because ubrr is handled
|
|
+ * Note that mega8/m32 still needs special handling, because ubrr is handled
|
|
* differently.
|
|
* differently.
|
|
*/
|
|
*/
|
|
#if UART == 0
|
|
#if UART == 0
|
|
@@ -386,7 +391,7 @@ int main(void) {
|
|
|
|
|
|
|
|
|
|
asm volatile ("clr __zero_reg__");
|
|
asm volatile ("clr __zero_reg__");
|
|
-#ifdef __AVR_ATmega8__
|
|
+#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__)
|
|
SP=RAMEND;
|
|
SP=RAMEND;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
@@ -400,7 +405,7 @@ int main(void) {
|
|
TCCR1B = _BV(CS12) | _BV(CS10);
|
|
TCCR1B = _BV(CS12) | _BV(CS10);
|
|
#endif
|
|
#endif
|
|
#ifndef SOFT_UART
|
|
#ifndef SOFT_UART
|
|
-#ifdef __AVR_ATmega8__
|
|
+#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__)
|
|
UCSRA = _BV(U2X);
|
|
UCSRA = _BV(U2X);
|
|
UCSRB = _BV(RXEN) | _BV(TXEN);
|
|
UCSRB = _BV(RXEN) | _BV(TXEN);
|
|
UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0);
|
|
UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0);
|
|
@@ -497,7 +502,9 @@ int main(void) {
|
|
while (--length);
|
|
while (--length);
|
|
|
|
|
|
|
|
|
|
-
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address);
|
|
if (address >= NRWWSTART) __boot_page_erase_short((uint16_t)(void*)address);
|
|
|
|
|
|
|
|
|
|
@@ -635,7 +642,7 @@ uint8_t getch(void) {
|
|
uint8_t ch;
|
|
uint8_t ch;
|
|
|
|
|
|
#ifdef LED_DATA_FLASH
|
|
#ifdef LED_DATA_FLASH
|
|
-#ifdef __AVR_ATmega8__
|
|
+#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__)
|
|
LED_PORT ^= _BV(LED);
|
|
LED_PORT ^= _BV(LED);
|
|
#else
|
|
#else
|
|
LED_PIN |= _BV(LED);
|
|
LED_PIN |= _BV(LED);
|
|
@@ -685,7 +692,7 @@ uint8_t getch(void) {
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#ifdef LED_DATA_FLASH
|
|
#ifdef LED_DATA_FLASH
|
|
-#ifdef __AVR_ATmega8__
|
|
+#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__)
|
|
LED_PORT ^= _BV(LED);
|
|
LED_PORT ^= _BV(LED);
|
|
#else
|
|
#else
|
|
LED_PIN |= _BV(LED);
|
|
LED_PIN |= _BV(LED);
|
|
@@ -734,7 +741,7 @@ void flash_led(uint8_t count) {
|
|
TCNT1 = -(F_CPU/(1024*16));
|
|
TCNT1 = -(F_CPU/(1024*16));
|
|
TIFR1 = _BV(TOV1);
|
|
TIFR1 = _BV(TOV1);
|
|
while(!(TIFR1 & _BV(TOV1)));
|
|
while(!(TIFR1 & _BV(TOV1)));
|
|
-#ifdef __AVR_ATmega8__
|
|
+#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__)
|
|
LED_PORT ^= _BV(LED);
|
|
LED_PORT ^= _BV(LED);
|
|
#else
|
|
#else
|
|
LED_PIN |= _BV(LED);
|
|
LED_PIN |= _BV(LED);
|