Skip to content

Commit b1d5fba

Browse files
authored
Merge pull request #15368 from caoddx/fix_stm32l1_flash_size
fix STM32L1 FLASH_SIZE for cat.3 devices with DEV_ID 0x436
2 parents 149d444 + c80da53 commit b1d5fba

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

+3-1
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)