blob: 186c95a209638cb4291971ae3359be8837e3eb14 [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("@pigweed//pw_kernel/tooling/panic_detector:rust_binary_no_panics_test.bzl", "rust_binary_no_panics_test")
load("@rules_rust//rust:defs.bzl", "rust_binary")
load("//target/veer:defs.bzl", "TARGET_COMPATIBLE_WITH")
load("//target/veer/tooling:caliptra_runner.bzl", "caliptra_runner", "caliptra_test")
rust_app(
name = "syscall_latency",
srcs = [
"main.rs",
],
codegen_crate_name = "app_syscall_latency",
crate_features = select({
"//target/veer:emulator": ["emulator"],
"//target/veer:fpga": ["fpga"],
"//target/veer:silicon": ["silicon"],
"//conditions:default": [],
}),
crate_name = "syscall_latency",
edition = "2024",
system_config = "@pigweed//pw_kernel/target:system_config_file",
tags = ["kernel"],
target_compatible_with = TARGET_COMPATIBLE_WITH,
deps = [
"//target/veer:config",
"@pigweed//pw_base64/rust:pw_base64",
"@pigweed//pw_kernel/syscall:syscall_user",
"@pigweed//pw_kernel/userspace",
"@pigweed//pw_log/rust:pw_log",
"@pigweed//pw_status/rust:pw_status",
],
)
system_image(
name = "measure_syscall_latency",
apps = [
":syscall_latency",
],
kernel = ":target",
platform = "//target/veer",
system_config = ":system_config",
tags = ["kernel"],
)
target_linker_script(
name = "linker_script",
system_config = ":system_config",
tags = ["kernel"],
template = "//target/veer: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/veer:entry",
"@pigweed//pw_kernel/arch/riscv:arch_riscv",
"@pigweed//pw_kernel/kernel",
"@pigweed//pw_kernel/lib/memory_config",
"@pigweed//pw_kernel/subsys/console:console_backend",
"@pigweed//pw_kernel/target:target_common",
"@pigweed//pw_kernel/userspace",
"@pigweed//pw_log/rust:pw_log",
],
)
rust_binary_no_panics_test(
name = "no_panics_test",
binary = ":measure_syscall_latency",
tags = ["kernel"],
)
caliptra_runner(
name = "measure_syscall_latency_emulator",
interface = "emulator",
tags = ["manual"],
target = ":measure_syscall_latency",
)
caliptra_test(
name = "measure_syscall_latency_emulator_test",
timeout = "long",
interface = "emulator",
# caliptra_runner.py hardcodes --i3c-port=65534, so caliptra emulator
# tests cannot run in parallel without an EADDRINUSE collision.
tags = [
"emulator",
"exclusive",
],
target = ":measure_syscall_latency",
)