itm: fix default initialization
Commitf9509c92db
("itm: rework itm commands before 'init'") ignores the default enable of ITM channel 0, that is applied when no 'itm port[s]' is issued. Call armv7m_trace_itm_config() unconditionally to handle it. Change-Id: I3e85d0b063ed38c1552f6af9ea9eea2e76aa9025 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reported-by: Paul Fertser <fercerpav@gmail.com> Fixes:f9509c92db
("itm: rework itm commands before 'init'") Reviewed-on: https://review.openocd.org/c/openocd/+/7900 Reviewed-by: <post@frankplowman.com> Tested-by: jenkins
This commit is contained in:
parent
198fecf5e4
commit
dde096e03f
|
@ -92,11 +92,14 @@ COMMAND_HANDLER(handle_itm_port_command)
|
||||||
else
|
else
|
||||||
armv7m->trace_config.itm_ter[reg_idx] &= ~(1 << port);
|
armv7m->trace_config.itm_ter[reg_idx] &= ~(1 << port);
|
||||||
|
|
||||||
if (CMD_CTX->mode == COMMAND_EXEC)
|
/*
|
||||||
return armv7m_trace_itm_config(target);
|
* In config mode ITM is not accessible yet.
|
||||||
|
* Keep the value and it will be programmed at target init.
|
||||||
armv7m->trace_config.itm_deferred_config = true;
|
*/
|
||||||
|
if (CMD_CTX->mode == COMMAND_CONFIG)
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
||||||
|
return armv7m_trace_itm_config(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
COMMAND_HANDLER(handle_itm_ports_command)
|
COMMAND_HANDLER(handle_itm_ports_command)
|
||||||
|
@ -112,11 +115,14 @@ COMMAND_HANDLER(handle_itm_ports_command)
|
||||||
memset(armv7m->trace_config.itm_ter, enable ? 0xff : 0,
|
memset(armv7m->trace_config.itm_ter, enable ? 0xff : 0,
|
||||||
sizeof(armv7m->trace_config.itm_ter));
|
sizeof(armv7m->trace_config.itm_ter));
|
||||||
|
|
||||||
if (CMD_CTX->mode == COMMAND_EXEC)
|
/*
|
||||||
return armv7m_trace_itm_config(target);
|
* In config mode ITM is not accessible yet.
|
||||||
|
* Keep the value and it will be programmed at target init.
|
||||||
armv7m->trace_config.itm_deferred_config = true;
|
*/
|
||||||
|
if (CMD_CTX->mode == COMMAND_CONFIG)
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
||||||
|
return armv7m_trace_itm_config(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct command_registration itm_command_handlers[] = {
|
static const struct command_registration itm_command_handlers[] = {
|
||||||
|
|
|
@ -35,8 +35,6 @@ struct armv7m_trace_config {
|
||||||
bool itm_async_timestamps;
|
bool itm_async_timestamps;
|
||||||
/** Enable synchronisation packet transmission (for sync port only) */
|
/** Enable synchronisation packet transmission (for sync port only) */
|
||||||
bool itm_synchro_packets;
|
bool itm_synchro_packets;
|
||||||
/** Config ITM after target examine */
|
|
||||||
bool itm_deferred_config;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const struct command_registration armv7m_trace_command_handlers[];
|
extern const struct command_registration armv7m_trace_command_handlers[];
|
||||||
|
|
|
@ -2659,7 +2659,7 @@ int cortex_m_examine(struct target *target)
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (armv7m->trace_config.itm_deferred_config)
|
/* Configure ITM */
|
||||||
armv7m_trace_itm_config(target);
|
armv7m_trace_itm_config(target);
|
||||||
|
|
||||||
/* NOTE: FPB and DWT are both optional. */
|
/* NOTE: FPB and DWT are both optional. */
|
||||||
|
|
Loading…
Reference in New Issue