logging: Do not set CYCCNTENA to zero in swo backend

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 <am@toroid.io>
This commit is contained in:
Andrés Manelli 2021-04-17 11:17:20 +02:00 committed by Ioannis Glaropoulos
parent 2cff32b6c4
commit ecf89143da

View file

@ -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 */