blob: 5f81a6543a0b20734986b9b570071df6da22d29c [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("@pigweed//pw_build:merge_flags.bzl", "flags_from_dict")
load("@rules_rust//rust:defs.bzl", "rust_library")
constraint_value(
name = "rp235x",
constraint_setting = "@pigweed//pw_build/constraints/chipset:chipset",
visibility = ["//visibility:public"],
)
cc_library(
name = "rp2350_linker_script",
linkopts = ["-T$(location rp2350.ld)"],
target_compatible_with = [":rp235x"],
deps = [
"rp2350.ld",
],
)
platform(
name = "rp2350",
constraint_values = [
":rp235x",
"@pigweed//pw_build/constraints/arm:cortex-m33",
"@platforms//cpu:armv8-m",
"@platforms//os:none",
"@rust_crates//:no_std",
],
flags = flags_from_dict({
"//arch:arch_backend": "//arch/arm_cortex_m:arm_cortex_m",
"//target:target_backend": ":target_rp2350",
"//lib/unittest:unittest_runner": "//lib/unittest:unittest_runner_cortex_m",
"//kernel/sync:spinlock_backend": "//arch/arm_cortex_m:spinlock_backend_cortex_m",
"//target:linker_script": "//target/rp:rp2350_linker_script",
"//subsys/console:console_backend": ":console_backend",
}),
)
rust_library(
name = "console_backend",
srcs = ["console_backend.rs"],
target_compatible_with = select({
":rp235x": [],
"//conditions:default": ["@platforms//:incompatible"],
}),
visibility = ["//visibility:public"],
deps = [
"//kernel/sync:spinlock",
"//lib/pw_status",
"@rust_crates//:embedded-io",
"@rust_crates//:rp235x-hal",
],
)
rust_library(
name = "target_rp2350",
srcs = ["target_rp2350.rs"],
crate_name = "target_backend",
deps = [
":console_backend",
"//target:target_interface",
"@rust_crates//:cortex-m-rt",
"@rust_crates//:panic-halt",
"@rust_crates//:rp235x-hal",
],
)