arch: cortex_m: Fix dwt cyccnt assert

Fix the assert that checks for existence of a cycle counter.

The field is named NO CYCCNT, so when it is 1, there is no cycle
counter. But we are asserting the opposite.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
This commit is contained in:
Sebastian Bøe 2021-12-10 11:01:21 +01:00 committed by Ioannis Glaropoulos
commit 1f87642f08

View file

@ -99,8 +99,10 @@ static inline int z_arm_dwt_init_cycle_counter(void)
DWT->CYCCNT = 0;
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
/* Assert that the cycle counter is indeed implemented. */
__ASSERT((DWT->CTRL & DWT_CTRL_NOCYCCNT_Msk) != 0,
/* Assert that the cycle counter is indeed implemented.
* The field is called NOCYCCNT. So 1 means there is no cycle counter.
*/
__ASSERT((DWT->CTRL & DWT_CTRL_NOCYCCNT_Msk) == 0,
"DWT implements no cycle counter. "
"Cannot be used for cycle counting\n");