• 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_rpc/system_server/backend.gni")
20import("$dir_pw_sync/backend.gni")
21import("$dir_pw_sys_io/backend.gni")
22
23import("$dir_pw_toolchain/arm_gcc/toolchains.gni")
24
25_target_config = {
26  # Use the logging main.
27  pw_unit_test_MAIN = "$dir_pw_unit_test:logging_main"
28
29  # Configuration options for Pigweed executable targets.
30  pw_build_EXECUTABLE_TARGET_TYPE = "mimxrt595_executable"
31
32  pw_build_EXECUTABLE_TARGET_TYPE_FILE =
33      get_path_info("mimxrt595_executable.gni", "abspath")
34
35  # Facade backends
36  pw_assert_BACKEND = dir_pw_assert_basic
37  pw_boot_BACKEND = "$dir_pw_boot_cortex_m:armv8m"
38  pw_chrono_SYSTEM_CLOCK_BACKEND = "$dir_pw_chrono_freertos:system_clock"
39  pw_chrono_SYSTEM_TIMER_BACKEND = "$dir_pw_chrono_freertos:system_timer"
40  pw_interrupt_CONTEXT_BACKEND = "$dir_pw_interrupt_cortex_m:context_armv8m"
41  pw_log_BACKEND = dir_pw_log_basic
42  pw_malloc_BACKEND = "$dir_pw_malloc:bucket_block_allocator"
43  pw_sync_BINARY_SEMAPHORE_BACKEND = "$dir_pw_sync_freertos:binary_semaphore"
44  pw_sync_COUNTING_SEMAPHORE_BACKEND =
45      "$dir_pw_sync_freertos:counting_semaphore"
46  pw_sync_MUTEX_BACKEND = "$dir_pw_sync_freertos:mutex"
47  pw_sync_TIMED_MUTEX_BACKEND = "$dir_pw_sync_freertos:timed_mutex"
48  pw_sync_INTERRUPT_SPIN_LOCK_BACKEND =
49      "$dir_pw_sync_freertos:interrupt_spin_lock"
50  pw_sync_THREAD_NOTIFICATION_BACKEND =
51      "$dir_pw_sync_freertos:thread_notification"
52  pw_sync_TIMED_THREAD_NOTIFICATION_BACKEND =
53      "$dir_pw_sync_freertos:timed_thread_notification"
54  pw_sys_io_BACKEND = "$dir_pw_sys_io_mcuxpresso"
55  pw_thread_ID_BACKEND = "$dir_pw_thread_freertos:id"
56  pw_thread_SLEEP_BACKEND = "$dir_pw_thread_freertos:sleep"
57  pw_thread_THREAD_BACKEND = "$dir_pw_thread_freertos:thread"
58  pw_thread_YIELD_BACKEND = "$dir_pw_thread_freertos:yield"
59
60  pw_rpc_system_server_BACKEND = "$dir_pw_hdlc:hdlc_sys_io_system_server"
61
62  # Override the default pw_boot_cortex_m linker script and set the memory
63  # regions for the target.
64  pw_boot_cortex_m_LINKER_SCRIPT =
65      "//targets/mimxrt595_evk_freertos:flash_linker_script"
66  pw_target_mimxrt595_evk_freertos_LINK_CONFIG_DEFINES = [
67    "PW_BOOT_FLASH_BEGIN=0x08001180",
68    "PW_BOOT_FLASH_SIZE=0x001FEE80",
69    "PW_BOOT_HEAP_SIZE=200K",
70    "PW_BOOT_MIN_STACK_SIZE=1K",
71    "PW_BOOT_RAM_BEGIN=0x20080000",
72    "PW_BOOT_RAM_SIZE=0x00280000",
73    "PW_BOOT_VECTOR_TABLE_BEGIN=0x08001000",
74    "PW_BOOT_VECTOR_TABLE_SIZE=0x00000180",
75  ]
76
77  # Use FreeRTOS with locally specified config and port.
78  pw_third_party_freertos_CONFIG =
79      "//targets/mimxrt595_evk_freertos:freertos_config"
80  pw_third_party_freertos_PORT =
81      "//targets/mimxrt595_evk_freertos:freertos_port"
82
83  pw_build_LINK_DEPS = [
84    "$dir_pw_assert:impl",
85    "$dir_pw_log:impl",
86    "$dir_pw_toolchain/arm_gcc:arm_none_eabi_gcc_support",
87  ]
88
89  current_cpu = "arm"
90  current_os = ""
91}
92
93_toolchain_properties = {
94  final_binary_extension = ".elf"
95}
96
97_target_default_configs = [
98  "$dir_pw_build:extra_strict_warnings",
99  "$dir_pw_toolchain/arm_gcc:enable_float_printf",
100]
101
102pw_target_toolchain_mimxrt595_evk_freertos = {
103  _excluded_members = [
104    "defaults",
105    "name",
106  ]
107
108  debug = {
109    name = "mimxrt595_evk_freertos_debug"
110    _toolchain_base = pw_toolchain_arm_gcc.cortex_m33f_debug
111    forward_variables_from(_toolchain_base, "*", _excluded_members)
112    forward_variables_from(_toolchain_properties, "*")
113    defaults = {
114      forward_variables_from(_toolchain_base.defaults, "*")
115      forward_variables_from(_target_config, "*")
116      default_configs += _target_default_configs
117    }
118  }
119
120  speed_optimized = {
121    name = "mimxrt595_evk_freertos_speed_optimized"
122    _toolchain_base = pw_toolchain_arm_gcc.cortex_m33f_speed_optimized
123    forward_variables_from(_toolchain_base, "*", _excluded_members)
124    forward_variables_from(_toolchain_properties, "*")
125    defaults = {
126      forward_variables_from(_toolchain_base.defaults, "*")
127      forward_variables_from(_target_config, "*")
128      default_configs += _target_default_configs
129    }
130  }
131
132  size_optimized = {
133    name = "mimxrt595_evk_freertos_size_optimized"
134    _toolchain_base = pw_toolchain_arm_gcc.cortex_m33f_size_optimized
135    forward_variables_from(_toolchain_base, "*", _excluded_members)
136    forward_variables_from(_toolchain_properties, "*")
137    defaults = {
138      forward_variables_from(_toolchain_base.defaults, "*")
139      forward_variables_from(_target_config, "*")
140      default_configs += _target_default_configs
141    }
142  }
143}
144
145# This list just contains the members of the above scope for convenience to make
146# it trivial to generate all the toolchains in this file via a
147# `generate_toolchains` target.
148pw_target_toolchain_mimxrt595_evk_freertos_list = [
149  pw_target_toolchain_mimxrt595_evk_freertos.debug,
150  pw_target_toolchain_mimxrt595_evk_freertos.speed_optimized,
151  pw_target_toolchain_mimxrt595_evk_freertos.size_optimized,
152]
153