| # 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. |
| |
| import("//build_overrides/pi_pico.gni") |
| import("//build_overrides/pigweed.gni") |
| |
| import("$dir_pw_build/target_types.gni") |
| import("$dir_pw_docgen/docs.gni") |
| import("$dir_pw_toolchain/arm_gcc/toolchains.gni") |
| import("$dir_pw_toolchain/generate_toolchain.gni") |
| |
| if (current_toolchain != default_toolchain) { |
| pw_source_set("pico_logging_test_main") { |
| # Required because the pico SDK can't properly propagate -Wno-undef and |
| # -Wno-unused-function because of Pigweed's very unusual default_configs |
| # behavior. |
| remove_configs = [ "$dir_pw_build:strict_warnings" ] |
| deps = [ |
| "$PICO_ROOT/src/common/pico_base", |
| "$PICO_ROOT/src/common/pico_stdlib", |
| "$dir_pw_unit_test:logging_event_handler", |
| "$dir_pw_unit_test:pw_unit_test", |
| ] |
| sources = [ "pico_logging_test_main.cc" ] |
| } |
| |
| config("elf2uf2_configs") { |
| include_dirs = [ "$PICO_SRC_DIR/src/common/boot_uf2/include" ] |
| cflags_cc = [ "-std=gnu++14" ] |
| } |
| |
| pw_executable("elf2uf2") { |
| configs = [ ":elf2uf2_configs" ] |
| sources = [ "$PICO_SRC_DIR/tools/elf2uf2/main.cpp" ] |
| remove_configs = [ "$dir_pw_build:strict_warnings" ] |
| } |
| } |
| |
| generate_toolchain("rp2040") { |
| _excluded_members = [ |
| "defaults", |
| "name", |
| ] |
| _toolchain_base = pw_toolchain_arm_gcc.cortex_m0plus_size_optimized |
| forward_variables_from(_toolchain_base, "*", _excluded_members) |
| final_binary_extension = ".elf" |
| |
| # For now, no Pigweed configurations set up. |
| defaults = { |
| forward_variables_from(_toolchain_base.defaults, "*") |
| |
| pw_build_EXECUTABLE_TARGET_TYPE = "pico_executable" |
| pw_build_EXECUTABLE_TARGET_TYPE_FILE = |
| get_path_info("$dir_pigweed/targets/rp2040/pico_executable.gni", |
| "abspath") |
| pw_unit_test_MAIN = "$dir_pigweed/targets/rp2040:pico_logging_test_main" |
| pw_assert_BACKEND = dir_pw_assert_basic |
| pw_log_BACKEND = dir_pw_log_basic |
| pw_sys_io_BACKEND = "$dir_pw_sys_io_stdio" |
| |
| pw_sync_INTERRUPT_SPIN_LOCK_BACKEND = |
| "$dir_pw_sync_baremetal:interrupt_spin_lock" |
| pw_sync_MUTEX_BACKEND = "$dir_pw_sync_baremetal:mutex" |
| |
| # Silence GN variable overwrite warning. |
| pw_build_LINK_DEPS = [] |
| |
| pw_build_LINK_DEPS = [ |
| "$dir_pw_assert:impl", |
| "$dir_pw_log:impl", |
| ] |
| |
| # Configure backend for pw_board_led |
| pw_board_led_BACKEND = "$dir_pw_board_led_pico" |
| |
| # Configure backend for pw_spin_delay |
| pw_spin_delay_BACKEND = "$dir_pw_spin_delay_pico" |
| |
| # Configure backend for pw_display |
| # pw_display_null does nothing. |
| pw_display_BACKEND = "$dir_pw_display_null" |
| |
| # pw_display_pico_ili9341 is for a ILI9341 screen connected over SPI. |
| if (PICO_SRC_DIR != "") { |
| # pw_display_BACKEND = "$dir_pw_display_pico_ili9341" |
| pw_display_BACKEND = "$dir_pw_display_pico_st7789_spi" |
| } |
| |
| # Configure backend for pw_touchscreen |
| pw_touchscreen_BACKEND = "$dir_pw_touchscreen_null" |
| |
| current_cpu = "arm" |
| current_os = "" |
| } |
| } |