diff options
author | drath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2007-08-16 09:09:44 +0000 |
---|---|---|
committer | drath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2007-08-16 09:09:44 +0000 |
commit | c35cc0b8b7463148fd6110a6357e0d141db0e247 (patch) | |
tree | a11e10c0e7da798c19b5a72a3b9c7b3b76ec761a /src/server | |
parent | 708535960c13fcb7bbd5d07abc871c5832f53aa2 (diff) | |
download | riscv-openocd-c35cc0b8b7463148fd6110a6357e0d141db0e247.zip riscv-openocd-c35cc0b8b7463148fd6110a6357e0d141db0e247.tar.gz riscv-openocd-c35cc0b8b7463148fd6110a6357e0d141db0e247.tar.bz2 |
- fixed several bugs in flash writing code (thanks to Pavel Chromy)
git-svn-id: svn://svn.berlios.de/openocd/trunk@196 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/gdb_server.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index 3481625..5dd6f3c 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -1270,29 +1270,29 @@ int gdb_v_packet(connection_t *connection, target_t *target, char *packet, int p if (!strcmp(packet, "vFlashDone")) { - u32 image_size; + u32 written; char *error_str; - u32 *failed = malloc(sizeof(u32) * gdb_connection->vflash_image->num_sections); - + /* process the flashing buffer */ - if ((result = flash_write(gdb_service->target, gdb_connection->vflash_image, &image_size, &error_str, failed)) != ERROR_OK) + if ((result = flash_write(gdb_service->target, gdb_connection->vflash_image, &written, &error_str, NULL)) != ERROR_OK) { if (result == ERROR_FLASH_DST_OUT_OF_BANK) gdb_put_packet(connection, "E.memtype", 9); else gdb_send_error(connection, EIO); - ERROR("flash writing failed: %s", error_str); - free(error_str); + if (error_str) + { + ERROR("flash writing failed: %s", error_str); + free(error_str); + } } else { - DEBUG("wrote %u bytes from vFlash image to flash", image_size); + DEBUG("wrote %u bytes from vFlash image to flash", written); gdb_put_packet(connection, "OK", 2); } - free(failed); - image_close(gdb_connection->vflash_image); free(gdb_connection->vflash_image); gdb_connection->vflash_image = NULL; |