Skip to content

Commit a4070ec

Browse files
committed
Set SysTick CLKSOURCE bit before enabling SysTick
1 parent aa987a3 commit a4070ec

File tree

1 file changed

+6
-2
lines changed
  • portable/ARMv8M/non_secure

1 file changed

+6
-2
lines changed

portable/ARMv8M/non_secure/port.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,12 @@ __attribute__( ( weak ) ) void vPortSetupTimerInterrupt( void ) /* PRIVILEGED_FU
620620
}
621621
#endif /* configUSE_TICKLESS_IDLE */
622622

623-
/* Stop and reset the SysTick. */
624-
portNVIC_SYSTICK_CTRL_REG = 0UL;
623+
/* Stop and reset the SysTick. Set the CLKSOURCE bit now while the SysTick
624+
* is stopped to accommodate a bug in QEMU versions older than 7.0.0. The
625+
* code that starts Systick (below) sets or clears the CLKSOURCE to match
626+
* the build configuration, so this temporary setting of the CLKSOURCE bit
627+
* has no impact on the actual operation of the SysTick. */
628+
portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT;
625629
portNVIC_SYSTICK_CURRENT_VALUE_REG = 0UL;
626630

627631
/* Configure SysTick to interrupt at the requested rate. */

0 commit comments

Comments
 (0)