blob: 52a5b92f35b81a63d4f08d9d57a4d530ffe5b1d0 [file] [log] [blame]
# Copyright 2025 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("@rules_rust//rust:defs.bzl", "rust_binary")
load("//pw_build:compatibility.bzl", "incompatible_with_mcu")
package(default_visibility = ["//visibility:public"])
CORTEX_M_DEPS = [
"@rust_crates//:cortex-m",
"@rust_crates//:cortex-m-rt",
]
RISCV_DEPS = [
"@rust_crates//:riscv",
"@rust_crates//:riscv-rt",
]
rust_binary(
name = "kernel",
srcs = ["kernel.rs"],
crate_features = select({
"//pw_build/constraints/arm:cortex-m33": ["arch_arm_cortex_m"],
"@platforms//cpu:riscv32": ["arch_riscv"],
"//conditions:default": ["arch_host"],
}),
edition = "2021",
tags = ["kernel"],
target_compatible_with = select({
"//pw_build/constraints/arm:cortex-m33": [],
"//pw_build/constraints/chipset:mps2-an505": [],
"//pw_build/constraints/chipset:qemu-virt": [],
"//pw_build/constraints/chipset:rp2350": [],
"@platforms//cpu:riscv32": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
deps = [
"//pw_kernel/kernel",
"//pw_kernel/subsys/console:console_backend",
"//pw_kernel/target",
"//pw_kernel/target:linker_script",
] + select({
"@pigweed//pw_build/constraints/arm:cortex-m33": CORTEX_M_DEPS,
"@platforms//cpu:riscv32": RISCV_DEPS,
"//conditions:default": [],
}),
)
rust_binary(
name = "kernel_host",
srcs = ["kernel_host.rs"],
edition = "2021",
tags = ["kernel"],
target_compatible_with = incompatible_with_mcu(),
deps = [
"//pw_kernel/kernel",
"//pw_kernel/subsys/console:console_backend",
"//pw_kernel/target",
],
)