Skip to content
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

Roll esp-idf to 5.1. #2650

Merged
merged 6 commits into from
Nov 29, 2024
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 CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ else()
# pressure, but means the TLS connection often breaks after a while when the
# counterpart makes the packets larger. This ...IN_CONTENT_LEN define is
# overriddden in sdkconfig files for devices.
set(MBEDTLS_C_FLAGS "-DMBEDTLS_SSL_IN_CONTENT_LEN=7800 -DMBEDTLS_SSL_OUT_CONTENT_LEN=3700 -DMBEDTLS_PLATFORM_MEMORY=1 -DMBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK=1")
set(MBEDTLS_C_FLAGS "-DMBEDTLS_CONFIG_FILE=\\\"${CMAKE_SOURCE_DIR}/mbedtls/include/toit_config.h\\\"")
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${TOIT_GENERIC_FLAGS} ${TOIT_LWIP_C_FLAGS} ${MBEDTLS_C_FLAGS}")
Expand Down
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ sdk: tools toit-tools version-file
.PHONY: sdk-no-cmake
sdk-no-cmake: tools-no-cmake toit-tools-no-cmake

.PHONY: check-env
check-env:
ifndef IGNORE_SUBMODULE
@ if git submodule status | grep '^[-+]' ; then \
Expand Down Expand Up @@ -96,6 +97,14 @@ ifeq ("$(wildcard ./toolchains/$(TOOLCHAIN).cmake)","")
$(error invalid compilation target '$(TOOLCHAIN)')
endif

.PHONY: check-mbedtls-config
check-mbedtls-config: check-env
@ if ! diff -q --ignore-all-space third_party/esp-idf/components/mbedtls/mbedtls/include/mbedtls/mbedtls_config.h mbedtls/include/default_config.h; then \
echo "mbedtls/include/default_config.h is not in sync with third_party/esp-idf/components/mbedtls/mbedtls/include/mbedtls/mbedtls_config.h"; \
echo "See the mbedtls/include/README.md for instructions on how to update mbedtls/include/default_config.h"; \
exit 1; \
fi

# We mark this phony because adding and removing .cc files means that
# cmake needs to be rerun, but we don't detect that, so it might not
# get run enough. It takes <1s on Linux to run cmake, so it's
Expand Down Expand Up @@ -143,7 +152,7 @@ disable-auto-sync:
cmake -DTOIT_PKG_AUTO_SYNC=OFF $(BUILD)/$(TARGET)

.PHONY: host-tools
host-tools: check-env $(BUILD)/$(HOST)/CMakeCache.txt
host-tools: check-mbedtls-config check-env $(BUILD)/$(HOST)/CMakeCache.txt
(cd $(BUILD)/$(HOST) && ninja build_tools)

.PHONY: tools
Expand Down
24 changes: 24 additions & 0 deletions mbedtls/include/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Toit configuration for mbedtls

This directory contains the configuration for building mbedtls with Toit.
When compiling for the ESP32 family, these files are ignored and the
ESP-IDF configuration is used. (The ESP-IDF configuration is located in
`./third_party/esp-idf/components/mbedtls/port/include/mbedtls/esp_config.h`.)

This directory contains two files: [default_config.h](default_config.h)
and [toit_config.h](toit_config.h). The default config is unused and
serves as a reference for the configuration options. It makes it possible to
easily see which configurations have changed.

## Updating mbedtls

When updating mbedtls to a new version, the configuration files should be
updated to match the new version.

Use the current `default_config.h` as a reference to see which configurations
were changed. It's likely we want the same changes in the new version.

Then replace the `default_config.h` with the new version located at
third_party/esp-idf/components/mbedtls/mbedtls/include/mbedtls/mbedtls_config.h.

Use it as a base for a new updated `toit_config.h`.
Loading