Skip to content

Commit 639fe6e

Browse files
Updated MCU core-ids
1 parent a5d6441 commit 639fe6e

File tree

4 files changed

+42
-18
lines changed

4 files changed

+42
-18
lines changed

inc/stm32.h

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,44 @@
77
#ifndef STM32_H
88
#define STM32_H
99

10-
/* Cortex-M core ids (CPUTAPID) */
11-
#define STM32_CORE_ID_M3_F2_JTAG 0x0ba00477 // unused // F2 JTAG (RM0033 p.1326)
12-
//#define STM32_CORE_ID_M33_JTAG 0x0ba04477 // unused // L5 JTAG
13-
#define STM32_CORE_ID_M0 0x0bb11477 // unused // F0
14-
#define STM32_CORE_ID_M0P 0x0bc11477 // unused // L0, G0
15-
#define STM32_CORE_ID_M33 0x0be01477 // unused // L5 SWD (RM0351 p.2029)
16-
#define STM32_CORE_ID_M33_JTAG 0x0be02477 // unused // L5 JTAG (RM0438 p.2029)
17-
#define STM32_CORE_ID_M3_F1 0x1ba01477 // F1 (RM0008 p.1092)
18-
#define STM32_CORE_ID_M4F_L4 0x1ba01477 // unused // L4 (RM0351 p.1845)
19-
#define STM32_CORE_ID_M4F_F4 0x2ba01477 // unused // F4 (RM0090 p.1695)
20-
#define STM32_CORE_ID_M4F_F4_JTAG 0x4ba00477 // unused // F4 JTAG (RM090 p.1691)
21-
#define STM32_CORE_ID_M7_F7 0x5ba02477 // F7
22-
#define STM32_CORE_ID_M7_H7 0x6ba02477 // H7
23-
#define STM32_CORE_ID_M7_H7_JTAG 0x6ba00477 // H7 JTAG (RM0433 p.3065)
10+
/* STM32 Cortex-M core ids (CPUTAPID) */
11+
#define STM32_CORE_ID_M0_SWD 0x0bb11477 // (RM0091 Section 32.5.3) F0 SW-DP
12+
// (RM0444 Section 40.5.3) G0 SW-DP
13+
14+
#define STM32_CORE_ID_M0P_SWD 0x0bc11477 // (RM0385 Section 27.5.3) L0 SW-DP
15+
16+
#define STM32_CORE_ID_M3_r1p1_SWD 0x1ba01477 // (RM0008 Section 31.8.3) F1 SW-DP
17+
#define STM32_CORE_ID_M3_r1p1_JTAG 0x3ba00477 // (RM0008 Section 31.6.3) F1 JTAG
18+
19+
#define STM32_CORE_ID_M3_r2p0_SWD 0x2ba01477 // (RM0033 Section 32.8.3) F2 SW-DP
20+
// (RM0038 Section 30.8.3) L1 SW-DP
21+
#define STM32_CORE_ID_M3_r2p0_JTAG 0x0ba00477 // (RM0033 Section 32.6.3) F2 JTAG
22+
// (RM0038 Section 30.6.2) L1 JTAG
23+
24+
#define STM32_CORE_ID_M4_r0p1_SWD 0x1ba01477 // (RM0316 Section 33.8.3) F3 SW-DP
25+
// (RM0351 Section 48.8.3) L4 SW-DP
26+
// (RM0432 Section 57.8.3) L4+ SW-DP
27+
#define STM32_CORE_ID_M4_r0p1_JTAG 0x4ba00477 // (RM0316 Section 33.6.3) F3 JTAG
28+
// (RM0351 Section 48.6.3) L4 JTAG
29+
// (RM0432 Section 57.6.3) L4+ JTAG
30+
31+
#define STM32_CORE_ID_M4F_r0p1_SWD 0x2ba01477 // (RM0090 Section 38.8.3) F4 SW-DP
32+
// (RM0090 Section 47.8.3) G4 SW-DP
33+
#define STM32_CORE_ID_M4F_r0p1_JTAG 0x4ba00477 // (RM0090 Section 38.6.3) F4 JTAG
34+
// (RM0090 Section 47.6.3) G4 JTAG
35+
36+
#define STM32_CORE_ID_M7F_SWD 0x5ba02477 // (RM0385 Section 40.8.3) F7 SW-DP
37+
#define STM32_CORE_ID_M7F_JTAG 0x5ba00477 // (RM0385 Section 40.6.3) F7 JTAG
38+
39+
#define STM32_CORE_ID_M7F_H7_SWD 0x6ba02477 // (RM0433 Section 60.4.1) H7 SW-DP
40+
#define STM32_CORE_ID_M7F_H7_JTAG 0x6ba00477 // (RM0433 Section 60.4.1) H7 JTAG
41+
42+
#define STM32_CORE_ID_M33_SWD 0x0be02477 // (RM0438 Section 52.2.10) L5 SW-DP
43+
// (RM0456 Section 65.3.3) U5 SW-DP
44+
#define STM32_CORE_ID_M33_JTAGD 0x0be01477 // (RM0438 Section 52.2.10) L5 JTAG-DP
45+
// (RM0456 Section 65.3.3) U5 JTAG-DP
46+
#define STM32_CORE_ID_M33_JTAG 0x0ba04477 // (RM0438 Section 52.2.8) L5 JTAG
47+
// (RM0456 Section 56.3.1) U5 JTAG
2448

2549
/* STM32 flash types */
2650
// New flash type definitions must go before STM32_FLASH_TYPE_UNDEFINED

src/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,7 @@ int stlink_chip_id(stlink_t *sl, uint32_t *chip_id) {
11371137
*
11381138
*/
11391139

1140-
if ((sl->core_id == STM32_CORE_ID_M7_H7 || sl->core_id == STM32_CORE_ID_M7_H7_JTAG) &&
1140+
if ((sl->core_id == STM32_CORE_ID_M7F_H7_SWD || sl->core_id == STM32_CORE_ID_M7F_H7_JTAG) &&
11411141
cpu_id.part == STLINK_REG_CMx_CPUID_PARTNO_CM7) {
11421142
// STM32H7 chipid in 0x5c001000 (RM0433 pg3189)
11431143
ret = stlink_read_debug32(sl, 0x5c001000, chip_id);

src/st-util/gdb-server.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ char* make_memory_map(stlink_t *sl) {
559559
strcpy(map, memory_map_template_F4);
560560
} else if (sl->chip_id == STM32_CHIPID_F4_DE) {
561561
strcpy(map, memory_map_template_F4_DE);
562-
} else if (sl->core_id == STM32_CORE_ID_M7_F7) {
562+
} else if (sl->core_id == STM32_CORE_ID_M7F_SWD) {
563563
snprintf(map, sz, memory_map_template_F7,
564564
(unsigned int)sl->sram_size);
565565
} else if (sl->chip_id == STM32_CHIPID_H74xxx) {

src/stlink-lib/flash_loader.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ int stlink_flash_loader_write_to_sram(stlink_t *sl, stm32_addr_t* addr, size_t*
245245
sl->chip_id == STM32_CHIPID_L0_CAT2) {
246246
loader_code = loader_code_stm32lx;
247247
loader_size = sizeof(loader_code_stm32lx);
248-
} else if (sl->core_id == STM32_CORE_ID_M3_F1 ||
248+
} else if (sl->core_id == STM32_CORE_ID_M3r1p1 ||
249249
sl->chip_id == STM32_CHIPID_F1_MD ||
250250
sl->chip_id == STM32_CHIPID_F1_HD ||
251251
sl->chip_id == STM32_CHIPID_F1_LD ||
@@ -278,7 +278,7 @@ int stlink_flash_loader_write_to_sram(stlink_t *sl, stm32_addr_t* addr, size_t*
278278
loader_code_stm32f4_lv, sizeof(loader_code_stm32f4_lv));
279279

280280
if (retval == -1) { return(retval); }
281-
} else if (sl->core_id == STM32_CORE_ID_M7_F7 ||
281+
} else if (sl->core_id == STM32_CORE_ID_M7F_SWD ||
282282
sl->chip_id == STM32_CHIPID_F7 ||
283283
sl->chip_id == STM32_CHIPID_F76xxx ||
284284
sl->chip_id == STM32_CHIPID_F72xxx) {

0 commit comments

Comments
 (0)