From 2b6a6de517b98f865afd7cda6312363958d894d9 Mon Sep 17 00:00:00 2001 From: Mike Schwerin Date: Sun, 29 Jan 2017 23:22:53 -0500 Subject: [PATCH 1/2] Added STM32F413 parameters and verified with st-info tool --- include/stlink/chipid.h | 3 ++- src/chipid.c | 12 ++++++++++++ src/flash_loader.c | 3 ++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/include/stlink/chipid.h b/include/stlink/chipid.h index 36fb73c62..29d81c785 100644 --- a/include/stlink/chipid.h +++ b/include/stlink/chipid.h @@ -55,7 +55,8 @@ enum stlink_stm32_chipids { STLINK_CHIPID_STM32_F0_CAN = 0x448, STLINK_CHIPID_STM32_F7 = 0x449, STLINK_CHIPID_STM32_F7XXXX = 0x451, - STLINK_CHIPID_STM32_F410 = 0x458 + STLINK_CHIPID_STM32_F410 = 0x458, + STLINK_CHIPID_STM32_F413 = 0x463 }; /** diff --git a/src/chipid.c b/src/chipid.c index 13307a99e..4318db787 100644 --- a/src/chipid.c +++ b/src/chipid.c @@ -298,6 +298,18 @@ static const struct stlink_chipid_params devices[] = { .bootrom_base = 0x1FFF0000, // "System memory" starting address from Table 4 .bootrom_size = 0x7800 // "System memory" byte size in hex from Table 4 }, + { + // RM0430 DocID029473 Rev 2 document was used to find these parameters + // Figure 2, Table 4, Table 5, Section 35.2 + .chip_id = STLINK_CHIPID_STM32_F413, + .description = "F4 device", + .flash_type = STLINK_FLASH_TYPE_F4, + .flash_size_reg = 0x1FFF7A22, // "Flash size data register" Section 35.2 + .flash_pagesize = 0x4000, // Table 5. Flash module organization (variable sector sizes, but 0x4000 is smallest) + .sram_size = 0x50000, // "SRAM" byte size in hex from Figure 2 (Table 4 only says 0x40000) + .bootrom_base = 0x1FFF0000, // "System memory" starting address from Table 4 + .bootrom_size = 0x7800 // "System memory" byte size in hex from Table 4 + }, { .chip_id = STLINK_CHIPID_STM32_F09X, .description = "F09X device", diff --git a/src/flash_loader.c b/src/flash_loader.c index f4d81cbab..337a121db 100644 --- a/src/flash_loader.c +++ b/src/flash_loader.c @@ -219,7 +219,8 @@ int stlink_flash_loader_write_to_sram(stlink_t *sl, stm32_addr_t* addr, size_t* sl->chip_id == STLINK_CHIPID_STM32_F410 || sl->chip_id == STLINK_CHIPID_STM32_F411RE || sl->chip_id == STLINK_CHIPID_STM32_F412 || - sl->chip_id == STLINK_CHIPID_STM32_F446 + sl->chip_id == STLINK_CHIPID_STM32_F413 || + sl->chip_id == STLINK_CHIPID_STM32_F446 ) { if( sl->version.stlink_v == 1 ) { printf("STLINK V1 cannot read voltage, defaulting to 32-bit writes on F4 devices\n"); From d17df108f0995229c562731c4e3c9a9456d1b22d Mon Sep 17 00:00:00 2001 From: Mike Schwerin Date: Mon, 30 Jan 2017 01:03:10 -0500 Subject: [PATCH 2/2] Indentation fixes --- include/stlink/chipid.h | 2 +- src/flash_loader.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/stlink/chipid.h b/include/stlink/chipid.h index 29d81c785..84aff7f80 100644 --- a/include/stlink/chipid.h +++ b/include/stlink/chipid.h @@ -56,7 +56,7 @@ enum stlink_stm32_chipids { STLINK_CHIPID_STM32_F7 = 0x449, STLINK_CHIPID_STM32_F7XXXX = 0x451, STLINK_CHIPID_STM32_F410 = 0x458, - STLINK_CHIPID_STM32_F413 = 0x463 + STLINK_CHIPID_STM32_F413 = 0x463 }; /** diff --git a/src/flash_loader.c b/src/flash_loader.c index 337a121db..0b05f4ab6 100644 --- a/src/flash_loader.c +++ b/src/flash_loader.c @@ -219,8 +219,8 @@ int stlink_flash_loader_write_to_sram(stlink_t *sl, stm32_addr_t* addr, size_t* sl->chip_id == STLINK_CHIPID_STM32_F410 || sl->chip_id == STLINK_CHIPID_STM32_F411RE || sl->chip_id == STLINK_CHIPID_STM32_F412 || - sl->chip_id == STLINK_CHIPID_STM32_F413 || - sl->chip_id == STLINK_CHIPID_STM32_F446 + sl->chip_id == STLINK_CHIPID_STM32_F413 || + sl->chip_id == STLINK_CHIPID_STM32_F446 ) { if( sl->version.stlink_v == 1 ) { printf("STLINK V1 cannot read voltage, defaulting to 32-bit writes on F4 devices\n");