|  | # 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. | 
|  |  | 
|  | # load("@bazel_skylib//rules:common_settings.bzl", "label_flag") | 
|  | load("@rules_cc//cc:defs.bzl", "cc_library") | 
|  | load(":defs.bzl", "syscall_library_files", "zephyr_offset_header") | 
|  |  | 
|  | package(default_visibility = ["//visibility:public"]) | 
|  |  | 
|  | exports_files(glob(["**"])) | 
|  |  | 
|  | cc_library( | 
|  | name = "syscall_tracing", | 
|  | hdrs = [ | 
|  | "//include:zephyr/llext/symbol.h", | 
|  | "//include:zephyr/sys/__assert.h", | 
|  | "//include:zephyr/sys/iterable_sections.h", | 
|  | "//include:zephyr/toolchain.h", | 
|  | "//include:zephyr/toolchain/common.h", | 
|  | "//include:zephyr/toolchain/gcc.h", | 
|  | "//include:zephyr/tracing/tracing_syscall.h", | 
|  | ], | 
|  | includes = ["include"], | 
|  | ) | 
|  |  | 
|  | syscall_library_files( | 
|  | name = "syscall_files", | 
|  | hdrs = [ | 
|  | "//include:zephyr/cache.h", | 
|  | "//include:zephyr/device.h", | 
|  | "//include:zephyr/drivers/counter.h", | 
|  | "//include:zephyr/drivers/entropy.h", | 
|  | "//include:zephyr/drivers/gpio.h", | 
|  | "//include:zephyr/drivers/uart.h", | 
|  | "//include:zephyr/drivers/watchdog.h", | 
|  | "//include:zephyr/kernel.h", | 
|  | "//include:zephyr/logging/log_ctrl.h", | 
|  | "//include:zephyr/logging/log_msg.h", | 
|  | "//include:zephyr/random/random.h", | 
|  | "//include:zephyr/sys/kobject.h", | 
|  | "//include:zephyr/sys/libc-hooks.h", | 
|  | ], | 
|  | # deps = [ | 
|  | #     ":syscall_tracing", | 
|  | #     "//kernel", | 
|  | # ], | 
|  | ) | 
|  |  | 
|  | cc_library( | 
|  | name = "syscall_list", | 
|  | hdrs = [":syscall_files"], | 
|  | includes = ["include/generated"], | 
|  | ) | 
|  |  | 
|  | label_flag( | 
|  | name = "dts_cc_library", | 
|  | build_setting_default = "@pigweed//pw_build:unspecified_backend", | 
|  | ) | 
|  |  | 
|  | label_flag( | 
|  | name = "autoconf_library", | 
|  | build_setting_default = "@pigweed//pw_build:unspecified_backend", | 
|  | ) | 
|  |  | 
|  | label_flag( | 
|  | name = "autoconf_file", | 
|  | build_setting_default = "@pigweed//pw_build:unspecified_backend", | 
|  | ) | 
|  |  | 
|  | label_flag( | 
|  | name = "soc", | 
|  | build_setting_default = "@pigweed//pw_build:unspecified_backend", | 
|  | ) | 
|  |  | 
|  | label_flag( | 
|  | name = "soc_linkerscript", | 
|  | build_setting_default = "@pigweed//pw_build:unspecified_backend", | 
|  | ) | 
|  |  | 
|  | label_flag( | 
|  | name = "offsets_lib", | 
|  | build_setting_default = "@pigweed//pw_build:unspecified_backend", | 
|  | ) | 
|  |  | 
|  | zephyr_offset_header( | 
|  | name = "offsets_header", | 
|  | lib = ":offsets_lib", | 
|  | tool = "//scripts/build:gen_offset_header", | 
|  | output = "zephyr/offsets.h" | 
|  | ) | 
|  |  | 
|  | cc_library( | 
|  | name = "offsets_header_lib", | 
|  | hdrs = [":offsets_header"], | 
|  | includes = ["."], | 
|  | ) | 
|  |  | 
|  | cc_library( | 
|  | name = "zephyr", | 
|  | hdrs = [ | 
|  | "//include:core", | 
|  | "//kernel:include/offsets_short.h", | 
|  | ], | 
|  | includes = [ | 
|  | "dts", | 
|  | "dts/common", | 
|  | "include", | 
|  | ], | 
|  | deps = [ | 
|  | ], | 
|  | ) | 
|  |  | 
|  | cc_library( | 
|  | name = "cortex_m", | 
|  | hdrs = [ | 
|  | "//arch/arm:cortex_m", | 
|  | "//include:zephyr/arch/arm/cortex_m/arm_mpu_mem_cfg.h", | 
|  | "//include:zephyr/arch/arm/cortex_m/cpu.h", | 
|  | "//include:zephyr/arch/arm/cortex_m/exception.h", | 
|  | "//include:zephyr/arch/arm/cortex_m/fpu.h", | 
|  | "//include:zephyr/arch/arm/cortex_m/memory_map.h", | 
|  | "//include:zephyr/arch/arm/cortex_m/nvic.h", | 
|  | "//include:zephyr/arch/arm/mpu/arm_mpu.h", | 
|  | "//include:zephyr/arch/arm/mpu/arm_mpu_v7m.h", | 
|  | ], | 
|  | copts = ["-include generated/zephyr/autoconf.h"], | 
|  | includes = [ | 
|  | "arch/arm/include", | 
|  | "include", | 
|  | ], | 
|  | deps = [ | 
|  | "//:autoconf_library", | 
|  | "//:dts_cc_library", | 
|  | "//:zephyr", | 
|  | "//modules/cmsis", | 
|  | "@cmsis//:core", | 
|  | ], | 
|  | ) | 
|  |  | 
|  | exports_files([ | 
|  | "cc.bzl", | 
|  | "defs.bzl", | 
|  | ]) |