| # Copyright 2024 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:pigweed.bzl", "pw_cc_test") |
| load("@rules_cc//cc:defs.bzl", "cc_binary") |
| load("@zephyr//:defs.bzl", "dts_cc_library") |
| |
| package(default_visibility = ["//visibility:public"]) |
| |
| label_flag( |
| name = "pw_assert_backend_impl", |
| build_setting_default = "@pigweed//pw_assert_log:assert_backend", |
| ) |
| |
| dts_cc_library( |
| name = "app_host_dts", |
| dts_lib = "@zephyr//boards/native/native_sim:native_sim", |
| ) |
| |
| cc_binary( |
| name = "app", |
| srcs = ["hello_dts.cc"], |
| copts = select({ |
| "@platforms//cpu:armv7e-m": [], |
| "@platforms//cpu:x86_64": [ |
| "-DCONFIG_ARCH_POSIX=1", |
| ], |
| }), |
| malloc = select({ |
| "@platforms//cpu:armv7e-m": "@pigweed//pw_malloc", |
| "@platforms//cpu:x86_64": "@bazel_tools//tools/cpp:malloc", |
| }), |
| deps = [ |
| "@pigweed//pw_assert:backend_impl", |
| "@pigweed//pw_log", |
| "@pigweed//pw_log:backend_impl", |
| "@pigweed//pw_sys_io", |
| "@zephyr", |
| ] + select({ |
| "@platforms//cpu:armv7e-m": [ |
| "@pigweed//pw_toolchain/arm_gcc:arm_none_eabi_gcc_support", |
| "@pigweed//targets/stm32f429i_disc1:basic_linker_script", |
| "@pigweed//targets/stm32f429i_disc1:pre_init", |
| ], |
| "@platforms//cpu:x86_64": [ |
| ":app_host_dts", |
| "@zephyr//include:posix", |
| ], |
| }), |
| ) |
| |
| pw_cc_test( |
| name = "test", |
| srcs = [ |
| "native_sim_test.cc", |
| ], |
| deps = [ |
| ":app_host_dts", |
| "@zephyr", |
| "@zephyr//include:posix", |
| ], |
| copts = [ |
| "-DCONFIG_ARCH_POSIX=1", |
| ], |
| ) |