From: Stephan Baerwolf Date: Tue, 31 Jul 2012 13:04:47 +0000 (+0200) Subject: introducing more optimized code with the ability (backdoor) to update BLS X-Git-Tag: 2010-07-27-stephan-201207311515^0 X-Git-Url: http://git.linex4red.de/pub/USBaspLoader.git/commitdiff_plain/0af1d0a764634dc8425cdc9e3ed0250a70984517?ds=inline introducing more optimized code with the ability (backdoor) to update BLS Signed-off-by: Stephan Baerwolf --- diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h index 1b2bf24..9525aad 100644 --- a/firmware/bootloaderconfig.h +++ b/firmware/bootloaderconfig.h @@ -93,6 +93,14 @@ these macros are defined, the boot loader usees them. * to erase itself from the bootregion */ +#define HAVE_BLB11_SOFTW_BACKDOOR 1 +/* + * When "HAVE_BLB11_SOFTW_LOCKBIT" is enabled, this backdor will allow writing + * to the BLS while JUMPER stays low. (keeps be pressed) + * If JUMPER is released (and after a short debouncing period) repressing it + * will have NO affect on disabling the writelock. + */ + #define HAVE_EEPROM_PAGED_ACCESS 1 /* If HAVE_EEPROM_PAGED_ACCESS is defined to 1, page mode access to EEPROM is * compiled in. Whether page mode or byte mode access is used by AVRDUDE diff --git a/firmware/main.c b/firmware/main.c index a029169..fe99dae 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -250,12 +250,12 @@ uchar isLast; } }else{ uchar i; -#if HAVE_BLB11_SOFTW_LOCKBIT - uint8_t allowWrite; -#endif for(i = 0; i < len;){ #if HAVE_BLB11_SOFTW_LOCKBIT - allowWrite = (CURRENT_ADDRESS < (addr_t)(BOOTLOADER_ADDRESS)); + uint8_t allowWrite = (CURRENT_ADDRESS < (addr_t)(BOOTLOADER_ADDRESS)); +#if HAVE_BLB11_SOFTW_BACKDOOR + if ((stayinloader >= 0x10) && (bootLoaderCondition())) allowWrite=1; +#endif #endif #if !HAVE_CHIP_ERASE if((currentAddress.w[0] & (SPM_PAGESIZE - 1)) == 0){ /* if page start: erase */ @@ -374,7 +374,7 @@ int __attribute__((noreturn)) main(void) } } #endif - if (stayinloader > 0x10) { + if (stayinloader >= 0x10) { if (!bootLoaderCondition()) { stayinloader-=0x10; }