Commit 1f87642f authored by Sebastian Bøe's avatar Sebastian Bøe Committed by Ioannis Glaropoulos
Browse files

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: default avatarSebastian Bøe <sebastian.boe@nordicsemi.no>
parent 58234d49
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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");