From 847b7ccbcc72cd4d160d79a6bdf9483d292013e1 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 31 Oct 2018 10:48:32 +0100 Subject: [PATCH] tests: kernel tickless: Bugfix for POSIX arch in TICKLESS In the POSIX architecture, with the inf_clock "SOC", time does not pass while the CPU is running. Tests that require time to pass while busy waiting should call k_busy_wait() or in some other way set the CPU to idle. This test was setting the CPU to idle while waiting for the next time slice. This is ok if the system tick (timer) is active and awaking the CPU every system tick period. But when configured in tickless mode that is not the case, and the CPU was set to sleep for an indefinite amount of time. This commit fixes it by using k_busy_wait(a few microseconds) inside that busy wait loop instead. Signed-off-by: Alberto Escolar Piedras --- tests/kernel/tickless/tickless_concept/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/kernel/tickless/tickless_concept/src/main.c b/tests/kernel/tickless/tickless_concept/src/main.c index d0b39b97cf3..49b108ff99f 100644 --- a/tests/kernel/tickless/tickless_concept/src/main.c +++ b/tests/kernel/tickless/tickless_concept/src/main.c @@ -33,7 +33,7 @@ static struct k_thread tdata[NUM_THREAD]; do { \ u32_t t = k_uptime_get_32(); \ while (t == k_uptime_get_32()) \ - posix_halt_cpu(); \ + k_busy_wait(50); \ } while (0) #else #define ALIGN_MS_BOUNDARY() \