realprocrastinator opened a new pull request, #18153: URL: https://github.com/apache/nuttx/pull/18153
## Summary ARM SysTick requires programming RELOAD = N - 1 to achieve a period of N CPU cycles. This change fixes an off-by-one in the SysTick reload/timeout conversions by: subtracting 1 when writing RELOAD, and adding 1 back when reporting timeouts/intervals derived from RELOAD clamping RELOAD to the valid 24-bit range (1..0x00ffffff) on Armv7-M and Armv8-M to avoid invalid values This prevents subtle time drift (short “jiffies”) when the desired tick interval is computed from CPU frequency and timeout. Reference: [https://developer.arm.com/documentation/dui0646/c/Cortex-M7-Peripherals/System-timer--SysTick/SysTick-Reload-Value-Register](vscode-file://vscode-app/c:/Users/MI/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/code/electron-browser/workbench/workbench.html) ## Impact Users/behavior: More accurate SysTick timing; avoids systematic drift caused by programming RELOAD = N instead of N-1. Compatibility: No API changes; behavior change is limited to SysTick timing on Armv7-M/Armv8-M ports using the SysTick lower-half. ## Testing - Testing was performed on a custom Cortex-M7 board. - I configured SysTick for a 1 ms interval and monitored the system over an extended runtime. - Compared to the previous behavior, the long-term timing drift was significantly reduced. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
