From: Stephan Baerwolf Date: Fri, 16 Nov 2012 20:13:54 +0000 (+0100) Subject: BUG: fix flash read error on atmegas with more than 64k memory X-Git-Tag: v0.95~13 X-Git-Url: http://git.linex4red.de/pub/USBaspLoader.git/commitdiff_plain/af57c1bbd277f15b633e77e430ce6240ba62746a?ds=sidebyside BUG: fix flash read error on atmegas with more than 64k memory Signed-off-by: Stephan Baerwolf --- diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h index 0b6cea1..4f3f613 100644 --- a/firmware/bootloaderconfig.h +++ b/firmware/bootloaderconfig.h @@ -12,6 +12,7 @@ #ifndef __bootloaderconfig_h_included__ #define __bootloaderconfig_h_included__ +#include /* General Description: diff --git a/firmware/usbconfig.h b/firmware/usbconfig.h index 94e3d99..c266544 100644 --- a/firmware/usbconfig.h +++ b/firmware/usbconfig.h @@ -99,7 +99,11 @@ * 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. diff --git a/firmware/usbdrv/usbportability.h b/firmware/usbdrv/usbportability.h index a1ea93b..3d8a424 100644 --- a/firmware/usbdrv/usbportability.h +++ b/firmware/usbdrv/usbportability.h @@ -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. */