From 980e181110a1e76b97d10eb5b91f44ea2a63c61f Mon Sep 17 00:00:00 2001 From: Dominik Fischer Date: Fri, 19 Jun 2026 14:40:42 +0200 Subject: [PATCH 1/2] Migrate lwip - libs/3rdparty/lwip: lwip_core cc_library, lwip_configuration label_flag - executables/referenceApp/lwipConfiguration: lwip_configuration implementation with platform-select for lwipSysArch - executables/referenceApp/application: application_headers stub - platforms/posix/lwipSysArch, platforms/s32k1xx/lwipSysArch: sys_arch port libraries - libs/bsw/lwipSocket: lwipSocket cc_library - Add lwip BUILD file to ignored rim files. Change-Id: Ia5ec7c273aac6fc3545df972b02cf44898de570b --- bazel_migration/README.md | 14 ++++-- .../referenceApp/application/BUILD.bazel | 18 ++++++++ .../lwipConfiguration/BUILD.bazel | 39 ++++++++++++++++ libs/3rdparty/lwip/.riminfo | 4 +- libs/3rdparty/lwip/BUILD.bazel | 45 +++++++++++++++++++ libs/bsw/lwipSocket/BUILD.bazel | 42 +++++++++++++++++ platforms/posix/lwipSysArch/BUILD.bazel | 24 ++++++++++ platforms/s32k1xx/lwipSysArch/BUILD.bazel | 28 ++++++++++++ 8 files changed, 209 insertions(+), 5 deletions(-) create mode 100644 executables/referenceApp/application/BUILD.bazel create mode 100644 executables/referenceApp/lwipConfiguration/BUILD.bazel create mode 100644 libs/3rdparty/lwip/BUILD.bazel create mode 100644 libs/bsw/lwipSocket/BUILD.bazel create mode 100644 platforms/posix/lwipSysArch/BUILD.bazel create mode 100644 platforms/s32k1xx/lwipSysArch/BUILD.bazel diff --git a/bazel_migration/README.md b/bazel_migration/README.md index 1e7425e6f82..256c34fc54c 100644 --- a/bazel_migration/README.md +++ b/bazel_migration/README.md @@ -38,9 +38,11 @@ OpenBSW Bazel migration ├── docker/ ⬛ ├── executables/ │ ├── referenceApp/ 🔲 +│ │ ├── application (application_headers stub) ✅ │ │ ├── asyncBinding ✅ │ │ ├── asyncCoreConfiguration ✅ │ │ ├── configuration ✅ +│ │ ├── lwipConfiguration ✅ │ │ └── platforms/ │ │ ├── posix/ ✅ (freeRtosCoreConfiguration, osHooks) │ │ └── s32k148evb/ ✅ (freeRtosCoreConfiguration, osHooks) @@ -50,7 +52,9 @@ OpenBSW Bazel migration │ ├── 3rdparty/ │ │ ├── cmsis ✅ │ │ ├── etl ✅ -│ │ └── freeRtos ✅ +│ │ ├── freeRtos ✅ +│ │ ├── lwip ✅ +│ │ └── printf ✅ │ │ └── printf ✅ │ ├── bsp/ │ │ └── bspInterrupts ✅ @@ -64,6 +68,8 @@ OpenBSW Bazel migration │ │ ├── io ✅ │ │ ├── lifecycle ✅ │ │ ├── logger ✅ +│ │ ├── loggerIntegration ✅ +│ │ ├── lwipSocket ✅ │ │ ├── middleware ✅ │ │ ├── bsp ✅ │ │ ├── common ✅ @@ -74,8 +80,8 @@ OpenBSW Bazel migration │ │ ├── util ✅ │ └── (remaining) 🔲 ├── platforms/ -│ ├── posix/ ✅ (freeRtosPosix, bspInterruptsImpl) -│ └── s32k1xx/ ✅ (freertos_cm4_sysTick, bspMcu, bspInterruptsImpl) +│ ├── posix/ ✅ (freeRtosPosix, bspInterruptsImpl, etlImpl, lwipSysArch) +│ └── s32k1xx/ ✅ (freertos_cm4_sysTick, bspMcu, bspInterruptsImpl, etlImpl, lwipSysArch) ├── test/ Scope of Bazel support TBD └── tools/ Scope of Bazel support TBD @@ -104,6 +110,8 @@ Implemented config points: | [`platform`](../bazel/platform/BUILD) | Selects toolchain based on target platform | `--config=s32k148` | `platform` | `//bazel/platform:s32k148`, `@platforms//host` | `@platforms//host` | | [`executable_config`](../bazel/config/executable_config/BUILD) | Controls executable config; `unit_test` is incompatible with baremetal platforms (e.g `s32k148`) | `--//bazel/config/executable_config` | `string_flag` | `reference_app`, `unit_test` | `reference_app`, `unit_test` (bazel test invocations) | | [`etl_profile`](../libs/3rdparty/etl/BUILD) | Injects custom ETL profile; otherwise use default based on executable_config | `--//libs/3rdparty/etl:etl_profile` | `label_flag` | any `cc_library` label | `//executables/referenceApp/etl_profile` (`executable_config:reference_app`), `//executables/unitTest/etl_profile` (`executable_config:unit_test`) | +| [`etl_impl`](../libs/bsw/loggerIntegration/BUILD.bazel) | Injects custom ETL implementation for loggerIntegration; otherwise selects based on platform | `--//libs/bsw/loggerIntegration:etl_impl` | `label_flag` | any `cc_library` label | `//platforms/s32k1xx/etlImpl:etl_impl` (s32k148), `//platforms/posix/etlImpl:etl_impl` (posix) | +| [`lwip_configuration`](../libs/3rdparty/lwip/BUILD.bazel) | Injects custom lwIP configuration (lwipopts.h + sys_arch port); otherwise uses referenceApp default | `--//libs/3rdparty/lwip:lwip_configuration` | `label_flag` | any `cc_library` label | `//executables/referenceApp/lwipConfiguration:lwip_configuration` | Examples: ```bash diff --git a/executables/referenceApp/application/BUILD.bazel b/executables/referenceApp/application/BUILD.bazel new file mode 100644 index 00000000000..9ee516587f8 --- /dev/null +++ b/executables/referenceApp/application/BUILD.bazel @@ -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 = "application_headers", + hdrs = glob(["include/**/*.h"]), + strip_include_prefix = "include", + visibility = ["//visibility:public"], +) diff --git a/executables/referenceApp/lwipConfiguration/BUILD.bazel b/executables/referenceApp/lwipConfiguration/BUILD.bazel new file mode 100644 index 00000000000..d5d71b47e05 --- /dev/null +++ b/executables/referenceApp/lwipConfiguration/BUILD.bazel @@ -0,0 +1,39 @@ +# ******************************************************************************* +# 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 = "lwip_sys_arch_default", + actual = select( + { + "//bazel/platform/constraints/soc:s32k148": "//platforms/s32k1xx/lwipSysArch:lwip_sys_arch", + "@platforms//os:linux": "//platforms/posix/lwipSysArch:lwip_sys_arch", + }, + no_match_error = "No lwip sys_arch for this platform. Override --//libs/3rdparty/lwip:lwip_configuration with your own implementation.", + ), + visibility = ["//visibility:public"], +) + +cc_library( + name = "lwip_configuration", + srcs = ["src/rng.cpp"], + hdrs = [ + "include/lwipopts.h", + "include/rng.h", + ], + strip_include_prefix = "include", + visibility = ["//visibility:public"], + deps = [ + ":lwip_sys_arch_default", + "//libs/3rdparty/etl", + "//libs/bsw/platform", + ], +) diff --git a/libs/3rdparty/lwip/.riminfo b/libs/3rdparty/lwip/.riminfo index 5c44b2a9dc5..25b4e16ac48 100644 --- a/libs/3rdparty/lwip/.riminfo +++ b/libs/3rdparty/lwip/.riminfo @@ -1,4 +1,4 @@ -fb7b6b88c102aada3af57fbb5b649d7af271fd44 +e26ace8f8ce559a2e625e181286217e54bd67854 RIM Info file. You're welcome to read but don't write it. Instead, use RIM commands to do the things you want to do. @@ -7,7 +7,7 @@ BEWARE: Any manual modification will invalidate the file! remote_url : https://github.com/lwip-tcpip/lwip.git revision_sha1 : 009c2256469004009488b3385ba269461e8eb616 target_revision: STABLE-2_2_1_RELEASE -ignores : +ignores : BUILD.bazel checksum : 07f96577ede325cf117d934bd0229a5e0f0b3187 subdir : diff --git a/libs/3rdparty/lwip/BUILD.bazel b/libs/3rdparty/lwip/BUILD.bazel new file mode 100644 index 00000000000..4a3b6fbe703 --- /dev/null +++ b/libs/3rdparty/lwip/BUILD.bazel @@ -0,0 +1,45 @@ +# ******************************************************************************* +# 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 = "lwip_configuration_default", + actual = "//executables/referenceApp/lwipConfiguration:lwip_configuration", + visibility = ["//visibility:public"], +) + +# Default: //executables/referenceApp/lwipConfiguration:lwip_configuration +# Override: --//libs/3rdparty/lwip:lwip_configuration=//path/to:your_lwip_config +label_flag( + name = "lwip_configuration", + build_setting_default = ":lwip_configuration_default", + visibility = ["//visibility:public"], +) + +cc_library( + name = "lwip_core", + srcs = glob([ + "src/core/*.c", + "src/core/ipv4/*.c", + "src/core/ipv6/*.c", + "src/api/*.c", + "src/netif/*.c", + "src/netif/ppp/*.c", + "src/netif/ppp/polarssl/*.c", + ]), + hdrs = glob(["src/include/**/*.h"]), + strip_include_prefix = "src/include", + visibility = ["//visibility:public"], + deps = [ + ":lwip_configuration", + "//executables/referenceApp/application:application_headers", + ], +) diff --git a/libs/bsw/lwipSocket/BUILD.bazel b/libs/bsw/lwipSocket/BUILD.bazel new file mode 100644 index 00000000000..4b00a9d781e --- /dev/null +++ b/libs/bsw/lwipSocket/BUILD.bazel @@ -0,0 +1,42 @@ +# ******************************************************************************* +# 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 = "lwip_socket", + srcs = [ + "src/lwipSocket/netif/LwipNetworkInterface.cpp", + "src/lwipSocket/tcp/LwipServerSocket.cpp", + "src/lwipSocket/tcp/LwipSocket.cpp", + "src/lwipSocket/udp/LwipDatagramSocket.cpp", + "src/lwipSocket/utils/FilterFrame.cpp", + "src/lwipSocket/utils/TaskAssert.cpp", + ], + hdrs = [ + "include/lwipSocket/netif/LwipNetworkInterface.h", + "include/lwipSocket/tcp/LwipServerSocket.h", + "include/lwipSocket/tcp/LwipSocket.h", + "include/lwipSocket/udp/LwipDatagramSocket.h", + "include/lwipSocket/utils/LwipHelper.h", + "include/lwipSocket/utils/LwipLogger.h", + "include/lwipSocket/utils/TaskAssert.h", + ], + strip_include_prefix = "include", + visibility = ["//visibility:public"], + deps = [ + "//libs/3rdparty/etl", + "//libs/3rdparty/lwip:lwip_core", + "//libs/bsw/async", + "//libs/bsw/common", + "//libs/bsw/cpp2ethernet", + "//libs/bsw/util", + ], +) diff --git a/platforms/posix/lwipSysArch/BUILD.bazel b/platforms/posix/lwipSysArch/BUILD.bazel new file mode 100644 index 00000000000..09009d16033 --- /dev/null +++ b/platforms/posix/lwipSysArch/BUILD.bazel @@ -0,0 +1,24 @@ +# ******************************************************************************* +# 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 = "lwip_sys_arch", + srcs = ["src/arch/sys_arch.cpp"], + hdrs = [ + "include/arch/cc.h", + "include/arch/sys_arch.h", + ], + implementation_deps = ["//libs/bsw/bsp"], + strip_include_prefix = "include", + target_compatible_with = ["@platforms//os:linux"], + visibility = ["//visibility:public"], +) diff --git a/platforms/s32k1xx/lwipSysArch/BUILD.bazel b/platforms/s32k1xx/lwipSysArch/BUILD.bazel new file mode 100644 index 00000000000..1befa89de0e --- /dev/null +++ b/platforms/s32k1xx/lwipSysArch/BUILD.bazel @@ -0,0 +1,28 @@ +# ******************************************************************************* +# 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 = "lwip_sys_arch", + srcs = ["src/arch/sys_arch.cpp"], + hdrs = [ + "include/arch/cc.h", + "include/arch/sys_arch.h", + ], + implementation_deps = [ + "//libs/bsp/bspInterrupts:bsp_interrupts", + "//libs/bsw/bsp", + "//libs/bsw/platform", + ], + strip_include_prefix = "include", + target_compatible_with = ["//bazel/platform/constraints/soc:s32k148"], + visibility = ["//visibility:public"], +) From 68bc96faf6ce1ae540d40aa07edfb6972462a3c4 Mon Sep 17 00:00:00 2001 From: Dominik Fischer Date: Thu, 25 Jun 2026 12:32:20 +0200 Subject: [PATCH 2/2] remove //executables/referenceApp/application:application_headers target Change-Id: I91e9ba7871144b2c4a5f72fa3d42ba2554065d9b --- .../referenceApp/application/BUILD.bazel | 18 ------------------ libs/3rdparty/lwip/BUILD.bazel | 5 +---- 2 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 executables/referenceApp/application/BUILD.bazel diff --git a/executables/referenceApp/application/BUILD.bazel b/executables/referenceApp/application/BUILD.bazel deleted file mode 100644 index 9ee516587f8..00000000000 --- a/executables/referenceApp/application/BUILD.bazel +++ /dev/null @@ -1,18 +0,0 @@ -# ******************************************************************************* -# 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 = "application_headers", - hdrs = glob(["include/**/*.h"]), - strip_include_prefix = "include", - visibility = ["//visibility:public"], -) diff --git a/libs/3rdparty/lwip/BUILD.bazel b/libs/3rdparty/lwip/BUILD.bazel index 4a3b6fbe703..819a67fffea 100644 --- a/libs/3rdparty/lwip/BUILD.bazel +++ b/libs/3rdparty/lwip/BUILD.bazel @@ -38,8 +38,5 @@ cc_library( hdrs = glob(["src/include/**/*.h"]), strip_include_prefix = "src/include", visibility = ["//visibility:public"], - deps = [ - ":lwip_configuration", - "//executables/referenceApp/application:application_headers", - ], + deps = [":lwip_configuration"], )