-
Notifications
You must be signed in to change notification settings - Fork 3k
STM: Fix Hal_GetTick wrap around errors #14215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@flippy84, thank you for your changes. |
|
||
HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) | ||
{ | ||
if (initialized) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for your contribution
Shouldn't HAL_InitTick content also be under critical section if this can happen that HAL_InitTick is called from several threads ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that is needed since HAL_InitTick is called before main() is called and no user threads are running yet.
I forgot to add include "hal/critical_section_api.h". Will add that include so it compiles without warnings in another commit. |
Hi ex:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - now must be tested by @jeromecoutant
@jeromecoutant I will look into the failed test and see if i can get it working. |
Hi @jeromecoutant, I sorted out the issue with the failed tests. It had to do with the double initialization code. I've removed that check and tested on a Nucleo F413ZH board. Attached is two test runs, one with the test that failed and the other a full test run. |
Tidied up the commit history, let me know if there is something else. |
Jenkins CI Test : ✔️ SUCCESSBuild Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
Summary of changes
This pull request changes the handling of the HAL_GetTick timer in the STM target.
Both commits prevents a wrap around when new_time < prev_time which results in the wrong number of ticks added to total_ticks.
Impact of changes
Migration actions required
Documentation
None
Pull request type
Test results
Tested and verified with J-Link Ozone execution counters.
Reviewers