Skip to content

Commit 9ea8df2

Browse files
tarek-bochkatigerekon
authored andcommitted
flash/stm32l4x: support STM32U59/U5Ax devices
STM32U59/U5Ax devices are similar to U57/U58x devices with 2 flash banks up to 2 MB each while at there update STM32U57x/U58x revisions Change-Id: I7e5c1700acf8c9fda34f660c9274bfd8bcb1381b Signed-off-by: Tarek BOCHKATI <[email protected]> Reviewed-on: https://review.openocd.org/c/openocd/+/6875 Tested-by: jenkins Reviewed-by: Tomas Vanek <[email protected]>
1 parent 431e0aa commit 9ea8df2

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

src/flash/nor/stm32l4x.c

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@
120120
* http://www.st.com/resource/en/reference_manual/dm00346336.pdf
121121
*/
122122

123+
/* STM32U5xxx series for reference.
124+
*
125+
* RM0456 (STM32U5xx)
126+
* http://www.st.com/resource/en/reference_manual/dm00477635.pdf
127+
*/
128+
123129
/* Erase time can be as high as 25ms, 10x this and assume it's toast... */
124130

125131
#define FLASH_ERASE_TIMEOUT 250
@@ -346,7 +352,11 @@ static const struct stm32l4_rev stm32g49_g4axx_revs[] = {
346352

347353
static const struct stm32l4_rev stm32u57_u58xx_revs[] = {
348354
{ 0x1000, "A" }, { 0x1001, "Z" }, { 0x1003, "Y" }, { 0x2000, "B" },
349-
{ 0x2001, "X" }, { 0x3000, "C" },
355+
{ 0x2001, "X" }, { 0x3000, "C" }, { 0x3001, "W" },
356+
};
357+
358+
static const struct stm32l4_rev stm32u59_u5axx_revs[] = {
359+
{ 0x3001, "X" },
350360
};
351361

352362
static const struct stm32l4_rev stm32wba5x_revs[] = {
@@ -574,6 +584,18 @@ static const struct stm32l4_part_info stm32l4_parts[] = {
574584
.otp_base = 0x1FFF7000,
575585
.otp_size = 1024,
576586
},
587+
{
588+
.id = DEVID_STM32U59_U5AXX,
589+
.revs = stm32u59_u5axx_revs,
590+
.num_revs = ARRAY_SIZE(stm32u59_u5axx_revs),
591+
.device_str = "STM32U59/U5Axx",
592+
.max_flash_size_kb = 4096,
593+
.flags = F_HAS_DUAL_BANK | F_QUAD_WORD_PROG | F_HAS_TZ | F_HAS_L5_FLASH_REGS,
594+
.flash_regs_base = 0x40022000,
595+
.fsize_addr = 0x0BFA07A0,
596+
.otp_base = 0x0BFA0000,
597+
.otp_size = 512,
598+
},
577599
{
578600
.id = DEVID_STM32U57_U58XX,
579601
.revs = stm32u57_u58xx_revs,
@@ -2000,9 +2022,10 @@ static int stm32l4_probe(struct flash_bank *bank)
20002022
stm32l4_info->bank1_sectors = num_pages / 2;
20012023
}
20022024
break;
2025+
case DEVID_STM32U59_U5AXX:
20032026
case DEVID_STM32U57_U58XX:
2004-
/* if flash size is max (2M) the device is always dual bank
2005-
* otherwise check DUALBANK
2027+
/* if flash size is more than 1M the device is always dual bank
2028+
* otherwise check DUALBANK bit
20062029
*/
20072030
page_size_kb = 8;
20082031
num_pages = flash_size_kb / page_size_kb;

src/flash/nor/stm32l4x.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
#define DEVID_STM32L4P_L4QXX 0x471
103103
#define DEVID_STM32L55_L56XX 0x472
104104
#define DEVID_STM32G49_G4AXX 0x479
105+
#define DEVID_STM32U59_U5AXX 0x481
105106
#define DEVID_STM32U57_U58XX 0x482
106107
#define DEVID_STM32WBA5X 0x492
107108
#define DEVID_STM32WB1XX 0x494

0 commit comments

Comments
 (0)