diff --git a/include/stlink.h b/include/stlink.h index db737ac..87d708e 100644 --- a/include/stlink.h +++ b/include/stlink.h @@ -81,11 +81,11 @@ extern "C" { enum stlink_flash_type { STLINK_FLASH_TYPE_UNKNOWN = 0, - STLINK_FLASH_TYPE_F0, - STLINK_FLASH_TYPE_L0, - STLINK_FLASH_TYPE_F4, - STLINK_FLASH_TYPE_L4, - STLINK_FLASH_TYPE_F1_XL, + STLINK_FLASH_TYPE_F0, /* used by f0, f1 (except f1xl),f3. */ + STLINK_FLASH_TYPE_F1_XL, /* f0 flash with dual bank, apparently */ + STLINK_FLASH_TYPE_F4, /* used by f2, f4, f7 */ + STLINK_FLASH_TYPE_L0, /* l0, l1 */ + STLINK_FLASH_TYPE_L4, /* l4, l4+ */ STLINK_FLASH_TYPE_G0, STLINK_FLASH_TYPE_G4, STLINK_FLASH_TYPE_WB diff --git a/src/common.c b/src/common.c index 9694a8b..7ca017e 100644 --- a/src/common.c +++ b/src/common.c @@ -3238,6 +3238,7 @@ int stlink_read_option_bytes32(stlink_t *sl, uint32_t* option_byte) ELOG("Option bytes read is currently not supported for connected chip\n"); return -1; } + switch (sl->chip_id) { case STLINK_CHIPID_STM32_F2: return stlink_read_option_bytes_f2(sl, option_byte); @@ -3289,6 +3290,7 @@ int stlink_write_option_bytes(stlink_t *sl, stm32_addr_t addr, uint8_t* base, ui return -1; } + /* filter out on chip_id, until complete flash family are handled */ switch (sl->chip_id) { case STLINK_CHIPID_STM32_F2: return stlink_write_option_bytes_f2(sl, base, addr, len);