Skip to content

Commit

Permalink
logging: Do not set CYCCNTENA to zero in swo backend
Browse files Browse the repository at this point in the history
The log_backend_swo_init function sets the CYCCNTENA bit of the DWT
register to 0, disabling the counter (which is necessary for the timing
functions.
Avoid overwriting the CYCCNTENA bit.
Do not try to set read-only bits.

Fixes #34341

Signed-off-by: Andrés Manelli <[email protected]>
  • Loading branch information
andresmanelli authored and ioannisg committed Apr 22, 2021
1 parent 2cff32b commit ecf8914
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion subsys/logging/log_backend_swo.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ static void log_backend_swo_init(struct log_backend const *const backend)
/* Enable unprivileged access to ITM stimulus ports */
ITM->TPR = 0x0;
/* Configure Debug Watchpoint and Trace */
DWT->CTRL = 0x400003FE;
DWT->CTRL &= (DWT_CTRL_POSTPRESET_Msk | DWT_CTRL_POSTINIT_Msk | DWT_CTRL_CYCCNTENA_Msk);
DWT->CTRL |= (DWT_CTRL_POSTPRESET_Msk | DWT_CTRL_POSTINIT_Msk);
/* Configure Formatter and Flush Control Register */
TPI->FFCR = 0x00000100;
/* Enable ITM, set TraceBusID=1, no local timestamp generation */
Expand Down

0 comments on commit ecf8914

Please sign in to comment.