BUG: fix flash read error on atmegas with more than 64k memory
authorStephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
Fri, 16 Nov 2012 20:13:54 +0000 (21:13 +0100)
committerStephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
Mon, 19 Nov 2012 15:16:57 +0000 (15:16 +0000)
Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
firmware/bootloaderconfig.h
firmware/usbconfig.h
firmware/usbdrv/usbportability.h

index 0b6cea1..4f3f613 100644 (file)
@@ -12,6 +12,7 @@
 
 #ifndef __bootloaderconfig_h_included__
 #define __bootloaderconfig_h_included__
+#include <avr/io.h>
 
 /*
 General Description:
index 94e3d99..c266544 100644 (file)
  * of the macros usbDisableAllRequests() and usbEnableAllRequests() in
  * usbdrv.h.
  */
-#define USB_CFG_DRIVER_FLASH_PAGE       0
+#if defined(BOOTLOADER_ADDRESS)
+#      define USB_CFG_DRIVER_FLASH_PAGE       (BOOTLOADER_ADDRESS >> 16)
+#else
+#      define USB_CFG_DRIVER_FLASH_PAGE       0
+#endif
 /* If the device has more than 64 kBytes of flash, define this to the 64 k page
  * where the driver's constants (descriptors) are located. Or in other words:
  * Define this to 1 for boot loaders on the ATMega128.
index a1ea93b..3d8a424 100644 (file)
@@ -23,6 +23,7 @@ Thanks to Oleg Semyonov for his help with the IAR tools port!
 
 #ifndef __usbportability_h_INCLUDED__
 #define __usbportability_h_INCLUDED__
+#include "usbconfig.h"
 
 /* We check explicitly for IAR and CodeVision. Default is avr-gcc/avr-libc. */