Duane Ellis: "target as an [tcl] object" feature.

git-svn-id: svn://svn.berlios.de/openocd/trunk@975 b42882b7-edfa-0310-969c-e2dbd0fdcd60
This commit is contained in:
oharboe 2008-09-01 07:20:21 +00:00
parent 3c8ef2c41b
commit ef1cfb2394
42 changed files with 1544 additions and 524 deletions

View File

@ -210,7 +210,7 @@ command_t* register_command(command_context_t *context, command_t *parent, char
/* we now need to add an overrideable proc */ /* we now need to add an overrideable proc */
const char *override_name=alloc_printf("proc %s%s%s {args} {if {[catch {eval \"ocd_%s%s%s $args\"}]==0} {return \"\"} else { return -code error }", t1, t2, t3, t1, t2, t3); const char *override_name=alloc_printf("proc %s%s%s {args} {if {[catch {eval \"ocd_%s%s%s $args\"}]==0} {return \"\"} else { return -code error }", t1, t2, t3, t1, t2, t3);
Jim_Eval(interp, override_name); Jim_Eval_Named(interp, override_name, __FILE__, __LINE__ );
free((void *)override_name); free((void *)override_name);
/* accumulate help text in Tcl helptext list. */ /* accumulate help text in Tcl helptext list. */
@ -430,7 +430,7 @@ int command_run_line(command_context_t *context, char *line)
retcode = Jim_SetAssocData(interp, "retval", NULL, &retval); retcode = Jim_SetAssocData(interp, "retval", NULL, &retval);
if (retcode == JIM_OK) if (retcode == JIM_OK)
{ {
retcode = Jim_Eval(interp, line); retcode = Jim_Eval_Named(interp, line, __FILE__, __LINE__ );
Jim_DeleteAssocData(interp, "retval"); Jim_DeleteAssocData(interp, "retval");
} }
@ -658,7 +658,7 @@ command_context_t* command_init()
#ifdef JIM_EMBEDDED #ifdef JIM_EMBEDDED
Jim_EventLoopOnLoad(interp); Jim_EventLoopOnLoad(interp);
#endif #endif
if (Jim_Eval(interp, startup_tcl)==JIM_ERR) if (Jim_Eval_Named(interp, startup_tcl, "embedded:startup.tcl",1)==JIM_ERR)
{ {
LOG_ERROR("Failed to run startup.tcl (embedded into OpenOCD compile time)"); LOG_ERROR("Failed to run startup.tcl (embedded into OpenOCD compile time)");
Jim_PrintErrorMessage(interp); Jim_PrintErrorMessage(interp);

View File

@ -111,6 +111,33 @@ static Jim_HashTableType JimVariablesHashTableType;
* Utility functions * Utility functions
* ---------------------------------------------------------------------------*/ * ---------------------------------------------------------------------------*/
static char *
jim_vasprintf( const char *fmt, va_list ap )
{
#ifndef HAVE_VASPRINTF
/* yucky way */
static char buf[2048];
vsnprintf( buf, sizeof(buf), fmt, ap );
/* garentee termination */
buf[sizeof(buf)-1] = 0;
#else
char *buf;
vasprintf( &buf, fmt, ap );
#endif
return buf;
}
static void
jim_vasprintf_done( void *buf )
{
#ifndef HAVE_VASPRINTF
(void)(buf);
#else
free(buf);
#endif
}
/* /*
* Convert a string to a jim_wide INTEGER. * Convert a string to a jim_wide INTEGER.
* This function originates from BSD. * This function originates from BSD.
@ -2019,6 +2046,22 @@ void Jim_AppendString(Jim_Interp *interp, Jim_Obj *objPtr, const char *str,
StringAppendString(objPtr, str, len); StringAppendString(objPtr, str, len);
} }
void Jim_AppendString_sprintf( Jim_Interp *interp, Jim_Obj *objPtr, const char *fmt, ... )
{
char *buf;
va_list ap;
va_start( ap, fmt );
buf = jim_vasprintf( fmt, ap );
va_end(ap);
if( buf ){
Jim_AppendString( interp, objPtr, buf, -1 );
jim_vasprintf_done(buf);
}
}
void Jim_AppendObj(Jim_Interp *interp, Jim_Obj *objPtr, void Jim_AppendObj(Jim_Interp *interp, Jim_Obj *objPtr,
Jim_Obj *appendObjPtr) Jim_Obj *appendObjPtr)
{ {
@ -8726,17 +8769,31 @@ int JimCallProcedure(Jim_Interp *interp, Jim_Cmd *cmd, int argc,
return retcode; return retcode;
} }
int Jim_Eval(Jim_Interp *interp, const char *script) int Jim_Eval_Named(Jim_Interp *interp, const char *script, const char *filename, int lineno)
{ {
Jim_Obj *scriptObjPtr = Jim_NewStringObj(interp, script, -1);
int retval; int retval;
Jim_Obj *scriptObjPtr;
scriptObjPtr = Jim_NewStringObj(interp, script, -1);
Jim_IncrRefCount(scriptObjPtr); Jim_IncrRefCount(scriptObjPtr);
if( filename ){
JimSetSourceInfo( interp, scriptObjPtr, filename, lineno );
}
retval = Jim_EvalObj(interp, scriptObjPtr); retval = Jim_EvalObj(interp, scriptObjPtr);
Jim_DecrRefCount(interp, scriptObjPtr); Jim_DecrRefCount(interp, scriptObjPtr);
return retval; return retval;
} }
int Jim_Eval(Jim_Interp *interp, const char *script)
{
return Jim_Eval_Named( interp, script, NULL, 0 );
}
/* Execute script in the scope of the global level */ /* Execute script in the scope of the global level */
int Jim_EvalGlobal(Jim_Interp *interp, const char *script) int Jim_EvalGlobal(Jim_Interp *interp, const char *script)
{ {
@ -9076,6 +9133,7 @@ void JimRegisterCoreApi(Jim_Interp *interp)
JIM_REGISTER_API(Alloc); JIM_REGISTER_API(Alloc);
JIM_REGISTER_API(Free); JIM_REGISTER_API(Free);
JIM_REGISTER_API(Eval); JIM_REGISTER_API(Eval);
JIM_REGISTER_API(Eval_Named);
JIM_REGISTER_API(EvalGlobal); JIM_REGISTER_API(EvalGlobal);
JIM_REGISTER_API(EvalFile); JIM_REGISTER_API(EvalFile);
JIM_REGISTER_API(EvalObj); JIM_REGISTER_API(EvalObj);
@ -9102,6 +9160,7 @@ void JimRegisterCoreApi(Jim_Interp *interp)
JIM_REGISTER_API(NewStringObj); JIM_REGISTER_API(NewStringObj);
JIM_REGISTER_API(NewStringObjNoAlloc); JIM_REGISTER_API(NewStringObjNoAlloc);
JIM_REGISTER_API(AppendString); JIM_REGISTER_API(AppendString);
JIM_REGISTER_API(AppendString_sprintf);
JIM_REGISTER_API(AppendObj); JIM_REGISTER_API(AppendObj);
JIM_REGISTER_API(AppendStrings); JIM_REGISTER_API(AppendStrings);
JIM_REGISTER_API(StringEqObj); JIM_REGISTER_API(StringEqObj);
@ -12536,27 +12595,15 @@ int
Jim_SetResult_sprintf( Jim_Interp *interp, const char *fmt,... ) Jim_SetResult_sprintf( Jim_Interp *interp, const char *fmt,... )
{ {
va_list ap; va_list ap;
#ifndef HAVE_VASPRINTF
/* yucky way */
char buf[2048];
va_start(ap,fmt);
vsnprintf( buf, sizeof(buf), fmt, ap );
va_end(ap);
/* garentee termination */
buf[2047] = 0;
Jim_SetResultString( interp, buf, -1 );
#else
char *buf; char *buf;
va_start(ap,fmt); va_start(ap,fmt);
vasprintf( &buf, fmt, ap ); buf = jim_vasprintf( fmt, ap );
va_end(ap); va_end(ap);
if( buf ){ if( buf ){
Jim_SetResultString( interp, buf, -1 ); Jim_SetResultString( interp, buf, -1 );
free(buf); jim_vasprintf_done(buf);
} }
#endif
return JIM_OK; return JIM_OK;
} }

View File

@ -675,6 +675,9 @@ JIM_STATIC char * JIM_API(Jim_StrDup) (const char *s);
/* evaluation */ /* evaluation */
JIM_STATIC int JIM_API(Jim_Eval)(Jim_Interp *interp, const char *script); JIM_STATIC int JIM_API(Jim_Eval)(Jim_Interp *interp, const char *script);
/* in C code, you can do this and get better error messages */
/* Jim_Eval_Named( interp, "some tcl commands", __FILE__, __LINE__ ); */
JIM_STATIC int JIM_API(Jim_Eval_Named)(Jim_Interp *interp, const char *script,const char *filename, int lineno);
JIM_STATIC int JIM_API(Jim_EvalGlobal)(Jim_Interp *interp, const char *script); JIM_STATIC int JIM_API(Jim_EvalGlobal)(Jim_Interp *interp, const char *script);
JIM_STATIC int JIM_API(Jim_EvalFile)(Jim_Interp *interp, const char *filename); JIM_STATIC int JIM_API(Jim_EvalFile)(Jim_Interp *interp, const char *filename);
JIM_STATIC int JIM_API(Jim_EvalObj) (Jim_Interp *interp, Jim_Obj *scriptObjPtr); JIM_STATIC int JIM_API(Jim_EvalObj) (Jim_Interp *interp, Jim_Obj *scriptObjPtr);
@ -733,6 +736,8 @@ JIM_STATIC Jim_Obj * JIM_API(Jim_NewStringObjNoAlloc) (Jim_Interp *interp,
char *s, int len); char *s, int len);
JIM_STATIC void JIM_API(Jim_AppendString) (Jim_Interp *interp, Jim_Obj *objPtr, JIM_STATIC void JIM_API(Jim_AppendString) (Jim_Interp *interp, Jim_Obj *objPtr,
const char *str, int len); const char *str, int len);
JIM_STATIC void JIM_API(Jim_AppendString_sprintf) (Jim_Interp *interp, Jim_Obj *objPtr,
const char *fmt, ... );
JIM_STATIC void JIM_API(Jim_AppendObj) (Jim_Interp *interp, Jim_Obj *objPtr, JIM_STATIC void JIM_API(Jim_AppendObj) (Jim_Interp *interp, Jim_Obj *objPtr,
Jim_Obj *appendObjPtr); Jim_Obj *appendObjPtr);
JIM_STATIC void JIM_API(Jim_AppendStrings) (Jim_Interp *interp, JIM_STATIC void JIM_API(Jim_AppendStrings) (Jim_Interp *interp,
@ -1169,6 +1174,7 @@ static void Jim_InitExtension(Jim_Interp *interp)
JIM_GET_API(Alloc); JIM_GET_API(Alloc);
JIM_GET_API(Free); JIM_GET_API(Free);
JIM_GET_API(Eval); JIM_GET_API(Eval);
JIM_GET_API(Eval_Named);
JIM_GET_API(EvalGlobal); JIM_GET_API(EvalGlobal);
JIM_GET_API(EvalFile); JIM_GET_API(EvalFile);
JIM_GET_API(EvalObj); JIM_GET_API(EvalObj);
@ -1195,6 +1201,7 @@ static void Jim_InitExtension(Jim_Interp *interp)
JIM_GET_API(NewStringObj); JIM_GET_API(NewStringObj);
JIM_GET_API(NewStringObjNoAlloc); JIM_GET_API(NewStringObjNoAlloc);
JIM_GET_API(AppendString); JIM_GET_API(AppendString);
JIM_GET_API(AppendString_sprintf);
JIM_GET_API(AppendObj); JIM_GET_API(AppendObj);
JIM_GET_API(AppendStrings); JIM_GET_API(AppendStrings);
JIM_GET_API(StringEqObj); JIM_GET_API(StringEqObj);

View File

@ -109,18 +109,40 @@ proc unknown {args} {
return -code error "Unknown command: $args" return -code error "Unknown command: $args"
} }
proc new_target_name { } {
proc target_script {target_num eventname scriptname} { return [target number [expr [target count] - 1 ]]
if {[string compare $eventname reset]==0} {
set eventname post_reset
}
# This is the script we invoke
proc "target_[set target_num]_[set eventname]" {} "script $scriptname"
} }
add_help_text target_script "<target#> <event=reset/pre_reset/post_halt/pre_resume/gdb_program_config> <script_file>"
proc target_script {target_num eventname scriptname} {
set tname [target number $target_num]
if { 0 == [string compare $eventname "reset"] } {
$tname configure -event old-post_reset "script $scriptname"
return
}
if { 0 == [string compare $eventname "post_reset"] } {
$tname configure -event old-post_reset "script $scriptname"
return
}
if { 0 == [string compare $eventname "pre_reset"] } {
$tname configure -event old-pre_reset "script $scriptname"
return
}
if { 0 == [string compare $eventname "gdb_program_config"] } {
$tname configure -event old-gdb_program_config "script $scriptname"
return
}
return -code error "Unknown target (old) event: $eventname (try $tname configure -event NAME)"
}
add_help_text target_script "DEPRECATED please see the new TARGETNAME configure -event interface"
# Try flipping / and \ to find file if the filename does not # Try flipping / and \ to find file if the filename does not
@ -170,4 +192,4 @@ proc jtag_rclk {fallback_speed_khz} {
} }
} }
add_help_text jtag_rclk "fallback_speed_khz - set JTAG speed to RCLK or use fallback speed" add_help_text jtag_rclk "fallback_speed_khz - set JTAG speed to RCLK or use fallback speed"

View File

@ -614,15 +614,6 @@ int gdb_output(struct command_context_s *context, const char* line)
return ERROR_OK; return ERROR_OK;
} }
int gdb_program_handler(struct target_s *target, enum target_event event, void *priv)
{
struct command_context_s *cmd_ctx = priv;
target_invoke_script(cmd_ctx, target, "gdb_program");
jtag_execute_queue();
return ERROR_OK;
}
static void gdb_frontend_halted(struct target_s *target, connection_t *connection) static void gdb_frontend_halted(struct target_s *target, connection_t *connection)
{ {
@ -664,13 +655,15 @@ int gdb_target_callback_event_handler(struct target_s *target, enum target_event
{ {
connection_t *connection = priv; connection_t *connection = priv;
target_handle_event( target, event );
switch (event) switch (event)
{ {
case TARGET_EVENT_HALTED: case TARGET_EVENT_HALTED:
gdb_frontend_halted(target, connection); gdb_frontend_halted(target, connection);
break; break;
case TARGET_EVENT_GDB_FLASH_ERASE_START: case TARGET_EVENT_GDB_FLASH_ERASE_START:
gdb_program_handler(target, event, connection->cmd_ctx); target_handle_event( target, TARGET_EVENT_OLD_gdb_program_config );
jtag_execute_queue();
break; break;
default: default:
break; break;
@ -748,7 +741,7 @@ int gdb_new_connection(connection_t *connection)
*/ */
if (initial_ack != '+') if (initial_ack != '+')
gdb_putback_char(connection, initial_ack); gdb_putback_char(connection, initial_ack);
target_call_event_callbacks(gdb_service->target, TARGET_EVENT_GDB_ATTACH );
return ERROR_OK; return ERROR_OK;
} }
@ -781,6 +774,7 @@ int gdb_connection_closed(connection_t *connection)
target_unregister_event_callback(gdb_target_callback_event_handler, connection); target_unregister_event_callback(gdb_target_callback_event_handler, connection);
log_remove_callback(gdb_log_callback, connection); log_remove_callback(gdb_log_callback, connection);
target_call_event_callbacks(gdb_service->target, TARGET_EVENT_GDB_DETACH );
return ERROR_OK; return ERROR_OK;
} }
@ -1279,7 +1273,7 @@ int gdb_step_continue_packet(connection_t *connection, target_t *target, char *p
if (packet[0] == 'c') if (packet[0] == 'c')
{ {
LOG_DEBUG("continue"); LOG_DEBUG("continue");
target_invoke_script(connection->cmd_ctx, target, "pre_resume"); target_handle_event( target, TARGET_EVENT_OLD_pre_resume );
retval=target_resume(target, current, address, 0, 0); /* resume at current address, don't handle breakpoints, not debugging */ retval=target_resume(target, current, address, 0, 0); /* resume at current address, don't handle breakpoints, not debugging */
} }
else if (packet[0] == 's') else if (packet[0] == 's')
@ -1790,9 +1784,11 @@ int gdb_v_packet(connection_t *connection, target_t *target, char *packet, int p
/* perform any target specific operations before the erase */ /* perform any target specific operations before the erase */
target_call_event_callbacks(gdb_service->target, TARGET_EVENT_GDB_FLASH_ERASE_START); target_call_event_callbacks(gdb_service->target, TARGET_EVENT_GDB_FLASH_ERASE_START);
result = flash_erase_address_range(gdb_service->target, addr, length );
target_call_event_callbacks(gdb_service->target, TARGET_EVENT_GDB_FLASH_ERASE_END);
/* perform erase */ /* perform erase */
if ((result = flash_erase_address_range(gdb_service->target, addr, length)) != ERROR_OK) if (result != ERROR_OK)
{ {
/* GDB doesn't evaluate the actual error number returned, /* GDB doesn't evaluate the actual error number returned,
* treat a failed erase as an I/O error * treat a failed erase as an I/O error
@ -1846,7 +1842,10 @@ int gdb_v_packet(connection_t *connection, target_t *target, char *packet, int p
/* process the flashing buffer. No need to erase as GDB /* process the flashing buffer. No need to erase as GDB
* always issues a vFlashErase first. */ * always issues a vFlashErase first. */
if ((result = flash_write(gdb_service->target, gdb_connection->vflash_image, &written, 0)) != ERROR_OK) target_call_event_callbacks(gdb_service->target, TARGET_EVENT_GDB_FLASH_WRITE_START);
result = flash_write(gdb_service->target, gdb_connection->vflash_image, &written, 0);
target_call_event_callbacks(gdb_service->target, TARGET_EVENT_GDB_FLASH_WRITE_END);
if ( result != ERROR_OK)
{ {
if (result == ERROR_FLASH_DST_OUT_OF_BANK) if (result == ERROR_FLASH_DST_OUT_OF_BANK)
gdb_put_packet(connection, "E.memtype", 9); gdb_put_packet(connection, "E.memtype", 9);
@ -1872,10 +1871,11 @@ int gdb_v_packet(connection_t *connection, target_t *target, char *packet, int p
int gdb_detach(connection_t *connection, target_t *target) int gdb_detach(connection_t *connection, target_t *target)
{ {
switch( detach_mode ) switch( detach_mode )
{ {
case GDB_DETACH_RESUME: case GDB_DETACH_RESUME:
target_invoke_script(connection->cmd_ctx, target, "pre_resume"); target_handle_event( target, TARGET_EVENT_OLD_pre_resume );
target_resume(target, 1, 0, 1, 0); target_resume(target, 1, 0, 1, 0);
break; break;
@ -1893,7 +1893,6 @@ int gdb_detach(connection_t *connection, target_t *target)
} }
gdb_put_packet(connection, "OK", 2); gdb_put_packet(connection, "OK", 2);
return ERROR_OK; return ERROR_OK;
} }
@ -2279,3 +2278,12 @@ int gdb_register_commands(command_context_t *command_context)
"is not sufficient"); "is not sufficient");
return ERROR_OK; return ERROR_OK;
} }
/*
* Local Variables: ***
* c-basic-offset: 4 ***
* tab-width: 4 ***
* End: ***
*/

View File

@ -143,7 +143,7 @@ static int tcl_input(connection_t *connection)
} }
else { else {
tclc->tc_line[tclc->tc_lineoffset-1] = '\0'; tclc->tc_line[tclc->tc_lineoffset-1] = '\0';
retval = Jim_Eval(interp, tclc->tc_line); retval = Jim_Eval_Named(interp, tclc->tc_line, "remote:connection",1);
result = Jim_GetString(Jim_GetResult(interp), &reslen); result = Jim_GetString(Jim_GetResult(interp), &reslen);
retval = tcl_output(connection, result, reslen); retval = tcl_output(connection, result, reslen);
if (retval != ERROR_OK) if (retval != ERROR_OK)

View File

@ -92,7 +92,7 @@ target_type_t arm11_target =
ARM11_HANDLER(run_algorithm), ARM11_HANDLER(run_algorithm),
ARM11_HANDLER(register_commands), ARM11_HANDLER(register_commands),
ARM11_HANDLER(target_command), ARM11_HANDLER(target_create),
ARM11_HANDLER(init_target), ARM11_HANDLER(init_target),
ARM11_HANDLER(examine), ARM11_HANDLER(examine),
ARM11_HANDLER(quit), ARM11_HANDLER(quit),
@ -1351,28 +1351,21 @@ int arm11_run_algorithm(struct target_s *target, int num_mem_params, mem_param_t
return ERROR_OK; return ERROR_OK;
} }
int arm11_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target) int arm11_target_create(struct target_s *target, Jim_Interp *interp)
{ {
FNC_INFO; FNC_INFO;
if (argc < 4)
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
int chain_pos = strtoul(args[3], NULL, 0);
NEW(arm11_common_t, arm11, 1); NEW(arm11_common_t, arm11, 1);
arm11->target = target; arm11->target = target;
/* prepare JTAG information for the new target */ /* prepare JTAG information for the new target */
arm11->jtag_info.chain_pos = chain_pos; arm11->jtag_info.chain_pos = target->chain_position;
arm11->jtag_info.scann_size = 5; arm11->jtag_info.scann_size = 5;
arm_jtag_setup_connection(&arm11->jtag_info); arm_jtag_setup_connection(&arm11->jtag_info);
jtag_device_t *device = jtag_get_device(chain_pos); jtag_device_t *device = jtag_get_device(target->chain_position);
if (device->ir_length != 5) if (device->ir_length != 5)
{ {
@ -1810,3 +1803,11 @@ int arm11_register_commands(struct command_context_s *cmd_ctx)
return ERROR_OK; return ERROR_OK;
} }
/*
* Local Variables: ***
* c-basic-offset: 4 ***
* tab-width: 4 ***
* End: ***
*/

View File

@ -222,7 +222,7 @@ int arm11_remove_watchpoint(struct target_s *target, watchpoint_t *watchpoint);
int arm11_run_algorithm(struct target_s *target, int num_mem_params, mem_param_t *mem_params, int num_reg_params, reg_param_t *reg_param, u32 entry_point, u32 exit_point, int timeout_ms, void *arch_info); int arm11_run_algorithm(struct target_s *target, int num_mem_params, mem_param_t *mem_params, int num_reg_params, reg_param_t *reg_param, u32 entry_point, u32 exit_point, int timeout_ms, void *arch_info);
int arm11_register_commands(struct command_context_s *cmd_ctx); int arm11_register_commands(struct command_context_s *cmd_ctx);
int arm11_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); int arm11_target_create(struct target_s *target, Jim_Interp *interp);
int arm11_init_target(struct command_context_s *cmd_ctx, struct target_s *target); int arm11_init_target(struct command_context_s *cmd_ctx, struct target_s *target);
int arm11_quit(void); int arm11_quit(void);

View File

@ -42,7 +42,7 @@ int arm720t_handle_md_phys_command(struct command_context_s *cmd_ctx, char *cmd,
int arm720t_handle_mw_phys_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int arm720t_handle_mw_phys_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
/* forward declarations */ /* forward declarations */
int arm720t_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); int arm720t_target_create(struct target_s *target,Jim_Interp *interp);
int arm720t_init_target(struct command_context_s *cmd_ctx, struct target_s *target); int arm720t_init_target(struct command_context_s *cmd_ctx, struct target_s *target);
int arm720t_quit(void); int arm720t_quit(void);
int arm720t_arch_state(struct target_s *target); int arm720t_arch_state(struct target_s *target);
@ -81,7 +81,7 @@ target_type_t arm720t_target =
.remove_watchpoint = arm7_9_remove_watchpoint, .remove_watchpoint = arm7_9_remove_watchpoint,
.register_commands = arm720t_register_commands, .register_commands = arm720t_register_commands,
.target_command = arm720t_target_command, .target_create = arm720t_target_create,
.init_target = arm720t_init_target, .init_target = arm720t_init_target,
.examine = arm7tdmi_examine, .examine = arm7tdmi_examine,
.quit = arm720t_quit .quit = arm720t_quit
@ -436,7 +436,7 @@ int arm720t_quit(void)
return ERROR_OK; return ERROR_OK;
} }
int arm720t_init_arch_info(target_t *target, arm720t_common_t *arm720t, int chain_pos, char *variant) int arm720t_init_arch_info(target_t *target, arm720t_common_t *arm720t, int chain_pos, const char *variant)
{ {
arm7tdmi_common_t *arm7tdmi = &arm720t->arm7tdmi_common; arm7tdmi_common_t *arm7tdmi = &arm720t->arm7tdmi_common;
arm7_9_common_t *arm7_9 = &arm7tdmi->arm7_9_common; arm7_9_common_t *arm7_9 = &arm7tdmi->arm7_9_common;
@ -461,27 +461,11 @@ int arm720t_init_arch_info(target_t *target, arm720t_common_t *arm720t, int chai
return ERROR_OK; return ERROR_OK;
} }
int arm720t_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target) int arm720t_target_create(struct target_s *target, Jim_Interp *interp)
{ {
int chain_pos; arm720t_common_t *arm720t = calloc(1,sizeof(arm720t_common_t));
char *variant = NULL;
arm720t_common_t *arm720t = malloc(sizeof(arm720t_common_t));
memset(arm720t, 0, sizeof(*arm720t));
if (argc < 4) arm720t_init_arch_info(target, arm720t, target->chain_position, target->variant);
{
LOG_ERROR("'target arm720t' requires at least one additional argument");
exit(-1);
}
chain_pos = strtoul(args[3], NULL, 0);
if (argc >= 5)
variant = args[4];
LOG_DEBUG("chain_pos: %i, variant: %s", chain_pos, variant);
arm720t_init_arch_info(target, arm720t, chain_pos, variant);
return ERROR_OK; return ERROR_OK;
} }
@ -644,3 +628,10 @@ int arm720t_handle_mw_phys_command(command_context_t *cmd_ctx, char *cmd, char *
return armv4_5_mmu_handle_mw_phys_command(cmd_ctx, cmd, args, argc, target, &arm720t->armv4_5_mmu); return armv4_5_mmu_handle_mw_phys_command(cmd_ctx, cmd, args, argc, target, &arm720t->armv4_5_mmu);
} }
/*
* Local Variables: ***
* c-basic-offset: 4 ***
* tab-width: 4 ***
* End: ***
*/

View File

@ -44,8 +44,8 @@
int arm7tdmi_register_commands(struct command_context_s *cmd_ctx); int arm7tdmi_register_commands(struct command_context_s *cmd_ctx);
/* forward declarations */ /* forward declarations */
int arm7tdmi_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target);
int arm7tdmi_target_create(Jim_Interp *interp, struct target_s *target); int arm7tdmi_target_create(struct target_s *target,Jim_Interp *interp);
int arm7tdmi_init_target(struct command_context_s *cmd_ctx, struct target_s *target); int arm7tdmi_init_target(struct command_context_s *cmd_ctx, struct target_s *target);
int arm7tdmi_quit(void); int arm7tdmi_quit(void);
@ -85,9 +85,8 @@ target_type_t arm7tdmi_target =
.add_watchpoint = arm7_9_add_watchpoint, .add_watchpoint = arm7_9_add_watchpoint,
.remove_watchpoint = arm7_9_remove_watchpoint, .remove_watchpoint = arm7_9_remove_watchpoint,
.register_commands = arm7tdmi_register_commands, .register_commands = arm7tdmi_register_commands,
.target_command = arm7tdmi_target_command, .target_create = arm7tdmi_target_create,
// .target_create = arm7tdmi_target_create,
.init_target = arm7tdmi_init_target, .init_target = arm7tdmi_init_target,
.examine = arm7tdmi_examine, .examine = arm7tdmi_examine,
.quit = arm7tdmi_quit .quit = arm7tdmi_quit
@ -829,32 +828,9 @@ int arm7tdmi_init_arch_info(target_t *target, arm7tdmi_common_t *arm7tdmi, int c
return ERROR_OK; return ERROR_OK;
} }
/* target arm7tdmi <endianess> <startup_mode> <chain_pos> <variant> */
int arm7tdmi_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target)
{
int chain_pos;
char *variant = NULL;
arm7tdmi_common_t *arm7tdmi = malloc(sizeof(arm7tdmi_common_t));
memset(arm7tdmi, 0, sizeof(*arm7tdmi));
if (argc < 4)
{
LOG_ERROR("'target arm7tdmi' requires at least one additional argument");
exit(-1);
}
chain_pos = strtoul(args[3], NULL, 0);
if (argc >= 5)
variant = args[4];
arm7tdmi_init_arch_info(target, arm7tdmi, chain_pos, variant);
return ERROR_OK;
}
int arm7tdmi_target_create(Jim_Interp *interp, int arm7tdmi_target_create( struct target_s *target, Jim_Interp *interp )
struct target_s *target)
{ {
arm7tdmi_common_t *arm7tdmi; arm7tdmi_common_t *arm7tdmi;
@ -866,7 +842,6 @@ int arm7tdmi_target_create(Jim_Interp *interp,
} }
int arm7tdmi_register_commands(struct command_context_s *cmd_ctx) int arm7tdmi_register_commands(struct command_context_s *cmd_ctx)
{ {
int retval; int retval;
@ -878,6 +853,8 @@ int arm7tdmi_register_commands(struct command_context_s *cmd_ctx)
} }
/* /*
* Local Variables: *** * Local Variables: ***
* c-basic-offset: 4 *** * c-basic-offset: 4 ***

View File

@ -47,7 +47,7 @@ int arm920t_handle_read_cache_command(struct command_context_s *cmd_ctx, char *c
int arm920t_handle_read_mmu_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int arm920t_handle_read_mmu_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
/* forward declarations */ /* forward declarations */
int arm920t_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); int arm920t_target_create(struct target_s *target, Jim_Interp *interp);
int arm920t_init_target(struct command_context_s *cmd_ctx, struct target_s *target); int arm920t_init_target(struct command_context_s *cmd_ctx, struct target_s *target);
int arm920t_quit(void); int arm920t_quit(void);
int arm920t_arch_state(struct target_s *target); int arm920t_arch_state(struct target_s *target);
@ -90,7 +90,7 @@ target_type_t arm920t_target =
.remove_watchpoint = arm7_9_remove_watchpoint, .remove_watchpoint = arm7_9_remove_watchpoint,
.register_commands = arm920t_register_commands, .register_commands = arm920t_register_commands,
.target_command = arm920t_target_command, .target_create = arm920t_target_create,
.init_target = arm920t_init_target, .init_target = arm920t_init_target,
.examine = arm9tdmi_examine, .examine = arm9tdmi_examine,
.quit = arm920t_quit .quit = arm920t_quit
@ -699,7 +699,7 @@ int arm920t_quit(void)
return ERROR_OK; return ERROR_OK;
} }
int arm920t_init_arch_info(target_t *target, arm920t_common_t *arm920t, int chain_pos, char *variant) int arm920t_init_arch_info(target_t *target, arm920t_common_t *arm920t, int chain_pos, const char *variant)
{ {
arm9tdmi_common_t *arm9tdmi = &arm920t->arm9tdmi_common; arm9tdmi_common_t *arm9tdmi = &arm920t->arm9tdmi_common;
arm7_9_common_t *arm7_9 = &arm9tdmi->arm7_9_common; arm7_9_common_t *arm7_9 = &arm9tdmi->arm7_9_common;
@ -735,27 +735,11 @@ int arm920t_init_arch_info(target_t *target, arm920t_common_t *arm920t, int chai
return ERROR_OK; return ERROR_OK;
} }
int arm920t_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target) int arm920t_target_create(struct target_s *target, Jim_Interp *interp)
{ {
int chain_pos; arm920t_common_t *arm920t = calloc(1,sizeof(arm920t_common_t));
char *variant = NULL;
arm920t_common_t *arm920t = malloc(sizeof(arm920t_common_t));
memset(arm920t, 0, sizeof(*arm920t));
if (argc < 4) arm920t_init_arch_info(target, arm920t, target->chain_position, target->variant);
{
LOG_ERROR("'target arm920t' requires at least one additional argument");
exit(-1);
}
chain_pos = strtoul(args[3], NULL, 0);
if (argc >= 5)
variant = args[4];
LOG_DEBUG("chain_pos: %i, variant: %s", chain_pos, variant);
arm920t_init_arch_info(target, arm920t, chain_pos, variant);
return ERROR_OK; return ERROR_OK;
} }
@ -1516,3 +1500,12 @@ int arm920t_handle_mw_phys_command(command_context_t *cmd_ctx, char *cmd, char *
return armv4_5_mmu_handle_mw_phys_command(cmd_ctx, cmd, args, argc, target, &arm920t->armv4_5_mmu); return armv4_5_mmu_handle_mw_phys_command(cmd_ctx, cmd, args, argc, target, &arm920t->armv4_5_mmu);
} }
/*
* Local Variables: ***
* c-basic-offset: 4 ***
* tab-width: 4 ***
* End: ***
*/

View File

@ -47,7 +47,7 @@ int arm926ejs_handle_read_cache_command(struct command_context_s *cmd_ctx, char
int arm926ejs_handle_read_mmu_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int arm926ejs_handle_read_mmu_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
/* forward declarations */ /* forward declarations */
int arm926ejs_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); int arm926ejs_target_create(struct target_s *target, Jim_Interp *interp);
int arm926ejs_init_target(struct command_context_s *cmd_ctx, struct target_s *target); int arm926ejs_init_target(struct command_context_s *cmd_ctx, struct target_s *target);
int arm926ejs_quit(void); int arm926ejs_quit(void);
int arm926ejs_arch_state(struct target_s *target); int arm926ejs_arch_state(struct target_s *target);
@ -90,7 +90,7 @@ target_type_t arm926ejs_target =
.remove_watchpoint = arm7_9_remove_watchpoint, .remove_watchpoint = arm7_9_remove_watchpoint,
.register_commands = arm926ejs_register_commands, .register_commands = arm926ejs_register_commands,
.target_command = arm926ejs_target_command, .target_create = arm926ejs_target_create,
.init_target = arm926ejs_init_target, .init_target = arm926ejs_init_target,
.examine = arm9tdmi_examine, .examine = arm9tdmi_examine,
.quit = arm926ejs_quit, .quit = arm926ejs_quit,
@ -680,7 +680,7 @@ int arm926ejs_quit(void)
return ERROR_OK; return ERROR_OK;
} }
int arm926ejs_init_arch_info(target_t *target, arm926ejs_common_t *arm926ejs, int chain_pos, char *variant) int arm926ejs_init_arch_info(target_t *target, arm926ejs_common_t *arm926ejs, int chain_pos, const char *variant)
{ {
arm9tdmi_common_t *arm9tdmi = &arm926ejs->arm9tdmi_common; arm9tdmi_common_t *arm9tdmi = &arm926ejs->arm9tdmi_common;
arm7_9_common_t *arm7_9 = &arm9tdmi->arm7_9_common; arm7_9_common_t *arm7_9 = &arm9tdmi->arm7_9_common;
@ -717,27 +717,11 @@ int arm926ejs_init_arch_info(target_t *target, arm926ejs_common_t *arm926ejs, in
return ERROR_OK; return ERROR_OK;
} }
int arm926ejs_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target) int arm926ejs_target_create(struct target_s *target, Jim_Interp *interp)
{ {
int chain_pos; arm926ejs_common_t *arm926ejs = calloc(1,sizeof(arm926ejs_common_t));
char *variant = NULL;
arm926ejs_common_t *arm926ejs = malloc(sizeof(arm926ejs_common_t));
memset(arm926ejs, 0, sizeof(*arm926ejs));
if (argc < 4) arm926ejs_init_arch_info(target, arm926ejs, target->chain_position, target->variant);
{
LOG_ERROR("'target arm926ejs' requires at least one additional argument");
exit(-1);
}
chain_pos = strtoul(args[3], NULL, 0);
if (argc >= 5)
variant = args[4];
LOG_DEBUG("chain_pos: %i, variant: %s", chain_pos, variant);
arm926ejs_init_arch_info(target, arm926ejs, chain_pos, variant);
return ERROR_OK; return ERROR_OK;
} }
@ -963,3 +947,10 @@ static int arm926ejs_mmu(struct target_s *target, int *enabled)
*enabled = arm926ejs->armv4_5_mmu.mmu_enabled; *enabled = arm926ejs->armv4_5_mmu.mmu_enabled;
return ERROR_OK; return ERROR_OK;
} }
/*
* Local Variables: ***
* c-basic-offset: 4 ***
* tab-width: 4 ***
* End: ***
*/

View File

@ -43,7 +43,7 @@ typedef struct arm926ejs_common_s
u32 d_far; u32 d_far;
} arm926ejs_common_t; } arm926ejs_common_t;
extern int arm926ejs_init_arch_info(target_t *target, arm926ejs_common_t *arm926ejs, int chain_pos, char *variant); extern int arm926ejs_init_arch_info(target_t *target, arm926ejs_common_t *arm926ejs, int chain_pos, const char *variant);
extern int arm926ejs_register_commands(struct command_context_s *cmd_ctx); extern int arm926ejs_register_commands(struct command_context_s *cmd_ctx);
extern int arm926ejs_arch_state(struct target_s *target); extern int arm926ejs_arch_state(struct target_s *target);
extern int arm926ejs_write_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer); extern int arm926ejs_write_memory(struct target_s *target, u32 address, u32 size, u32 count, u8 *buffer);

View File

@ -43,7 +43,7 @@
int arm966e_register_commands(struct command_context_s *cmd_ctx); int arm966e_register_commands(struct command_context_s *cmd_ctx);
/* forward declarations */ /* forward declarations */
int arm966e_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); int arm966e_target_create(struct target_s *target, Jim_Interp *interp);
int arm966e_init_target(struct command_context_s *cmd_ctx, struct target_s *target); int arm966e_init_target(struct command_context_s *cmd_ctx, struct target_s *target);
int arm966e_quit(void); int arm966e_quit(void);
@ -80,7 +80,7 @@ target_type_t arm966e_target =
.remove_watchpoint = arm7_9_remove_watchpoint, .remove_watchpoint = arm7_9_remove_watchpoint,
.register_commands = arm966e_register_commands, .register_commands = arm966e_register_commands,
.target_command = arm966e_target_command, .target_create = arm966e_target_create,
.init_target = arm966e_init_target, .init_target = arm966e_init_target,
.examine = arm9tdmi_examine, .examine = arm9tdmi_examine,
.quit = arm966e_quit, .quit = arm966e_quit,
@ -99,7 +99,7 @@ int arm966e_quit(void)
return ERROR_OK; return ERROR_OK;
} }
int arm966e_init_arch_info(target_t *target, arm966e_common_t *arm966e, int chain_pos, char *variant) int arm966e_init_arch_info(target_t *target, arm966e_common_t *arm966e, int chain_pos, const char *variant)
{ {
arm9tdmi_common_t *arm9tdmi = &arm966e->arm9tdmi_common; arm9tdmi_common_t *arm9tdmi = &arm966e->arm9tdmi_common;
arm7_9_common_t *arm7_9 = &arm9tdmi->arm7_9_common; arm7_9_common_t *arm7_9 = &arm9tdmi->arm7_9_common;
@ -118,27 +118,11 @@ int arm966e_init_arch_info(target_t *target, arm966e_common_t *arm966e, int chai
return ERROR_OK; return ERROR_OK;
} }
int arm966e_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target) int arm966e_target_create( struct target_s *target, Jim_Interp *interp )
{ {
int chain_pos; arm966e_common_t *arm966e = calloc(1,sizeof(arm966e_common_t));
char *variant = NULL;
arm966e_common_t *arm966e = malloc(sizeof(arm966e_common_t));
memset(arm966e, 0, sizeof(*arm966e));
if (argc < 4) arm966e_init_arch_info(target, arm966e, target->chain_position, target->variant);
{
LOG_ERROR("'target arm966e' requires at least one additional argument");
exit(-1);
}
chain_pos = strtoul(args[3], NULL, 0);
if (argc >= 5)
variant = args[4];
LOG_DEBUG("chain_pos: %i, variant: %s", chain_pos, variant);
arm966e_init_arch_info(target, arm966e, chain_pos, variant);
return ERROR_OK; return ERROR_OK;
} }
@ -361,3 +345,10 @@ int arm966e_register_commands(struct command_context_s *cmd_ctx)
return ERROR_OK; return ERROR_OK;
} }
/*
* Local Variables: ***
* c-basic-offset: 4 ***
* tab-width: 4 ***
* End: ***
*/

View File

@ -46,7 +46,8 @@ int arm9tdmi_register_commands(struct command_context_s *cmd_ctx);
int handle_arm9tdmi_catch_vectors_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int handle_arm9tdmi_catch_vectors_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
/* forward declarations */ /* forward declarations */
int arm9tdmi_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); int arm9tdmi_target_create( struct target_s *target, Jim_Interp *interp );
int arm9tdmi_init_target(struct command_context_s *cmd_ctx, struct target_s *target); int arm9tdmi_init_target(struct command_context_s *cmd_ctx, struct target_s *target);
int arm9tdmi_quit(void); int arm9tdmi_quit(void);
@ -83,7 +84,7 @@ target_type_t arm9tdmi_target =
.remove_watchpoint = arm7_9_remove_watchpoint, .remove_watchpoint = arm7_9_remove_watchpoint,
.register_commands = arm9tdmi_register_commands, .register_commands = arm9tdmi_register_commands,
.target_command = arm9tdmi_target_command, .target_create = arm9tdmi_target_create,
.init_target = arm9tdmi_init_target, .init_target = arm9tdmi_init_target,
.examine = arm9tdmi_examine, .examine = arm9tdmi_examine,
.quit = arm9tdmi_quit .quit = arm9tdmi_quit
@ -902,7 +903,7 @@ int arm9tdmi_quit(void)
return ERROR_OK; return ERROR_OK;
} }
int arm9tdmi_init_arch_info(target_t *target, arm9tdmi_common_t *arm9tdmi, int chain_pos, char *variant) int arm9tdmi_init_arch_info(target_t *target, arm9tdmi_common_t *arm9tdmi, int chain_pos, const char *variant)
{ {
armv4_5_common_t *armv4_5; armv4_5_common_t *armv4_5;
arm7_9_common_t *arm7_9; arm7_9_common_t *arm7_9;
@ -1007,26 +1008,12 @@ int arm9tdmi_get_arch_pointers(target_t *target, armv4_5_common_t **armv4_5_p, a
} }
/* target arm9tdmi <endianess> <startup_mode> <chain_pos> <variant>*/
int arm9tdmi_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target)
{
int chain_pos;
char *variant = NULL;
arm9tdmi_common_t *arm9tdmi = malloc(sizeof(arm9tdmi_common_t));
memset(arm9tdmi, 0, sizeof(*arm9tdmi));
if (argc < 4) int arm9tdmi_target_create(struct target_s *target, Jim_Interp *interp)
{ {
LOG_ERROR("'target arm9tdmi' requires at least one additional argument"); arm9tdmi_common_t *arm9tdmi = calloc(1,sizeof(arm9tdmi_common_t));
exit(-1);
} arm9tdmi_init_arch_info(target, arm9tdmi, target->chain_position, target->variant);
chain_pos = strtoul(args[3], NULL, 0);
if (argc >= 5)
variant = args[4];
arm9tdmi_init_arch_info(target, arm9tdmi, chain_pos, variant);
return ERROR_OK; return ERROR_OK;
} }
@ -1129,3 +1116,12 @@ int handle_arm9tdmi_catch_vectors_command(struct command_context_s *cmd_ctx, cha
return ERROR_OK; return ERROR_OK;
} }
/*
* Local Variables: ***
* c-basic-offset: 4 ***
* tab-width: 4 ***
* End: ***
*/

View File

@ -57,7 +57,7 @@ enum arm9tdmi_vector
extern int arm9tdmi_init_target(struct command_context_s *cmd_ctx, struct target_s *target); extern int arm9tdmi_init_target(struct command_context_s *cmd_ctx, struct target_s *target);
int arm9tdmi_examine(struct target_s *target); int arm9tdmi_examine(struct target_s *target);
extern int arm9tdmi_init_arch_info(target_t *target, arm9tdmi_common_t *arm9tdmi, int chain_pos, char *variant); extern int arm9tdmi_init_arch_info(target_t *target, arm9tdmi_common_t *arm9tdmi, int chain_pos, const char *variant);
extern int arm9tdmi_register_commands(struct command_context_s *cmd_ctx); extern int arm9tdmi_register_commands(struct command_context_s *cmd_ctx);
extern int arm9tdmi_clock_out(arm_jtag_t *jtag_info, u32 instr, u32 out, u32 *in, int sysspeed); extern int arm9tdmi_clock_out(arm_jtag_t *jtag_info, u32 instr, u32 out, u32 *in, int sysspeed);

View File

@ -45,7 +45,7 @@ int cortex_m3_register_commands(struct command_context_s *cmd_ctx);
/* forward declarations */ /* forward declarations */
void cortex_m3_enable_breakpoints(struct target_s *target); void cortex_m3_enable_breakpoints(struct target_s *target);
void cortex_m3_enable_watchpoints(struct target_s *target); void cortex_m3_enable_watchpoints(struct target_s *target);
int cortex_m3_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); int cortex_m3_target_create(struct target_s *target, Jim_Interp *interp);
int cortex_m3_init_target(struct command_context_s *cmd_ctx, struct target_s *target); int cortex_m3_init_target(struct command_context_s *cmd_ctx, struct target_s *target);
int cortex_m3_quit(void); int cortex_m3_quit(void);
int cortex_m3_load_core_reg_u32(target_t *target, enum armv7m_regtype type, u32 num, u32 *value); int cortex_m3_load_core_reg_u32(target_t *target, enum armv7m_regtype type, u32 num, u32 *value);
@ -91,7 +91,7 @@ target_type_t cortexm3_target =
.remove_watchpoint = cortex_m3_remove_watchpoint, .remove_watchpoint = cortex_m3_remove_watchpoint,
.register_commands = cortex_m3_register_commands, .register_commands = cortex_m3_register_commands,
.target_command = cortex_m3_target_command, .target_create = cortex_m3_target_create,
.init_target = cortex_m3_init_target, .init_target = cortex_m3_init_target,
.examine = cortex_m3_examine, .examine = cortex_m3_examine,
.quit = cortex_m3_quit .quit = cortex_m3_quit
@ -1463,7 +1463,7 @@ int cortex_m3_handle_target_request(void *priv)
return ERROR_OK; return ERROR_OK;
} }
int cortex_m3_init_arch_info(target_t *target, cortex_m3_common_t *cortex_m3, int chain_pos, char *variant) int cortex_m3_init_arch_info(target_t *target, cortex_m3_common_t *cortex_m3, int chain_pos, const char *variant)
{ {
armv7m_common_t *armv7m; armv7m_common_t *armv7m;
armv7m = &cortex_m3->armv7m; armv7m = &cortex_m3->armv7m;
@ -1510,26 +1510,11 @@ int cortex_m3_init_arch_info(target_t *target, cortex_m3_common_t *cortex_m3, in
return ERROR_OK; return ERROR_OK;
} }
/* target cortex_m3 <endianess> <startup_mode> <chain_pos> <variant>*/ int cortex_m3_target_create(struct target_s *target, Jim_Interp *interp)
int cortex_m3_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target)
{ {
int chain_pos; cortex_m3_common_t *cortex_m3 = calloc(1,sizeof(cortex_m3_common_t));
char *variant = NULL;
cortex_m3_common_t *cortex_m3 = malloc(sizeof(cortex_m3_common_t));
memset(cortex_m3, 0, sizeof(*cortex_m3));
if (argc < 4)
{
LOG_ERROR("'target cortex_m3' requires at least one additional argument");
exit(-1);
}
chain_pos = strtoul(args[3], NULL, 0); cortex_m3_init_arch_info(target, cortex_m3, target->chain_position, target->variant);
if (argc >= 5)
variant = args[4];
cortex_m3_init_arch_info(target, cortex_m3, chain_pos, variant);
return ERROR_OK; return ERROR_OK;
} }
@ -1542,3 +1527,11 @@ int cortex_m3_register_commands(struct command_context_s *cmd_ctx)
return retval; return retval;
} }
/*
* Local Variables: ***
* c-basic-offset: 4 ***
* tab-width: 4 ***
* End: ***
*/

View File

@ -186,6 +186,6 @@ int cortex_m3_add_watchpoint(struct target_s *target, watchpoint_t *watchpoint);
int cortex_m3_remove_watchpoint(struct target_s *target, watchpoint_t *watchpoint); int cortex_m3_remove_watchpoint(struct target_s *target, watchpoint_t *watchpoint);
extern int cortex_m3_register_commands(struct command_context_s *cmd_ctx); extern int cortex_m3_register_commands(struct command_context_s *cmd_ctx);
extern int cortex_m3_init_arch_info(target_t *target, cortex_m3_common_t *cortex_m3, int chain_pos, char *variant); extern int cortex_m3_init_arch_info(target_t *target, cortex_m3_common_t *cortex_m3, int chain_pos, const char *variant);
#endif /* CORTEX_M3_H */ #endif /* CORTEX_M3_H */

View File

@ -55,7 +55,7 @@
#include <string.h> #include <string.h>
int feroceon_examine(struct target_s *target); int feroceon_examine(struct target_s *target);
int feroceon_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); int feroceon_target_create(struct target_s *target, Jim_Interp *interp);
int feroceon_bulk_write_memory(target_t *target, u32 address, u32 count, u8 *buffer); int feroceon_bulk_write_memory(target_t *target, u32 address, u32 count, u8 *buffer);
int feroceon_init_target(struct command_context_s *cmd_ctx, struct target_s *target); int feroceon_init_target(struct command_context_s *cmd_ctx, struct target_s *target);
int feroceon_quit(void); int feroceon_quit(void);
@ -106,7 +106,7 @@ target_type_t feroceon_target =
.remove_watchpoint = arm7_9_remove_watchpoint, .remove_watchpoint = arm7_9_remove_watchpoint,
.register_commands = arm926ejs_register_commands, .register_commands = arm926ejs_register_commands,
.target_command = feroceon_target_command, .target_create = feroceon_target_create,
.init_target = feroceon_init_target, .init_target = feroceon_init_target,
.examine = feroceon_examine, .examine = feroceon_examine,
.quit = feroceon_quit .quit = feroceon_quit
@ -646,29 +646,13 @@ int feroceon_quit(void)
return ERROR_OK; return ERROR_OK;
} }
int feroceon_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target) int feroceon_target_create(struct target_s *target, Jim_Interp *interp)
{ {
int chain_pos;
char *variant = NULL;
armv4_5_common_t *armv4_5; armv4_5_common_t *armv4_5;
arm7_9_common_t *arm7_9; arm7_9_common_t *arm7_9;
arm926ejs_common_t *arm926ejs = malloc(sizeof(arm926ejs_common_t)); arm926ejs_common_t *arm926ejs = calloc(1,sizeof(arm926ejs_common_t));
memset(arm926ejs, 0, sizeof(*arm926ejs));
arm926ejs_init_arch_info(target, arm926ejs, target->chain_position, target->variant);
if (argc < 4)
{
LOG_ERROR("'target arm926ejs' requires at least one additional argument");
exit(-1);
}
chain_pos = strtoul(args[3], NULL, 0);
if (argc >= 5)
variant = args[4];
LOG_DEBUG("chain_pos: %i, variant: %s", chain_pos, variant);
arm926ejs_init_arch_info(target, arm926ejs, chain_pos, variant);
armv4_5 = target->arch_info; armv4_5 = target->arch_info;
arm7_9 = armv4_5->arch_info; arm7_9 = armv4_5->arch_info;
@ -741,3 +725,10 @@ int feroceon_examine(struct target_s *target)
return ERROR_OK; return ERROR_OK;
} }
/*
* Local Variables: ***
* c-basic-offset: 4 ***
* tab-width: 4 ***
* End: ***
*/

View File

@ -314,7 +314,7 @@ reg_cache_t *mips32_build_reg_cache(target_t *target)
return cache; return cache;
} }
int mips32_init_arch_info(target_t *target, mips32_common_t *mips32, int chain_pos, char *variant) int mips32_init_arch_info(target_t *target, mips32_common_t *mips32, int chain_pos, const char *variant)
{ {
target->arch_info = mips32; target->arch_info = mips32;
mips32->common_magic = MIPS32_COMMON_MAGIC; mips32->common_magic = MIPS32_COMMON_MAGIC;

View File

@ -99,7 +99,7 @@ typedef struct mips32_core_reg_s
#define MIPS32_DRET 0x4200001F #define MIPS32_DRET 0x4200001F
extern int mips32_arch_state(struct target_s *target); extern int mips32_arch_state(struct target_s *target);
extern int mips32_init_arch_info(target_t *target, mips32_common_t *mips32, int chain_pos, char *variant); extern int mips32_init_arch_info(target_t *target, mips32_common_t *mips32, int chain_pos, const char *variant);
extern int mips32_restore_context(target_t *target); extern int mips32_restore_context(target_t *target);
extern int mips32_save_context(target_t *target); extern int mips32_save_context(target_t *target);
extern reg_cache_t *mips32_build_reg_cache(target_t *target); extern reg_cache_t *mips32_build_reg_cache(target_t *target);

View File

@ -44,7 +44,7 @@ int mips_m4k_write_memory(struct target_s *target, u32 address, u32 size, u32 co
int mips_m4k_register_commands(struct command_context_s *cmd_ctx); int mips_m4k_register_commands(struct command_context_s *cmd_ctx);
int mips_m4k_init_target(struct command_context_s *cmd_ctx, struct target_s *target); int mips_m4k_init_target(struct command_context_s *cmd_ctx, struct target_s *target);
int mips_m4k_quit(void); int mips_m4k_quit(void);
int mips_m4k_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); int mips_m4k_target_create(struct target_s *target, Jim_Interp *interp);
int mips_m4k_examine(struct target_s *target); int mips_m4k_examine(struct target_s *target);
int mips_m4k_assert_reset(target_t *target); int mips_m4k_assert_reset(target_t *target);
@ -83,7 +83,7 @@ target_type_t mips_m4k_target =
.remove_watchpoint = mips_m4k_remove_watchpoint, .remove_watchpoint = mips_m4k_remove_watchpoint,
.register_commands = mips_m4k_register_commands, .register_commands = mips_m4k_register_commands,
.target_command = mips_m4k_target_command, .target_create = mips_m4k_target_create,
.init_target = mips_m4k_init_target, .init_target = mips_m4k_init_target,
.examine = mips_m4k_examine, .examine = mips_m4k_examine,
.quit = mips_m4k_quit .quit = mips_m4k_quit
@ -578,7 +578,7 @@ int mips_m4k_quit(void)
return ERROR_OK; return ERROR_OK;
} }
int mips_m4k_init_arch_info(target_t *target, mips_m4k_common_t *mips_m4k, int chain_pos, char *variant) int mips_m4k_init_arch_info(target_t *target, mips_m4k_common_t *mips_m4k, int chain_pos, const char *variant)
{ {
mips32_common_t *mips32 = &mips_m4k->mips32_common; mips32_common_t *mips32 = &mips_m4k->mips32_common;
@ -600,24 +600,11 @@ int mips_m4k_init_arch_info(target_t *target, mips_m4k_common_t *mips_m4k, int c
return ERROR_OK; return ERROR_OK;
} }
int mips_m4k_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target) int mips_m4k_target_create(struct target_s *target, Jim_Interp *interp)
{ {
int chain_pos; mips_m4k_common_t *mips_m4k = calloc(1,sizeof(mips_m4k_common_t));
char *variant = NULL;
mips_m4k_common_t *mips_m4k = malloc(sizeof(mips_m4k_common_t));
if (argc < 4) mips_m4k_init_arch_info(target, mips_m4k, target->chain_position, target->variant);
{
LOG_ERROR("'target mips4k' requires at least one additional argument");
exit(-1);
}
chain_pos = strtoul(args[3], NULL, 0);
if (argc >= 5)
variant = args[4];
mips_m4k_init_arch_info(target, mips_m4k, chain_pos, variant);
return ERROR_OK; return ERROR_OK;
} }
@ -652,3 +639,11 @@ int mips_m4k_bulk_write_memory(target_t *target, u32 address, u32 count, u8 *buf
{ {
return mips_m4k_write_memory(target, address, 4, count, buffer); return mips_m4k_write_memory(target, address, 4, count, buffer);
} }
/*
* Local Variables: ***
* c-basic-offset: 4 ***
* tab-width: 4 ***
* End: ***
*/

File diff suppressed because it is too large Load Diff

View File

@ -199,10 +199,11 @@ typedef struct target_type_s
/* target algorithm support */ /* target algorithm support */
int (*run_algorithm_imp)(struct target_s *target, int num_mem_params, mem_param_t *mem_params, int num_reg_params, reg_param_t *reg_param, u32 entry_point, u32 exit_point, int timeout_ms, void *arch_info); int (*run_algorithm_imp)(struct target_s *target, int num_mem_params, mem_param_t *mem_params, int num_reg_params, reg_param_t *reg_param, u32 entry_point, u32 exit_point, int timeout_ms, void *arch_info);
int (*run_algorithm)(struct target_s *target, int num_mem_params, mem_param_t *mem_params, int num_reg_params, reg_param_t *reg_param, u32 entry_point, u32 exit_point, int timeout_ms, void *arch_info); int (*run_algorithm)(struct target_s *target, int num_mem_params, mem_param_t *mem_params, int num_reg_params, reg_param_t *reg_param, u32 entry_point, u32 exit_point, int timeout_ms, void *arch_info);
int (*register_commands)(struct command_context_s *cmd_ctx); int (*register_commands)(struct command_context_s *cmd_ctx);
/* called when target is created */ /* called when target is created */
int (*target_jim_create)( struct target_s *target, Jim_Interp *interp ); int (*target_create)( struct target_s *target, Jim_Interp *interp );
/* called for various config parameters */ /* called for various config parameters */
/* returns JIM_CONTINUE - if option not understood */ /* returns JIM_CONTINUE - if option not understood */
@ -213,8 +214,6 @@ typedef struct target_type_s
/* returns JIM_OK, or JIM_ERR, or JIM_CONTINUE - if option not understood */ /* returns JIM_OK, or JIM_ERR, or JIM_CONTINUE - if option not understood */
int (*target_jim_commands)( struct target_s *target, Jim_GetOptInfo *goi ); int (*target_jim_commands)( struct target_s *target, Jim_GetOptInfo *goi );
/* old init function */
int (*target_command)(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target);
/* invoked after JTAG chain has been examined & validated. During /* invoked after JTAG chain has been examined & validated. During
* this stage the target is examined and any additional setup is * this stage the target is examined and any additional setup is
* performed. * performed.
@ -271,19 +270,40 @@ typedef struct target_s
enum target_event enum target_event
{ {
// OLD historical names
// - Prior to the great TCL change
// - June/July/Aug 2008
// - Duane Ellis
TARGET_EVENT_OLD_gdb_program_config,
TARGET_EVENT_OLD_pre_reset,
TARGET_EVENT_OLD_post_reset,
TARGET_EVENT_OLD_pre_resume,
TARGET_EVENT_HALTED, /* target entered debug state from normal execution or reset */ TARGET_EVENT_HALTED, /* target entered debug state from normal execution or reset */
TARGET_EVENT_RESUMED, /* target resumed to normal execution */ TARGET_EVENT_RESUMED, /* target resumed to normal execution */
TARGET_EVENT_RESUME_START, TARGET_EVENT_RESUME_START,
TARGET_EVENT_RESUME_END, TARGET_EVENT_RESUME_END,
TARGET_EVENT_RESET_START, TARGET_EVENT_RESET_START,
TARGET_EVENT_RESET, /* target entered reset */ TARGET_EVENT_RESET_ASSERT_PRE,
TARGET_EVENT_RESET_ASSERT_POST,
TARGET_EVENT_RESET_DEASSERT_PRE,
TARGET_EVENT_RESET_DEASSERT_POST,
TARGET_EVENT_RESET_HALT_PRE,
TARGET_EVENT_RESET_HALT_POST,
TARGET_EVENT_RESET_WAIT_PRE,
TARGET_EVENT_RESET_WAIT_POST,
TARGET_EVENT_RESET_INIT, TARGET_EVENT_RESET_INIT,
TARGET_EVENT_RESET_END, TARGET_EVENT_RESET_END,
TARGET_EVENT_DEBUG_HALTED, /* target entered debug state, but was executing on behalf of the debugger */ TARGET_EVENT_DEBUG_HALTED, /* target entered debug state, but was executing on behalf of the debugger */
TARGET_EVENT_DEBUG_RESUMED, /* target resumed to execute on behalf of the debugger */ TARGET_EVENT_DEBUG_RESUMED, /* target resumed to execute on behalf of the debugger */
TARGET_EVENT_EXAMINE_START,
TARGET_EVENT_EXAMINE_END,
TARGET_EVENT_GDB_ATTACH, TARGET_EVENT_GDB_ATTACH,
TARGET_EVENT_GDB_DETACH, TARGET_EVENT_GDB_DETACH,
@ -298,6 +318,7 @@ extern const Jim_Nvp nvp_target_event[];
struct target_event_action_s { struct target_event_action_s {
enum target_event event; enum target_event event;
Jim_Obj *body; Jim_Obj *body;
int has_percent;
target_event_action_t *next; target_event_action_t *next;
}; };
@ -392,7 +413,8 @@ int target_write_u8(struct target_s *target, u32 address, u8 value);
/* Issues USER() statements with target state information */ /* Issues USER() statements with target state information */
int target_arch_state(struct target_s *target); int target_arch_state(struct target_s *target);
int target_invoke_script(struct command_context_s *cmd_ctx, target_t *target, char *name); void target_handle_event( target_t *t, enum target_event e);
void target_all_handle_event( enum target_event e );
#define ERROR_TARGET_INVALID (-300) #define ERROR_TARGET_INVALID (-300)
@ -407,6 +429,9 @@ int target_invoke_script(struct command_context_s *cmd_ctx, target_t *target, ch
#define ERROR_TARGET_NOT_RUNNING (-310) #define ERROR_TARGET_NOT_RUNNING (-310)
#define ERROR_TARGET_NOT_EXAMINED (-311) #define ERROR_TARGET_NOT_EXAMINED (-311)
extern const Jim_Nvp nvp_error_target[];
extern const char *target_strerror_safe( int err );
#endif /* TARGET_H */ #endif /* TARGET_H */

View File

@ -34,5 +34,5 @@ proc watchdog_service {} {
set watchdog_hdl [after 500 watchdog_service] set watchdog_hdl [after 500 watchdog_service]
} }
proc target_0_post_halt {} { watchdog_service } [new_target_name] configure -event old-post_halt { watchdog_service }
proc arget_0_pre_resume {} { global watchdog_hdl; after cancel $watchdog_hdl } [new_target_name] configure -event old-pre_resume { global watchdog_hdl; after cancel $watchdog_hdl }

View File

@ -32,7 +32,7 @@ working_area 0 0x00000000 0x20000 nobackup
global reset_count global reset_count
set reset_count 0 set reset_count 0
proc target_0_post_reset {} { [new_target_name] configure -event old-post_reset {
puts "Running reset init script for AT91EB40A" puts "Running reset init script for AT91EB40A"
global reset_count global reset_count
# Reset script for AT91EB40a # Reset script for AT91EB40a
@ -46,10 +46,9 @@ proc target_0_post_reset {} {
set reset_count [expr $reset_count+1] set reset_count [expr $reset_count+1]
echo "Testing reset $reset_count !" echo "Testing reset $reset_count !"
asdfs
} }
proc target_0_pre_reset {} { [new_target_name] configure -event old-pre_reset {
global reset_count global reset_count
set reset_count [expr $reset_count+1] set reset_count [expr $reset_count+1]
echo "Testing pre_reset $reset_count !" echo "Testing pre_reset $reset_count !"

View File

@ -13,7 +13,7 @@ jtag_device 4 0x1 0xf 0xe
target arm7tdmi little 0 arm7tdmi target arm7tdmi little 0 arm7tdmi
target_script 0 reset event/at91r40008_reset.script [new_target_name] configure -event old-gdb_program_config { script event/at91r40008_reset.script }
working_area 0 0x3C000 0x4000 nobackup working_area 0 0x3C000 0x4000 nobackup
flash bank cfi 0x10000000 0x400000 2 2 0 flash bank cfi 0x10000000 0x400000 2 2 0

View File

@ -17,7 +17,7 @@ jtag_ntrst_delay 0
#target <type> <endianess> <reset mode> <JTAG pos> <variant> #target <type> <endianess> <reset mode> <JTAG pos> <variant>
target arm926ejs little 0 arm926ejs target arm926ejs little 0 arm926ejs
target_script 0 reset event/at91sam9260_reset.script [new_target_name] configure -event old-post_reset { script event/at91sam9260_reset.script }
#working area <target#> <address> <size> <backup|nobackup> #working area <target#> <address> <size> <backup|nobackup>

View File

@ -8,7 +8,7 @@ jtag_device 4 0x1 0xf 0xe
target arm7tdmi little 0 arm7tdmi target arm7tdmi little 0 arm7tdmi
target_script 0 reset event/eir-sam7se512_reset.script [new_target_name] configure -event old-post_reset { script event/eir-sam7se512_reset.script }
working_area 0 0x00200000 0x4000 nobackup working_area 0 0x00200000 0x4000 nobackup

View File

@ -10,12 +10,12 @@ jtag_device 4 0x1 0xf 0xe
target arm920t little 0 arm920t target arm920t little 0 arm920t
[new_target_name] configure -event old-post_reset { script event/hammer_reset.script }
# speed up memory downloads # speed up memory downloads
arm7 fast_memory_access enable arm7 fast_memory_access enable
arm7_9 dcc_downloads enable arm7_9 dcc_downloads enable
target_script 0 reset event/hammer_reset.script
working_area 0 0x30800000 0x20000 nobackup working_area 0 0x30800000 0x20000 nobackup

View File

@ -14,8 +14,7 @@ reset_config trst_and_srst srst_pulls_trst
jtag_device 4 0x1 0xf 0xe jtag_device 4 0x1 0xf 0xe
target arm7tdmi little 0 arm7tdmi-s_r4 target arm7tdmi little 0 arm7tdmi-s_r4
[new_target_name] configure -event old-post_reset {} {
proc target_0_post_reset {} {
# Force target into ARM state # Force target into ARM state
soft_reset_halt soft_reset_halt
#do not remap 0x0000-0x0020 to anything but the flash #do not remap 0x0000-0x0020 to anything but the flash

View File

@ -11,8 +11,7 @@ jtag_device 4 0x1 0x0 0xe
jtag_device 8 0x0 0x0 0x0 jtag_device 8 0x0 0x0 0x0
target arm926ejs little 1 arm926ejs target arm926ejs little 1 arm926ejs
target_script 0 reset event/omap5912_reset.script [new_target_name] configure -event old-post_reset { script event/omap5912_reset.script }
# omap5912 lcd frame buffer as working area # omap5912 lcd frame buffer as working area
working_area 0 0x20000000 0x3e800 nobackup working_area 0 0x20000000 0x3e800 nobackup

View File

@ -1,11 +1,13 @@
jtag_device 5 0x1 0x1f 0x1e jtag_device 5 0x1 0x1f 0x1e
jtag_nsrst_delay 200 jtag_nsrst_delay 200
jtag_ntrst_delay 200 jtag_ntrst_delay 200
target xscale little 0 pxa255 target xscale little 0 pxa255
[new_target_name] configure -event old-post_reset { script event/pxa255_reset.script }
reset_config trst_and_srst reset_config trst_and_srst
target_script 0 reset event/pxa255_reset.script
#xscale debug_handler 0 0xFFFF0800 # debug handler base address #xscale debug_handler 0 0xFFFF0800 # debug handler base address

View File

@ -8,9 +8,7 @@ jtag_device 4 0x1 0xf 0xe
#target <type> <startup mode> #target <type> <startup mode>
#target arm7tdmi <reset mode> <chainpos> <endianness> <variant> #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
target arm7tdmi little 0 arm7tdmi target arm7tdmi little 0 arm7tdmi
[new_target_name] configure -event old-post_reset { script event/sam7x256_reset.script }
target_script 0 reset event/sam7x256_reset.script
working_area 0 0x00200000 0x4000 nobackup working_area 0 0x00200000 0x4000 nobackup

View File

@ -1,11 +1,6 @@
#start slow, speed up after reset #start slow, speed up after reset
jtag_khz 10 jtag_khz 10
proc target_0_pre_reset {} {
jtag_khz 10
}
proc target_0_post_reset {} {
jtag_khz 6000
}
#use combined on interfaces or targets that can't set TRST/SRST separately #use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst srst_pulls_trst reset_config trst_and_srst srst_pulls_trst
@ -17,9 +12,9 @@ jtag_device 4 0x1 0xf 0xe
#target <type> <startup mode> #target <type> <startup mode>
#target arm7tdmi <reset mode> <chainpos> <endianness> <variant> #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
target arm7tdmi little 0 arm7tdmi target arm7tdmi little 0 arm7tdmi
[new_target_name] configure -event old-pre_reset { jtag_khz 10 }
[new_target_name] configure -event old-post_reset { jtag_khz 6000 }
target_script 0 gdb_program_config event/str710_program.script [new_target_name] configure -event old-gdb_program_config { script event/str710_program.script }
working_area 0 0x2000C000 0x4000 nobackup working_area 0 0x2000C000 0x4000 nobackup

View File

@ -2,12 +2,6 @@
jtag_khz 3000 jtag_khz 3000
proc target_0_pre_reset {} {
jtag_khz 10
}
proc target_0_post_reset {} {
jtag_khz 3000
}
#use combined on interfaces or targets that cant set TRST/SRST separately #use combined on interfaces or targets that cant set TRST/SRST separately
@ -23,10 +17,9 @@ jtag_nsrst_delay 500
jtag_ntrst_delay 500 jtag_ntrst_delay 500
target arm7tdmi little 0 arm7tdmi target arm7tdmi little 0 arm7tdmi
[new_target_name] configure -event old-pre_reset { jtag_khz 10 }
[new_target_name] configure -event old-post_reset { jtag_khz 3000 }
[new_target_name] configure -event old-gdb_program_config { script event/str730_program.script }
target_script 0 gdb_program_config event/str730_program.script
working_area 0 0x40000000 0x4000 nobackup working_area 0 0x40000000 0x4000 nobackup

View File

@ -2,12 +2,7 @@
# jtag speed # jtag speed
jtag_khz 10 jtag_khz 10
proc target_0_pre_reset {} {
jtag_khz 10
}
proc target_0_post_reset {} {
jtag_khz 3000
}
#use combined on interfaces or targets that cant set TRST/SRST separately #use combined on interfaces or targets that cant set TRST/SRST separately
#reset_config trst_and_srst srst_pulls_trst #reset_config trst_and_srst srst_pulls_trst
@ -25,9 +20,9 @@ jtag_ntrst_delay 500
#target arm7tdmi <reset mode> <chainpos> <endianness> <variant> #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
target arm7tdmi little 0 arm7tdmi target arm7tdmi little 0 arm7tdmi
[new_target_name] configure -event old-pre_reset { jtag_khz 10 }
[new_target_name] configure -event old-post_reset { jtag_khz 3000 }
target_script 0 gdb_program_config event/str750_program.script [new_target_name] configure -event old-gdb_program_config { script event/str750_program.script }
working_area 0 0x40000000 0x4000 nobackup working_area 0 0x40000000 0x4000 nobackup

View File

@ -3,23 +3,6 @@
# jtag speed. We need to stick to 16kHz until we've finished reset. # jtag speed. We need to stick to 16kHz until we've finished reset.
jtag_rclk 16 jtag_rclk 16
proc target_0_pre_reset {} {
jtag_rclk 16
}
proc target_0_post_reset {} {
# We can increase speed now that we know the target is halted.
jtag_rclk 3000
# -- Enable 96K RAM
# PFQBC enabled / DTCM & AHB wait-states disabled
mww 0x5C002034 0x0191
str9x flash_config 0 4 2 0 0x80000
flash protect 0 0 7 off
}
jtag_nsrst_delay 100 jtag_nsrst_delay 100
@ -38,6 +21,20 @@ jtag_device 5 0x1 0x1 0x1e
#target arm7tdmi <reset mode> <chainpos> <endianness> <variant> #target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
target arm966e little 1 arm966e target arm966e little 1 arm966e
[new_target_name] configure -event old-pre_reset { jtag_rclk 16 }
[new_target_name] configure -event old-post_reset {
# We can increase speed now that we know the target is halted.
jtag_rclk 3000
# -- Enable 96K RAM
# PFQBC enabled / DTCM & AHB wait-states disabled
mww 0x5C002034 0x0191
str9x flash_config 0 4 2 0 0x80000
flash protect 0 0 7 off
}
working_area 0 0x50000000 16384 nobackup working_area 0 0x50000000 16384 nobackup

View File

@ -17,7 +17,7 @@ jtag_ntrst_delay 0
#target <type> <endianess> <reset mode> <JTAG pos> <variant> #target <type> <endianess> <reset mode> <JTAG pos> <variant>
target arm926ejs big 0 arm926ejs target arm926ejs big 0 arm926ejs
target_script 0 reset event/wi-9c_reset.script [new_target_name] configure -event old-post_reset { script event/wi-9c_reset.script }
#working area <target#> <address> <size> <backup|nobackup> #working area <target#> <address> <size> <backup|nobackup>

View File

@ -10,7 +10,7 @@ jtag_ntrst_delay 100
jtag_device 7 0x1 0x7f 0x7e jtag_device 7 0x1 0x7f 0x7e
target xscale big 0 ixp42x target xscale big 0 ixp42x
target_script 0 reset event/xba_revA3.script [new_target_name] configure -event old-post_reset { script event/xba_revA3.script }
flash bank cfi 0x50000000 0x400000 2 2 0 flash bank cfi 0x50000000 0x400000 2 2 0

View File

@ -21,7 +21,7 @@ arm7_9 fast_memory_access enable
arm7_9 dcc_downloads enable arm7_9 dcc_downloads enable
flash bank ecosflash 0x01000000 0x200000 2 2 0 ecos/at91eb40a.elf flash bank ecosflash 0x01000000 0x200000 2 2 0 ecos/at91eb40a.elf
target_script 0 reset event/zy1000_reset.script [new_target_name] configure -event old-post_reset { script event/zy1000_reset.script }
# required for usable performance. Used for lots of # required for usable performance. Used for lots of
# other things than flash programming. # other things than flash programming.

View File

@ -53,7 +53,7 @@
int xscale_register_commands(struct command_context_s *cmd_ctx); int xscale_register_commands(struct command_context_s *cmd_ctx);
/* forward declarations */ /* forward declarations */
int xscale_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target); int xscale_target_create(struct target_s *target, Jim_Interp *interp);
int xscale_init_target(struct command_context_s *cmd_ctx, struct target_s *target); int xscale_init_target(struct command_context_s *cmd_ctx, struct target_s *target);
int xscale_quit(void); int xscale_quit(void);
@ -124,7 +124,7 @@ target_type_t xscale_target =
.remove_watchpoint = xscale_remove_watchpoint, .remove_watchpoint = xscale_remove_watchpoint,
.register_commands = xscale_register_commands, .register_commands = xscale_register_commands,
.target_command = xscale_target_command, .target_create = xscale_target_create,
.init_target = xscale_init_target, .init_target = xscale_init_target,
.quit = xscale_quit, .quit = xscale_quit,
@ -3001,7 +3001,7 @@ int xscale_quit(void)
return ERROR_OK; return ERROR_OK;
} }
int xscale_init_arch_info(target_t *target, xscale_common_t *xscale, int chain_pos, char *variant) int xscale_init_arch_info(target_t *target, xscale_common_t *xscale, int chain_pos, const char *variant)
{ {
armv4_5_common_t *armv4_5; armv4_5_common_t *armv4_5;
u32 high_reset_branch, low_reset_branch; u32 high_reset_branch, low_reset_branch;
@ -3112,24 +3112,11 @@ int xscale_init_arch_info(target_t *target, xscale_common_t *xscale, int chain_p
} }
/* target xscale <endianess> <startup_mode> <chain_pos> <variant> */ /* target xscale <endianess> <startup_mode> <chain_pos> <variant> */
int xscale_target_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct target_s *target) int xscale_target_create(struct target_s *target, Jim_Interp *interp)
{ {
int chain_pos; xscale_common_t *xscale = calloc(1,sizeof(xscale_common_t));
char *variant = NULL;
xscale_common_t *xscale = malloc(sizeof(xscale_common_t));
memset(xscale, 0, sizeof(*xscale));
if (argc < 5) xscale_init_arch_info(target, xscale, target->chain_position, target->variant);
{
LOG_ERROR("'target xscale' requires four arguments: <endianess> <startup_mode> <chain_pos> <variant>");
return ERROR_OK;
}
chain_pos = strtoul(args[3], NULL, 0);
variant = args[4];
xscale_init_arch_info(target, xscale, chain_pos, variant);
xscale_build_reg_cache(target); xscale_build_reg_cache(target);
return ERROR_OK; return ERROR_OK;
@ -3735,3 +3722,11 @@ int xscale_register_commands(struct command_context_s *cmd_ctx)
return ERROR_OK; return ERROR_OK;
} }
/*
* Local Variables: ***
* c-basic-offset: 4 ***
* tab-width: 4 ***
* End: ***
*/