diff options
author | drath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2007-07-15 11:19:33 +0000 |
---|---|---|
committer | drath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2007-07-15 11:19:33 +0000 |
commit | 1429d2c659ab9b84dee673e7697da7eab44a8f90 (patch) | |
tree | 03230f43a7404b1e22f0ffdafb69e41196808b30 /src/target | |
parent | 32c6d70f6acd41dd1af5ea73051dd6c8a46eac14 (diff) | |
download | openocd_libswd-1429d2c659ab9b84dee673e7697da7eab44a8f90.tar.gz openocd_libswd-1429d2c659ab9b84dee673e7697da7eab44a8f90.tar.bz2 openocd_libswd-1429d2c659ab9b84dee673e7697da7eab44a8f90.tar.xz openocd_libswd-1429d2c659ab9b84dee673e7697da7eab44a8f90.zip |
- added support for Asix Presto JTAG interface (thanks to Pavel Chromy and Asix for making this addition possible)
- added support for usbprog (thanks to Benedikt Sauter)
- make OpenOCD listen for WM_QUIT messages on windows (thanks to Pavel Chromy)
- register at_exit handler to do necessary unregistering (thanks to Pavel Chromy)
- added dummy ETM capture driver to allow ETM to be registered without a capture driver
git-svn-id: svn://svn.berlios.de/openocd/trunk@180 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/target')
-rw-r--r-- | src/target/Makefile.am | 8 | ||||
-rw-r--r-- | src/target/etm.c | 34 | ||||
-rw-r--r-- | src/target/etm.h | 3 | ||||
-rw-r--r-- | src/target/etm_dummy.c | 116 | ||||
-rw-r--r-- | src/target/etm_dummy.h | 33 |
5 files changed, 185 insertions, 9 deletions
diff --git a/src/target/Makefile.am b/src/target/Makefile.am index c6cf9525..d33d161b 100644 --- a/src/target/Makefile.am +++ b/src/target/Makefile.am @@ -3,7 +3,9 @@ METASOURCES = AUTO noinst_LIBRARIES = libtarget.a libtarget_a_SOURCES = target.c register.c breakpoints.c armv4_5.c embeddedice.c etm.c arm7tdmi.c arm9tdmi.c \ arm_jtag.c arm7_9_common.c algorithm.c arm920t.c arm720t.c armv4_5_mmu.c armv4_5_cache.c arm_disassembler.c \ - arm966e.c arm926ejs.c etb.c xscale.c arm_simulator.c image.c armv7m.c cortex_m3.c cortex_swjdp.c + arm966e.c arm926ejs.c etb.c xscale.c arm_simulator.c image.c armv7m.c cortex_m3.c cortex_swjdp.c \ + etm_dummy.c noinst_HEADERS = target.h register.h armv4_5.h embeddedice.h etm.h arm7tdmi.h arm9tdmi.h \ - arm_jtag.h arm7_9_common.h arm920t.h arm720t.h armv4_5_mmu.h armv4_5_cache.h breakpoints.h algorithm.h \ - arm_disassembler.h arm966e.h arm926ejs.h etb.h xscale.h arm_simulator.h image.h armv7m.h cortex_m3.h cortex_swjdp.h + arm_jtag.h arm7_9_common.h arm920t.h arm720t.h armv4_5_mmu.h armv4_5_cache.h breakpoints.h algorithm.h \ + arm_disassembler.h arm966e.h arm926ejs.h etb.h xscale.h arm_simulator.h image.h armv7m.h cortex_m3.h cortex_swjdp.h \ + etm_dummy.h diff --git a/src/target/etm.c b/src/target/etm.c index 367eafff..e095e50d 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -465,10 +465,12 @@ int etm_store_reg(reg_t *reg) * */ extern etm_capture_driver_t etb_capture_driver; +extern etm_capture_driver_t etm_dummy_capture_driver; etm_capture_driver_t *etm_capture_drivers[] = { &etb_capture_driver, + &etm_dummy_capture_driver, NULL }; @@ -1005,7 +1007,7 @@ int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, char *cmd, c tracemode = arm7_9->etm_ctx->tracemode; - if (argc == 3) + if (argc == 4) { if (strcmp(args[0], "none") == 0) { @@ -1061,10 +1063,24 @@ int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, char *cmd, c command_print(cmd_ctx, "invalid option '%s'", args[2]); return ERROR_OK; } + + if (strcmp(args[3], "enable") == 0) + { + tracemode |= ETMV1_BRANCH_OUTPUT; + } + else if (strcmp(args[3], "disable") == 0) + { + tracemode |= 0; + } + else + { + command_print(cmd_ctx, "invalid option '%s'", args[2]); + return ERROR_OK; + } } else if (argc != 0) { - command_print(cmd_ctx, "usage: configure trace mode <none|data|address|all> <context id bits> <enable|disable cycle accurate>"); + command_print(cmd_ctx, "usage: configure trace mode <none|data|address|all> <context id bits> <cycle accurate> <branch output>"); return ERROR_OK; } @@ -1110,6 +1126,15 @@ int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, char *cmd, c { command_print(cmd_ctx, "cycle-accurate tracing disabled"); } + + if (tracemode & ETMV1_BRANCH_OUTPUT) + { + command_print(cmd_ctx, "full branch address output enabled"); + } + else + { + command_print(cmd_ctx, "full branch address output disabled"); + } /* only update ETM_CTRL register if tracemode changed */ if (arm7_9->etm_ctx->tracemode != tracemode) @@ -1121,7 +1146,7 @@ int handle_etm_tracemode_command(struct command_context_s *cmd_ctx, char *cmd, c buf_set_u32(etm_ctrl_reg->value, 2, 2, tracemode & ETMV1_TRACE_MASK); buf_set_u32(etm_ctrl_reg->value, 14, 2, (tracemode & ETMV1_CONTEXTID_MASK) >> 4); buf_set_u32(etm_ctrl_reg->value, 12, 1, (tracemode & ETMV1_CYCLE_ACCURATE) >> 8); - + buf_set_u32(etm_ctrl_reg->value, 8, 1, (tracemode & ETMV1_BRANCH_OUTPUT) >> 9); etm_store_reg(etm_ctrl_reg); arm7_9->etm_ctx->tracemode = tracemode; @@ -1317,7 +1342,6 @@ int handle_etm_image_command(struct command_context_s *cmd_ctx, char *cmd, char armv4_5_common_t *armv4_5; arm7_9_common_t *arm7_9; etm_context_t *etm_ctx; - int i; if (argc < 1) { @@ -1634,7 +1658,7 @@ int etm_register_commands(struct command_context_s *cmd_ctx) int etm_register_user_commands(struct command_context_s *cmd_ctx) { register_command(cmd_ctx, etm_cmd, "tracemode", handle_etm_tracemode_command, - COMMAND_EXEC, "configure trace mode <none|data|address|all> <context id bits> <enable|disable cycle accurate>"); + COMMAND_EXEC, "configure trace mode <none|data|address|all> <context id bits> <cycle accurate> <branch output"); register_command(cmd_ctx, etm_cmd, "status", handle_etm_status_command, COMMAND_EXEC, "display current target's ETM status"); diff --git a/src/target/etm.h b/src/target/etm.h index 0b7b05ad..f5a48c31 100644 --- a/src/target/etm.h +++ b/src/target/etm.h @@ -103,7 +103,8 @@ typedef enum ETMV1_CONTEXTID_32 = 0x30,
ETMV1_CONTEXTID_MASK = 0x30,
/* Misc */
- ETMV1_CYCLE_ACCURATE = 0x100
+ ETMV1_CYCLE_ACCURATE = 0x100,
+ ETMV1_BRANCH_OUTPUT = 0x200
} etmv1_tracemode_t;
/* forward-declare ETM context */
diff --git a/src/target/etm_dummy.c b/src/target/etm_dummy.c new file mode 100644 index 00000000..b22f1f6c --- /dev/null +++ b/src/target/etm_dummy.c @@ -0,0 +1,116 @@ +/*************************************************************************** + * Copyright (C) 2007 by Dominic Rath * + * Dominic.Rath@gmx.de * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <string.h> + +#include "etm_dummy.h" +#include "etm.h" + +#include "arm7_9_common.h" +#include "log.h" +#include "types.h" +#include "binarybuffer.h" +#include "target.h" +#include "register.h" +#include "jtag.h" + +#include <stdlib.h> + +int handle_etm_dummy_config_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) +{ + target_t *target; + armv4_5_common_t *armv4_5; + arm7_9_common_t *arm7_9; + + target = get_target_by_num(strtoul(args[0], NULL, 0)); + + if (!target) + { + ERROR("target number '%s' not defined", args[0]); + exit(-1); + } + + if (arm7_9_get_arch_pointers(target, &armv4_5, &arm7_9) != ERROR_OK) + { + command_print(cmd_ctx, "current target isn't an ARM7/ARM9 target"); + return ERROR_OK; + } + + if (arm7_9->etm_ctx) + { + arm7_9->etm_ctx->capture_driver_priv = NULL; + } + else + { + ERROR("target has no ETM defined, ETM dummy left unconfigured"); + } + + return ERROR_OK; +} + +int etm_dummy_register_commands(struct command_context_s *cmd_ctx) +{ + command_t *etm_dummy_cmd; + + etm_dummy_cmd = register_command(cmd_ctx, NULL, "etm_dummy", NULL, COMMAND_ANY, "Dummy ETM capture driver"); + + register_command(cmd_ctx, etm_dummy_cmd, "config", handle_etm_dummy_config_command, COMMAND_CONFIG, NULL); + + return ERROR_OK; +} + +int etm_dummy_init(etm_context_t *etm_ctx) +{ + return ERROR_OK; +} + +trace_status_t etm_dummy_status(etm_context_t *etm_ctx) +{ + return TRACE_IDLE; +} + +int etm_dummy_read_trace(etm_context_t *etm_ctx) +{ + return ERROR_OK; +} + +int etm_dummy_start_capture(etm_context_t *etm_ctx) +{ + return ERROR_ETM_PORTMODE_NOT_SUPPORTED; +} + +int etm_dummy_stop_capture(etm_context_t *etm_ctx) +{ + return ERROR_OK; +} + +etm_capture_driver_t etm_dummy_capture_driver = +{ + .name = "dummy", + .register_commands = etm_dummy_register_commands, + .init = etm_dummy_init, + .status = etm_dummy_status, + .start_capture = etm_dummy_start_capture, + .stop_capture = etm_dummy_stop_capture, + .read_trace = etm_dummy_read_trace, +}; diff --git a/src/target/etm_dummy.h b/src/target/etm_dummy.h new file mode 100644 index 00000000..31afeffb --- /dev/null +++ b/src/target/etm_dummy.h @@ -0,0 +1,33 @@ +/***************************************************************************
+ * Copyright (C) 2007 by Dominic Rath *
+ * Dominic.Rath@gmx.de *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef ETM_DUMMY_H
+#define ETM_DUMMY_H
+
+#include "command.h"
+#include "target.h"
+#include "register.h"
+#include "arm_jtag.h"
+
+#include "etm.h"
+
+extern etm_capture_driver_t etm_dummy_capture_driver;
+extern int etm_dummy_register_commands(struct command_context_s *cmd_ctx);
+
+#endif /* ETB_H */
|