Skip to content

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion TESTS/events/queue/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ using namespace utest::v1;
// (for more details about EVENTS_EVENT_SIZE see EventQueue constructor)
#define TEST_EQUEUE_SIZE (18*EVENTS_EVENT_SIZE)

// By empirical, we take 80MHz CPU/2ms delay as base tolerance for time left test.
// For higher CPU frequency, tolerance is fixed to 2ms.
// For lower CPU frequency, tolerance is inversely proportional to CPU frequency.
// E.g.:
// 100MHz: 2ms
// 80MHz: 2ms
// 64MHz: 3ms
// 48MHz: 4ms
#define ALLOWED_TIME_LEFT_TOLERANCE_MS ((SystemCoreClock >= 80000000) ? 2 : ((80000000 * 2 + SystemCoreClock - 1) / SystemCoreClock))

// flag for called
volatile bool touched = false;

Expand Down Expand Up @@ -283,7 +293,7 @@ int timeleft_events[2];
void check_time_left(EventQueue *queue, int index, int expected)
{
const int event_id = timeleft_events[index];
TEST_ASSERT_INT_WITHIN(2, expected, queue->time_left(event_id));
TEST_ASSERT_INT_WITHIN(ALLOWED_TIME_LEFT_TOLERANCE_MS, expected, queue->time_left(event_id));
touched = true;
}

Expand Down
2 changes: 1 addition & 1 deletion TESTS/mbed_hal/stack_size_unification/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ extern uint32_t mbed_stack_isr_size;
#define EXPECTED_ISR_STACK_SIZE (1024)
#endif

#if defined(TARGET_NUCLEO_F070RB) || defined(TARGET_NANO100) || defined(TARGET_STM32F072RB) || defined(TARGET_TMPM46B) || defined(TARGET_TMPM066)
#if defined(TARGET_NUCLEO_F070RB) || defined(TARGET_STM32F072RB) || defined(TARGET_TMPM46B) || defined(TARGET_TMPM066)
#define EXPECTED_MAIN_THREAD_STACK_SIZE (3072)
#else
#define EXPECTED_MAIN_THREAD_STACK_SIZE (4096)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ uint32_t CLK_WaitClockReady(uint32_t u32ClkMask)
{
int32_t i32TimeOutCnt;

i32TimeOutCnt = __HSI / 200; /* About 5ms */
i32TimeOutCnt = __HSI / 20; /* About 50ms */

while((CLK->CLKSTATUS & u32ClkMask) != u32ClkMask) {
if(i32TimeOutCnt-- <= 0)
Expand Down