introducing more optimized code with the ability (backdoor) to update BLS 2010-07-27-stephan-201207311515
authorStephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
Tue, 31 Jul 2012 13:04:47 +0000 (15:04 +0200)
committerStephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
Tue, 31 Jul 2012 13:12:42 +0000 (13:12 +0000)
Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
firmware/bootloaderconfig.h
firmware/main.c

index 1b2bf24..9525aad 100644 (file)
@@ -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
index a029169..fe99dae 100644 (file)
@@ -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;
          }