blob: 01256d41bb99b62090f0e0f83723deb35f2ff2bb [file] [log] [blame]
# Copyright 2021 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
load(
"@pigweed//pw_build:pigweed.bzl",
"pw_cc_library",
)
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
pw_cc_library(
name = "config_assert",
hdrs = [
"public/pw_third_party/freertos/config_assert.h",
],
includes = ["public"],
deps = [
"@pigweed//pw_assert",
],
)
constraint_setting(
name = "port",
)
constraint_value(
name = "port_ARM_CM7",
constraint_setting = ":port",
)
constraint_value(
name = "port_ARM_CM4F",
constraint_setting = ":port",
)
pw_cc_library(
name = "freertos",
srcs = [
"croutine.c",
"event_groups.c",
"list.c",
"queue.c",
"stream_buffer.c",
"timers.c",
] + select({
":port_ARM_CM4F": ["portable/GCC/ARM_CM4F/port.c"],
":port_ARM_CM7": ["portable/GCC/ARM_CM7/r0p1/port.c"],
"//conditions:default": [],
}),
includes = ["include/"] + select({
":port_ARM_CM4F": ["portable/GCC/ARM_CM4F"],
":port_ARM_CM7": ["portable/GCC/ARM_CM7/r0p1"],
"//conditions:default": [],
}),
textual_hdrs = [
"include/FreeRTOS.h",
"include/StackMacros.h",
"include/croutine.h",
"include/deprecated_definitions.h",
"include/event_groups.h",
"include/list.h",
"include/message_buffer.h",
"include/mpu_wrappers.h",
"include/portable.h",
"include/projdefs.h",
"include/queue.h",
"include/semphr.h",
"include/stack_macros.h",
"include/stream_buffer.h",
"include/task.h",
"include/timers.h",
] + select({
":port_ARM_CM4F": ["portable/GCC/ARM_CM4F/portmacro.h"],
":port_ARM_CM7": ["portable/GCC/ARM_CM7/r0p1/portmacro.h"],
"//conditions:default": [],
}),
deps = [
":pigweed_tasks_c",
"@pigweed_config//:freertos_config",
],
# Required because breaking out tasks_c results in the dependencies between
# the libraries not being quite correct: to link pigweed_tasks_c you
# actually need a bunch of the source files from here (e.g., list.c).
alwayslink = 1,
)
# Constraint setting used to determine if task statics should be disabled.
constraint_setting(
name = "disable_tasks_statics_setting",
default_constraint_value = ":no_disable_task_statics",
)
constraint_value(
name = "disable_task_statics",
constraint_setting = ":disable_tasks_statics_setting",
)
constraint_value(
name = "no_disable_task_statics",
constraint_setting = ":disable_tasks_statics_setting",
)
pw_cc_library(
name = "pigweed_tasks_c",
srcs = ["tasks.c"],
defines = select({
":disable_task_statics": [
"PW_THIRD_PARTY_FREERTOS_NO_STATICS=1",
],
"//conditions:default": [],
}),
includes = [
"include/",
] + select({
":port_ARM_CM4F": ["portable/GCC/ARM_CM4F/"],
":port_ARM_CM7": ["portable/GCC/ARM_CM7/r0p1/"],
"//conditions:default": [],
}),
local_defines = select({
":disable_task_statics": [
"static=",
],
"//conditions:default": [],
}),
# tasks.c transitively includes all these headers :/
textual_hdrs = [
"include/FreeRTOS.h",
"include/portable.h",
"include/projdefs.h",
"include/list.h",
"include/deprecated_definitions.h",
"include/mpu_wrappers.h",
"include/stack_macros.h",
"include/task.h",
"include/timers.h",
] + select({
":port_ARM_CM4F": ["portable/GCC/ARM_CM4F/portmacro.h"],
":port_ARM_CM7": ["portable/GCC/ARM_CM7/r0p1/portmacro.h"],
"//conditions:default": [],
}),
deps = ["@pigweed_config//:freertos_config"],
)
# Constraint setting used to select the FreeRTOSConfig version.
constraint_setting(
name = "freertos_config_setting",
)
alias(
name = "freertos_config",
actual = select({
"@pigweed//targets/stm32f429i_disc1_stm32cube:freertos_config_cv": "@pigweed//targets/stm32f429i_disc1_stm32cube:freertos_config",
"//conditions:default": "default_freertos_config",
}),
)
pw_cc_library(
name = "default_freertos_config",
# The "default" config is not compatible with any configuration: you can't
# build FreeRTOS without choosing a config.
target_compatible_with = ["@platforms//:incompatible"],
)
# Exported for
# pw_thread_freertos/py/pw_thread_freertos/generate_freertos_tsktcb.py
exports_files(
["tasks.c"],
)