- added "init" command. "init" and "reset" at end of startup script is equivalent

to daemon_startup(still supported).
- print warning if srst and trst change state at the same time when srst_and_trst
is seperate
- reset now performs a trst, examines and validates the jtag chain before targets
assert reset
- if startup fails to examine and validate the jtag chain, try a reset before
trying again


git-svn-id: svn://svn.berlios.de/openocd/trunk@552 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
oharboe
2008-04-09 05:50:34 +00:00
parent 94320a1dc3
commit a064722743
7 changed files with 179 additions and 88 deletions
+17 -10
View File
@@ -755,6 +755,14 @@ int arm7_9_assert_reset(target_t *target)
if ((target->reset_mode == RESET_HALT) || (target->reset_mode == RESET_INIT))
{
reg_t *dbg_ctrl = &arm7_9->eice_cache->reg_list[EICE_DBG_CTRL];
/* program EmbeddedICE Debug Control Register to deassert DBGRQ
* i.e. resume.
*/
buf_set_u32(dbg_ctrl->value, EICE_DBG_CONTROL_DBGRQ, 1, 0);
embeddedice_store_reg(dbg_ctrl);
/*
* Some targets do not support communication while SRST is asserted. We need to
* set up the reset vector catch here.
@@ -777,16 +785,6 @@ int arm7_9_assert_reset(target_t *target)
}
}
/* we can't know what state the target is in as we might e.g.
* be resetting after a power dropout, so we need to issue a tms/srst
*/
/* assert SRST and TRST */
/* system would get ouf sync if we didn't reset test-logic, too */
jtag_add_reset(1, 1);
jtag_add_sleep(5000);
/* here we should issue a srst only, but we may have to assert trst as well */
if (jtag_reset_config & RESET_SRST_PULLS_TRST)
{
@@ -965,6 +963,15 @@ int arm7_9_halt(target_t *target)
LOG_ERROR("can't request a halt while in reset if nSRST pulls nTRST");
return ERROR_TARGET_FAILURE;
}
else
{
/* we came here in a reset_halt or reset_init sequence
* debug entry was already prepared in arm7_9_prepare_reset_halt()
*/
target->debug_reason = DBG_REASON_DBGRQ;
return ERROR_OK;
}
}
if (arm7_9->use_dbgrq)
+4 -33
View File
@@ -51,7 +51,6 @@ int cli_target_callback_event_handler(struct target_s *target, enum target_event
int handle_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_daemon_startup_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_targets_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_target_script_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
@@ -132,8 +131,6 @@ char *target_endianess_strings[] =
"little endian",
};
enum daemon_startup_mode startup_mode = DAEMON_ATTACH;
static int target_continous_poll = 1;
/* read a u32 from a buffer in target memory endianness */
@@ -264,6 +261,10 @@ int target_process_reset(struct command_context_s *cmd_ctx)
jtag->speed(jtag_speed);
if ((retval = jtag_init_reset(cmd_ctx)) != ERROR_OK)
return retval;
/* prepare reset_halt where necessary */
target = targets;
while (target)
@@ -460,14 +461,6 @@ int target_init(struct command_context_s *cmd_ctx)
return ERROR_OK;
}
int target_init_reset(struct command_context_s *cmd_ctx)
{
if (startup_mode == DAEMON_RESET)
target_process_reset(cmd_ctx);
return ERROR_OK;
}
int target_register_event_callback(int (*callback)(struct target_s *target, enum target_event event, void *priv), void *priv)
{
target_event_callback_t **callbacks_p = &target_event_callbacks;
@@ -801,7 +794,6 @@ int target_register_commands(struct command_context_s *cmd_ctx)
{
register_command(cmd_ctx, NULL, "target", handle_target_command, COMMAND_CONFIG, "target <cpu> [reset_init default - DEPRECATED] <chainpos> <endianness> <variant> [cpu type specifc args]");
register_command(cmd_ctx, NULL, "targets", handle_targets_command, COMMAND_EXEC, NULL);
register_command(cmd_ctx, NULL, "daemon_startup", handle_daemon_startup_command, COMMAND_CONFIG, NULL);
register_command(cmd_ctx, NULL, "target_script", handle_target_script_command, COMMAND_CONFIG, NULL);
register_command(cmd_ctx, NULL, "run_and_halt_time", handle_run_and_halt_time_command, COMMAND_CONFIG, "<target> <run time ms>");
register_command(cmd_ctx, NULL, "working_area", handle_working_area_command, COMMAND_ANY, "working_area <target#> <address> <size> <'backup'|'nobackup'> [virtual address]");
@@ -1639,27 +1631,6 @@ int handle_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **arg
return handle_wait_halt_command(cmd_ctx, cmd, args, argc);
}
/* what to do on daemon startup */
int handle_daemon_startup_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc == 1)
{
if (strcmp(args[0], "attach") == 0)
{
startup_mode = DAEMON_ATTACH;
return ERROR_OK;
}
else if (strcmp(args[0], "reset") == 0)
{
startup_mode = DAEMON_RESET;
return ERROR_OK;
}
}
LOG_WARNING("invalid daemon_startup configuration directive: %s", args[0]);
return ERROR_OK;
}
int handle_soft_reset_halt_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
+5 -8
View File
@@ -54,14 +54,6 @@ enum target_state
extern char *target_state_strings[];
enum daemon_startup_mode
{
DAEMON_ATTACH, /* simply attach to the target */
DAEMON_RESET, /* reset target (behaviour defined by reset_mode */
};
extern enum daemon_startup_mode startup_mode;
enum target_reset_mode
{
RESET_RUN = 0, /* reset and let target run */
@@ -130,6 +122,11 @@ typedef struct target_type_s
* assert_reset() can therefore make no assumptions whatsoever about the
* state of the target
*
* Before assert_reset() for the target is invoked, a TRST/tms and
* chain validation is executed. TRST should not be asserted
* during target assert unless there is no way around it due to
* the way reset's are configured.
*
*/
int (*assert_reset)(struct target_s *target);
int (*deassert_reset)(struct target_s *target);
+4
View File
@@ -5,6 +5,10 @@ jtag_ntrst_delay 200
#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst srst_pulls_trst
#LPCs need reset pulled while RTCK is log. 0 to activate JTAG, power-on reset is not enough
jtag_reset 1 1
jtag_reset 0 0
#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 4 0x1 0xf 0xe