diff options
author | Spencer Oliver <spen@spen-soft.co.uk> | 2013-02-05 16:41:30 +0000 |
---|---|---|
committer | Spencer Oliver <spen@spen-soft.co.uk> | 2013-02-25 11:56:18 +0000 |
commit | bd5df8520b5d1755c8c8a86a0f64d3aa452729ca (patch) | |
tree | 1738560d120bd402930f71c8bfaf61ee9b9ab8db /src/flash | |
parent | 87668aebf1851c06af2513ab5f27ebb9ebf1ff16 (diff) | |
download | riscv-openocd-bd5df8520b5d1755c8c8a86a0f64d3aa452729ca.zip riscv-openocd-bd5df8520b5d1755c8c8a86a0f64d3aa452729ca.tar.gz riscv-openocd-bd5df8520b5d1755c8c8a86a0f64d3aa452729ca.tar.bz2 |
stm32: enable flash bank size override
It has been seen on some stm32 targets that the flash size register that
is probed by the driver may contain an invalid size.
This change enables the user to override the probed value.
Change-Id: I09359e59a96f9133d3d939670957d32a830a944e
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1132
Tested-by: jenkins
Reviewed-by: Johan Almquist <johan.almquist@assaabloy.com>
Diffstat (limited to 'src/flash')
-rw-r--r-- | src/flash/nor/stm32f1x.c | 7 | ||||
-rw-r--r-- | src/flash/nor/stm32f2x.c | 7 | ||||
-rw-r--r-- | src/flash/nor/stm32lx.c | 7 |
3 files changed, 21 insertions, 0 deletions
diff --git a/src/flash/nor/stm32f1x.c b/src/flash/nor/stm32f1x.c index 17df121..13affcd 100644 --- a/src/flash/nor/stm32f1x.c +++ b/src/flash/nor/stm32f1x.c @@ -956,6 +956,13 @@ static int stm32x_probe(struct flash_bank *bank) } } + /* if the user sets the size manually then ignore the probed value + * this allows us to work around devices that have a invalid flash size register value */ + if (bank->size) { + LOG_INFO("ignoring flash probed value, using configured bank size"); + flash_size_in_kb = bank->size / 1024; + } + LOG_INFO("flash size = %dkbytes", flash_size_in_kb); /* did we assign flash size? */ diff --git a/src/flash/nor/stm32f2x.c b/src/flash/nor/stm32f2x.c index 7a4352f..1d59e3c 100644 --- a/src/flash/nor/stm32f2x.c +++ b/src/flash/nor/stm32f2x.c @@ -791,6 +791,13 @@ static int stm32x_probe(struct flash_bank *bank) flash_size_in_kb = max_flash_size_in_kb; } + /* if the user sets the size manually then ignore the probed value + * this allows us to work around devices that have a invalid flash size register value */ + if (bank->size) { + LOG_INFO("ignoring flash probed value, using configured bank size"); + flash_size_in_kb = bank->size / 1024; + } + LOG_INFO("flash size = %dkbytes", flash_size_in_kb); /* did we assign flash size? */ diff --git a/src/flash/nor/stm32lx.c b/src/flash/nor/stm32lx.c index ebc7534..f871a36 100644 --- a/src/flash/nor/stm32lx.c +++ b/src/flash/nor/stm32lx.c @@ -552,6 +552,13 @@ static int stm32lx_probe(struct flash_bank *bank) flash_size_in_kb = max_flash_size_in_kb; } + /* if the user sets the size manually then ignore the probed value + * this allows us to work around devices that have a invalid flash size register value */ + if (bank->size) { + LOG_INFO("ignoring flash probed value, using configured bank size"); + flash_size_in_kb = bank->size / 1024; + } + /* STM32L - we have 32 sectors, 16 pages per sector -> 512 pages * 16 pages for a protection area */ |