-
Notifications
You must be signed in to change notification settings - Fork 3k
NANO130: Fix test failures with tickless from lp_ticker #12604
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
NANO130: Fix test failures with tickless from lp_ticker #12604
Conversation
@ccli8, thank you for your changes. |
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.
The rest looks fine, just that test fix should be made generic
TESTS/events/queue/main.cpp
Outdated
@@ -283,7 +283,12 @@ int timeleft_events[2]; | |||
void check_time_left(EventQueue *queue, int index, int expected) | |||
{ | |||
const int event_id = timeleft_events[index]; | |||
#if defined(TARGET_NANO100) | |||
/* Enlarge tolerance due to low CPU frequency and no cache */ | |||
TEST_ASSERT_INT_WITHIN(4, expected, queue->time_left(event_id)); |
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.
Can this be based on sys clock rather? What is the value for NANO100 ? We should not have this ifdef target in tests
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.
NANO100 runs at 48MHz and has no cache. The tolerance is just empirical. Do you have idea to improve this code?
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.
using SystemCoreClock
and make the tolerance based on its value
mbed_platform/atomic test does it for instance , or maybe better approach is to add tolerance. Like our flash tests do.
#define ALLOWED_DRIFT_PPM (1000000/5000) //0.5%
void flash_clock_and_cache_test()
{
const int timer_diff_end = time_cpu_cycles(TEST_CYCLES);
const int acceptable_range = timer_diff_start / (ALLOWED_DRIFT_PPM);
TEST_ASSERT_UINT32_WITHIN(acceptable_range, timer_diff_start, timer_diff_end);
}
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.
@0xc0170 Thanks for your sample. Changed the tolerance policy: for higher CPU frequency (80MHz or above), tolerance is fixed to 2ms as original; for lower CPU frequency (below 80MHz), tolerance is enlarged to inversely proportional to CPU frequency.
Most code doesn't check return code of CLK_WaitClockReady(...). Enlarge timeout to meet most cases. lp_ticker initialization fails with this issue. Steps for reproducing: 1. System runs in tickless from lp_ticker mode. 2. Arm WDT reset. 3. In next reset cycle, lp_ticker initialization fails (active flag doesn't become active).
NANO130 doesn't re-configure rtos.main-thread-stack-size, so keep EXPECTED_MAIN_THREAD_STACK_SIZE as normal.
106ffd3
to
c3473e4
Compare
CI started @ARMmbed/mbed-os-hal Can you review test change? |
Test run: FAILEDSummary: 1 of 6 test jobs failed Failed test jobs:
|
Failures look unrelated so restarting CI |
Test run: FAILEDSummary: 1 of 6 test jobs failed Failed test jobs:
|
Test restarted |
CI restarted |
Test run: SUCCESSSummary: 6 of 6 test jobs passed |
This PR does not contain release version label after merging. |
Summary of changes
This PR tries to fix test failures, most related to tickless from lp_ticker mode:
events-queue
test failure due to low CPU frequency and no cache on this target.mbed_hal-stack_size_unification
test failure due to inconsistent main stack size configuration.CLK_WaitClockReady(...)
.Pull request type
Test results