1# Copyright 2024 The Pigweed Authors 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4# use this file except in compliance with the License. You may obtain a copy of 5# the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12# License for the specific language governing permissions and limitations under 13# the License. 14 15"""Bazel transitions for the rp2xxx series.""" 16 17load("@rules_platform//platform_data:defs.bzl", "platform_data") 18load("//third_party/freertos:flags.bzl", "FREERTOS_FLAGS") 19 20# Typical RP2040 pw_system backends and other platform configuration flags. 21RP2_SYSTEM_FLAGS = FREERTOS_FLAGS | { 22 "@bazel_tools//tools/cpp:link_extra_libs": str(Label("@pigweed//targets/rp2040:extra_platform_libs")), 23 "@freertos//:freertos_config": str(Label("//targets/rp2040:freertos_config")), 24 "@pico-sdk//bazel/config:PICO_CLIB": "llvm_libc", 25 "@pico-sdk//bazel/config:PICO_STDIO_UART": True, 26 "@pico-sdk//bazel/config:PICO_STDIO_USB": True, 27 "@pico-sdk//bazel/config:PICO_TOOLCHAIN": "clang", 28 "@pigweed//pw_assert:assert_backend": str(Label("//pw_assert_trap:assert_backend")), 29 "@pigweed//pw_assert:assert_backend_impl": str(Label("//pw_assert_trap:impl")), 30 "@pigweed//pw_assert:check_backend": str(Label("//pw_assert_trap:check_backend")), 31 "@pigweed//pw_assert:check_backend_impl": str(Label("//pw_assert_trap:impl")), 32 "@pigweed//pw_bloat:pw_size_report_bloaty_config": str(Label("//targets/rp2040:bloaty_config")), 33 "@pigweed//pw_build:default_module_config": str(Label("//targets/rp2040:pigweed_module_config")), 34 "@pigweed//pw_cpu_exception:entry_backend": str(Label("//pw_cpu_exception_cortex_m:cpu_exception")), 35 "@pigweed//pw_cpu_exception:entry_backend_impl": str(Label("//pw_cpu_exception_cortex_m:cpu_exception_impl")), 36 "@pigweed//pw_cpu_exception:handler_backend": str(Label("//pw_cpu_exception:basic_handler")), 37 "@pigweed//pw_cpu_exception:support_backend": str(Label("//pw_cpu_exception_cortex_m:support")), 38 "@pigweed//pw_crypto:ecdsa_backend": str(Label("//pw_crypto:ecdsa_mbedtls")), 39 "@pigweed//pw_crypto:sha256_backend": str(Label("//pw_crypto:sha256_mbedtls")), 40 "@pigweed//pw_interrupt:backend": str(Label("//pw_interrupt_cortex_m:context")), 41 "@pigweed//pw_log:backend": str(Label("//pw_log_tokenized")), 42 "@pigweed//pw_log:backend_impl": str(Label("//pw_log_tokenized:impl")), 43 "@pigweed//pw_log_tokenized:handler_backend": str(Label("//pw_system:log_backend")), 44 "@pigweed//pw_sys_io:backend": str(Label("//pw_sys_io_rp2040")), 45 "@pigweed//pw_system:device_handler_backend": str(Label("//targets/rp2040:device_handler")), 46 "@pigweed//pw_system:extra_platform_libs": str(Label("//targets/rp2040:extra_platform_libs")), 47 "@pigweed//pw_toolchain:cortex-m_toolchain_kind": "clang", 48 "@pigweed//pw_trace:backend": str(Label("//pw_trace_tokenized:pw_trace_tokenized")), 49 "@pigweed//pw_unit_test:backend": str(Label("//pw_unit_test:light")), 50 "@pigweed//pw_unit_test:main": str(Label("//targets/rp2040:unit_test_app")), 51} 52 53def rp2040_binary(name = "", binary = "", testonly = False): 54 return platform_data(name = name, target = binary, testonly = testonly, platform = "//targets/rp2040:rp2040") 55 56def rp2350_binary(name = "", binary = "", testonly = False): 57 return platform_data(name = name, target = binary, testonly = testonly, platform = "//targets/rp2040:rp2350") 58