1 /*
2  * Copyright (c) 2021 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /*
8  * Weak stub implementation of threading related kernel functions.
9  *
10  * This file is needed for armlink.
11  *
12  * When linking with armlink the linker will resolve undefined symbols for all
13  * undefined functions even if those functions the reference the undefined
14  * symbol is never actually called.
15  *
16  * This file provides weak stub implementations that are compiled when
17  * CONFIG_MULTITHREADING=n to ensure proper linking.
18  */
19 
20 #include <zephyr/kernel.h>
21 
z_impl_k_mutex_init(struct k_mutex * mutex)22 int __weak z_impl_k_mutex_init(struct k_mutex *mutex)
23 {
24 	return 0;
25 }
26 
z_impl_k_mutex_lock(struct k_mutex * mutex,k_timeout_t timeout)27 int __weak z_impl_k_mutex_lock(struct k_mutex *mutex, k_timeout_t timeout)
28 {
29 	return 0;
30 }
31 
z_impl_k_mutex_unlock(struct k_mutex * mutex)32 int __weak z_impl_k_mutex_unlock(struct k_mutex *mutex)
33 {
34 	return 0;
35 }
36 
z_impl_k_sem_give(struct k_sem * sem)37 void __weak z_impl_k_sem_give(struct k_sem *sem)
38 {
39 }
40 
z_impl_k_sem_init(struct k_sem * sem,unsigned int initial_count,unsigned int limit)41 int __weak z_impl_k_sem_init(struct k_sem *sem, unsigned int initial_count,
42 		      unsigned int limit)
43 {
44 	return 0;
45 }
46 
z_impl_k_sem_take(struct k_sem * sem,k_timeout_t timeout)47 int __weak z_impl_k_sem_take(struct k_sem *sem, k_timeout_t timeout)
48 {
49 	return 0;
50 }
51 
z_impl_k_sched_current_thread_query(void)52 k_tid_t __weak z_impl_k_sched_current_thread_query(void)
53 {
54 	return 0;
55 }
56 
z_impl_k_usleep(int us)57 int32_t __weak z_impl_k_usleep(int us)
58 {
59 	return 0;
60 }
61 
z_thread_abort(struct k_thread * thread)62 void __weak z_thread_abort(struct k_thread *thread)
63 {
64 }
65 
k_sched_lock(void)66 void __weak k_sched_lock(void)
67 {
68 }
69 
k_sched_unlock(void)70 void __weak k_sched_unlock(void)
71 {
72 }
73