From d6ab5b0c3fafd14afeeb356afa5c12d254bb8906 Mon Sep 17 00:00:00 2001 From: jnosky Date: Thu, 10 Nov 2011 20:12:29 -0500 Subject: [PATCH] Temp fix to work with F4 up to 64k of flash, changed chip detection Can debug with up to 64k flash on the F4 --- gdbserver/gdb-server.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gdbserver/gdb-server.c b/gdbserver/gdb-server.c index e376eb4..4d549a6 100644 --- a/gdbserver/gdb-server.c +++ b/gdbserver/gdb-server.c @@ -1,5 +1,5 @@ /* -*- tab-width:8 -*- */ - +#define DEBUG 1 /* Copyright (C) 2011 Peter Zotov Use of this source code is governed by a BSD-style @@ -49,6 +49,7 @@ struct chip_params { 0x100000, 0x20000, 0x20000, 0x1fff0000, 0x7800 }, // table 1, pm0059 { 0x412, "F1 Low-density device", 0x1ffff7e0, 0x8000, 0x400, 0x2800, 0x1ffff000, 0x800 }, // table 1, pm0063 + /*No flash size register? page size is variable */ { 0x413, "F4 device", 0x1FFF7A10, 0x100000, 0x4000, 0x30000, 0x1fff0000, 0x7800 }, // table 1, pm0081 { 0x414, "F1 High-density device", 0x1ffff7e0, @@ -176,11 +177,16 @@ int main(int argc, char** argv) { FLASH_PAGE = params->flash_pagesize; + //sl->flash_pgsz=0x4000; + //sl->flash_size=0x100000; + uint32_t flash_size; stlink_read_mem32(sl, params->flash_size_reg, 4); flash_size = sl->q_buf[0] | (sl->q_buf[1] << 8); + //flash_size=0x100000; + printf("Flash size is %d KiB.\n", flash_size); // memory map is in 1k blocks. current_memory_map = make_memory_map(params, flash_size * 0x400); @@ -531,6 +537,7 @@ static int flash_go(stlink_t *sl) { printf("flash_do: page %08x\n", page); #endif + //todo:write flash already does erase so why is this here? stlink_erase_flash_page(sl, page); if(stlink_write_flash(sl, page, fb->data + (page - fb->addr),