Parcourir la source

Add RAMSTART definition to use correct memory location on older avr-gcc compilers.

Avr-gcc shipped with Arduino below version 1.6.x doesn't define RAMSTART
for Armega2560 and Optiboot incorrectly assumes wrong location.
It led to store new flash values in register's memory space which
caused unexpected chip behaviour and write/verification errors.
Thanks to Matthijs Kooijman for finding this.
Matthijs Kooijman il y a 8 ans
Parent
commit
af82d7f67c
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      optiboot/bootloaders/optiboot/optiboot.c

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

@@ -39,6 +39,7 @@
 /*   ATmega644P based devices (Sanguino)                  */
 /*   ATmega1284P based devices                            */
 /*   ATmega1280 based devices (Arduino Mega)              */
+/*   ATmega2560 based devices (Arduino Mega)              */
 /*                                                        */
 /* Alpha test                                             */
 /*   ATmega32                                             */
@@ -382,7 +383,7 @@ void appStart(uint8_t rstFlags) __attribute__ ((naked));
 // correct for a bug in avr-libc
 #undef SIGNATURE_2
 #define SIGNATURE_2 0x0A
-#elif defined(__AVR_ATmega1280__)
+#elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
 #undef RAMSTART
 #define RAMSTART (0x200)
 #endif