- added configurable delays after reset lines get deasserted. useful if reset circuitry keeps lines asserted for too long.

- additional debug output when opening the parallel port
- fixed counting of available arm7/9 watchpoint units
- 'flash write' now displays elapsed time


git-svn-id: svn://svn.berlios.de/openocd/trunk@79 b42882b7-edfa-0310-969c-e2dbd0fdcd60
__archive__
drath 2006-07-30 11:25:43 +00:00
parent 82d2633b5f
commit 1341eb3b0a
6 changed files with 89 additions and 6 deletions

View File

@ -476,6 +476,9 @@ int handle_flash_write_command(struct command_context_s *cmd_ctx, char *cmd, cha
u32 buf_cnt; u32 buf_cnt;
int retval; int retval;
flash_bank_t *p; flash_bank_t *p;
struct timeval start, end, duration;
gettimeofday(&start, NULL);
if (argc < 3) if (argc < 3)
{ {
@ -553,7 +556,10 @@ int handle_flash_write_command(struct command_context_s *cmd_ctx, char *cmd, cha
free(buffer); free(buffer);
fclose(binary); fclose(binary);
command_print(cmd_ctx, "wrote file %s to flash bank %i at offset 0x%8.8x", args[1], strtoul(args[0], NULL, 0), strtoul(args[2], NULL, 0)); gettimeofday(&end, NULL);
timeval_subtract(&duration, &end, &start);
command_print(cmd_ctx, "wrote file %s to flash bank %i at offset 0x%8.8x in %is %ius", args[1], strtoul(args[0], NULL, 0), strtoul(args[2], NULL, 0), duration.tv_sec, duration.tv_usec);
return ERROR_OK; return ERROR_OK;

View File

@ -111,6 +111,10 @@ enum tap_state cmd_queue_cur_state = TAP_TLR;
int jtag_verify_capture_ir = 1; int jtag_verify_capture_ir = 1;
/* how long the OpenOCD should wait before attempting JTAG communication after reset lines deasserted (in ms) */
int jtag_nsrst_delay = 0; /* default to no nSRST delay */
int jtag_ntrst_delay = 0; /* default to no nTRST delay */
/* callbacks to inform high-level handlers about JTAG state changes */ /* callbacks to inform high-level handlers about JTAG state changes */
jtag_event_callback_t *jtag_event_callbacks; jtag_event_callback_t *jtag_event_callbacks;
@ -168,6 +172,8 @@ int handle_interface_command(struct command_context_s *cmd_ctx, char *cmd, char
int handle_jtag_speed_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int handle_jtag_speed_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int handle_jtag_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_reset_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int handle_reset_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_jtag_nsrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int handle_scan_chain_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
@ -805,7 +811,10 @@ int jtag_add_reset(int req_trst, int req_srst)
} }
if (req_srst && !(jtag_reset_config & RESET_HAS_SRST)) if (req_srst && !(jtag_reset_config & RESET_HAS_SRST))
{
ERROR("requested nSRST assertion, but the current configuration doesn't support this");
return ERROR_JTAG_RESET_CANT_SRST; return ERROR_JTAG_RESET_CANT_SRST;
}
if (req_trst && !(jtag_reset_config & RESET_HAS_TRST)) if (req_trst && !(jtag_reset_config & RESET_HAS_TRST))
{ {
@ -827,9 +836,15 @@ int jtag_add_reset(int req_trst, int req_srst)
jtag_srst = req_srst; jtag_srst = req_srst;
if (jtag_srst) if (jtag_srst)
{
jtag_call_event_callbacks(JTAG_SRST_ASSERTED); jtag_call_event_callbacks(JTAG_SRST_ASSERTED);
}
else else
{
jtag_call_event_callbacks(JTAG_SRST_RELEASED); jtag_call_event_callbacks(JTAG_SRST_RELEASED);
if (jtag_nsrst_delay)
jtag_add_sleep(jtag_nsrst_delay);
}
if (trst_with_tms) if (trst_with_tms)
{ {
@ -854,9 +869,20 @@ int jtag_add_reset(int req_trst, int req_srst)
{ {
if (jtag_trst) if (jtag_trst)
{ {
/* we just asserted nTRST, so we're now in Test-Logic-Reset,
* and inform possible listeners about this
*/
cmd_queue_cur_state = TAP_TLR; cmd_queue_cur_state = TAP_TLR;
jtag_call_event_callbacks(JTAG_TRST_ASSERTED); jtag_call_event_callbacks(JTAG_TRST_ASSERTED);
} }
else
{
/* the nTRST line got deasserted, so we're still in Test-Logic-Reset,
* but we might want to add a delay to give the TAP time to settle
*/
if (jtag_ntrst_delay)
jtag_add_sleep(jtag_ntrst_delay);
}
} }
return ERROR_OK; return ERROR_OK;
@ -1121,6 +1147,10 @@ int jtag_register_commands(struct command_context_s *cmd_ctx)
COMMAND_CONFIG, NULL); COMMAND_CONFIG, NULL);
register_command(cmd_ctx, NULL, "reset_config", handle_reset_config_command, register_command(cmd_ctx, NULL, "reset_config", handle_reset_config_command,
COMMAND_CONFIG, NULL); COMMAND_CONFIG, NULL);
register_command(cmd_ctx, NULL, "nsrst_delay", handle_jtag_nsrst_delay_command,
COMMAND_CONFIG, NULL);
register_command(cmd_ctx, NULL, "ntrst_delay", handle_jtag_ntrst_delay_command,
COMMAND_CONFIG, NULL);
register_command(cmd_ctx, NULL, "scan_chain", handle_scan_chain_command, register_command(cmd_ctx, NULL, "scan_chain", handle_scan_chain_command,
COMMAND_EXEC, "print current scan chain configuration"); COMMAND_EXEC, "print current scan chain configuration");
@ -1341,6 +1371,36 @@ int handle_reset_config_command(struct command_context_s *cmd_ctx, char *cmd, ch
return ERROR_OK; return ERROR_OK;
} }
int handle_jtag_nsrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc < 1)
{
ERROR("nsrst_delay <ms> command takes one required argument");
exit(-1);
}
else
{
jtag_nsrst_delay = strtoul(args[0], NULL, 0);
}
return ERROR_OK;
}
int handle_jtag_ntrst_delay_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{
if (argc < 1)
{
ERROR("ntrst_delay <ms> command takes one required argument");
exit(-1);
}
else
{
jtag_ntrst_delay = strtoul(args[0], NULL, 0);
}
return ERROR_OK;
}
int handle_jtag_speed_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) int handle_jtag_speed_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{ {
if (argc == 0) if (argc == 0)

View File

@ -199,6 +199,9 @@ enum jtag_event
JTAG_TRST_RELEASED, JTAG_TRST_RELEASED,
}; };
extern int jtag_trst;
extern int jtag_srst;
typedef struct jtag_event_callback_s typedef struct jtag_event_callback_s
{ {
int (*callback)(enum jtag_event event, void *priv); int (*callback)(enum jtag_event event, void *priv);

View File

@ -310,6 +310,8 @@ int parport_init(void)
return ERROR_JTAG_INIT_FAILED; return ERROR_JTAG_INIT_FAILED;
} }
DEBUG("opening /dev/parport%d...", parport_port);
snprintf(buffer, 256, "/dev/parport%d", parport_port); snprintf(buffer, 256, "/dev/parport%d", parport_port);
device_handle = open(buffer, O_WRONLY); device_handle = open(buffer, O_WRONLY);
@ -319,6 +321,8 @@ int parport_init(void)
return ERROR_JTAG_INIT_FAILED; return ERROR_JTAG_INIT_FAILED;
} }
DEBUG("...open");
i=ioctl(device_handle, PPCLAIM); i=ioctl(device_handle, PPCLAIM);
if (i<0) if (i<0)
{ {
@ -351,6 +355,7 @@ int parport_init(void)
dataport = parport_port; dataport = parport_port;
statusport = parport_port + 1; statusport = parport_port + 1;
DEBUG("requesting privileges for parallel port 0x%x...", dataport);
#if PARPORT_USE_GIVEIO == 1 #if PARPORT_USE_GIVEIO == 1
if (parport_get_giveio_access() != 0) if (parport_get_giveio_access() != 0)
#else /* PARPORT_USE_GIVEIO */ #else /* PARPORT_USE_GIVEIO */
@ -360,6 +365,7 @@ int parport_init(void)
ERROR("missing privileges for direct i/o"); ERROR("missing privileges for direct i/o");
return ERROR_JTAG_INIT_FAILED; return ERROR_JTAG_INIT_FAILED;
} }
DEBUG("...privileges granted");
#endif /* PARPORT_USE_PPDEV */ #endif /* PARPORT_USE_PPDEV */
parport_reset(0, 0); parport_reset(0, 0);

View File

@ -18,7 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#define OPENOCD_VERSION "Open On-Chip Debugger (2006-07-15 12:00 CEST)" #define OPENOCD_VERSION "Open On-Chip Debugger (2006-07-30 13:30 CEST)"
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"

View File

@ -304,7 +304,8 @@ int arm7_9_remove_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
arm7_9_unset_breakpoint(target, breakpoint); arm7_9_unset_breakpoint(target, breakpoint);
} }
arm7_9->wp_available++; if (breakpoint->type == BKPT_HARD)
arm7_9->wp_available++;
return ERROR_OK; return ERROR_OK;
} }
@ -456,11 +457,12 @@ int arm7_9_enable_sw_bkpts(struct target_s *target)
if (arm7_9->sw_bkpts_enabled) if (arm7_9->sw_bkpts_enabled)
return ERROR_OK; return ERROR_OK;
if (arm7_9->wp_available-- < 1) if (arm7_9->wp_available < 1)
{ {
WARNING("can't enable sw breakpoints with no watchpoint unit available"); WARNING("can't enable sw breakpoints with no watchpoint unit available");
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
} }
arm7_9->wp_available--;
if (!arm7_9->wp0_used) if (!arm7_9->wp0_used)
{ {
@ -785,6 +787,12 @@ int arm7_9_halt(target_t *target)
WARNING("target was in unknown state when halt was requested"); WARNING("target was in unknown state when halt was requested");
} }
if ((target->state == TARGET_RESET) && (jtag_reset_config & RESET_SRST_PULLS_TRST) && (jtag_srst))
{
ERROR("can't request a halt while in reset if nSRST pulls nTRST");
return ERROR_TARGET_FAILURE;
}
if (arm7_9->use_dbgrq) if (arm7_9->use_dbgrq)
{ {
/* program EmbeddedICE Debug Control Register to assert DBGRQ /* program EmbeddedICE Debug Control Register to assert DBGRQ