1*61c4878aSAndroid Build Coastguard Worker# Copyright 2020 The Pigweed Authors 2*61c4878aSAndroid Build Coastguard Worker# 3*61c4878aSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); you may not 4*61c4878aSAndroid Build Coastguard Worker# use this file except in compliance with the License. You may obtain a copy of 5*61c4878aSAndroid Build Coastguard Worker# the License at 6*61c4878aSAndroid Build Coastguard Worker# 7*61c4878aSAndroid Build Coastguard Worker# https://www.apache.org/licenses/LICENSE-2.0 8*61c4878aSAndroid Build Coastguard Worker# 9*61c4878aSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software 10*61c4878aSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11*61c4878aSAndroid Build Coastguard Worker# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12*61c4878aSAndroid Build Coastguard Worker# License for the specific language governing permissions and limitations under 13*61c4878aSAndroid Build Coastguard Worker# the License. 14*61c4878aSAndroid Build Coastguard Worker 15*61c4878aSAndroid Build Coastguard Workerimport("//build_overrides/pigweed.gni") 16*61c4878aSAndroid Build Coastguard Worker 17*61c4878aSAndroid Build Coastguard Workerimport("$dir_pigweed/third_party/freertos/freertos.gni") 18*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_build/error.gni") 19*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_build/facade.gni") 20*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_build/module_config.gni") 21*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_build/target_types.gni") 22*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_chrono/backend.gni") 23*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_docgen/docs.gni") 24*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_thread/backend.gni") 25*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_thread_freertos/backend.gni") 26*61c4878aSAndroid Build Coastguard Workerimport("$dir_pw_unit_test/test.gni") 27*61c4878aSAndroid Build Coastguard Worker 28*61c4878aSAndroid Build Coastguard Workerdeclare_args() { 29*61c4878aSAndroid Build Coastguard Worker # The build target that overrides the default configuration options for this 30*61c4878aSAndroid Build Coastguard Worker # module. This should point to a source set that provides defines through a 31*61c4878aSAndroid Build Coastguard Worker # public config (which may -include a file or add defines directly). 32*61c4878aSAndroid Build Coastguard Worker pw_thread_freertos_CONFIG = pw_build_DEFAULT_MODULE_CONFIG 33*61c4878aSAndroid Build Coastguard Worker} 34*61c4878aSAndroid Build Coastguard Worker 35*61c4878aSAndroid Build Coastguard Workerconfig("public_include_path") { 36*61c4878aSAndroid Build Coastguard Worker include_dirs = [ "public" ] 37*61c4878aSAndroid Build Coastguard Worker visibility = [ ":*" ] 38*61c4878aSAndroid Build Coastguard Worker} 39*61c4878aSAndroid Build Coastguard Worker 40*61c4878aSAndroid Build Coastguard Workerpw_source_set("config") { 41*61c4878aSAndroid Build Coastguard Worker public = [ "public/pw_thread_freertos/config.h" ] 42*61c4878aSAndroid Build Coastguard Worker public_configs = [ ":public_include_path" ] 43*61c4878aSAndroid Build Coastguard Worker public_deps = [ 44*61c4878aSAndroid Build Coastguard Worker "$dir_pw_third_party/freertos", 45*61c4878aSAndroid Build Coastguard Worker pw_thread_freertos_CONFIG, 46*61c4878aSAndroid Build Coastguard Worker ] 47*61c4878aSAndroid Build Coastguard Worker} 48*61c4878aSAndroid Build Coastguard Worker 49*61c4878aSAndroid Build Coastguard Workerconfig("id_public_overrides") { 50*61c4878aSAndroid Build Coastguard Worker include_dirs = [ "id_public_overrides" ] 51*61c4878aSAndroid Build Coastguard Worker visibility = [ ":*" ] 52*61c4878aSAndroid Build Coastguard Worker} 53*61c4878aSAndroid Build Coastguard Worker 54*61c4878aSAndroid Build Coastguard Worker# This target provides the backend for pw::Thread::id & pw::this_thread::get_id. 55*61c4878aSAndroid Build Coastguard Workerpw_source_set("id") { 56*61c4878aSAndroid Build Coastguard Worker public_configs = [ 57*61c4878aSAndroid Build Coastguard Worker ":public_include_path", 58*61c4878aSAndroid Build Coastguard Worker ":id_public_overrides", 59*61c4878aSAndroid Build Coastguard Worker ] 60*61c4878aSAndroid Build Coastguard Worker public_deps = [ 61*61c4878aSAndroid Build Coastguard Worker "$dir_pw_assert", 62*61c4878aSAndroid Build Coastguard Worker "$dir_pw_interrupt:context", 63*61c4878aSAndroid Build Coastguard Worker "$dir_pw_third_party/freertos", 64*61c4878aSAndroid Build Coastguard Worker ] 65*61c4878aSAndroid Build Coastguard Worker public = [ 66*61c4878aSAndroid Build Coastguard Worker "id_public_overrides/pw_thread_backend/id_inline.h", 67*61c4878aSAndroid Build Coastguard Worker "id_public_overrides/pw_thread_backend/id_native.h", 68*61c4878aSAndroid Build Coastguard Worker "public/pw_thread_freertos/id_inline.h", 69*61c4878aSAndroid Build Coastguard Worker "public/pw_thread_freertos/id_native.h", 70*61c4878aSAndroid Build Coastguard Worker ] 71*61c4878aSAndroid Build Coastguard Worker deps = [ "$dir_pw_thread:id.facade" ] 72*61c4878aSAndroid Build Coastguard Worker} 73*61c4878aSAndroid Build Coastguard Worker 74*61c4878aSAndroid Build Coastguard Workerpw_build_assert("check_system_clock_backend") { 75*61c4878aSAndroid Build Coastguard Worker condition = 76*61c4878aSAndroid Build Coastguard Worker pw_chrono_SYSTEM_CLOCK_BACKEND == "" || 77*61c4878aSAndroid Build Coastguard Worker pw_chrono_SYSTEM_CLOCK_BACKEND == "$dir_pw_chrono_freertos:system_clock" 78*61c4878aSAndroid Build Coastguard Worker message = "This FreeRTOS backend only works with the FreeRTOS " + 79*61c4878aSAndroid Build Coastguard Worker "pw::chrono::SystemClock backend " + 80*61c4878aSAndroid Build Coastguard Worker "(pw_chrono_SYSTEM_CLOCK_BACKEND = " + 81*61c4878aSAndroid Build Coastguard Worker "\"$dir_pw_chrono_freertos:system_clock\")" 82*61c4878aSAndroid Build Coastguard Worker visibility = [ ":*" ] 83*61c4878aSAndroid Build Coastguard Worker} 84*61c4878aSAndroid Build Coastguard Worker 85*61c4878aSAndroid Build Coastguard Workerconfig("sleep_public_overrides") { 86*61c4878aSAndroid Build Coastguard Worker include_dirs = [ "sleep_public_overrides" ] 87*61c4878aSAndroid Build Coastguard Worker visibility = [ ":*" ] 88*61c4878aSAndroid Build Coastguard Worker} 89*61c4878aSAndroid Build Coastguard Worker 90*61c4878aSAndroid Build Coastguard Worker# This target provides the backend for pw::this_thread::sleep_{for,until}. 91*61c4878aSAndroid Build Coastguard Workerpw_source_set("sleep") { 92*61c4878aSAndroid Build Coastguard Worker public_configs = [ 93*61c4878aSAndroid Build Coastguard Worker ":public_include_path", 94*61c4878aSAndroid Build Coastguard Worker ":sleep_public_overrides", 95*61c4878aSAndroid Build Coastguard Worker ] 96*61c4878aSAndroid Build Coastguard Worker public = [ 97*61c4878aSAndroid Build Coastguard Worker "public/pw_thread_freertos/sleep_inline.h", 98*61c4878aSAndroid Build Coastguard Worker "sleep_public_overrides/pw_thread_backend/sleep_inline.h", 99*61c4878aSAndroid Build Coastguard Worker ] 100*61c4878aSAndroid Build Coastguard Worker public_deps = [ "$dir_pw_chrono:system_clock" ] 101*61c4878aSAndroid Build Coastguard Worker sources = [ "sleep.cc" ] 102*61c4878aSAndroid Build Coastguard Worker deps = [ 103*61c4878aSAndroid Build Coastguard Worker ":check_system_clock_backend", 104*61c4878aSAndroid Build Coastguard Worker "$dir_pw_assert", 105*61c4878aSAndroid Build Coastguard Worker "$dir_pw_chrono_freertos:system_clock", 106*61c4878aSAndroid Build Coastguard Worker "$dir_pw_third_party/freertos", 107*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread:sleep.facade", 108*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread:thread", 109*61c4878aSAndroid Build Coastguard Worker ] 110*61c4878aSAndroid Build Coastguard Worker} 111*61c4878aSAndroid Build Coastguard Worker 112*61c4878aSAndroid Build Coastguard Workerconfig("thread_public_overrides") { 113*61c4878aSAndroid Build Coastguard Worker include_dirs = [ "thread_public_overrides" ] 114*61c4878aSAndroid Build Coastguard Worker visibility = [ ":*" ] 115*61c4878aSAndroid Build Coastguard Worker} 116*61c4878aSAndroid Build Coastguard Worker 117*61c4878aSAndroid Build Coastguard Worker# This target provides the backend for pw::Thread and the headers needed for 118*61c4878aSAndroid Build Coastguard Worker# thread creation. 119*61c4878aSAndroid Build Coastguard Workerpw_source_set("thread") { 120*61c4878aSAndroid Build Coastguard Worker public_configs = [ 121*61c4878aSAndroid Build Coastguard Worker ":public_include_path", 122*61c4878aSAndroid Build Coastguard Worker ":thread_public_overrides", 123*61c4878aSAndroid Build Coastguard Worker ] 124*61c4878aSAndroid Build Coastguard Worker public_deps = [ 125*61c4878aSAndroid Build Coastguard Worker ":config", 126*61c4878aSAndroid Build Coastguard Worker ":id", 127*61c4878aSAndroid Build Coastguard Worker "$dir_pw_assert", 128*61c4878aSAndroid Build Coastguard Worker "$dir_pw_string", 129*61c4878aSAndroid Build Coastguard Worker "$dir_pw_third_party/freertos", 130*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread:thread.facade", 131*61c4878aSAndroid Build Coastguard Worker dir_pw_function, 132*61c4878aSAndroid Build Coastguard Worker dir_pw_span, 133*61c4878aSAndroid Build Coastguard Worker ] 134*61c4878aSAndroid Build Coastguard Worker public = [ 135*61c4878aSAndroid Build Coastguard Worker "public/pw_thread_freertos/context.h", 136*61c4878aSAndroid Build Coastguard Worker "public/pw_thread_freertos/options.h", 137*61c4878aSAndroid Build Coastguard Worker "public/pw_thread_freertos/thread_inline.h", 138*61c4878aSAndroid Build Coastguard Worker "public/pw_thread_freertos/thread_native.h", 139*61c4878aSAndroid Build Coastguard Worker "thread_public_overrides/pw_thread_backend/thread_inline.h", 140*61c4878aSAndroid Build Coastguard Worker "thread_public_overrides/pw_thread_backend/thread_native.h", 141*61c4878aSAndroid Build Coastguard Worker ] 142*61c4878aSAndroid Build Coastguard Worker allow_circular_includes_from = [ "$dir_pw_thread:thread.facade" ] 143*61c4878aSAndroid Build Coastguard Worker sources = [ "thread.cc" ] 144*61c4878aSAndroid Build Coastguard Worker} 145*61c4878aSAndroid Build Coastguard Worker 146*61c4878aSAndroid Build Coastguard Worker# This target provides the backend for pw::thread::thread_iteration. 147*61c4878aSAndroid Build Coastguard Workerif (pw_thread_freertos_FREERTOS_TSKTCB_BACKEND != "") { 148*61c4878aSAndroid Build Coastguard Worker pw_source_set("thread_iteration") { 149*61c4878aSAndroid Build Coastguard Worker public_configs = [ ":thread_public_overrides" ] 150*61c4878aSAndroid Build Coastguard Worker deps = [ 151*61c4878aSAndroid Build Coastguard Worker ":freertos_tsktcb", 152*61c4878aSAndroid Build Coastguard Worker "$dir_pw_third_party/freertos", 153*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread:thread_info", 154*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread:thread_iteration.facade", 155*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread_freertos:util", 156*61c4878aSAndroid Build Coastguard Worker dir_pw_function, 157*61c4878aSAndroid Build Coastguard Worker dir_pw_span, 158*61c4878aSAndroid Build Coastguard Worker dir_pw_status, 159*61c4878aSAndroid Build Coastguard Worker ] 160*61c4878aSAndroid Build Coastguard Worker sources = [ 161*61c4878aSAndroid Build Coastguard Worker "pw_thread_freertos_private/thread_iteration.h", 162*61c4878aSAndroid Build Coastguard Worker "thread_iteration.cc", 163*61c4878aSAndroid Build Coastguard Worker ] 164*61c4878aSAndroid Build Coastguard Worker } 165*61c4878aSAndroid Build Coastguard Worker} 166*61c4878aSAndroid Build Coastguard Worker 167*61c4878aSAndroid Build Coastguard Workerconfig("yield_public_overrides") { 168*61c4878aSAndroid Build Coastguard Worker include_dirs = [ "yield_public_overrides" ] 169*61c4878aSAndroid Build Coastguard Worker visibility = [ ":*" ] 170*61c4878aSAndroid Build Coastguard Worker} 171*61c4878aSAndroid Build Coastguard Worker 172*61c4878aSAndroid Build Coastguard Worker# This target provides the backend for pw::this_thread::yield. 173*61c4878aSAndroid Build Coastguard Workerpw_source_set("yield") { 174*61c4878aSAndroid Build Coastguard Worker public_configs = [ 175*61c4878aSAndroid Build Coastguard Worker ":public_include_path", 176*61c4878aSAndroid Build Coastguard Worker ":yield_public_overrides", 177*61c4878aSAndroid Build Coastguard Worker ] 178*61c4878aSAndroid Build Coastguard Worker public = [ 179*61c4878aSAndroid Build Coastguard Worker "public/pw_thread_freertos/yield_inline.h", 180*61c4878aSAndroid Build Coastguard Worker "yield_public_overrides/pw_thread_backend/yield_inline.h", 181*61c4878aSAndroid Build Coastguard Worker ] 182*61c4878aSAndroid Build Coastguard Worker public_deps = [ 183*61c4878aSAndroid Build Coastguard Worker "$dir_pw_assert", 184*61c4878aSAndroid Build Coastguard Worker "$dir_pw_third_party/freertos", 185*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread:thread", 186*61c4878aSAndroid Build Coastguard Worker ] 187*61c4878aSAndroid Build Coastguard Worker deps = [ "$dir_pw_thread:yield.facade" ] 188*61c4878aSAndroid Build Coastguard Worker} 189*61c4878aSAndroid Build Coastguard Worker 190*61c4878aSAndroid Build Coastguard Workerpw_source_set("util") { 191*61c4878aSAndroid Build Coastguard Worker public_configs = [ ":public_include_path" ] 192*61c4878aSAndroid Build Coastguard Worker public_deps = [ 193*61c4878aSAndroid Build Coastguard Worker "$dir_pw_third_party/freertos", 194*61c4878aSAndroid Build Coastguard Worker dir_pw_function, 195*61c4878aSAndroid Build Coastguard Worker dir_pw_span, 196*61c4878aSAndroid Build Coastguard Worker dir_pw_status, 197*61c4878aSAndroid Build Coastguard Worker ] 198*61c4878aSAndroid Build Coastguard Worker public = [ "public/pw_thread_freertos/util.h" ] 199*61c4878aSAndroid Build Coastguard Worker deps = [ dir_pw_log ] 200*61c4878aSAndroid Build Coastguard Worker sources = [ "util.cc" ] 201*61c4878aSAndroid Build Coastguard Worker} 202*61c4878aSAndroid Build Coastguard Worker 203*61c4878aSAndroid Build Coastguard Worker# Action to generate `freertos_tsktcb.h` for 204*61c4878aSAndroid Build Coastguard Worker# pw_thread_freertos_FREERTOS_TSKTCB_BACKEND. 205*61c4878aSAndroid Build Coastguard Workerif (dir_pw_third_party_freertos != "") { 206*61c4878aSAndroid Build Coastguard Worker pw_python_action("generate_freertos_tsktcb") { 207*61c4878aSAndroid Build Coastguard Worker _out_path = "${target_gen_dir}/public_overrides/pw_thread_freertos_backend/freertos_tsktcb.h" 208*61c4878aSAndroid Build Coastguard Worker script = "py/pw_thread_freertos/generate_freertos_tsktcb.py" 209*61c4878aSAndroid Build Coastguard Worker args = [ 210*61c4878aSAndroid Build Coastguard Worker "--freertos-src-dir", 211*61c4878aSAndroid Build Coastguard Worker rebase_path(dir_pw_third_party_freertos, root_build_dir), 212*61c4878aSAndroid Build Coastguard Worker "-o", 213*61c4878aSAndroid Build Coastguard Worker rebase_path(_out_path, root_build_dir), 214*61c4878aSAndroid Build Coastguard Worker ] 215*61c4878aSAndroid Build Coastguard Worker outputs = [ _out_path ] 216*61c4878aSAndroid Build Coastguard Worker visibility = [ ":auto_freertos_tsktcb" ] 217*61c4878aSAndroid Build Coastguard Worker } 218*61c4878aSAndroid Build Coastguard Worker 219*61c4878aSAndroid Build Coastguard Worker config("auto_freertos_include_path") { 220*61c4878aSAndroid Build Coastguard Worker include_dirs = [ "${target_gen_dir}/public_overrides" ] 221*61c4878aSAndroid Build Coastguard Worker visibility = [ ":auto_freertos_tsktcb" ] 222*61c4878aSAndroid Build Coastguard Worker } 223*61c4878aSAndroid Build Coastguard Worker 224*61c4878aSAndroid Build Coastguard Worker # Source set that provides backend for automatically generated 225*61c4878aSAndroid Build Coastguard Worker # `freertos_tsktcb.h` header. 226*61c4878aSAndroid Build Coastguard Worker pw_source_set("auto_freertos_tsktcb") { 227*61c4878aSAndroid Build Coastguard Worker public_configs = [ ":auto_freertos_include_path" ] 228*61c4878aSAndroid Build Coastguard Worker public = [ "${target_gen_dir}/public_overrides/pw_thread_freertos_backend/freertos_tsktcb.h" ] 229*61c4878aSAndroid Build Coastguard Worker public_deps = [ "$dir_pw_third_party/freertos" ] 230*61c4878aSAndroid Build Coastguard Worker deps = [ ":generate_freertos_tsktcb" ] 231*61c4878aSAndroid Build Coastguard Worker visibility = [ ":freertos_tsktcb" ] 232*61c4878aSAndroid Build Coastguard Worker } 233*61c4878aSAndroid Build Coastguard Worker} 234*61c4878aSAndroid Build Coastguard Worker 235*61c4878aSAndroid Build Coastguard Workerpw_facade("freertos_tsktcb") { 236*61c4878aSAndroid Build Coastguard Worker backend = pw_thread_freertos_FREERTOS_TSKTCB_BACKEND 237*61c4878aSAndroid Build Coastguard Worker public_configs = [ ":public_include_path" ] 238*61c4878aSAndroid Build Coastguard Worker public = [ "public/pw_thread_freertos/freertos_tsktcb.h" ] 239*61c4878aSAndroid Build Coastguard Worker public_deps = [ "$dir_pw_third_party/freertos" ] 240*61c4878aSAndroid Build Coastguard Worker} 241*61c4878aSAndroid Build Coastguard Worker 242*61c4878aSAndroid Build Coastguard Workerpw_source_set("snapshot") { 243*61c4878aSAndroid Build Coastguard Worker public_configs = [ ":public_include_path" ] 244*61c4878aSAndroid Build Coastguard Worker public_deps = [ 245*61c4878aSAndroid Build Coastguard Worker ":config", 246*61c4878aSAndroid Build Coastguard Worker "$dir_pw_third_party/freertos", 247*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread:protos.pwpb", 248*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread:snapshot", 249*61c4878aSAndroid Build Coastguard Worker dir_pw_function, 250*61c4878aSAndroid Build Coastguard Worker dir_pw_protobuf, 251*61c4878aSAndroid Build Coastguard Worker dir_pw_status, 252*61c4878aSAndroid Build Coastguard Worker ] 253*61c4878aSAndroid Build Coastguard Worker public = [ "public/pw_thread_freertos/snapshot.h" ] 254*61c4878aSAndroid Build Coastguard Worker sources = [ "snapshot.cc" ] 255*61c4878aSAndroid Build Coastguard Worker deps = [ 256*61c4878aSAndroid Build Coastguard Worker ":freertos_tsktcb", 257*61c4878aSAndroid Build Coastguard Worker ":util", 258*61c4878aSAndroid Build Coastguard Worker dir_pw_function, 259*61c4878aSAndroid Build Coastguard Worker dir_pw_log, 260*61c4878aSAndroid Build Coastguard Worker ] 261*61c4878aSAndroid Build Coastguard Worker} 262*61c4878aSAndroid Build Coastguard Worker 263*61c4878aSAndroid Build Coastguard Workerconfig("test_thread_context_public_overrides") { 264*61c4878aSAndroid Build Coastguard Worker include_dirs = [ "test_thread_context_public_overrides" ] 265*61c4878aSAndroid Build Coastguard Worker visibility = [ ":*" ] 266*61c4878aSAndroid Build Coastguard Worker} 267*61c4878aSAndroid Build Coastguard Worker 268*61c4878aSAndroid Build Coastguard Workerpw_source_set("test_thread_context") { 269*61c4878aSAndroid Build Coastguard Worker public_configs = [ 270*61c4878aSAndroid Build Coastguard Worker ":public_include_path", 271*61c4878aSAndroid Build Coastguard Worker ":test_thread_context_public_overrides", 272*61c4878aSAndroid Build Coastguard Worker ] 273*61c4878aSAndroid Build Coastguard Worker public_deps = [ 274*61c4878aSAndroid Build Coastguard Worker ":thread", 275*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread:test_thread_context.facade", 276*61c4878aSAndroid Build Coastguard Worker ] 277*61c4878aSAndroid Build Coastguard Worker public = [ 278*61c4878aSAndroid Build Coastguard Worker "public/pw_thread_freertos/test_thread_context_native.h", 279*61c4878aSAndroid Build Coastguard Worker "test_thread_context_public_overrides/pw_thread_backend/test_thread_context_native.h", 280*61c4878aSAndroid Build Coastguard Worker ] 281*61c4878aSAndroid Build Coastguard Worker} 282*61c4878aSAndroid Build Coastguard Worker 283*61c4878aSAndroid Build Coastguard Workerpw_test_group("tests") { 284*61c4878aSAndroid Build Coastguard Worker tests = [ 285*61c4878aSAndroid Build Coastguard Worker ":dynamic_thread_backend_test", 286*61c4878aSAndroid Build Coastguard Worker ":static_thread_backend_test", 287*61c4878aSAndroid Build Coastguard Worker ] 288*61c4878aSAndroid Build Coastguard Worker if (pw_thread_freertos_FREERTOS_TSKTCB_BACKEND != "") { 289*61c4878aSAndroid Build Coastguard Worker tests += [ ":thread_iteration_test" ] 290*61c4878aSAndroid Build Coastguard Worker } 291*61c4878aSAndroid Build Coastguard Worker} 292*61c4878aSAndroid Build Coastguard Worker 293*61c4878aSAndroid Build Coastguard Workerif (pw_thread_freertos_FREERTOS_TSKTCB_BACKEND != "") { 294*61c4878aSAndroid Build Coastguard Worker pw_test("thread_iteration_test") { 295*61c4878aSAndroid Build Coastguard Worker enable_if = pw_thread_THREAD_BACKEND == "$dir_pw_thread_freertos:thread" && 296*61c4878aSAndroid Build Coastguard Worker pw_thread_THREAD_ITERATION_BACKEND != "" 297*61c4878aSAndroid Build Coastguard Worker sources = [ 298*61c4878aSAndroid Build Coastguard Worker "pw_thread_freertos_private/thread_iteration.h", 299*61c4878aSAndroid Build Coastguard Worker "thread_iteration_test.cc", 300*61c4878aSAndroid Build Coastguard Worker ] 301*61c4878aSAndroid Build Coastguard Worker deps = [ 302*61c4878aSAndroid Build Coastguard Worker ":freertos_tsktcb", 303*61c4878aSAndroid Build Coastguard Worker ":static_test_threads", 304*61c4878aSAndroid Build Coastguard Worker ":thread_iteration", 305*61c4878aSAndroid Build Coastguard Worker "$dir_pw_bytes", 306*61c4878aSAndroid Build Coastguard Worker "$dir_pw_span", 307*61c4878aSAndroid Build Coastguard Worker "$dir_pw_string:builder", 308*61c4878aSAndroid Build Coastguard Worker "$dir_pw_string:util", 309*61c4878aSAndroid Build Coastguard Worker "$dir_pw_sync:thread_notification", 310*61c4878aSAndroid Build Coastguard Worker "$dir_pw_third_party/freertos", 311*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread:non_portable_test_thread_options", 312*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread:thread", 313*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread:thread_info", 314*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread:thread_iteration", 315*61c4878aSAndroid Build Coastguard Worker ] 316*61c4878aSAndroid Build Coastguard Worker } 317*61c4878aSAndroid Build Coastguard Worker} 318*61c4878aSAndroid Build Coastguard Worker 319*61c4878aSAndroid Build Coastguard Workerpw_source_set("dynamic_test_threads") { 320*61c4878aSAndroid Build Coastguard Worker public_deps = [ "$dir_pw_thread:non_portable_test_thread_options" ] 321*61c4878aSAndroid Build Coastguard Worker sources = [ "dynamic_test_threads.cc" ] 322*61c4878aSAndroid Build Coastguard Worker deps = [ 323*61c4878aSAndroid Build Coastguard Worker "$dir_pw_chrono:system_clock", 324*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread:sleep", 325*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread:thread", 326*61c4878aSAndroid Build Coastguard Worker ] 327*61c4878aSAndroid Build Coastguard Worker} 328*61c4878aSAndroid Build Coastguard Worker 329*61c4878aSAndroid Build Coastguard Workerpw_test("dynamic_thread_backend_test") { 330*61c4878aSAndroid Build Coastguard Worker enable_if = pw_thread_THREAD_BACKEND == "$dir_pw_thread_freertos:thread" 331*61c4878aSAndroid Build Coastguard Worker deps = [ 332*61c4878aSAndroid Build Coastguard Worker ":dynamic_test_threads", 333*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread:thread_facade_test", 334*61c4878aSAndroid Build Coastguard Worker ] 335*61c4878aSAndroid Build Coastguard Worker 336*61c4878aSAndroid Build Coastguard Worker # Doesn't work on the Pico yet; 337*61c4878aSAndroid Build Coastguard Worker # TODO: https://pwbug.dev/325509758 - Doesn't work on the Pico yet; hangs 338*61c4878aSAndroid Build Coastguard Worker # indefinitely (on join() test). 339*61c4878aSAndroid Build Coastguard Worker if (pw_build_EXECUTABLE_TARGET_TYPE == "pico_executable") { 340*61c4878aSAndroid Build Coastguard Worker enable_if = false 341*61c4878aSAndroid Build Coastguard Worker } 342*61c4878aSAndroid Build Coastguard Worker} 343*61c4878aSAndroid Build Coastguard Worker 344*61c4878aSAndroid Build Coastguard Workerpw_source_set("static_test_threads") { 345*61c4878aSAndroid Build Coastguard Worker public_deps = [ "$dir_pw_thread:non_portable_test_thread_options" ] 346*61c4878aSAndroid Build Coastguard Worker sources = [ "static_test_threads.cc" ] 347*61c4878aSAndroid Build Coastguard Worker deps = [ 348*61c4878aSAndroid Build Coastguard Worker "$dir_pw_chrono:system_clock", 349*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread:sleep", 350*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread:thread", 351*61c4878aSAndroid Build Coastguard Worker ] 352*61c4878aSAndroid Build Coastguard Worker} 353*61c4878aSAndroid Build Coastguard Worker 354*61c4878aSAndroid Build Coastguard Workerpw_test("static_thread_backend_test") { 355*61c4878aSAndroid Build Coastguard Worker enable_if = pw_thread_THREAD_BACKEND == "$dir_pw_thread_freertos:thread" 356*61c4878aSAndroid Build Coastguard Worker deps = [ 357*61c4878aSAndroid Build Coastguard Worker ":static_test_threads", 358*61c4878aSAndroid Build Coastguard Worker "$dir_pw_thread:thread_facade_test", 359*61c4878aSAndroid Build Coastguard Worker ] 360*61c4878aSAndroid Build Coastguard Worker} 361*61c4878aSAndroid Build Coastguard Worker 362*61c4878aSAndroid Build Coastguard Workerpw_doc_group("docs") { 363*61c4878aSAndroid Build Coastguard Worker sources = [ "docs.rst" ] 364*61c4878aSAndroid Build Coastguard Worker} 365