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;
}