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