xref: /aosp_15_r20/external/pigweed/targets/mimxrt595_evk_freertos/target_toolchains.gni (revision 61c4878ac05f98d0ceed94b57d316916de578985)
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_pigweed/targets/common/freertos.gni")
18import("$dir_pw_boot/backend.gni")
19import("$dir_pw_log/backend.gni")
20import("$dir_pw_rpc/system_server/backend.gni")
21import("$dir_pw_sys_io/backend.gni")
22import("$dir_pw_toolchain/arm_gcc/toolchains.gni")
23
24_target_config = {
25  # This target uses FreeRTOS.
26  forward_variables_from(pw_targets_FREERTOS_BACKEND_GROUP, "*")
27  pw_thread_THREAD_ITERATION_BACKEND = ""
28  pw_third_party_freertos_DISABLE_TASKS_STATICS = true
29
30  # Use the logging main.
31  pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main"
32
33  # Configuration options for Pigweed executable targets.
34  pw_build_EXECUTABLE_TARGET_TYPE = "mimxrt595_executable"
35
36  pw_build_EXECUTABLE_TARGET_TYPE_FILE =
37      get_path_info("mimxrt595_executable.gni", "abspath")
38
39  # Facade backends
40  pw_assert_BACKEND = dir_pw_assert_basic
41  pw_boot_BACKEND = "$dir_pw_boot_cortex_m:armv8m"
42  pw_interrupt_CONTEXT_BACKEND = "$dir_pw_interrupt_cortex_m:context_armv8m"
43  pw_log_BACKEND = dir_pw_log_basic
44  pw_malloc_BACKEND = "$dir_pw_malloc:bucket_block_allocator"
45  pw_sys_io_BACKEND = "$dir_pw_sys_io_mcuxpresso"
46
47  pw_rpc_system_server_BACKEND = "$dir_pw_hdlc:hdlc_sys_io_system_server"
48
49  # Override the default pw_boot_cortex_m linker script and set the memory
50  # regions for the target.
51  pw_boot_cortex_m_LINKER_SCRIPT =
52      "//targets/mimxrt595_evk_freertos:flash_linker_script"
53  pw_target_mimxrt595_evk_freertos_LINK_CONFIG_DEFINES = [
54    "PW_BOOT_FLASH_BEGIN=0x08001180",
55    "PW_BOOT_FLASH_SIZE=0x001FEE80",
56    "PW_BOOT_HEAP_SIZE=200K",
57    "PW_BOOT_MIN_STACK_SIZE=1K",
58    "PW_BOOT_RAM_BEGIN=0x20080000",
59    "PW_BOOT_RAM_SIZE=0x00280000",
60    "PW_BOOT_VECTOR_TABLE_BEGIN=0x08001000",
61    "PW_BOOT_VECTOR_TABLE_SIZE=0x00000180",
62  ]
63
64  # Use FreeRTOS with locally specified config and port.
65  pw_third_party_freertos_CONFIG =
66      "//targets/mimxrt595_evk_freertos:freertos_config"
67  pw_third_party_freertos_PORT =
68      "//targets/mimxrt595_evk_freertos:freertos_port"
69
70  pw_build_LINK_DEPS = [
71    "$dir_pw_assert:impl",
72    "$dir_pw_log:impl",
73    "$dir_pw_toolchain/arm_gcc:arm_none_eabi_gcc_support",
74  ]
75
76  current_cpu = "arm"
77  current_os = ""
78}
79
80_toolchain_properties = {
81  final_binary_extension = ".elf"
82}
83
84_target_default_configs = [
85  "$dir_pw_build:extra_strict_warnings",
86  "$dir_pw_toolchain/arm_gcc:enable_float_printf",
87]
88
89pw_target_toolchain_mimxrt595_evk_freertos = {
90  _excluded_members = [
91    "defaults",
92    "name",
93  ]
94
95  debug = {
96    name = "mimxrt595_evk_freertos_debug"
97    _toolchain_base = pw_toolchain_arm_gcc.cortex_m33f_debug
98    forward_variables_from(_toolchain_base, "*", _excluded_members)
99    forward_variables_from(_toolchain_properties, "*")
100    defaults = {
101      forward_variables_from(_toolchain_base.defaults, "*")
102      forward_variables_from(_target_config, "*")
103      default_configs += _target_default_configs
104    }
105  }
106
107  speed_optimized = {
108    name = "mimxrt595_evk_freertos_speed_optimized"
109    _toolchain_base = pw_toolchain_arm_gcc.cortex_m33f_speed_optimized
110    forward_variables_from(_toolchain_base, "*", _excluded_members)
111    forward_variables_from(_toolchain_properties, "*")
112    defaults = {
113      forward_variables_from(_toolchain_base.defaults, "*")
114      forward_variables_from(_target_config, "*")
115      default_configs += _target_default_configs
116    }
117  }
118
119  size_optimized = {
120    name = "mimxrt595_evk_freertos_size_optimized"
121    _toolchain_base = pw_toolchain_arm_gcc.cortex_m33f_size_optimized
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
132# This list just contains the members of the above scope for convenience to make
133# it trivial to generate all the toolchains in this file via a
134# `generate_toolchains` target.
135pw_target_toolchain_mimxrt595_evk_freertos_list = [
136  pw_target_toolchain_mimxrt595_evk_freertos.debug,
137  pw_target_toolchain_mimxrt595_evk_freertos.speed_optimized,
138  pw_target_toolchain_mimxrt595_evk_freertos.size_optimized,
139]
140