• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2023 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_log/backend.gni")
19import("$dir_pw_toolchain/arm_gcc/toolchains.gni")
20
21_target_config = {
22  pw_third_party_ambiq_PRODUCT = "apollo4p"
23
24  # Use the logging main.
25  pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main"
26
27  # Use ARM Cycle Counts
28  pw_perf_test_TIMER_INTERFACE_BACKEND = "$dir_pw_perf_test:arm_cortex_timer"
29
30  # Configuration options for Pigweed executable targets.
31  pw_build_EXECUTABLE_TARGET_TYPE = "apollo4_executable"
32
33  pw_build_EXECUTABLE_TARGET_TYPE_FILE =
34      get_path_info("apollo4_executable.gni", "abspath")
35
36  # Path to the bloaty config file for the output binaries.
37  pw_bloat_BLOATY_CONFIG = "$dir_pw_boot_cortex_m/bloaty_config.bloaty"
38
39  # Configure backend for assert facade.
40  pw_assert_BACKEND = dir_pw_assert_basic
41
42  pw_boot_BACKEND = "$dir_pw_boot_cortex_m"
43  pw_cpu_exception_ENTRY_BACKEND =
44      "$dir_pw_cpu_exception_cortex_m:cpu_exception"
45  pw_cpu_exception_HANDLER_BACKEND = "$dir_pw_cpu_exception:basic_handler"
46  pw_cpu_exception_SUPPORT_BACKEND = "$dir_pw_cpu_exception_cortex_m:support"
47  pw_sync_INTERRUPT_SPIN_LOCK_BACKEND =
48      "$dir_pw_sync_baremetal:interrupt_spin_lock"
49
50  # Configure backends for pw_sync's facades.
51  pw_sync_MUTEX_BACKEND = "$dir_pw_sync_baremetal:mutex"
52
53  # Configure backend for logging facade.
54  pw_log_BACKEND = "$dir_pw_log_basic"
55
56  # Configure backend for pw_sys_io facade.
57  pw_sys_io_BACKEND = "$dir_pw_sys_io_ambiq_sdk"
58
59  # Configure backend for pw_rpc_system_server.
60  pw_rpc_system_server_BACKEND = "$dir_pw_hdlc:hdlc_sys_io_system_server"
61  pw_rpc_CONFIG = "$dir_pw_rpc:disable_global_mutex"
62
63  pw_malloc_BACKEND = "$dir_pw_malloc:bucket_block_allocator"
64
65  pw_boot_cortex_m_LINK_CONFIG_DEFINES = [
66    "PW_BOOT_VECTOR_TABLE_BEGIN=0x00018000",
67    "PW_BOOT_VECTOR_TABLE_SIZE=512",
68
69    "PW_BOOT_FLASH_BEGIN=0x00018200",
70    "PW_BOOT_FLASH_SIZE=1951K",
71
72    "PW_BOOT_HEAP_SIZE=100K",
73    "PW_BOOT_MIN_STACK_SIZE=1K",
74
75    "PW_BOOT_RAM_BEGIN=0x10000000",
76    "PW_BOOT_RAM_SIZE=1408K",
77  ]
78
79  pw_build_LINK_DEPS = []  # Explicit list overwrite required by GN
80  pw_build_LINK_DEPS = [
81    "$dir_pw_assert:impl",
82    "$dir_pw_log:impl",
83    "$dir_pw_cpu_exception:entry_impl",
84    "$dir_pw_toolchain/arm_gcc:arm_none_eabi_gcc_support",
85  ]
86
87  current_cpu = "arm"
88  current_os = ""
89}
90
91_toolchain_properties = {
92  final_binary_extension = ".elf"
93}
94
95_target_default_configs = [
96  "$dir_pw_build:extra_strict_warnings",
97  "$dir_pw_toolchain/arm_gcc:enable_float_printf",
98]
99
100pw_target_toolchain_apollo4 = {
101  _excluded_members = [
102    "defaults",
103    "name",
104  ]
105
106  debug = {
107    name = "apollo4_debug"
108    _toolchain_base = pw_toolchain_arm_gcc.cortex_m4f_debug
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 += _target_default_configs
115    }
116  }
117
118  speed_optimized = {
119    name = "apollo4_speed_optimized"
120    _toolchain_base = pw_toolchain_arm_gcc.cortex_m4f_speed_optimized
121    forward_variables_from(_toolchain_base, "*", _excluded_members)
122    forward_variables_from(_toolchain_properties, "*")
123    defaults = {
124      forward_variables_from(_toolchain_base.defaults, "*")
125      forward_variables_from(_target_config, "*")
126      default_configs += _target_default_configs
127    }
128  }
129
130  size_optimized = {
131    name = "apollo4_size_optimized"
132    _toolchain_base = pw_toolchain_arm_gcc.cortex_m4f_size_optimized
133    forward_variables_from(_toolchain_base, "*", _excluded_members)
134    forward_variables_from(_toolchain_properties, "*")
135    defaults = {
136      forward_variables_from(_toolchain_base.defaults, "*")
137      forward_variables_from(_target_config, "*")
138      default_configs += _target_default_configs
139    }
140  }
141}
142
143# This list just contains the members of the above scope for convenience to make
144# it trivial to generate all the toolchains in this file via a
145# `generate_toolchains` target.
146pw_target_toolchain_apollo4_list = [
147  pw_target_toolchain_apollo4.debug,
148  pw_target_toolchain_apollo4.speed_optimized,
149  pw_target_toolchain_apollo4.size_optimized,
150]
151