extend "spminterface.h" for support of atmega32
authorStephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
Tue, 2 Oct 2012 16:11:29 +0000 (18:11 +0200)
committerStephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
Tue, 2 Oct 2012 22:08:19 +0000 (22:08 +0000)
Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
firmware/spminterface.h

index 1b96e20..7a7f657 100644 (file)
@@ -108,7 +108,8 @@ ret
   #else
     #if defined (__AVR_ATmega8__) || defined (__AVR_ATmega8A__) || defined (__AVR_ATmega8HVA__)
       #define  funcaddr___bootloader__do_spm 0x1826
   #else
     #if defined (__AVR_ATmega8__) || defined (__AVR_ATmega8A__) || defined (__AVR_ATmega8HVA__)
       #define  funcaddr___bootloader__do_spm 0x1826
-      
+    #elif defined (__AVR_ATmega32__)
+      #define  funcaddr___bootloader__do_spm 0x7054      
     #else
       #error "unknown MCU - where is bootloader__do_spm located?"
     #endif
     #else
       #error "unknown MCU - where is bootloader__do_spm located?"
     #endif
@@ -179,14 +180,22 @@ void do_spm(const uint32_t flash_byteaddress, const uint8_t spmcrval, const uint
  * try to make this array as big as possible
  * (so bootloader always uses 2kbytes flash)
  */
  * try to make this array as big as possible
  * (so bootloader always uses 2kbytes flash)
  */
-#if defined (__AVR_ATmega8__) || defined (__AVR_ATmega8A__) || defined (__AVR_ATmega8HVA__)
+#if defined (__AVR_ATmega8__) || defined (__AVR_ATmega8A__) || defined (__AVR_ATmega8HVA__) || defined (__AVR_ATmega32__)
 
 
-#if (BOOTLOADER_ADDRESS != 0x1800)
-  #error BOOTLOADER_ADDRESS!=0x1800, on current MCU "funcaddr___bootloader__do_spm" might be currupted - please edit spminterface.h for nonstandard use
+#if defined (__AVR_ATmega8__) || defined (__AVR_ATmega8A__) || defined (__AVR_ATmega8HVA__)
+  #if (BOOTLOADER_ADDRESS != 0x1800)
+    #error BOOTLOADER_ADDRESS!=0x1800, on current MCU "funcaddr___bootloader__do_spm" might be currupted - please edit spminterface.h for nonstandard use
+  #endif
+#elif defined (__AVR_ATmega32__)
+  #if (BOOTLOADER_ADDRESS != 0x7000)
+    #error BOOTLOADER_ADDRESS!=0x7000, on current MCU "funcaddr___bootloader__do_spm" might be currupted - please edit spminterface.h for nonstandard use
+  #endif
+#else
+  #error undefined device selection - this should not happen! 
 #endif
 //assume  SPMCR==0x37, SPMEN==0x0, RWWSRE=0x4, RWWSB=0x6
 const uint16_t bootloader__do_spm[17] BOOTLIBLINK = {0x0000, 0x2dec, 0x2dfd, 0xb6b7, 0xfcb0, 0xcffd, 0xbf27, 0x95e8, 0xb6b7,
 #endif
 //assume  SPMCR==0x37, SPMEN==0x0, RWWSRE=0x4, RWWSB=0x6
 const uint16_t bootloader__do_spm[17] BOOTLIBLINK = {0x0000, 0x2dec, 0x2dfd, 0xb6b7, 0xfcb0, 0xcffd, 0xbf27, 0x95e8, 0xb6b7,
-                                                    0xfcb0, 0xcffd, 0xe121, 0xb6b7, 0xfcb6, 0xcff4, 0x9508, 0xFFFF};
+                                                     0xfcb0, 0xcffd, 0xe121, 0xb6b7, 0xfcb6, 0xcff4, 0x9508, 0xFFFF};
 /*
 00001826 <bootloader__do_spm>:
     1826:      00 00           nop
 /*
 00001826 <bootloader__do_spm>:
     1826:      00 00           nop