]> git.gag.com Git - fw/openocd/blobdiff - src/flash/nor/stm32lx.c
stm32l1: Devid 0x429 only has 8bit flash size register
[fw/openocd] / src / flash / nor / stm32lx.c
index e4f499d3cb8225d05ceda26955cdf0866f05e8b6..0c2fddc92004a3d6eca5cbfd8fb40d05eb7c873f 100644 (file)
@@ -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) {