aboutsummaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2020-11-13 19:41:41 +0100
committerAntonio Borneo <borneo.antonio@gmail.com>2021-03-10 21:33:09 +0000
commitf9509c92dba370be363f5641d3fefe2250bee10c (patch)
tree448e9a04f6afa2e3bbbe96dbe433e3bdc553113a /src/target
parentfaaa42283f5c06830fe997b80d6c64f6469c6cf0 (diff)
downloadriscv-openocd-f9509c92dba370be363f5641d3fefe2250bee10c.zip
riscv-openocd-f9509c92dba370be363f5641d3fefe2250bee10c.tar.gz
riscv-openocd-f9509c92dba370be363f5641d3fefe2250bee10c.tar.bz2
itm: rework itm commands before 'init'
If the command 'itm port[s]' is issued before 'init', the ITM can not be programmed because OpenOCD cannot access the target yet. The configuration is recorded and applied after target examine. The current test to trigger the ITM delayed-programming is based on the TPIU configuration. This is allowed because the only use of ITM it so send data through TPIU. In case of system TPIU, not belonging anymore to the target, there is no more association between target ITM and system TPIU. Add a flag to record the pending ITM configuration requested before 'init' and test the flag to trigger the delayed-programming of the ITM. Change-Id: I101eb97a116d7925cd2ff068f3e8813fc008b08e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6029 Tested-by: jenkins
Diffstat (limited to 'src/target')
-rw-r--r--src/target/armv7m_trace.c10
-rw-r--r--src/target/armv7m_trace.h2
-rw-r--r--src/target/cortex_m.c5
3 files changed, 11 insertions, 6 deletions
diff --git a/src/target/armv7m_trace.c b/src/target/armv7m_trace.c
index adfef2e..02f3f10 100644
--- a/src/target/armv7m_trace.c
+++ b/src/target/armv7m_trace.c
@@ -408,8 +408,9 @@ COMMAND_HANDLER(handle_itm_port_command)
if (CMD_CTX->mode == COMMAND_EXEC)
return armv7m_trace_itm_config(target);
- else
- return ERROR_OK;
+
+ armv7m->trace_config.itm_deferred_config = true;
+ return ERROR_OK;
}
COMMAND_HANDLER(handle_itm_ports_command)
@@ -427,8 +428,9 @@ COMMAND_HANDLER(handle_itm_ports_command)
if (CMD_CTX->mode == COMMAND_EXEC)
return armv7m_trace_itm_config(target);
- else
- return ERROR_OK;
+
+ armv7m->trace_config.itm_deferred_config = true;
+ return ERROR_OK;
}
static const struct command_registration tpiu_command_handlers[] = {
diff --git a/src/target/armv7m_trace.h b/src/target/armv7m_trace.h
index cdf79e7..61142b1 100644
--- a/src/target/armv7m_trace.h
+++ b/src/target/armv7m_trace.h
@@ -78,6 +78,8 @@ struct armv7m_trace_config {
bool itm_async_timestamps;
/** Enable synchronisation packet transmission (for sync port only) */
bool itm_synchro_packets;
+ /** Config ITM after target examine */
+ bool itm_deferred_config;
/** Current frequency of TRACECLKIN (usually matches HCLK) */
unsigned int traceclkin_freq;
diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c
index ce2c426..4580c10 100644
--- a/src/target/cortex_m.c
+++ b/src/target/cortex_m.c
@@ -2082,10 +2082,11 @@ int cortex_m_examine(struct target *target)
if (retval != ERROR_OK)
return retval;
- if (armv7m->trace_config.config_type != TRACE_CONFIG_TYPE_DISABLED) {
+ if (armv7m->trace_config.config_type != TRACE_CONFIG_TYPE_DISABLED)
armv7m_trace_tpiu_config(target);
+
+ if (armv7m->trace_config.itm_deferred_config)
armv7m_trace_itm_config(target);
- }
/* NOTE: FPB and DWT are both optional. */