• 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_build/target_types.gni")
18import("$dir_pw_docgen/docs.gni")
19import("$dir_pw_third_party/mcuxpresso/mcuxpresso.gni")
20import("$dir_pw_unit_test/test.gni")
21
22config("default_config") {
23  include_dirs = [ "public" ]
24}
25
26if (pw_third_party_mcuxpresso_SDK != "") {
27  pw_source_set("pw_stream_uart_mcuxpresso") {
28    public_configs = [ ":default_config" ]
29    public = [ "public/pw_stream_uart_mcuxpresso/stream.h" ]
30    public_deps = [
31      "$dir_pw_clock_tree",
32      "$dir_pw_stream",
33    ]
34    deps = [ pw_third_party_mcuxpresso_SDK ]
35    sources = [ "stream.cc" ]
36  }
37
38  pw_source_set("pw_stream_uart_dma_mcuxpresso") {
39    public_configs = [ ":default_config" ]
40    public = [ "public/pw_stream_uart_mcuxpresso/dma_stream.h" ]
41    public_deps = [
42      "$dir_pw_clock_tree",
43      "$dir_pw_stream",
44      "$dir_pw_sync:thread_notification",
45    ]
46    deps = [
47      "$dir_pw_preprocessor",
48      "$dir_pw_sync:interrupt_spin_lock",
49      pw_third_party_mcuxpresso_SDK,
50    ]
51    sources = [ "dma_stream.cc" ]
52  }
53
54  pw_source_set("pw_stream_uart_interrupt_safe_writer_mcuxpresso") {
55    public_configs = [ ":default_config" ]
56    public = [ "public/pw_stream_uart_mcuxpresso/interrupt_safe_writer.h" ]
57    public_deps = [
58      "$dir_pw_clock_tree",
59      "$dir_pw_status",
60      "$dir_pw_stream",
61    ]
62    deps = [ pw_third_party_mcuxpresso_SDK ]
63    sources = [ "interrupt_safe_writer.cc" ]
64  }
65
66  pw_test("stream_test") {
67    enable_if =
68        pw_third_party_mcuxpresso_SDK ==
69        "//targets/mimxrt595_evk_freertos:sdk" &&
70        (pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_debug" ||
71         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_size_optimized" ||
72         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_speed_optimized")
73    sources = [ "stream_test.cc" ]
74    deps = [
75      ":pw_stream_uart_mcuxpresso",
76      "//targets/mimxrt595_evk_freertos:sdk",
77    ]
78  }
79
80  pw_test("stream_example") {
81    enable_if =
82        pw_third_party_mcuxpresso_SDK ==
83        "//targets/mimxrt595_evk_freertos:sdk" &&
84        (pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_debug" ||
85         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_size_optimized" ||
86         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_speed_optimized")
87    sources = [ "stream_example.cc" ]
88    deps = [
89      ":pw_stream_uart_mcuxpresso",
90      "//targets/mimxrt595_evk_freertos:sdk",
91    ]
92  }
93
94  pw_test("dma_stream_example") {
95    enable_if =
96        pw_third_party_mcuxpresso_SDK ==
97        "//targets/mimxrt595_evk_freertos:sdk" &&
98        (pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_debug" ||
99         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_size_optimized" ||
100         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_speed_optimized")
101    sources = [ "dma_stream_example.cc" ]
102    deps = [
103      ":pw_stream_uart_dma_mcuxpresso",
104      "//targets/mimxrt595_evk_freertos:sdk",
105    ]
106  }
107
108  pw_test("interrupt_safe_writer_example") {
109    enable_if =
110        pw_third_party_mcuxpresso_SDK ==
111        "//targets/mimxrt595_evk_freertos:sdk" &&
112        (pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_debug" ||
113         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_size_optimized" ||
114         pw_toolchain_SCOPE.name == "mimxrt595_evk_freertos_speed_optimized")
115    public_configs = [ "//pw_build:cpp20" ]
116    sources = [ "interrupt_safe_writer_example.cc" ]
117    deps = [
118      ":pw_stream_uart_interrupt_safe_writer_mcuxpresso",
119      "//targets/mimxrt595_evk_freertos:sdk",
120    ]
121  }
122
123  pw_test_group("tests") {
124    tests = [
125      ":stream_test",
126      ":stream_example",
127      ":dma_stream_example",
128      ":interrupt_safe_writer_example",
129    ]
130  }
131} else {
132  pw_test_group("tests") {
133    tests = []
134  }
135}
136
137pw_doc_group("docs") {
138  inputs = [
139    "stream_example.cc",
140    "dma_stream_example.cc",
141    "interrupt_safe_writer_example.cc",
142  ]
143  sources = [ "docs.rst" ]
144}
145