diff options
author | mifi <mifi@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-01-27 14:05:59 +0000 |
---|---|---|
committer | mifi <mifi@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-01-27 14:05:59 +0000 |
commit | c882cb089477050eb46f5f9fba90ff52179acd71 (patch) | |
tree | bd76561bffd5afd45beaf8a29d06ea33f688c6ab /src/server | |
parent | 8d6292d9a070e87bf49d7d2894cd933795b9e3a8 (diff) | |
download | openocd+libswd-c882cb089477050eb46f5f9fba90ff52179acd71.tar.gz openocd+libswd-c882cb089477050eb46f5f9fba90ff52179acd71.tar.bz2 openocd+libswd-c882cb089477050eb46f5f9fba90ff52179acd71.tar.xz openocd+libswd-c882cb089477050eb46f5f9fba90ff52179acd71.zip |
- added autoprobe functionality
- corrected blocksize handling from GDB "info mem" command
(thanks to Øyvind and Spen for these patches)
git-svn-id: svn://svn.berlios.de/openocd/trunk@278 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/gdb_server.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index d094a0c9..d48101f4 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -1364,6 +1364,22 @@ static int decode_xfer_read (char *buf, char **annex, int *ofs, unsigned int *le return 0; } +int gdb_calc_blocksize(flash_bank_t *bank) +{ + int i; + int block_size = 0xffffffff; + + /* loop through all sectors and return smallest sector size */ + + for (i = 0; i < bank->num_sectors; i++) + { + if (bank->sectors[i].size < block_size) + block_size = bank->sectors[i].size; + } + + return block_size; +} + int gdb_query_packet(connection_t *connection, target_t *target, char *packet, int packet_size) { command_context_t *cmd_ctx = connection->cmd_ctx; @@ -1470,6 +1486,7 @@ int gdb_query_packet(connection_t *connection, target_t *target, char *packet, i int offset; int length; char *separator; + int blocksize; /* skip command character */ packet += 23; @@ -1486,10 +1503,14 @@ int gdb_query_packet(connection_t *connection, target_t *target, char *packet, i if (p == NULL) break; + /* if device has uneven sector sizes, eg. str7, lpc + * we pass the smallest sector size to gdb memory map */ + blocksize = gdb_calc_blocksize(p); + xml_printf(&retval, &xml, &pos, &size, "<memory type=\"flash\" start=\"0x%x\" length=\"0x%x\">\n" \ "<property name=\"blocksize\">0x%x</property>\n" \ "</memory>\n", \ - p->base, p->size, p->size/p->num_sectors); + p->base, p->size, blocksize); i++; } |