-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add wait_ns API #9812
Add wait_ns API #9812
Conversation
c1372bc
to
b99806f
Compare
Added a timing test - this will test both that my tuning number ( |
Testing shows a bunch of failures: https://mbed-os.mbedcloudtesting.com/job/mbed-os-ci_greentea-test/1244/testReport/
Looks like I need to do something to make the M7 timing predictable - the nRF51 and RTL8195 seem to have some sort of target-specific problem - either a clock error or unexpectedly high interrupt load. |
f940807
to
ae6c8fd
Compare
Updated with something that I hope stabilises the M7 timing - Still need to figure out RTL8195 and NRF51_DK - maybe some input from relevant teams might be useful. |
@ARMmbed/team-realtek Can you review time differences for target? @ARMmbed/mbed-os-pan or @TacoGrandeTX could comment on NRF51_DK ? |
In my latest run RTL8195 and M7 devices passed, nRF51 still fails, and now Nucleo L073 and F072 failed too. https://mbed-os.mbedcloudtesting.com/job/mbed-os-ci_greentea-test/1257/testReport/ It's possible it's down to alignment again, rather than specific platforms - flash sometimes not able to keep up with the instruction flow? Rerunning that one to see if consistent for one build, and will keep fiddling. If I can't force alignment (seems to be hard to do), may be able to get it down to a tolerable difference between fast and slow alignment by putting enough NOPs in - smoothing out the flow. |
Some platforms seem to be quite persistently running 30% slower than expected, but not been able to lock down a cause. Falling back to making the upper tolerance bound higher, to try to make sure the test is stable. It would be nice to get it more precise, but for the sort of use case envisaged, taking 40% longer is acceptable. Trying some repeated test system runs to get confidence. |
This provides the ability to generate really small delays - it's often the case that wait_us() takes multiple microseconds to set up, so having an alternative suitable for <10us delays is useful. There have been a few local implementations - it makes sense to centralise them as they need retuning for each new ARM core. Based on the local implementation inside the Atmel 802.15.4 driver.
Nuvoton M2351 was including generic core_armv8mbl.h from CMSIS - we need it to be more specific to identify the specific core for wait_ns. Change to core_cm23.h.
#elif (__CORTEX_M == 0 && defined __CM0PLUS_REV) || __CORTEX_M == 3 || __CORTEX_M == 4 || \ | ||
__CORTEX_M == 23 || __CORTEX_M == 33 | ||
// Cortex-M0+, M3, M4, M23 and M33 take 6 cycles per iteration - SUBS = 1, 3xNOP = 2, BCS = 2 | ||
// TODO - check M33 |
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.
Could we resolve the TODO before committing this?
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.
We don't actually have any M33 targets yet, do we? So don't think I've got anything I can test this on.
My belief is that the M33 is basically an M4 in terms of internal architecture, but no firm evidence. Could leave the __CORTEX_M == 33
case out and deal with it when we have the first actual target.
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.
Looks good, but I don't like the TODO labels, we should either do it now or remove them as it won't happen later.
CI started |
@bulislaw A quick search of the Mbed OS repo found that we have 330 files with If that's the only problem with this PR, I wouldn't suggest holding it up. @kjbracey-arm It would be good to know why this is still here though. |
Test run: FAILEDSummary: 1 of 8 test jobs failed Failed test jobs:
|
Info: A CI config issue appears to be affecting Other build failures should still be investigated, if any. Will restart CI when appropriate. |
I approved the PR, so not holding it back, but I find it pointless to add |
CI restarted |
Do I need to rebase this or something? |
Not needed, it's in the CI queue (hooks here will be updated once it is executing). |
Test run: FAILEDSummary: 1 of 13 test jobs failed Failed test jobs:
|
Ci will be restarted (iar8 exporter issue we will resolve separately). |
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 adding this @kjbracey-arm
Based on the local implementation inside the Atmel 802.15.4 driver
It will be good to record somewhere that this local implementation should be removed and use the generic one implemented here.
Description
This provides the ability to generate really small delays - it's often
the case that wait_us() takes multiple microseconds to set up, so
having an alternative suitable for <10us delays is useful.
There have been a few local implementations - it makes sense to
centralise them as they need retuning for each new ARM core.
Based on the local implementation inside the Atmel 802.15.4 driver.
Pull request type
Reviewers
@c1728p9, @bulislaw
Release Notes