blob: c36ba6d330cd308fcda5b6af2f3fcaf941410364 [file] [log] [blame]
Ewout van Bekkum749342b2021-01-19 14:53:19 -08001# Copyright 2020 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
15load(
16 "//pw_build:pigweed.bzl",
17 "pw_cc_library",
Ewout van Bekkumae6c03a2021-01-19 14:53:19 -080018 "pw_cc_test",
Ewout van Bekkum749342b2021-01-19 14:53:19 -080019)
20
21package(default_visibility = ["//visibility:public"])
22
23licenses(["notice"]) # Apache License 2.0
24
25pw_cc_library(
26 name = "id_headers",
27 hdrs = [
28 "public/pw_thread_freertos/id_inline.h",
29 "public/pw_thread_freertos/id_native.h",
30 "public_overrides/pw_thread_backend/id_inline.h",
31 "public_overrides/pw_thread_backend/id_native.h",
32 ],
33 includes = [
34 "public",
35 "public_overrides",
36 ],
37)
38
39pw_cc_library(
40 name = "id",
41 deps = [
42 ":id_headers",
43 "//pw_thread:id_facade",
44 ],
Ewout van Bekkumae6c03a2021-01-19 14:53:19 -080045 # TODO(pwbug/317): This should depend on FreeRTOS but our third parties
46 # currently do not have Bazel support.
Ewout van Bekkum749342b2021-01-19 14:53:19 -080047)
48
49pw_cc_library(
50 name = "sleep_headers",
51 hdrs = [
52 "public/pw_thread_freertos/sleep_inline.h",
53 "public_overrides/pw_thread_backend/sleep_inline.h",
54 ],
55 includes = [
56 "public",
57 "public_overrides",
58 ],
59 deps = [
60 "//pw_chrono:system_clock",
61 ],
62)
63
64pw_cc_library(
65 name = "sleep",
Ewout van Bekkumae6c03a2021-01-19 14:53:19 -080066 srcs = [
67 "sleep.cc",
68 ],
Ewout van Bekkum749342b2021-01-19 14:53:19 -080069 deps = [
70 ":sleep_headers",
Ewout van Bekkum749342b2021-01-19 14:53:19 -080071 "//pw_assert",
72 "//pw_chrono:system_clock",
Nathaniel Brougha1113be2021-03-07 09:05:41 +080073 "//pw_chrono_freertos:system_clock_headers",
Ewout van Bekkum749342b2021-01-19 14:53:19 -080074 "//pw_thread:sleep_facade",
75 ],
Ewout van Bekkumae6c03a2021-01-19 14:53:19 -080076 # TODO(pwbug/317): This should depend on FreeRTOS but our third parties
77 # currently do not have Bazel support.
78)
79
80# This target provides the FreeRTOS specific headers needs for thread creation.
81pw_cc_library(
82 name = "thread_headers",
83 hdrs = [
Nathaniel Brougha1113be2021-03-07 09:05:41 +080084 "public/pw_thread_freertos/config.h",
Ewout van Bekkumae6c03a2021-01-19 14:53:19 -080085 "public/pw_thread_freertos/context.h",
86 "public/pw_thread_freertos/options.h",
Ewout van Bekkumae6c03a2021-01-19 14:53:19 -080087 "public/pw_thread_freertos/thread_inline.h",
88 "public/pw_thread_freertos/thread_native.h",
89 "public_overrides/pw_thread_backend/thread_inline.h",
90 "public_overrides/pw_thread_backend/thread_native.h",
91 ],
92 includes = [
93 "public",
94 "public_overrides",
95 ],
96 deps = [
Ewout van Bekkumae6c03a2021-01-19 14:53:19 -080097 ":id",
Nathaniel Brougha1113be2021-03-07 09:05:41 +080098 "//pw_assert",
Ewout van Bekkum3f00a3e2021-05-14 10:28:49 -070099 "//pw_string",
Nathaniel Brougha1113be2021-03-07 09:05:41 +0800100 "//pw_sync:binary_semaphore",
Ewout van Bekkumae6c03a2021-01-19 14:53:19 -0800101 "//pw_thread:thread_headers",
Ewout van Bekkumae6c03a2021-01-19 14:53:19 -0800102 ],
103 # TODO(pwbug/317): This should depend on FreeRTOS but our third parties
104 # currently do not have Bazel support.
105)
106
107pw_cc_library(
108 name = "thread",
109 srcs = [
110 "thread.cc",
111 ],
112 deps = [
Ewout van Bekkumae6c03a2021-01-19 14:53:19 -0800113 ":id",
114 ":thread_headers",
Nathaniel Brougha1113be2021-03-07 09:05:41 +0800115 "//pw_assert",
Ewout van Bekkumae6c03a2021-01-19 14:53:19 -0800116 ],
117 # TODO(pwbug/317): This should depend on FreeRTOS but our third parties
118 # currently do not have Bazel support.
119)
120
121pw_cc_library(
122 name = "dynamic_test_threads",
Ewout van Bekkumae6c03a2021-01-19 14:53:19 -0800123 srcs = [
124 "dynamic_test_threads.cc",
Nathaniel Brougha1113be2021-03-07 09:05:41 +0800125 ],
126 deps = [
127 "//pw_chrono:system_clock",
128 "//pw_thread:sleep",
129 "//pw_thread:test_threads_header",
130 "//pw_thread:thread_facade",
131 ],
Ewout van Bekkumae6c03a2021-01-19 14:53:19 -0800132)
133
134pw_cc_test(
135 name = "dynamic_thread_backend_test",
136 deps = [
Ewout van Bekkumae6c03a2021-01-19 14:53:19 -0800137 ":dynamic_test_threads",
Nathaniel Brougha1113be2021-03-07 09:05:41 +0800138 "//pw_thread:thread_facade_test",
139 ],
Ewout van Bekkumae6c03a2021-01-19 14:53:19 -0800140)
141
142pw_cc_library(
143 name = "static_test_threads",
Ewout van Bekkumae6c03a2021-01-19 14:53:19 -0800144 srcs = [
145 "static_test_threads.cc",
Nathaniel Brougha1113be2021-03-07 09:05:41 +0800146 ],
147 deps = [
148 "//pw_chrono:system_clock",
149 "//pw_thread:sleep",
150 "//pw_thread:test_threads_header",
151 "//pw_thread:thread_facade",
152 ],
Ewout van Bekkumae6c03a2021-01-19 14:53:19 -0800153)
154
155pw_cc_test(
156 name = "static_thread_backend_test",
157 deps = [
Ewout van Bekkumae6c03a2021-01-19 14:53:19 -0800158 ":static_test_threads",
Nathaniel Brougha1113be2021-03-07 09:05:41 +0800159 "//pw_thread:thread_facade_test",
160 ],
Ewout van Bekkum749342b2021-01-19 14:53:19 -0800161)
162
163pw_cc_library(
164 name = "yield_headers",
165 hdrs = [
166 "public/pw_thread_freertos/yield_inline.h",
167 "public_overrides/pw_thread_backend/yield_inline.h",
168 ],
169 includes = [
170 "public",
171 "public_overrides",
172 ],
Ewout van Bekkumae6c03a2021-01-19 14:53:19 -0800173 # TODO(pwbug/317): This should depend on FreeRTOS but our third parties
174 # currently do not have Bazel support.
Ewout van Bekkum749342b2021-01-19 14:53:19 -0800175)
176
177pw_cc_library(
178 name = "yield",
179 deps = [
180 ":yield_headers",
181 "//pw_thread:yield_facade",
182 ],
183)