From e5dcb5048c58bcbb95fee79e4775b7b447a5fc4f Mon Sep 17 00:00:00 2001 From: Timothy Lee Date: Tue, 27 Oct 2020 20:28:48 +1100 Subject: [PATCH] [feature] support STM32F4 option bytes --- inc/stm32.h | 1 + src/common.c | 1 + src/stlink-lib/chipid.c | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/inc/stm32.h b/inc/stm32.h index 1773e703b..b81d3149d 100644 --- a/inc/stm32.h +++ b/inc/stm32.h @@ -20,6 +20,7 @@ #define STM32_F2_OPTION_BYTES_BASE ((uint32_t)0x1FFFC000) #define STM32_L4_OPTION_BYTES_BASE ((uint32_t)0x1FFF7800) #define STM32_L1_OPTION_BYTES_BASE ((uint32_t)0x1FF80000) +#define STM32_F4_OPTION_BYTES_BASE ((uint32_t)0x40023C14) #define STM32_F7_OPTION_BYTES_BASE ((uint32_t)0x1FFF0000) #define STM32_H7_OPTION_BYTES_BASE ((uint32_t)0x5200201C) diff --git a/src/common.c b/src/common.c index a08db2733..32c00ad3b 100644 --- a/src/common.c +++ b/src/common.c @@ -3680,6 +3680,7 @@ int stlink_read_option_bytes32(stlink_t *sl, uint32_t* option_byte) { switch (sl->chip_id) { case STLINK_CHIPID_STM32_F2: return stlink_read_option_bytes_f2(sl, option_byte); + case STLINK_CHIPID_STM32_F4: case STLINK_CHIPID_STM32_F446: return stlink_read_option_bytes_f4(sl, option_byte); case STLINK_CHIPID_STM32_F7XXXX: diff --git a/src/stlink-lib/chipid.c b/src/stlink-lib/chipid.c index c191fa919..a8d160445 100644 --- a/src/stlink-lib/chipid.c +++ b/src/stlink-lib/chipid.c @@ -77,7 +77,9 @@ static const struct stlink_chipid_params devices[] = { .flash_pagesize = 0x4000, .sram_size = 0x30000, .bootrom_base = 0x1fff0000, - .bootrom_size = 0x7800 + .bootrom_size = 0x7800, + .option_base = STM32_F4_OPTION_BYTES_BASE, + .option_size = 4, }, { .chip_id = STLINK_CHIPID_STM32_F4_DSI,