diff --git a/portable/ARMv8M/non_secure/port.c b/portable/ARMv8M/non_secure/port.c index 9976daee49a..04f4cd14ef7 100644 --- a/portable/ARMv8M/non_secure/port.c +++ b/portable/ARMv8M/non_secure/port.c @@ -620,8 +620,12 @@ __attribute__( ( weak ) ) void vPortSetupTimerInterrupt( void ) /* PRIVILEGED_FU } #endif /* configUSE_TICKLESS_IDLE */ - /* Stop and reset the SysTick. */ - portNVIC_SYSTICK_CTRL_REG = 0UL; + /* Stop and reset the SysTick. Set the CLKSOURCE bit now while the SysTick + * is stopped to accommodate a bug in QEMU versions older than 7.0.0. The + * code that starts Systick (below) sets or clears the CLKSOURCE to match + * the build configuration, so this temporary setting of the CLKSOURCE bit + * has no impact on the actual operation of the SysTick. */ + portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT; portNVIC_SYSTICK_CURRENT_VALUE_REG = 0UL; /* Configure SysTick to interrupt at the requested rate. */