| # Licensed under the Apache-2.0 license |
| |
| load("@rules_rust//rust:defs.bzl", "rust_binary") |
| load("//target/ast1060-evb:defs.bzl", "TARGET_COMPATIBLE_WITH") |
| load("@pigweed//pw_kernel/tooling:app_linker_script.bzl", "app_linker_script") |
| load("@pigweed//pw_kernel/tooling:rust_app.bzl", "rust_app_codegen") |
| load("@pigweed//pw_kernel/tooling:system_image.bzl", "system_image", "system_image_test") |
| load("@pigweed//pw_kernel/tooling:target_codegen.bzl", "target_codegen") |
| load("@pigweed//pw_kernel/tooling:target_linker_script.bzl", "target_linker_script") |
| load("//target:uart_boot_image.bzl", "uart_boot_image") |
| load("//target/ast1060-evb/harness:uart_upload_test.bzl", "uart_upload", "uart_upload_test") |
| load("@pigweed//pw_kernel/tooling/panic_detector:rust_binary_no_panics_test.bzl", "rust_binary_no_panics_test") |
| |
| exports_files([ |
| "spdm_loopback_test.rs", |
| "mock_platform.rs", |
| ]) |
| |
| system_image( |
| name = "spdm_loopback_test", |
| apps = [ |
| ":spdm_loopback_test_app", |
| ], |
| kernel = ":target", |
| platform = "//target/ast1060-evb", |
| system_config = ":system_config", |
| tags = ["kernel"], |
| visibility = ["//visibility:public"], |
| ) |
| |
| system_image_test( |
| name = "spdm_loopback_test_qemu", |
| image = ":spdm_loopback_test", |
| target_compatible_with = TARGET_COMPATIBLE_WITH, |
| ) |
| |
| rust_binary_no_panics_test( |
| name = "no_panics_test", |
| binary = ":spdm_loopback_test", |
| tags = ["kernel"], |
| ) |
| |
| # Generate UART bootable image with size header for physical board flashing |
| uart_boot_image( |
| name = "spdm_loopback_test_uart", |
| src = ":spdm_loopback_test", |
| out = "spdm_loopback_test_uart.bin", |
| ) |
| |
| # UART upload test - uploads firmware and monitors test execution |
| # Run with: bazel test :spdm_loopback_test_uart_test --test_env=UART_DEVICE=/dev/ttyUSB0 |
| uart_upload_test( |
| name = "spdm_loopback_test_uart_test", |
| image = ":spdm_loopback_test_uart", |
| skip_gpio = True, |
| tags = [ |
| "exclusive", |
| "local", |
| "manual", |
| ], |
| test_timeout = 300, |
| ) |
| |
| # Upload-only target for manual testing |
| # Run with: bazel run :upload_spdm_loopback_test |
| uart_upload( |
| name = "upload_spdm_loopback_test", |
| image = ":spdm_loopback_test_uart", |
| skip_gpio = True, |
| ) |
| |
| filegroup( |
| name = "system_config", |
| srcs = ["system.json5"], |
| visibility = ["//visibility:public"], |
| ) |
| |
| target_codegen( |
| name = "codegen", |
| arch = "@pigweed//pw_kernel/arch/arm_cortex_m:arch_arm_cortex_m", |
| system_config = ":system_config", |
| target_compatible_with = TARGET_COMPATIBLE_WITH, |
| ) |
| |
| target_linker_script( |
| name = "linker_script", |
| system_config = ":system_config", |
| tags = ["kernel"], |
| target_compatible_with = TARGET_COMPATIBLE_WITH, |
| template = "//target/ast1060-evb:linker_script_template", |
| ) |
| |
| rust_binary( |
| name = "target", |
| srcs = [ |
| "target.rs", |
| ], |
| edition = "2024", |
| tags = ["kernel"], |
| target_compatible_with = TARGET_COMPATIBLE_WITH, |
| deps = [ |
| ":codegen", |
| ":linker_script", |
| "@pigweed//pw_kernel/arch/arm_cortex_m:arch_arm_cortex_m", |
| "@pigweed//pw_kernel/kernel", |
| "//target/ast1060-evb:console_backend_uart", |
| "@pigweed//pw_kernel/target:target_common", |
| "//target/ast1060-evb:entry", |
| "@pigweed//pw_kernel/userspace", |
| "@pigweed//pw_log/rust:pw_log", |
| "@oot_crates_no_std//:cortex-m-semihosting", |
| ], |
| ) |
| |
| rust_app_codegen( |
| name = "app_spdm_loopback_test", |
| app_name = "spdm_loopback_test", |
| edition = "2024", |
| system_config = ":system_config", |
| tags = ["kernel"], |
| target_compatible_with = TARGET_COMPATIBLE_WITH, |
| ) |
| |
| app_linker_script( |
| name = "spdm_loopback_test_app.linker_script", |
| app_name = "spdm_loopback_test", |
| system_config = ":system_config", |
| tags = ["kernel"], |
| ) |
| |
| rust_binary( |
| name = "spdm_loopback_test_app", |
| srcs = [ |
| "spdm_loopback_test.rs", |
| "mock_platform.rs", |
| ], |
| crate_root = "spdm_loopback_test.rs", |
| edition = "2024", |
| tags = ["kernel"], |
| target_compatible_with = TARGET_COMPATIBLE_WITH, |
| deps = [ |
| ":app_spdm_loopback_test", |
| ":spdm_loopback_test_app.linker_script", |
| "//services/mctp/transport-loopback:mctp_transport_loopback", |
| "//services/spdm/transport-mctp:spdm_transport_mctp", |
| "@pigweed//pw_kernel/syscall:syscall_user", |
| "@pigweed//pw_kernel/userspace", |
| "@pigweed//pw_log/rust:pw_log", |
| "@pigweed//pw_status/rust:pw_status", |
| "@oot_crates_no_std//:spdm-lib", |
| ], |
| ) |