target.c 123 KB
Newer Older
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
	},
	{
		.name = "fast_load",
		.handler = &handle_fast_load_command,
		.mode = COMMAND_ANY,
		.help = "loads active fast load image to current target "
			"- mainly for profiling purposes",
	},
	{
		.name = "profile",
		.handler = &handle_profile_command,
		.mode = COMMAND_EXEC,
		.help = "profiling samples the CPU PC",
	},
	/** @todo don't register virt2phys() unless target supports it */
	{
		.name = "virt2phys",
		.handler = &handle_virt2phys_command,
		.mode = COMMAND_ANY,
		.help = "translate a virtual address into a physical address",
	},

	{
		.name = "reg",
		.handler = &handle_reg_command,
		.mode = COMMAND_EXEC,
		.help = "display or set a register",
	},

	{
		.name = "poll",
		.handler = &handle_poll_command,
		.mode = COMMAND_EXEC,
		.help = "poll target state",
	},
	{
		.name = "wait_halt",
		.handler = &handle_wait_halt_command,
		.mode = COMMAND_EXEC,
		.help = "wait for target halt",
		.usage = "[time (s)]",
	},
	{
		.name = "halt",
		.handler = &handle_halt_command,
		.mode = COMMAND_EXEC,
		.help = "halt target",
	},
	{
		.name = "resume",
		.handler = &handle_resume_command,
		.mode = COMMAND_EXEC,
		.help = "resume target",
		.usage = "[<address>]",
	},
	{
		.name = "reset",
		.handler = &handle_reset_command,
		.mode = COMMAND_EXEC,
		.usage = "[run|halt|init]",
		.help = "Reset all targets into the specified mode."
			"Default reset mode is run, if not given.",
	},
	{
		.name = "soft_reset_halt",
		.handler = &handle_soft_reset_halt_command,
		.mode = COMMAND_EXEC,
		.help = "halt the target and do a soft reset",
	},
	{

		.name = "step",
		.handler = &handle_step_command,
		.mode = COMMAND_EXEC,
		.help =	"step one instruction from current PC or [addr]",
		.usage = "[<address>]",
	},
	{

		.name = "mdw",
		.handler = &handle_md_command,
		.mode = COMMAND_EXEC,
		.help = "display memory words",
		.usage = "[phys] <addr> [count]",
	},
	{
		.name = "mdh",
		.handler = &handle_md_command,
		.mode = COMMAND_EXEC,
		.help = "display memory half-words",
		.usage = "[phys] <addr> [count]",
	},
	{
		.name = "mdb",
		.handler = &handle_md_command,
		.mode = COMMAND_EXEC,
		.help = "display memory bytes",
		.usage = "[phys] <addr> [count]",
	},
	{

		.name = "mww",
		.handler = &handle_mw_command,
		.mode = COMMAND_EXEC,
		.help = "write memory word",
		.usage = "[phys]  <addr> <value> [count]",
	},
	{
		.name = "mwh",
		.handler = &handle_mw_command,
		.mode = COMMAND_EXEC,
		.help = "write memory half-word",
		.usage = "[phys] <addr> <value> [count]",
	},
	{
		.name = "mwb",
		.handler = &handle_mw_command,
		.mode = COMMAND_EXEC,
		.help = "write memory byte",
		.usage = "[phys] <addr> <value> [count]",
	},
	{

		.name = "bp",
		.handler = &handle_bp_command,
		.mode = COMMAND_EXEC,
		.help = "list or set breakpoint",
		.usage = "[<address> <length> [hw]]",
	},
	{
		.name = "rbp",
		.handler = &handle_rbp_command,
		.mode = COMMAND_EXEC,
		.help = "remove breakpoint",
		.usage = "<address>",
	},
	{

		.name = "wp",
		.handler = &handle_wp_command,
		.mode = COMMAND_EXEC,
		.help = "list or set watchpoint",
		.usage = "[<address> <length> <r/w/a> [value] [mask]]",
	},
	{
		.name = "rwp",
		.handler = &handle_rwp_command,
		.mode = COMMAND_EXEC,
		.help = "remove watchpoint",
		.usage = "<address>",

	},
	{
		.name = "load_image",
		.handler = &handle_load_image_command,
		.mode = COMMAND_EXEC,
		.usage = "<file> <address> ['bin'|'ihex'|'elf'|'s19'] "
			"[min_address] [max_length]",
	},
	{
		.name = "dump_image",
		.handler = &handle_dump_image_command,
		.mode = COMMAND_EXEC,
		.usage = "<file> <address> <size>",
	},
	{
		.name = "verify_image",
		.handler = &handle_verify_image_command,
		.mode = COMMAND_EXEC,
		.usage = "<file> [offset] [type]",
	},
	{
		.name = "test_image",
		.handler = &handle_test_image_command,
		.mode = COMMAND_EXEC,
		.usage = "<file> [offset] [type]",
	},
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
	{
		.name = "ocd_mem2array",
		.mode = COMMAND_EXEC,
		.jim_handler = &jim_mem2array,
		.help = "read memory and return as a TCL array "
			"for script processing",
		.usage = "<arrayname> <width=32|16|8> <address> <count>",
	},
	{
		.name = "ocd_array2mem",
		.mode = COMMAND_EXEC,
		.jim_handler = &jim_array2mem,
		.help = "convert a TCL array to memory locations "
			"and write the values",
		.usage = "<arrayname> <width=32|16|8> <address> <count>",
	},
5194
5195
	COMMAND_REGISTRATION_DONE
};
5196
int target_register_user_commands(struct command_context *cmd_ctx)
5197
5198
5199
5200
5201
5202
5203
5204
5205
{
	int retval = ERROR_OK;
	if ((retval = target_request_register_commands(cmd_ctx)) != ERROR_OK)
		return retval;

	if ((retval = trace_register_commands(cmd_ctx)) != ERROR_OK)
		return retval;


5206
	return register_commands(cmd_ctx, NULL, target_exec_command_handlers);
5207
}
For faster browsing, not all history is shown. View entire blame