Skip to content

Update mbedtls, lwip and cyw43-driver #2405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Apr 11, 2025
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: actions/checkout@v4

- name: Checkout submodules
run: git submodule update --init
run: git submodule update --init --recursive

- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
Expand Down
11 changes: 9 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,25 @@ new_git_repository(
new_git_repository(
name = "cyw43-driver",
build_file = "//src/rp2_common/pico_cyw43_driver:cyw43-driver.BUILD",
commit = "c1075d4bc440422cf2b2fd12c64a1f53f77660ee", # keep-in-sync-with-submodule: lib/cyw43-driver
commit = "dd7568229f3bf7a37737b9e1ef250c26efe75b23", # keep-in-sync-with-submodule: lib/cyw43-driver
remote = "https://github.com/georgerobotics/cyw43-driver.git",
)

# TODO: Provide lwip as a proper Bazel module.
new_git_repository(
name = "lwip",
build_file = "//src/rp2_common/pico_lwip:lwip.BUILD",
commit = "0a0452b2c39bdd91e252aef045c115f88f6ca773", # keep-in-sync-with-submodule: lib/lwip
commit = "77dcd25a72509eb83f72b033d219b1d40cd8eb95", # keep-in-sync-with-submodule: lib/lwip
remote = "https://github.com/lwip-tcpip/lwip.git",
)

new_git_repository(
name = "mbedtls",
build_file = "//src/rp2_common/pico_mbedtls:mbedtls.BUILD",
commit = "107ea89daaefb9867ea9121002fbbdf926780e98", # keep-in-sync-with-submodule: lib/mbedtls
remote = "https://github.com/Mbed-TLS/mbedtls.git",
)

register_toolchains(
"//bazel/toolchain:linux-aarch64-rp2040",
"//bazel/toolchain:linux-aarch64-rp2350",
Expand Down
6 changes: 6 additions & 0 deletions bazel/config/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -294,3 +294,9 @@ label_flag(
name = "PICO_FREERTOS_LIB",
build_setting_default = "//bazel:empty_cc_lib",
)

# PICO_BAZEL_CONFIG: PICO_MBEDTL_CONFIG, [Bazel only] The cc_library that provides mbedtls_config.h, default=//bazel:empty_cc_lib, group=pico_mbedtls
label_flag(
name = "PICO_MBEDTLS_CONFIG",
build_setting_default = "//bazel:empty_cc_lib",
)
6 changes: 6 additions & 0 deletions bazel/constraint/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -252,3 +252,9 @@ label_flag_matches(
flag = "//bazel/config:PICO_FREERTOS_LIB",
value = "//bazel:empty_cc_lib",
)

label_flag_matches(
name = "pico_mbedtls_config_unset",
flag = "//bazel/config:PICO_MBEDTLS_CONFIG",
value = "//bazel:empty_cc_lib",
)
2 changes: 2 additions & 0 deletions bazel/util/transition.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ kitchen_sink_test_binary = declare_transtion(
attrs = {
"bt_stack_config": attr.label(mandatory = True),
"lwip_config": attr.label(mandatory = True),
"mbedtls_config": attr.label(mandatory = True),
"enable_ble": attr.bool(default = False),
"enable_bt_classic": attr.bool(default = False),
# This could be shared, but we don't in order to make it clearer that
Expand All @@ -127,6 +128,7 @@ kitchen_sink_test_binary = declare_transtion(
"@pico-sdk//bazel/config:PICO_LWIP_CONFIG": "lwip_config",
"@pico-sdk//bazel/config:PICO_BT_ENABLE_BLE": "enable_ble",
"@pico-sdk//bazel/config:PICO_BT_ENABLE_CLASSIC": "enable_bt_classic",
"@pico-sdk//bazel/config:PICO_MBEDTLS_CONFIG": "mbedtls_config",
},
)

Expand Down
1 change: 1 addition & 0 deletions docs/index.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
* \defgroup tinyusb_device tinyusb_device
* \defgroup tinyusb_host tinyusb_host
* \endcond
* \cond pico_mbedtls \defgroup pico_mbedtls pico_mbedtls \endcond
* @}
*
* \defgroup networking Networking Libraries
Expand Down
2 changes: 1 addition & 1 deletion lib/lwip
Submodule lwip updated 103 files
2 changes: 1 addition & 1 deletion lib/mbedtls
Submodule mbedtls updated 1568 files
2 changes: 1 addition & 1 deletion src/cmake/rp2_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ if (NOT PICO_BARE_METAL)
pico_add_subdirectory(rp2_common/pico_async_context)
pico_add_subdirectory(rp2_common/pico_btstack)
pico_add_subdirectory(rp2_common/pico_cyw43_driver)
pico_add_subdirectory(rp2_common/pico_mbedtls)
pico_add_subdirectory(rp2_common/pico_lwip)
pico_add_subdirectory(rp2_common/pico_cyw43_arch)
pico_add_subdirectory(rp2_common/pico_mbedtls)

pico_add_subdirectory(rp2_common/pico_time_adapter)

Expand Down
1 change: 1 addition & 0 deletions src/rp2_common/pico_btstack/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# PICO_CMAKE_CONFIG: PICO_BTSTACK_PATH, Path to an alternative version of btstack overriding the version in pico-sdk/libs/btstack. Can be passed to cmake or set in your environment, type=string, group=pico_btstack
if (DEFINED ENV{PICO_BTSTACK_PATH} AND (NOT PICO_BTSTACK_PATH))
set(PICO_BTSTACK_PATH $ENV{PICO_BTSTACK_PATH})
message("Using PICO_BTSTACK_PATH from environment ('${PICO_BTSTACK_PATH}')")
Expand Down
1 change: 1 addition & 0 deletions src/rp2_common/pico_cyw43_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# PICO_CMAKE_CONFIG: PICO_CYW43_DRIVER_PATH, Path to an alternative version of cyw43-driver overriding the version in pico-sdk/libs/cyw43-driver, type=string, group=pico_cyw43_driver
if (DEFINED ENV{PICO_CYW43_DRIVER_PATH} AND (NOT PICO_CYW43_DRIVER_PATH))
set(PICO_CYW43_DRIVER_PATH $ENV{PICO_CYW43_DRIVER_PATH})
message("Using PICO_CYW43_DRIVER_PATH from environment ('${PICO_CYW43_DRIVER_PATH}')")
Expand Down
9 changes: 5 additions & 4 deletions src/rp2_common/pico_lwip/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,15 @@ alias(
actual = "@lwip//:pico_lwip_tftp",
)

alias(
cc_library(
name = "pico_lwip_mbedtls",
actual = "@lwip//:pico_lwip_mbedtls",
srcs = ["altcp_tls_mbedtls.c"],
deps = ["@lwip//:pico_lwip_mbedtls"],
)

alias(
name = "pico_lwip_mqttt",
actual = "@lwip//:pico_lwip_mqttt",
name = "pico_lwip_mqtt",
actual = "@lwip//:pico_lwip_mqtt",
)

alias(
Expand Down
18 changes: 17 additions & 1 deletion src/rp2_common/pico_lwip/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# PICO_CMAKE_CONFIG: PICO_LWIP_PATH, Path to an alternative version of lwip overriding the version in pico-sdk/libs/lwip. Can be passed to cmake or set in your environment, type=string, group=pico_lwip
if (DEFINED ENV{PICO_LWIP_PATH} AND (NOT PICO_LWIP_PATH))
set(PICO_LWIP_PATH $ENV{PICO_LWIP_PATH})
message("Using PICO_LWIP_PATH from environment ('${PICO_LWIP_PATH}')")
Expand Down Expand Up @@ -234,14 +235,29 @@ if (EXISTS ${PICO_LWIP_PATH}/${LWIP_TEST_PATH})
${PICO_LWIP_PATH}/src/apps/tftp/tftp.c
)


# Mbed TLS files
pico_add_library(pico_lwip_mbedtls NOFLAG)
target_sources(pico_lwip_mbedtls INTERFACE
${PICO_LWIP_PATH}/src/apps/altcp_tls/altcp_tls_mbedtls.c
${PICO_LWIP_PATH}/src/apps/altcp_tls/altcp_tls_mbedtls_mem.c
${PICO_LWIP_PATH}/src/apps/snmp/snmpv3_mbedtls.c
)

# altcp_tls_mbedtls.c is not compatible with mbedtls 3.x so use a patched version until this is resolved
# See https://savannah.nongnu.org/patch/index.php?10448
if (MBEDTLS_VERSION_MAJOR AND MBEDTLS_VERSION_MAJOR GREATER_EQUAL 3)
target_sources(pico_lwip_mbedtls INTERFACE
${CMAKE_CURRENT_LIST_DIR}/altcp_tls_mbedtls.c
)
target_include_directories(pico_lwip_mbedtls INTERFACE
${PICO_LWIP_PATH}/src/apps/altcp_tls
)
else()
target_sources(pico_lwip_mbedtls INTERFACE
${PICO_LWIP_PATH}/src/apps/altcp_tls/altcp_tls_mbedtls.c
)
endif()

# MQTT client files
pico_add_library(pico_lwip_mqtt NOFLAG)
target_sources(pico_lwip_mqtt INTERFACE
Expand Down
Loading