-
Notifications
You must be signed in to change notification settings - Fork 3k
Use LP tickers for waiting in no RTOS builds when available #9960
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
@marcuschangarm, thank you for your changes. |
@marcuschangarm - This will enable both lpticker and usticker by default. Faced similar challenges with RTOS version - #8189 @kjbracey-arm @bulislaw - Can provide more input on this for bare metal version. |
Only if the user actually calls wait_us. Also, presumably the cost of enabling the lp ticker is negligible if you already have the us ticker running.
We can keep the float version as-is. I'm more concerned about having to use the us ticker by default for wait_ms on systems that supports lp ticker. |
wait_us is called from multiple places in mbed-os code base
Limitation is not of float, lpticker precision is in msec |
Could we check what's the difference?
I'm also afraid we are going further and further apart between RTOS and non-RTOS implementations, wait_ms with RTOS will use RTX osDelay. The way it works is a bit weird and timing is absolutely not guaranteed (I think it's something like osDelay(5) for 1ms tick will sleep for 4-5ms). It's good idea to use LPTicker rather than usticker whenever possible, but we should clean up the "wait" calls and make them behave in a predictable way between both OS variants. |
Exactly, I would expect msec precision from an API that takes msec as input and usec precision from an API that takes usec as input. |
100% with you on this, just that existing implementation was not like that :-( hence functionality change. |
True, but I believe all instances in the core code are because they specifically need an "IRQ-safe busywait" rather than "sleep", not because they want precision. Not sure about stuff in targets. This ties in with JIRA ISGDEVPREQ-1083, in which I propose fundamentally separating the What most normal users of There was recent talk about changing For a non-RTOS build, I think having at least a low power timer running is going to be almost a given - you need something to be your timebase. Emulation of But more care is needed in the "always present" bits to avoid pulling any timers into bootloaders or secure libraries that otherwise need no timing at all - either don't try for blinky LED on So, this PR is an incremental improvement, but if we're going to go ahead with wider changes proposed in ISGDEVPREQ-1083, both changes are redundant, as both affected calls are to be deprecated. Still, no reason to block this, so I basically approve. |
👍 |
@ARMmbed/mbed-os-core Please review |
Scheduling Ci while finalizing reviews |
Test run: FAILEDSummary: 6 of 7 test jobs failed Failed test jobs:
|
platform/mbed_wait_api_no_rtos.c
Outdated
uint32_t start = ticker_read(ticker); | ||
while ((ticker_read(ticker) - start) < (uint32_t)(ms * 1000)); | ||
#else | ||
wait_us(ms * 1000) |
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.
missing ;
- see the build failures
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.
Whoops! 😄
ci started |
Test run: FAILEDSummary: 1 of 11 test jobs failed Failed test jobs:
|
@marcuschangarm please take a look at the test failure |
I restarted the test, the latest test logs have no failure, and hook showed error that should be fixed now on master. |
Restarted ci |
Test run: FAILEDSummary: 2 of 11 test jobs failed Failed test jobs:
|
CI restarted |
@marcuschangarm Can you rebase this PR please? the error in dynamic memory job is configuration error that I've noticed in another Pr that is also weeks old (assuming the CI job was updated - configuration changed). Rebase should fix it |
For bare metal builds, use the lp_ticker for calls to wait_ms.
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
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.
Still fine with this - I will need to rebase my #10104. (I think it does the same thing differently, will double-check).
Description
For bare metal builds, use the lp_ticker for calls to wait_ms.
Pull request type
Reviewers
Release Notes
For bare metal builds, use the lp_ticker for calls to wait_ms instead of us ticker if lp_ticker is available.