• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2021 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_build/linker_script.gni")
18import("$dir_pw_build/target_types.gni")
19import("$dir_pw_docgen/docs.gni")
20import("$dir_pw_malloc/backend.gni")
21import("$dir_pw_third_party/mcuxpresso/mcuxpresso.gni")
22import("$dir_pw_toolchain/generate_toolchain.gni")
23import("target_toolchains.gni")
24
25generate_toolchains("target_toolchains") {
26  toolchains = pw_target_toolchain_mimxrt595_evk_list
27}
28
29declare_args() {
30  # When compiling with an MCUXpresso SDK, this variable is set to the path of
31  # the manifest file within the SDK installation. When set, a pw_source_set
32  # for a sample project SDK is created at
33  # "//targets/mimxrt595_evk/sample_sdk".
34  pw_target_mimxrt595_evk_MANIFEST = ""
35
36  # This list should contain the necessary defines for setting linker script
37  # memory regions. While we don't directly use the pw_boot_cortex_m linker
38  # script, these are deliberately matching to make being able to later easier.
39  pw_target_mimxrt595_evk_LINK_CONFIG_DEFINES = []
40}
41
42config("pw_malloc_active") {
43  if (pw_malloc_BACKEND != "") {
44    defines = [ "PW_MALLOC_ACTIVE=1" ]
45  }
46}
47
48config("disable_warnings") {
49  cflags = [
50    "-Wno-cast-qual",
51    "-Wno-redundant-decls",
52    "-Wno-undef",
53    "-Wno-unused-parameter",
54    "-Wno-unused-variable",
55  ]
56  visibility = [ ":*" ]
57}
58
59config("freestanding") {
60  cflags = [
61    "-ffreestanding",
62    "-fno-builtin",
63  ]
64  asmflags = cflags
65  ldflags = cflags
66  visibility = [ ":*" ]
67}
68
69config("sdk_defines") {
70  defines = [
71    "CPU_MIMXRT595SFFOC_cm33",
72    "DEBUG_CONSOLE_TRANSFER_NON_BLOCKING",
73    "SDK_DEBUGCONSOLE=1",
74  ]
75  visibility = [ ":*" ]
76}
77
78if (current_toolchain != default_toolchain) {
79  pw_linker_script("flash_linker_script") {
80    defines = pw_target_mimxrt595_evk_LINK_CONFIG_DEFINES
81    linker_script = "mimxrt595_flash.ld"
82  }
83}
84
85if (pw_third_party_mcuxpresso_SDK != "") {
86  # Startup and vector table for NXP MIMXRT595-EVK.
87  pw_source_set("boot") {
88    public_configs = [ ":pw_malloc_active" ]
89    deps = [
90      "$dir_pw_boot",
91      "$dir_pw_boot_cortex_m",
92      "$dir_pw_preprocessor",
93      "$dir_pw_sys_io_mcuxpresso",
94      pw_third_party_mcuxpresso_SDK,
95    ]
96    if (pw_malloc_BACKEND != "") {
97      deps += [ "$dir_pw_malloc" ]
98    }
99    sources = [
100      "boot.cc",
101      "vector_table.c",
102    ]
103  }
104}
105
106if (pw_third_party_mcuxpresso_SDK == "//targets/mimxrt595_evk:sample_sdk") {
107  pw_mcuxpresso_sdk("sample_sdk") {
108    manifest = pw_target_mimxrt595_evk_MANIFEST
109    include = [
110      "component.serial_manager_uart.MIMXRT595S",
111      "project_template.evkmimxrt595.MIMXRT595S",
112      "utility.debug_console.MIMXRT595S",
113    ]
114    exclude = [ "device.MIMXRT595S_startup.MIMXRT595S" ]
115
116    public_configs = [
117      ":disable_warnings",
118      ":freestanding",
119      ":sdk_defines",
120    ]
121  }
122}
123
124pw_doc_group("target_docs") {
125  sources = [ "target_docs.rst" ]
126}
127