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