From 44c02d9c8c1218fbb24804bb6486081361ec7243 Mon Sep 17 00:00:00 2001 From: Rocky04 Date: Thu, 2 May 2024 09:55:05 +0000 Subject: [PATCH] Dynamic SRAM size for F4 memory map - Instead of using a fixed size of 128 KB for the SRAM memory map for F4 chips it now uses the definied SRAM size from the chip configuration --- src/st-util/gdb-server.c | 3 ++- src/st-util/memory-map.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/st-util/gdb-server.c b/src/st-util/gdb-server.c index 28e06231..d11c320b 100644 --- a/src/st-util/gdb-server.c +++ b/src/st-util/gdb-server.c @@ -354,7 +354,8 @@ char* make_memory_map(stlink_t *sl) { if (sl->chip_id == STM32_CHIPID_F4 || sl->chip_id == STM32_CHIPID_F446 || sl->chip_id == STM32_CHIPID_F411xx) { - strcpy(map, memory_map_template_F4); + snprintf(map, sz, memory_map_template_F4, + sl->sram_size); } else if (sl->chip_id == STM32_CHIPID_F4_DE) { strcpy(map, memory_map_template_F4_DE); } else if (sl->core_id == STM32_CORE_ID_M7F_SWD) { diff --git a/src/st-util/memory-map.h b/src/st-util/memory-map.h index 6f34eeda..37acb62e 100644 --- a/src/st-util/memory-map.h +++ b/src/st-util/memory-map.h @@ -8,7 +8,7 @@ static const char* const memory_map_template_F4 = "" " " // code = sram, bootrom or flash; flash is bigger " " // ccm ram - " " // sram + " " // sram " " // Sectors 0...3 " 0x4000" // 16 kB " "