summaryrefslogtreecommitdiff
path: root/src/target/armv4_5.c
diff options
context:
space:
mode:
authorSpencer Oliver <ntfreak@users.sourceforge.net>2010-02-26 23:29:38 +0000
committerSpencer Oliver <ntfreak@users.sourceforge.net>2010-02-28 22:48:37 +0000
commit9d6ede25ddb0863873f84b6a55f4300891429049 (patch)
tree6acf9128732ed275ddc733fcd6fece4229e519b5 /src/target/armv4_5.c
parent550abe7396f60274ffd0c5f373eda046af9d9a85 (diff)
downloadopenocd+libswd-9d6ede25ddb0863873f84b6a55f4300891429049.tar.gz
openocd+libswd-9d6ede25ddb0863873f84b6a55f4300891429049.tar.bz2
openocd+libswd-9d6ede25ddb0863873f84b6a55f4300891429049.tar.xz
openocd+libswd-9d6ede25ddb0863873f84b6a55f4300891429049.zip
semihosting: move semihosting cmd to arm cmd group
Move semihosting cmd to the arm cmd group. Targets that support semihosting will setup the setup_semihosting callback function. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
Diffstat (limited to 'src/target/armv4_5.c')
-rw-r--r--src/target/armv4_5.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c
index 36101b02..04887857 100644
--- a/src/target/armv4_5.c
+++ b/src/target/armv4_5.c
@@ -951,6 +951,49 @@ static int jim_mcrmrc(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
return JIM_OK;
}
+COMMAND_HANDLER(handle_arm_semihosting_command)
+{
+ struct target *target = get_current_target(CMD_CTX);
+ struct arm *arm = target ? target_to_arm(target) : NULL;
+
+ if (!is_arm(arm)) {
+ command_print(CMD_CTX, "current target isn't an ARM");
+ return ERROR_FAIL;
+ }
+
+ if (!arm->setup_semihosting)
+ {
+ command_print(CMD_CTX, "semihosting not supported for current target");
+ }
+
+ if (CMD_ARGC > 0)
+ {
+ int semihosting;
+
+ COMMAND_PARSE_ENABLE(CMD_ARGV[0], semihosting);
+
+ if (!target_was_examined(target))
+ {
+ LOG_ERROR("Target not examined yet");
+ return ERROR_FAIL;
+ }
+
+ if (arm->setup_semihosting(target, semihosting) != ERROR_OK) {
+ LOG_ERROR("Failed to Configure semihosting");
+ return ERROR_FAIL;
+ }
+
+ /* FIXME never let that "catch" be dropped! */
+ arm->is_semihosting = semihosting;
+ }
+
+ command_print(CMD_CTX, "semihosting is %s",
+ arm->is_semihosting
+ ? "enabled" : "disabled");
+
+ return ERROR_OK;
+}
+
static const struct command_registration arm_exec_command_handlers[] = {
{
.name = "reg",
@@ -985,6 +1028,13 @@ static const struct command_registration arm_exec_command_handlers[] = {
.help = "read coprocessor register",
.usage = "cpnum op1 CRn op2 CRm",
},
+ {
+ "semihosting",
+ .handler = handle_arm_semihosting_command,
+ .mode = COMMAND_EXEC,
+ .usage = "['enable'|'disable']",
+ .help = "activate support for semihosting operations",
+ },
COMMAND_REGISTRATION_DONE
};