]> git.sur5r.net Git - openocd/blobdiff - src/flash/nor/dsp5680xx_flash.c
dsp5680xx - mark erase after unlocking flash
[openocd] / src / flash / nor / dsp5680xx_flash.c
index 688493b3ec5acd716deb74fae618365ace3a64a5..d804088f34980c728e394f26040d1953e6eaf625 100644 (file)
@@ -132,8 +132,15 @@ static int dsp5680xx_flash_protect(struct flash_bank *bank, int set, int first,
   int retval;
   if(set)
     retval = dsp5680xx_f_lock(bank->target);
-  else
-    retval = dsp5680xx_f_unlock(bank->target);
+else{
+       retval = dsp5680xx_f_unlock(bank->target);
+       if (retval == ERROR_OK) {
+               /* mark all as erased */
+               for (int i = 0; i <= (HFM_SECTOR_COUNT-1); i++)
+                       /* FM does not recognize it as erased if erased via JTAG. */
+                       bank->sectors[i].is_erased = 1;
+       }
+}
   return retval;
 }