dsp5680xx - mark erase after unlocking flash

the unlocking procedure erases the flash mem (even if it wasn't locked), so it should be marked as erased after unlocking.

Change-Id: I5cc6a1e1d6cf4e1f243de532eff54111ffd66187
Signed-off-by: Rodrigo L. Rosa <rodrigorosa.lg@gmail.com>
Reviewed-on: http://openocd.zylin.com/222
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
This commit is contained in:
rodrigo_l_rosa
2011-11-19 15:39:20 -08:00
committed by Øyvind Harboe
parent e0c0810a8e
commit c725167ba8
2 changed files with 61 additions and 50 deletions

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