tests: fix thread function signatures

Fix thread function signatures to avoid stack corruption on thread exit.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
This commit is contained in:
Benedikt Schmidt 2023-10-04 09:50:39 +02:00 committed by Carles Cufí
commit aa25e212d1
42 changed files with 447 additions and 148 deletions

View file

@ -51,8 +51,12 @@ K_SEM_DEFINE(sync_sema, 0, 1);
* gets the first timestamp and invokes the software interrupt.
*
*/
static void thread_one(void)
static void thread_one(void *p1, void *p2, void *p3)
{
ARG_UNUSED(p1);
ARG_UNUSED(p2);
ARG_UNUSED(p3);
k_sem_take(&sync_sema, K_FOREVER);
timestamp_start = timing_counter_get();
@ -75,8 +79,12 @@ static void thread_one(void)
*
* @return 0 on success
*/
static void thread_two(void)
static void thread_two(void *p1, void *p2, void *p3)
{
ARG_UNUSED(p1);
ARG_UNUSED(p2);
ARG_UNUSED(p3);
k_sem_give(&sync_sema);
while (ctx_switch_counter < NCTXSWITCH) {
k_yield();
@ -104,10 +112,10 @@ int coop_ctx_switch(void)
bench_test_start();
k_thread_create(&thread_one_data, thread_one_stack, STACKSIZE,
(k_thread_entry_t)thread_one, NULL, NULL, NULL,
thread_one, NULL, NULL, NULL,
K_PRIO_COOP(6), 0, K_NO_WAIT);
k_thread_create(&thread_two_data, thread_two_stack, STACKSIZE,
(k_thread_entry_t)thread_two, NULL, NULL, NULL,
thread_two, NULL, NULL, NULL,
K_PRIO_COOP(6), 0, K_NO_WAIT);
end = bench_test_end();

View file

@ -60,14 +60,18 @@ static void worker(struct k_work *item)
*
* @return 0 on success
*/
void int_thread(void)
void int_thread(void *p1, void *p2, void *p3)
{
ARG_UNUSED(p1);
ARG_UNUSED(p2);
ARG_UNUSED(p3);
k_sem_take(&INTSEMA, K_FOREVER);
irq_offload(latency_test_isr, NULL);
k_thread_suspend(k_current_get());
}
K_THREAD_DEFINE(int_thread_id, 512, (k_thread_entry_t)int_thread, NULL, NULL,
K_THREAD_DEFINE(int_thread_id, 512, int_thread, NULL, NULL,
NULL, 11, 0, 0);
/**