| # Licensed under the Apache-2.0 license |
| |
| load("@pigweed//pw_build:merge_flags.bzl", "flags_from_dict") |
| load("@pigweed//pw_kernel:flags.bzl", "KERNEL_DEVICE_COMMON_FLAGS") |
| load("@rules_rust//rust:defs.bzl", "rust_library") |
| load("//target/ast1060-evb:defs.bzl", "TARGET_COMPATIBLE_WITH") |
| |
| package(default_visibility = [":__subpackages__"]) |
| |
| platform( |
| name = "ast1060-evb", |
| constraint_values = [ |
| ":target_ast1060_evb", |
| # Use cortex-m3 to get soft-float ABI (compatible with thumbv7m-none-eabi Rust target) |
| # The actual AST1060 has a Cortex-M4F with FPU, but QEMU emulation works fine with M3 settings |
| "@pigweed//pw_build/constraints/arm:cortex-m3", |
| "@platforms//cpu:armv7-m", |
| "@platforms//os:none", |
| "@pigweed//pw_build/constraints/rust:no_std", |
| ], |
| flags = flags_from_dict( |
| KERNEL_DEVICE_COMMON_FLAGS | { |
| "@pigweed//pw_kernel/config:kernel_config": ":config", |
| # TODO: Switch to :console_backend_uart when aspeed-ddk uart driver is available |
| "@pigweed//pw_kernel/subsys/console:console_backend": "@pigweed//pw_kernel/subsys/console:console_backend_semihosting", |
| }, |
| ), |
| ) |
| |
| constraint_value( |
| name = "target_ast1060_evb", |
| constraint_setting = "@pigweed//pw_kernel/target:target", |
| ) |
| |
| rust_library( |
| name = "entry", |
| srcs = ["entry.rs"], |
| crate_features = ["jtag-halt"], |
| edition = "2024", |
| tags = ["kernel"], |
| target_compatible_with = TARGET_COMPATIBLE_WITH, |
| deps = [ |
| ":console_backend_uart", |
| "@pigweed//pw_kernel/arch/arm_cortex_m:arch_arm_cortex_m", |
| "@pigweed//pw_kernel/kernel", |
| "@pigweed//pw_status/rust:pw_status", |
| "@oot_crates_no_std//:aspeed-ddk", |
| "@oot_crates_no_std//:ast1060-pac", |
| "@oot_crates_no_std//:cortex-m-rt", |
| ], |
| ) |
| |
| rust_library( |
| name = "console_backend_uart", |
| srcs = ["console_backend.rs"], |
| crate_name = "console_backend", |
| edition = "2024", |
| tags = ["kernel"], |
| target_compatible_with = TARGET_COMPATIBLE_WITH, |
| deps = [ |
| "@oot_crates_no_std//:ast1060-pac", |
| "@pigweed//pw_status/rust:pw_status", |
| "@pigweed//pw_kernel/arch/arm_cortex_m:arch_arm_cortex_m", |
| "@pigweed//pw_kernel/kernel", |
| "@oot_crates_no_std//:aspeed-ddk", |
| "@oot_crates_no_std//:embedded-hal", |
| "@oot_crates_no_std//:embedded-io", |
| ], |
| ) |
| |
| rust_library( |
| name = "config", |
| srcs = ["config.rs"], |
| crate_name = "kernel_config", |
| edition = "2024", |
| tags = ["kernel"], |
| visibility = ["//target:__subpackages__"], |
| deps = [ |
| "@pigweed//pw_kernel/config:kernel_config_interface", |
| ], |
| ) |
| |
| filegroup( |
| name = "linker_script_template", |
| srcs = ["target.ld.tmpl"], |
| visibility = ["//target:__subpackages__"], |
| ) |