Skip to content

Commit c80da53

Browse files
committed
fix STM32L1 FLASH_SIZE for cat.3 devices with DEV_ID 0x436
1 parent 149d444 commit c80da53

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

targets/TARGET_STM/TARGET_STM32L1/STM32Cube_FW/STM32L1xx_HAL_Driver/stm32l1xx_hal_flash.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ typedef struct
121121
* @{
122122
*/
123123

124-
#define FLASH_SIZE (uint32_t)((*((uint32_t *)FLASHSIZE_BASE)&0xFFFFU) * 1024U)
124+
#define FLASH_SIZE_RAW (uint32_t)(*((uint32_t *)FLASHSIZE_BASE)&0xFFFFU)
125+
#define FLASH_SIZE (((FLASH_SIZE_RAW) == 0 ? 384 : ((FLASH_SIZE_RAW) == 1 ? 256 : (FLASH_SIZE_RAW))) * 1024)
126+
125127
#define FLASH_PAGE_SIZE (256U) /*!< FLASH Page Size in bytes */
126128

127129
/**

0 commit comments

Comments
 (0)