aboutsummaryrefslogtreecommitdiff
path: root/src/flash
diff options
context:
space:
mode:
authorrodrigo_l_rosa <rodrigorosa.lg@gmail.com>2011-11-19 15:39:20 -0800
committerØyvind Harboe <oyvindharboe@gmail.com>2011-11-24 23:25:57 +0000
commitc725167ba8e2aa9e43bc86e28b44b6cb444740a8 (patch)
treede01f9d7e93ecb04f4e18648cec8f15ee8970657 /src/flash
parente0c0810a8e62af36108cd5ac18b3f64952a7ef71 (diff)
downloadriscv-openocd-c725167ba8e2aa9e43bc86e28b44b6cb444740a8.zip
riscv-openocd-c725167ba8e2aa9e43bc86e28b44b6cb444740a8.tar.gz
riscv-openocd-c725167ba8e2aa9e43bc86e28b44b6cb444740a8.tar.bz2
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>
Diffstat (limited to 'src/flash')
-rw-r--r--src/flash/nor/dsp5680xx_flash.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/flash/nor/dsp5680xx_flash.c b/src/flash/nor/dsp5680xx_flash.c
index 688493b..d804088 100644
--- a/src/flash/nor/dsp5680xx_flash.c
+++ b/src/flash/nor/dsp5680xx_flash.c
@@ -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;
}