blob: d1e737b930f3e468a6f8169d24ece5446821e437 [file]
# Licensed under the Apache-2.0 license
# SPDX-License-Identifier: Apache-2.0
load("@pigweed//pw_kernel/tooling:rust_app.bzl", "rust_app")
load("@pigweed//pw_kernel/tooling:system_image.bzl", "system_image")
load("@pigweed//pw_kernel/tooling:target_codegen.bzl", "target_codegen")
load("@pigweed//pw_kernel/tooling:target_linker_script.bzl", "target_linker_script")
load("@rules_rust//rust:defs.bzl", "rust_binary")
load("//target/earlgrey:defs.bzl", "TARGET_COMPATIBLE_WITH")
load("//target/earlgrey/tooling:opentitan_runner.bzl", "opentitan_test")
rust_app(
name = "test_gpio",
srcs = [
"test_gpio.rs",
],
codegen_crate_name = "test_gpio_codegen",
edition = "2024",
system_config = "@pigweed//pw_kernel/target:system_config_file",
tags = ["kernel"],
target_compatible_with = TARGET_COMPATIBLE_WITH,
visibility = ["//visibility:public"],
deps = [
"//hal/blocking",
"//target/earlgrey/drivers:gpio",
"//target/earlgrey/drivers:pinmux",
"//target/earlgrey/registers",
"@pigweed//pw_kernel/userspace",
"@pigweed//pw_log/rust:pw_log",
"@pigweed//pw_status/rust:pw_status",
],
)
system_image(
name = "gpio",
apps = [
":test_gpio",
],
kernel = ":target",
platform = "//target/earlgrey",
system_config = ":system_config",
tags = ["kernel"],
)
target_linker_script(
name = "linker_script",
system_config = ":system_config",
tags = ["kernel"],
template = "//target/earlgrey:linker_script_template",
)
filegroup(
name = "system_config",
srcs = ["system.json5"],
)
target_codegen(
name = "codegen",
arch = "@pigweed//pw_kernel/arch/riscv:arch_riscv",
system_config = ":system_config",
)
rust_binary(
name = "target",
srcs = [
"target.rs",
],
edition = "2024",
tags = ["kernel"],
target_compatible_with = TARGET_COMPATIBLE_WITH,
deps = [
":codegen",
":linker_script",
"//target/earlgrey:entry",
"@pigweed//pw_kernel/arch/riscv:arch_riscv",
"@pigweed//pw_kernel/kernel",
"@pigweed//pw_kernel/subsys/console:console_backend",
"@pigweed//pw_kernel/target:target_common",
"@pigweed//pw_kernel/userspace",
"@pigweed//pw_log/rust:pw_log",
],
)
opentitan_test(
name = "gpio_verilator_test",
timeout = "eternal",
interface = "verilator",
tags = [
"verilator",
],
target = ":gpio",
)
# TODO: QEMU ot-earlgrey machine has no ot_gpio device model — DIRECT_OUT reads
# return 0. Re-enable when upstream lowRISC QEMU lands ot_gpio emulation.