| # Copyright 2022 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("//pw_build:pigweed.bzl", "pw_cc_binary") |
| load("//targets/rp2040:flash.bzl", "flash_rp2040") |
| load("//targets/rp2040:transition.bzl", "rp2040_binary") |
| |
| package(default_visibility = ["//visibility:public"]) |
| |
| licenses(["notice"]) |
| |
| platform( |
| name = "rp2040", |
| constraint_values = [ |
| "@freertos//:port_ARM_CM0", |
| "@freertos//:disable_task_statics", |
| "@pico-sdk//bazel/constraint:rp2040", |
| "freertos_config_cv", |
| "//pw_build/constraints/chipset:rp2040", |
| "//pw_build/constraints/rtos:freertos", |
| "//pw_interrupt_cortex_m:backend", |
| "//pw_sys_io_rp2040:backend", |
| # For toolchain selection. |
| "@platforms//cpu:armv6-m", |
| "@pw_toolchain//constraints/arm_mcpu:cortex-m0plus", |
| "@rust_crates//:no_std", |
| ], |
| ) |
| |
| cc_library( |
| name = "extra_platform_libs", |
| deps = [ |
| ":pre_init", |
| "//pw_tokenizer:linker_script", |
| "@pico-sdk//src/common/pico_stdlib:pico_stdlib", |
| ], |
| ) |
| |
| cc_library( |
| name = "freertos_config", |
| hdrs = [ |
| "config/FreeRTOSConfig.h", |
| ], |
| includes = ["config/"], |
| target_compatible_with = [":freertos_config_cv"], |
| deps = ["//third_party/freertos:config_assert"], |
| ) |
| |
| constraint_value( |
| name = "freertos_config_cv", |
| constraint_setting = "@freertos//:freertos_config_setting", |
| ) |
| |
| cc_library( |
| name = "unit_test_app", |
| testonly = True, |
| srcs = [ |
| "unit_test_app.cc", |
| ], |
| deps = [ |
| "//pw_status", |
| "//pw_system", |
| "//pw_unit_test:rpc_service", |
| ], |
| alwayslink = True, |
| ) |
| |
| # This is just a stub to silence warnings saying that boot.cc and *.h files are |
| # missing from the bazel build. There's no plans yet to do a Bazel build for |
| # the Pi Pico. |
| filegroup( |
| name = "rp2040_files", |
| srcs = [ |
| "config/pigweed_module_config.h", |
| "config/rp2040_hal_config.h", |
| ], |
| ) |
| |
| cc_library( |
| name = "pre_init", |
| srcs = [ |
| "boot.cc", |
| ], |
| # TODO: b/261603269 - Get this to build. |
| tags = ["manual"], |
| target_compatible_with = [":freertos_config_cv"], |
| deps = [ |
| ":freertos_config", |
| "//pw_assert", |
| "//pw_assert:backend_impl", |
| "//pw_string", |
| "//pw_system:init", |
| "//third_party/freertos:support", |
| "@freertos", |
| "@pico-sdk//src/rp2_common/pico_stdlib:pico_stdlib", |
| ], |
| alwayslink = 1, |
| ) |
| |
| pw_cc_binary( |
| name = "system_async_example", |
| testonly = True, |
| srcs = ["system_async_example.cc"], |
| deps = [ |
| "//pw_channel:rp2_stdio_channel", |
| "//pw_multibuf:testing", |
| "//pw_system:async", |
| "//third_party/freertos:support", |
| "@freertos", |
| "@pico-sdk//src/rp2_common/pico_stdlib:pico_stdlib", |
| ], |
| ) |
| |
| rp2040_binary( |
| name = "rp2040_system_async_example", |
| testonly = True, |
| binary = ":system_async_example", |
| ) |
| |
| flash_rp2040( |
| name = "flash_rp2040_system_async_example", |
| testonly = True, |
| rp2040_binary = ":rp2040_system_async_example", |
| ) |