From 1cffc453c5b9316251027da24542bf9493f6629c Mon Sep 17 00:00:00 2001 From: Christophe Levantis Date: Wed, 7 Sep 2016 11:11:45 +0100 Subject: [PATCH] Add memory map for stm32f401xe Trying to load a elf image on a stm32f401xe can result in a problem of flash write if a section does not start on a flash sector because the memory map given to gdb was wrong. --- src/gdbserver/gdb-server.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/gdbserver/gdb-server.c b/src/gdbserver/gdb-server.c index 15f8379..f99f3e7 100644 --- a/src/gdbserver/gdb-server.c +++ b/src/gdbserver/gdb-server.c @@ -433,6 +433,30 @@ static const char* const memory_map_template_F7 = " " // option byte area ""; + +static const char* const memory_map_template_F4_DE = + "" + "" + "" + " " // code = sram, bootrom or flash; flash is bigger + " " // sram + " " //Sectors 0..3 + " 0x4000" //16kB + " " + " " //Sector 4 + " 0x10000" //64kB + " " + " " //Sectors 5..7 + " 0x20000" //128kB + " " + " " // peripheral regs + " " // cortex regs + " " // bootrom + " " // otp + " " // option byte area + ""; + char* make_memory_map(stlink_t *sl) { /* This will be freed in serve() */ const size_t sz = 4096; @@ -441,6 +465,8 @@ char* make_memory_map(stlink_t *sl) { if(sl->chip_id==STLINK_CHIPID_STM32_F4 || sl->chip_id==STLINK_CHIPID_STM32_F446) { strcpy(map, memory_map_template_F4); + } else if(sl->chip_id==STLINK_CHIPID_STM32_F4_DE) { + strcpy(map, memory_map_template_F4_DE); } else if(sl->core_id==STM32F7_CORE_ID) { snprintf(map, sz, memory_map_template_F7, sl->sram_size);