From 04b23ef5022bd0ebbcac7ceed5112d822bbd966d Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Wed, 9 Aug 2017 17:11:29 +0000 Subject: [PATCH] stm32l1: Devid 0x429 only has 8bit flash size register A footnote in RM0038r14. Change-Id: Ic31894d846fbbe917a7290b2b7ff8fb582bb65da Signed-off-by: Karl Palsson Reviewed-on: http://openocd.zylin.com/4198 Tested-by: jenkins Reviewed-by: Antonio Borneo Reviewed-by: Spencer Oliver --- src/flash/nor/stm32lx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/flash/nor/stm32lx.c b/src/flash/nor/stm32lx.c index e4f499d3cb..0c2fddc920 100644 --- a/src/flash/nor/stm32lx.c +++ b/src/flash/nor/stm32lx.c @@ -790,6 +790,11 @@ static int stm32lx_probe(struct flash_bank *bank) flash_size_in_kb = 256; } + /* 0x429 devices only use the lowest 8 bits of the flash size register */ + if (retval == ERROR_OK && (device_id & 0xfff) == 0x429) { + flash_size_in_kb &= 0xff; + } + /* Failed reading flash size or flash size invalid (early silicon), * default to max target family */ if (retval != ERROR_OK || flash_size_in_kb == 0xffff || flash_size_in_kb == 0) { -- 2.30.2