summaryrefslogtreecommitdiff
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
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
-rw-r--r--src/flash/flash.c16
-rw-r--r--src/jtag/jtag.c2
-rw-r--r--src/target/target.c27
3 files changed, 36 insertions, 9 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;
}
+
diff --git a/src/jtag/jtag.c b/src/jtag/jtag.c
index 5a390070..09cffef7 100644
--- a/src/jtag/jtag.c
+++ b/src/jtag/jtag.c
@@ -1287,7 +1287,7 @@ int jtag_examine_chain()
part = (idcode & 0xffff000) >> 12;
version = (idcode & 0xf0000000) >> 28;
- DEBUG("JTAG device found: 0x%8.8x (Manufacturer: 0x%3.3x, Part: 0x%4.4x, Version: 0x%1.1x",
+ INFO("JTAG device found: 0x%8.8x (Manufacturer: 0x%3.3x, Part: 0x%4.4x, Version: 0x%1.1x)",
idcode, manufacturer, part, version);
bit_count += 32;
diff --git a/src/target/target.c b/src/target/target.c
index f9d957d6..0874010c 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -313,6 +313,23 @@ int target_process_reset(struct command_context_s *cmd_ctx)
while (target)
{
target->type->deassert_reset(target);
+
+ switch (target->reset_mode)
+ {
+ case RESET_INIT:
+ case RESET_HALT:
+ // If we're already halted, then this is harmless(reducing # of execution paths here)
+ // If nSRST & nTRST are tied together then the halt during reset failed(logged) and
+ // we use this as fallback(there is no other output to tell the user that reset halt
+ // didn't work).
+ target->type->poll(target);
+ target->type->halt(target);
+ break;
+ default:
+ break;
+ }
+
+
target = target->next;
}
jtag_execute_queue();
@@ -1047,7 +1064,7 @@ int handle_target_command(struct command_context_s *cmd_ctx, char *cmd, char **a
(*last_target_p)->trace_info->trace_history_overflowed = 0;
(*last_target_p)->dbgmsg = NULL;
-
+
(*last_target_p)->type->target_command(cmd_ctx, cmd, args, argc, *last_target_p);
found = 1;
@@ -1188,8 +1205,7 @@ int handle_target(void *priv)
if (target_continous_poll)
if ((retval = target->type->poll(target)) < 0)
{
- ERROR("couldn't poll target, exiting");
- exit(-1);
+ ERROR("couldn't poll target. It's due for a reset.");
}
}
@@ -1860,7 +1876,7 @@ int handle_verify_image_command(struct command_context_s *cmd_ctx, char *cmd, ch
if (!target)
{
ERROR("no target selected");
- return ERROR_OK;
+ return ERROR_OK;
}
duration_start_measure(&duration);
@@ -1875,7 +1891,7 @@ int handle_verify_image_command(struct command_context_s *cmd_ctx, char *cmd, ch
image.base_address_set = 0;
image.base_address = 0x0;
}
-
+
image.start_address_set = 0;
if (image_open(&image, args[0], (argc == 3) ? args[2] : NULL) != ERROR_OK)
@@ -2085,3 +2101,4 @@ int handle_rwp_command(struct command_context_s *cmd_ctx, char *cmd, char **args
return ERROR_OK;
}
+