This is an automated email from Gerrit. Spencer Oliver (s...@spen-soft.co.uk) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/1132
-- gerrit commit a6b830dbf6b23f43085963dcec7c2de8685e2a38 Author: Spencer Oliver <s...@spen-soft.co.uk> Date: Tue Feb 5 16:41:30 2013 +0000 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 <s...@spen-soft.co.uk> diff --git a/doc/openocd.texi b/doc/openocd.texi index 9aa7522..a5b0a12 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -5243,6 +5243,14 @@ the chip identification register, and autoconfigures itself. flash bank $_FLASHNAME stm32f1x 0 0 0 0 $_TARGETNAME @end example +Note that some devices have been found that have a flash size register that contains +an invalid value, to workaround this issue you can override the probed value used by +the flash driver. + +@example +flash bank $_FLASHNAME stm32f1x 0 0x20000 0 0 $_TARGETNAME +@end example + If you have a target with dual flash banks then define the second bank as per the following example. @example @@ -5283,6 +5291,14 @@ include internal flash and use ARM Cortex-M3/M4 cores. The driver automatically recognizes a number of these chips using the chip identification register, and autoconfigures itself. +Note that some devices have been found that have a flash size register that contains +an invalid value, to workaround this issue you can override the probed value used by +the flash driver. + +@example +flash bank $_FLASHNAME stm32f2x 0 0x20000 0 0 $_TARGETNAME +@end example + Some stm32f2x-specific commands are defined: @deffn Command {stm32f2x lock} num @@ -5296,6 +5312,21 @@ The @var{num} parameter is a value shown by @command{flash banks}. @end deffn @end deffn +@deffn {Flash Driver} stm32lx +All members of the STM32L microcontroller families from ST Microelectronics +include internal flash and use ARM Cortex-M3 cores. +The driver automatically recognizes a number of these chips using +the chip identification register, and autoconfigures itself. + +Note that some devices have been found that have a flash size register that contains +an invalid value, to workaround this issue you can override the probed value used by +the flash driver. + +@example +flash bank $_FLASHNAME stm32lx 0 0x20000 0 0 $_TARGETNAME +@end example +@end deffn + @deffn {Flash Driver} str7x All members of the STR7 microcontroller family from ST Microelectronics include internal flash and use ARM7TDMI cores. diff --git a/src/flash/nor/stm32f1x.c b/src/flash/nor/stm32f1x.c index 17df121..019e5c0 100644 --- a/src/flash/nor/stm32f1x.c +++ b/src/flash/nor/stm32f1x.c @@ -943,6 +943,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; + } + if (stm32x_info->has_dual_banks) { /* split reported size into matching bank */ if (bank->base != 0x08080000) { 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 */ -- ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb _______________________________________________ OpenOCD-devel mailing list OpenOCD-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openocd-devel