• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2022 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
15include($ENV{PW_ROOT}/pw_build/pigweed.cmake)
16include($ENV{PW_ROOT}/pw_thread_freertos/backend.cmake)
17
18pw_add_module_config(pw_thread_freertos_CONFIG)
19
20pw_add_library(pw_thread_freertos.config INTERFACE
21  HEADERS
22    public/pw_thread_freertos/config.h
23  PUBLIC_INCLUDES
24    public
25  PUBLIC_DEPS
26    pw_third_party.freertos
27    ${pw_thread_freertos_CONFIG}
28)
29
30# This target provides the backend for pw::Thread::id & pw::this_thread::get_id.
31pw_add_library(pw_thread_freertos.id INTERFACE
32  HEADERS
33    public/pw_thread_freertos/id_inline.h
34    public/pw_thread_freertos/id_native.h
35    id_public_overrides/pw_thread_backend/id_inline.h
36    id_public_overrides/pw_thread_backend/id_native.h
37  PUBLIC_INCLUDES
38    public
39    id_public_overrides
40  PUBLIC_DEPS
41    pw_assert
42    pw_interrupt.context
43    pw_third_party.freertos
44    pw_thread.thread.facade
45)
46
47# This target provides the backend for pw::this_thread::sleep_{for,until}.
48pw_add_library(pw_thread_freertos.sleep STATIC
49  HEADERS
50    public/pw_thread_freertos/sleep_inline.h
51    sleep_public_overrides/pw_thread_backend/sleep_inline.h
52  PUBLIC_INCLUDES
53    public
54    sleep_public_overrides
55  PUBLIC_DEPS
56    pw_chrono.system_clock
57    pw_thread.sleep.facade
58  SOURCES
59    sleep.cc
60  PRIVATE_DEPS
61    pw_assert
62    pw_chrono_freertos.system_clock
63    pw_third_party.freertos
64    pw_thread.thread
65)
66
67# This target provides the backend for pw::Thread and the headers needed for
68# thread creation.
69pw_add_library(pw_thread_freertos.thread STATIC
70  HEADERS
71    public/pw_thread_freertos/context.h
72    public/pw_thread_freertos/options.h
73    public/pw_thread_freertos/thread_inline.h
74    public/pw_thread_freertos/thread_native.h
75    thread_public_overrides/pw_thread_backend/thread_inline.h
76    thread_public_overrides/pw_thread_backend/thread_native.h
77  PUBLIC_INCLUDES
78    public
79    thread_public_overrides
80  PUBLIC_DEPS
81    pw_assert
82    pw_function
83    pw_span
84    pw_string
85    pw_third_party.freertos
86    pw_thread.thread.facade
87    pw_thread_freertos.config
88    pw_toolchain.constexpr_tag
89  SOURCES
90    thread.cc
91)
92
93pw_add_library(pw_thread_freertos.creation INTERFACE
94  HEADERS
95    thread_creation_public_overrides/pw_thread_backend/context.h
96    thread_creation_public_overrides/pw_thread_backend/options.h
97    thread_creation_public_overrides/pw_thread_backend/priority.h
98    thread_creation_public_overrides/pw_thread_backend/stack.h
99  PUBLIC_INCLUDES
100    thread_creation_public_overrides
101)
102
103# This target provides the backend for pw::this_thread::yield.
104pw_add_library(pw_thread_freertos.yield INTERFACE
105  HEADERS
106    public/pw_thread_freertos/yield_inline.h
107    yield_public_overrides/pw_thread_backend/yield_inline.h
108  PUBLIC_INCLUDES
109    public
110    yield_public_overrides
111  PUBLIC_DEPS
112    pw_assert
113    pw_third_party.freertos
114    pw_thread.thread
115    pw_thread.yield.facade
116)
117
118pw_add_library(pw_thread_freertos.util STATIC
119  HEADERS
120    public/pw_thread_freertos/util.h
121  PUBLIC_INCLUDES
122    public
123  PUBLIC_DEPS
124    pw_third_party.freertos
125    pw_function
126    pw_span
127    pw_status
128  SOURCES
129    util.cc
130  PRIVATE_DEPS
131    pw_log
132)
133
134pw_add_library(pw_thread_freertos.snapshot STATIC
135  HEADERS
136    public/pw_thread_freertos/snapshot.h
137  PUBLIC_INCLUDES
138    public
139  PUBLIC_DEPS
140    pw_function
141    pw_span
142    pw_protobuf
143    pw_status
144    pw_third_party.freertos
145    pw_thread.protos.pwpb
146    pw_thread.snapshot
147    pw_thread_freertos.config
148  SOURCES
149    snapshot.cc
150  PRIVATE_DEPS
151    pw_thread_freertos.freertos_tsktcb
152    pw_thread_freertos.util
153    pw_log
154)
155
156pw_add_facade(pw_thread_freertos.freertos_tsktcb INTERFACE
157  BACKEND
158    pw_thread_freertos.freertos_tsktcb_BACKEND
159  HEADERS
160    public/pw_thread_freertos/freertos_tsktcb.h
161  PUBLIC_INCLUDES
162    public
163  PUBLIC_DEPS
164    pw_third_party.freertos
165)
166
167pw_add_library(pw_thread_freertos.test_thread_context INTERFACE
168  HEADERS
169    public/pw_thread_freertos/test_thread_context_native.h
170    test_thread_context_public_overrides/pw_thread_backend/test_thread_context_native.h
171  PUBLIC_INCLUDES
172    public
173    test_thread_context_public_overrides
174  PUBLIC_DEPS
175    pw_thread.thread
176    pw_thread.test_thread_context.facade
177)
178