blob: 1abaa757c83f00bcf779e288c897bcb19bbebd20 [file] [log] [blame]
# Copyright 2024 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
package(default_visibility = ["//visibility:public"])
cc_library(
name = "offset",
hdrs = [
"include/gen_offset.h",
"include/kernel_arch_interface.h",
"include/kernel_internal.h",
"include/kernel_offsets.h",
],
copts = ["-include generated/zephyr/autoconf.h"],
includes = ["include"],
deps = [
"//:autoconf_library",
"//include:zephyr",
],
)
cc_library(
name = "kernel",
srcs = [
"banner.c",
"busy_wait.c",
"device.c",
"errno.c",
"fatal.c",
"float.c",
"init.c",
"init_static.c",
"kheap.c",
"main_weak.c",
"mem_slab.c",
"version.c",
] + select({
"//conditions:default": [],
"@kconfig//:CONFIG_MULTITHREADING=true": [
"idle.c",
"mailbox.c",
"msg_q.c",
"mutex.c",
"queue.c",
"sem.c",
"stack.c",
"system_work_q.c",
"work.c",
"condvar.c",
"priority_queues.c",
"thread.c",
"sched.c",
],
}) + select({
"//conditions:default": [],
"@kconfig//:CONFIG_TIMESLICING=true": ["timeslicing.c"],
}) + select({
"//conditions:default": [],
"@kconfig//:CONFIG_XIP=true": ["xip.c"],
}) + select({
"//conditions:default": [],
"@kconfig//:CONFIG_SYS_CLOCK_EXISTS=true": [
"timeout.c",
"timer.c",
],
}) + select({
"//conditions:default": ["dynamic_disabled.c"],
"@kconfig//:CONFIG_DYNAMIC_THREAD=true": [],
}) + select({
"//conditions:default": [],
"@kconfig//:CONFIG_KERNEL_MEM_POOL=true": ["mempool.c"],
}) + select({
"//conditions:default": [],
"@kconfig//:CONFIG_SPIN_VALIDATE=true": ["spinlock_validate.c"],
}) + select({
"//conditions:default": [],
"@kconfig//:CONFIG_POLL=true": ["poll.c"],
}) + select({
"//conditions:default": [],
"@kconfig//:CONFIG_EVENTS=true": ["events.c"],
}) + select({
"//conditions:default": [],
"@kconfig//:CONFIG_THREAD_MONITOR=true": ["thread_monitor.c"],
}),
hdrs = glob(["include/*.h"]),
copts = [
"-include generated/zephyr/autoconf.h",
"-include $(location //:autoconf_file)",
],
includes = ["include"],
deps = [
"//:autoconf_library",
"//:dts_cc_library",
"//:offsets_header_lib",
"//:syscall_list",
"//:zephyr",
"//include:zephyr",
"//lib/heap",
"//lib/os",
"@zephyr_version//:version",
],
additional_compiler_inputs = ["//:autoconf_file"],
alwayslink = True,
)