2019-04-06 21:08:09 +08:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2017-10-27 21:43:34 +08:00
|
|
|
# kernel is a normal CMake library and not a zephyr_library because it
|
|
|
|
# should not be --whole-archive'd
|
|
|
|
add_library(kernel
|
|
|
|
device.c
|
|
|
|
errno.c
|
2019-07-12 05:18:28 +08:00
|
|
|
fatal.c
|
2017-10-27 21:43:34 +08:00
|
|
|
idle.c
|
|
|
|
init.c
|
2020-04-04 01:01:03 +08:00
|
|
|
kheap.c
|
2017-10-27 21:43:34 +08:00
|
|
|
mailbox.c
|
|
|
|
mem_slab.c
|
|
|
|
mempool.c
|
|
|
|
msg_q.c
|
|
|
|
mutex.c
|
|
|
|
pipes.c
|
|
|
|
queue.c
|
|
|
|
sched.c
|
|
|
|
sem.c
|
|
|
|
stack.c
|
|
|
|
system_work_q.c
|
|
|
|
thread.c
|
|
|
|
thread_abort.c
|
|
|
|
version.c
|
|
|
|
work_q.c
|
2018-01-30 01:23:49 +08:00
|
|
|
smp.c
|
2018-03-28 17:46:48 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
# Kernel files has the macro __ZEPHYR_SUPERVISOR__ set so that it
|
|
|
|
# optimizes the code when userspace is enabled.
|
|
|
|
set_target_properties(
|
|
|
|
kernel
|
|
|
|
PROPERTIES
|
|
|
|
COMPILE_DEFINITIONS
|
|
|
|
__ZEPHYR_SUPERVISOR__
|
|
|
|
)
|
2017-10-27 21:43:34 +08:00
|
|
|
|
|
|
|
target_sources_ifdef(CONFIG_STACK_CANARIES kernel PRIVATE compiler_stack_protect.c)
|
2018-09-28 07:50:00 +08:00
|
|
|
target_sources_ifdef(CONFIG_SYS_CLOCK_EXISTS kernel PRIVATE timeout.c timer.c)
|
2017-10-27 21:43:34 +08:00
|
|
|
target_sources_ifdef(CONFIG_ATOMIC_OPERATIONS_C kernel PRIVATE atomic_c.c)
|
|
|
|
target_sources_if_kconfig( kernel PRIVATE poll.c)
|
|
|
|
|
2020-04-04 06:39:25 +08:00
|
|
|
if(${CONFIG_MEM_POOL_HEAP_BACKEND})
|
|
|
|
else()
|
|
|
|
target_sources(kernel PRIVATE mempool_sys.c)
|
|
|
|
endif()
|
|
|
|
|
2017-12-14 17:07:00 +08:00
|
|
|
# The last 2 files inside the target_sources_ifdef should be
|
|
|
|
# userspace_handler.c and userspace.c. If not the linker would complain.
|
|
|
|
# This order has to be maintained. Any new file should be placed
|
|
|
|
# above these 2 files.
|
2017-10-27 21:43:34 +08:00
|
|
|
target_sources_ifdef(
|
|
|
|
CONFIG_USERSPACE
|
|
|
|
kernel PRIVATE
|
2019-06-20 23:51:27 +08:00
|
|
|
futex.c
|
2017-10-27 21:43:34 +08:00
|
|
|
mem_domain.c
|
2017-12-14 17:07:00 +08:00
|
|
|
userspace_handler.c
|
|
|
|
userspace.c
|
2017-10-27 21:43:34 +08:00
|
|
|
)
|
|
|
|
|
2019-10-24 23:08:21 +08:00
|
|
|
target_include_directories(kernel PRIVATE
|
|
|
|
${ZEPHYR_BASE}/kernel/include
|
|
|
|
${ZEPHYR_BASE}/arch/${ARCH}/include
|
|
|
|
)
|
2018-03-28 17:46:48 +08:00
|
|
|
|
2020-01-23 22:39:17 +08:00
|
|
|
add_dependencies(kernel zephyr_generated_headers)
|
2017-10-27 21:43:34 +08:00
|
|
|
|
|
|
|
target_link_libraries(kernel zephyr_interface)
|