Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ build:s32k148_relwithdebinfo --config=s32k148
build:s32k148_relwithdebinfo --copt=-g3
build:s32k148_relwithdebinfo --copt=-O2
build:s32k148_relwithdebinfo --copt=-DNDEBUG

build:s32k148_threadx --config=s32k148
build:s32k148_threadx --//bazel/config/rtos=threadx
test --//bazel/config/executable_config=unit_test
32 changes: 30 additions & 2 deletions executables/referenceApp/platforms/posix/main/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,36 @@ load("@rules_cc//cc:cc_library.bzl", "cc_library")

cc_library(
name = "freertos_os_hooks",
srcs = ["src/osHooks/freertos/osHooks.cpp"],
srcs = select({
"//bazel/config/rtos:support_freertos": [
"src/osHooks/freertos/osHooks.cpp",
],
"//conditions:default": [],
}),
implementation_deps = select({
"//bazel/config/rtos:support_freertos": [
"//libs/3rdparty/freeRtos:freertos_headers",
],
"//conditions:default": [],
}),
target_compatible_with = ["@platforms//os:linux"],
visibility = ["//libs/3rdparty/freeRtos:__pkg__"],
deps = ["//libs/3rdparty/freeRtos:freertos_headers"],
)

cc_library(
name = "threadx_os_hooks",
srcs = select({
"//bazel/config/rtos:support_threadx": [
"src/osHooks/threadx/osHooks.cpp",
],
"//conditions:default": [],
}),
implementation_deps = select({
"//bazel/config/rtos:support_threadx": [
"//libs/3rdparty/threadx:threadx_headers",
],
"//conditions:default": [],
}),
target_compatible_with = ["@platforms//os:linux"],
visibility = ["//libs/3rdparty/threadx:__pkg__"],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# *******************************************************************************
# Copyright (c) 2026 Accenture
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

load("@rules_cc//cc:cc_library.bzl", "cc_library")

cc_library(
name = "threadx_core_configuration",
hdrs = ["include/tx_user.h"],
strip_include_prefix = "include",
visibility = ["//visibility:public"],
)
46 changes: 41 additions & 5 deletions executables/referenceApp/platforms/s32k148evb/main/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,47 @@ load("@rules_cc//cc:cc_library.bzl", "cc_library")

cc_library(
name = "freertos_os_hooks",
srcs = ["src/osHooks/freertos/osHooks.cpp"],
srcs = select({
"//bazel/config/rtos:support_freertos": [
"src/osHooks/freertos/osHooks.cpp",
],
"//conditions:default": [],
}),
implementation_deps = select({
"//bazel/config/rtos:support_freertos": [
"//libs/3rdparty/freeRtos:freertos_headers",
"//libs/bsw/common",
],
"//conditions:default": [],
}),
target_compatible_with = ["//bazel/platform/constraints/soc:s32k148"],
visibility = ["//libs/3rdparty/freeRtos:__pkg__"],
deps = [
"//libs/3rdparty/freeRtos:freertos_headers",
"//libs/bsw/common",
],
)

cc_library(
name = "threadx_os_hooks",
srcs = select({
"//bazel/config/rtos:support_threadx": [
"src/osHooks/threadx/osHooks.cpp",
],
"//conditions:default": [],
}),
hdrs = select({
"//bazel/config/rtos:support_threadx": [
"include/osHooks/threadx/osHooks.h",
],
"//conditions:default": [],
}),
implementation_deps = select({
"//bazel/config/rtos:support_threadx": [
"//libs/3rdparty/threadx:threadx_headers",
"//libs/bsw/asyncThreadX:threadx_configuration",
"//libs/bsw/common",
"//platforms/s32k1xx/3rdparty/threadx:threadx_cortex_m4",
],
"//conditions:default": [],
}),
strip_include_prefix = "include/osHooks/threadx",
target_compatible_with = ["//bazel/platform/constraints/soc:s32k148"],
visibility = ["//libs/3rdparty/threadx:__pkg__"],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# *******************************************************************************
# Copyright (c) 2026 Accenture
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

load("@rules_cc//cc:cc_library.bzl", "cc_library")

cc_library(
name = "threadx_core_configuration",
hdrs = ["include/tx_user.h"],
strip_include_prefix = "include",
target_compatible_with = ["//bazel/platform/constraints/soc:s32k148"],
visibility = ["//visibility:public"],
)
59 changes: 37 additions & 22 deletions libs/3rdparty/freeRtos/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -72,36 +72,51 @@ label_flag(

cc_library(
name = "freertos_headers",
hdrs = glob(["include/**/*.h"]),
hdrs = select({
"//bazel/config/rtos:support_freertos": glob(["include/**/*.h"]),
"//conditions:default": [],
}),
strip_include_prefix = "include",
visibility = ["//visibility:public"],
deps = [
":freertos_port",
"//libs/bsw/asyncFreeRtos:freertos_configuration",
],
deps = select({
"//bazel/config/rtos:support_freertos": [
":freertos_port",
"//libs/bsw/asyncFreeRtos:freertos_configuration",
],
"//conditions:default": [],
}),
)

# Circular dependency present on the CMake side: freeRtos -> freeRtosPortImpl -> freeRtos
# Split off freertos_headers and freertos_port_impl to break the circular dependency for Bazel
cc_library(
name = "freertos",
srcs = [
"src/croutine.c",
"src/event_groups.c",
"src/list.c",
"src/queue.c",
"src/stream_buffer.c",
"src/tasks.c",
"src/timers.c",
],
srcs = select({
"//bazel/config/rtos:support_freertos": [
"src/croutine.c",
"src/event_groups.c",
"src/list.c",
"src/queue.c",
"src/stream_buffer.c",
"src/tasks.c",
"src/timers.c",
],
"//conditions:default": [],
}),
copts = ["-Wno-unused-variable"],
implementation_deps = [
":freertos_os_hooks",
":freertos_port_impl",
],
implementation_deps = select({
"//bazel/config/rtos:support_freertos": [
":freertos_os_hooks",
":freertos_port_impl",
],
"//conditions:default": [],
}),
visibility = ["//visibility:public"],
deps = [
":freertos_headers",
"//libs/bsw/platform",
],
deps = select({
"//bazel/config/rtos:support_freertos": [
":freertos_headers",
"//libs/bsw/platform",
],
"//conditions:default": [],
}),
)
117 changes: 117 additions & 0 deletions libs/3rdparty/threadx/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# *******************************************************************************
# Copyright (c) 2026 Accenture
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

load("@rules_cc//cc:cc_library.bzl", "cc_library")

alias(
name = "threadx_port_default",
actual = select(
{
"//bazel/platform/constraints/soc:s32k148": "//platforms/s32k1xx/3rdparty/threadx:threadx_cortex_m4_port",
"@platforms//os:linux": "//platforms/posix/3rdparty/threadx:threadx_linux_port_headers",
},
no_match_error = "No ThreadX port for this platform. Override --//libs/3rdparty/threadx:threadx_port with your own port target.",
),
)

# ThreadX port (tx_port.h).
# Default: select based on the target platform (S32K148, POSIX)
# Override: --//libs/3rdparty/threadx:threadx_port=//path/to:your_port
label_flag(
name = "threadx_port",
build_setting_default = ":threadx_port_default",
visibility = ["//visibility:public"],
)

alias(
name = "threadx_port_impl_default",
actual = select(
{
"//bazel/platform/constraints/soc:s32k148": "//platforms/s32k1xx/3rdparty/threadx:threadx_cortex_m4",
"@platforms//os:linux": "//platforms/posix/3rdparty/threadx:threadx_linux",
},
no_match_error = "No ThreadX port implementation for this platform. Override --//libs/3rdparty/threadx:threadx_port_impl with your own port target.",
),
)

# ThreadX port implementation
# Default: select based on the target platform (S32K148, POSIX)
# Override: --//libs/3rdparty/threadx:threadx_port_impl=//path/to:your_port_impl
label_flag(
name = "threadx_port_impl",
build_setting_default = ":threadx_port_impl_default",
visibility = ["//visibility:public"],
)

alias(
name = "threadx_os_hooks_default",
actual = select(
{
"//bazel/platform/constraints/soc:s32k148": "//executables/referenceApp/platforms/s32k148evb/main:threadx_os_hooks",
"@platforms//os:linux": "//executables/referenceApp/platforms/posix/main:threadx_os_hooks",
},
no_match_error = "No ThreadX OS hooks for this platform. Override --//libs/3rdparty/threadx:threadx_os_hooks with your own hooks target.",
),
)

# ThreadX OS hooks
# Default: select based on the target platform (S32K148, POSIX)
# Override: --//libs/3rdparty/threadx:threadx_os_hooks=//path/to:your_os_hooks
label_flag(
name = "threadx_os_hooks",
build_setting_default = ":threadx_os_hooks_default",
visibility = ["//visibility:public"],
)

cc_library(
name = "threadx_headers",
hdrs = select({
"//bazel/config/rtos:support_threadx": glob(["common/inc/**/*.h"]),
"//conditions:default": [],
}),
includes = select({
"//bazel/config/rtos:support_threadx": ["common/inc"],
"//conditions:default": [],
}),
visibility = ["//visibility:public"],
deps = select({
"//bazel/config/rtos:support_threadx": [
":threadx_port",
"//libs/bsw/asyncThreadX:threadx_configuration",
],
"//conditions:default": [],
}),
)

# Circular dependency present on the CMake side: threadX -> osHooks -> asyncThreadX -> threadX
# Split off threadx_headers to break the circular dependency for Bazel
cc_library(
name = "threadx",
srcs = select({
"//bazel/config/rtos:support_threadx": glob(["common/src/*.c"]),
"//conditions:default": [],
}),
copts = ["-Wno-error=unused-parameter"],
implementation_deps = select({
"//bazel/config/rtos:support_threadx": [
":threadx_os_hooks",
":threadx_port_impl",
],
"//conditions:default": [],
}),
visibility = ["//visibility:public"],
deps = select({
"//bazel/config/rtos:support_threadx": [
":threadx_headers",
"//libs/bsw/platform",
],
"//conditions:default": [],
}),
)
Loading
Loading