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