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_compilation_testing/negative_compilation_test.gni") 18import("$dir_pw_perf_test/perf_test.gni") 19import("$dir_pw_rpc/system_server/backend.gni") 20import("$dir_pw_sys_io/backend.gni") 21import("$dir_pw_toolchain/arm_gcc/toolchains.gni") 22 23declare_args() { 24 # Enable the pw_target_runner for on-device testing. 25 pw_use_test_server = false 26} 27 28_target_config = { 29 # TODO(b/241565082): Enable NC testing in GN Windows when it is fixed. 30 pw_compilation_testing_NEGATIVE_COMPILATION_ENABLED = host_os != "win" 31 32 # Use the logging main. 33 pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main" 34 35 # Use ARM Cycle Counts 36 pw_perf_test_TIMER_INTERFACE_BACKEND = "$dir_pw_perf_test:arm_cortex_timer" 37 38 # Configuration options for Pigweed executable targets. 39 pw_build_EXECUTABLE_TARGET_TYPE = "stm32f429i_executable" 40 41 pw_build_EXECUTABLE_TARGET_TYPE_FILE = 42 get_path_info("stm32f429i_executable.gni", "abspath") 43 44 # Path to the bloaty config file for the output binaries. 45 pw_bloat_BLOATY_CONFIG = "$dir_pw_boot_cortex_m/bloaty_config.bloaty" 46 47 if (pw_use_test_server) { 48 _test_runner_script = "py/stm32f429i_disc1_utils/unit_test_client.py" 49 pw_unit_test_AUTOMATIC_RUNNER = 50 get_path_info(_test_runner_script, "abspath") 51 } 52 53 # Facade backends 54 pw_assert_BACKEND = dir_pw_assert_basic 55 pw_boot_BACKEND = "$dir_pw_boot_cortex_m" 56 pw_cpu_exception_ENTRY_BACKEND = 57 "$dir_pw_cpu_exception_cortex_m:cpu_exception" 58 pw_cpu_exception_HANDLER_BACKEND = "$dir_pw_cpu_exception:basic_handler" 59 pw_cpu_exception_SUPPORT_BACKEND = "$dir_pw_cpu_exception_cortex_m:support" 60 pw_sync_INTERRUPT_SPIN_LOCK_BACKEND = 61 "$dir_pw_sync_baremetal:interrupt_spin_lock" 62 pw_sync_MUTEX_BACKEND = "$dir_pw_sync_baremetal:mutex" 63 pw_rpc_CONFIG = "$dir_pw_rpc:disable_global_mutex" 64 pw_log_BACKEND = dir_pw_log_basic 65 pw_sys_io_BACKEND = dir_pw_sys_io_baremetal_stm32f429 66 pw_rpc_system_server_BACKEND = "$dir_pw_hdlc:hdlc_sys_io_system_server" 67 pw_malloc_BACKEND = dir_pw_malloc_freelist 68 69 pw_boot_cortex_m_LINK_CONFIG_DEFINES = [ 70 "PW_BOOT_FLASH_BEGIN=0x08000200", 71 "PW_BOOT_FLASH_SIZE=1024K", 72 73 # TODO(b/235348465): Currently "pw_tokenizer/detokenize_test" requires at 74 # least 6K bytes in heap when using pw_malloc_freelist. The heap size 75 # required for tests should be investigated. 76 # 77 # TLS realted tests such as $dir_pw_third_party/boringssl:tests require 78 # much larger heap for dynamic allocation. The current number is an 79 # estimated requirement. The acutal required size will be further investigated 80 # when all TLS tests are in place. 81 "PW_BOOT_HEAP_SIZE=112K", 82 "PW_BOOT_MIN_STACK_SIZE=1K", 83 "PW_BOOT_RAM_BEGIN=0x20000000", 84 "PW_BOOT_RAM_SIZE=192K", 85 "PW_BOOT_VECTOR_TABLE_BEGIN=0x08000000", 86 "PW_BOOT_VECTOR_TABLE_SIZE=512", 87 ] 88 89 pw_build_LINK_DEPS = [] 90 pw_build_LINK_DEPS = [ 91 "$dir_pw_assert:impl", 92 "$dir_pw_cpu_exception:entry_impl", 93 "$dir_pw_log:impl", 94 "$dir_pw_toolchain/arm_gcc:arm_none_eabi_gcc_support", 95 ] 96 97 current_cpu = "arm" 98 current_os = "" 99} 100 101_toolchain_properties = { 102 final_binary_extension = ".elf" 103} 104 105_target_default_configs = [ 106 "$dir_pw_build:extra_strict_warnings", 107 "$dir_pw_toolchain/arm_gcc:enable_float_printf", 108] 109 110pw_target_toolchain_stm32f429i_disc1 = { 111 _excluded_members = [ 112 "defaults", 113 "name", 114 ] 115 116 debug = { 117 name = "stm32f429i_disc1_debug" 118 _toolchain_base = pw_toolchain_arm_gcc.cortex_m4f_debug 119 forward_variables_from(_toolchain_base, "*", _excluded_members) 120 forward_variables_from(_toolchain_properties, "*") 121 defaults = { 122 forward_variables_from(_toolchain_base.defaults, "*") 123 forward_variables_from(_target_config, "*") 124 default_configs += _target_default_configs 125 } 126 } 127 128 speed_optimized = { 129 name = "stm32f429i_disc1_speed_optimized" 130 _toolchain_base = pw_toolchain_arm_gcc.cortex_m4f_speed_optimized 131 forward_variables_from(_toolchain_base, "*", _excluded_members) 132 forward_variables_from(_toolchain_properties, "*") 133 defaults = { 134 forward_variables_from(_toolchain_base.defaults, "*") 135 forward_variables_from(_target_config, "*") 136 default_configs += _target_default_configs 137 } 138 } 139 140 size_optimized = { 141 name = "stm32f429i_disc1_size_optimized" 142 _toolchain_base = pw_toolchain_arm_gcc.cortex_m4f_size_optimized 143 forward_variables_from(_toolchain_base, "*", _excluded_members) 144 forward_variables_from(_toolchain_properties, "*") 145 defaults = { 146 forward_variables_from(_toolchain_base.defaults, "*") 147 forward_variables_from(_target_config, "*") 148 default_configs += _target_default_configs 149 } 150 } 151} 152 153# This list just contains the members of the above scope for convenience to make 154# it trivial to generate all the toolchains in this file via a 155# `generate_toolchains` target. 156pw_target_toolchain_stm32f429i_disc1_list = [ 157 pw_target_toolchain_stm32f429i_disc1.debug, 158 pw_target_toolchain_stm32f429i_disc1.speed_optimized, 159 pw_target_toolchain_stm32f429i_disc1.size_optimized, 160] 161