summaryrefslogtreecommitdiff
path: root/src/flash/flash.c
diff options
context:
space:
mode:
authormifi <mifi@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2007-12-09 15:36:21 +0000
committermifi <mifi@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2007-12-09 15:36:21 +0000
commit9e6cec0dd3301395345777cfe2617559a868f2a9 (patch)
treece46406a1db239d40950df5a2fd071a554711fbd /src/flash/flash.c
parent00bbf24c1605e10e662f920c9b0a6ab02e6b81ee (diff)
downloadopenocd+libswd-9e6cec0dd3301395345777cfe2617559a868f2a9.tar.gz
openocd+libswd-9e6cec0dd3301395345777cfe2617559a868f2a9.tar.bz2
openocd+libswd-9e6cec0dd3301395345777cfe2617559a868f2a9.tar.xz
openocd+libswd-9e6cec0dd3301395345777cfe2617559a868f2a9.zip
- added patch to display device information as INFO too
- added patch which fixes a crash upon flash write error - added patch which will improve the reset handling when SRST is tied to TRST (thanks to Oyvind Harboe for these patches) git-svn-id: svn://svn.berlios.de/openocd/trunk@218 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/flash/flash.c')
-rw-r--r--src/flash/flash.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/flash/flash.c b/src/flash/flash.c
index 03ee46f3..390e37ad 100644
--- a/src/flash/flash.c
+++ b/src/flash/flash.c
@@ -570,10 +570,19 @@ int handle_flash_write_image_command(struct command_context_s *cmd_ctx, char *cm
failed = malloc(sizeof(int) * image.num_sections);
- if ((retval = flash_write(target, &image, &written, &error_str, failed, auto_erase)) != ERROR_OK)
+ error_str=NULL;
+ retval = flash_write(target, &image, &written, &error_str, failed, auto_erase);
+
+ if (retval != ERROR_OK)
{
- command_print(cmd_ctx, "failed writing image %s: %s", args[0], error_str);
- free(error_str);
+ if (error_str)
+ {
+ command_print(cmd_ctx, "failed writing image %s: %s", args[0], error_str);
+ free(error_str);
+ }
+ image_close(&image);
+ free(failed);
+ return retval;
}
for (i = 0; i < image.num_sections; i++)
@@ -938,3 +947,4 @@ int handle_flash_auto_erase_command(struct command_context_s *cmd_ctx, char *cmd
return ERROR_OK;
}
+