1# Copyright 2020 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 15import("//build_overrides/pigweed.gni") 16 17import("$dir_pw_build/defaults.gni") 18import("$dir_pw_sys_io/backend.gni") 19import("$dir_pw_toolchain/arm_gcc/toolchains.gni") 20 21declare_args() { 22 # Enable the pw_target_runner for on-device testing. 23 pw_arduino_use_test_server = false 24} 25_target_config = { 26 # Use the logging main. 27 pw_unit_test_MAIN = "$dir_pw_unit_test:simple_printing_main" 28 29 # Configuration options for Pigweed executable targets. 30 pw_build_EXECUTABLE_TARGET_TYPE = "arduino_executable" 31 32 pw_build_EXECUTABLE_TARGET_TYPE_FILE = 33 get_path_info("arduino_executable.gni", "abspath") 34 35 # Path to the bloaty config file for the output binaries. 36 pw_bloat_BLOATY_CONFIG = "$dir_pw_boot_cortex_m/bloaty_config.bloaty" 37 38 if (pw_arduino_use_test_server) { 39 _test_runner_script = 40 "$dir_pw_arduino_build/py/pw_arduino_build/unit_test_client.py" 41 pw_unit_test_AUTOMATIC_RUNNER = 42 get_path_info(_test_runner_script, "abspath") 43 } 44 45 # Facade backends 46 pw_assert_BACKEND = dir_pw_assert_basic 47 pw_log_BACKEND = dir_pw_log_basic 48 pw_sync_INTERRUPT_SPIN_LOCK_BACKEND = 49 "$dir_pw_sync_baremetal:interrupt_spin_lock" 50 pw_sync_MUTEX_BACKEND = "$dir_pw_sync_baremetal:mutex" 51 pw_rpc_CONFIG = "$dir_pw_rpc:disable_global_mutex" 52 pw_sys_io_BACKEND = dir_pw_sys_io_arduino 53 pw_rpc_system_server_BACKEND = "$dir_pw_hdlc:hdlc_sys_io_system_server" 54 pw_arduino_build_INIT_BACKEND = "$dir_pigweed/targets/arduino:pre_init" 55 56 pw_build_LINK_DEPS = [ 57 "$dir_pw_assert:impl", 58 "$dir_pw_log:impl", 59 ] 60 61 current_cpu = "arm" 62 current_os = "" 63} 64 65_toolchain_properties = { 66 final_binary_extension = ".elf" 67} 68 69_target_default_configs = pigweed_default_configs + [ 70 "$dir_pw_toolchain/arm_gcc:enable_float_printf", 71 "$dir_pigweed/targets/arduino:arduino_build", 72 ] 73 74pw_target_toolchain_arduino = { 75 _excluded_members = [ 76 "defaults", 77 "name", 78 ] 79 80 debug = { 81 name = "arduino_debug" 82 _toolchain_base = pw_toolchain_arm_gcc.cortex_m4f_debug 83 forward_variables_from(_toolchain_base, "*", _excluded_members) 84 forward_variables_from(_toolchain_properties, "*") 85 defaults = { 86 forward_variables_from(_toolchain_base.defaults, "*") 87 forward_variables_from(_target_config, "*") 88 default_configs = [] 89 default_configs = _target_default_configs 90 } 91 } 92 93 speed_optimized = { 94 name = "arduino_speed_optimized" 95 _toolchain_base = pw_toolchain_arm_gcc.cortex_m4f_speed_optimized 96 forward_variables_from(_toolchain_base, "*", _excluded_members) 97 forward_variables_from(_toolchain_properties, "*") 98 defaults = { 99 forward_variables_from(_toolchain_base.defaults, "*") 100 forward_variables_from(_target_config, "*") 101 default_configs = [] 102 default_configs = _target_default_configs 103 } 104 } 105 106 size_optimized = { 107 name = "arduino_size_optimized" 108 _toolchain_base = pw_toolchain_arm_gcc.cortex_m4f_size_optimized 109 forward_variables_from(_toolchain_base, "*", _excluded_members) 110 forward_variables_from(_toolchain_properties, "*") 111 defaults = { 112 forward_variables_from(_toolchain_base.defaults, "*") 113 forward_variables_from(_target_config, "*") 114 default_configs = [] 115 default_configs = _target_default_configs 116 } 117 } 118} 119 120# This list just contains the members of the above scope for convenience to make 121# it trivial to generate all the toolchains in this file via a 122# `generate_toolchains` target. 123pw_target_toolchain_arduino_list = [ 124 pw_target_toolchain_arduino.debug, 125 pw_target_toolchain_arduino.speed_optimized, 126 pw_target_toolchain_arduino.size_optimized, 127] 128