Skip to content
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
18 changes: 14 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,23 @@ jobs:
run: make test

esp-idf:
name: ESP-IDF component build
name: ESP-IDF ${{ matrix.idf }} build (${{ matrix.target }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# v5.5.x uses plain mbedtls; v6.x (mbedTLS v4) exercises the
# mbedtls_compat shim path. esp32p4 is Kern's target on IDF 6.
include:
- idf: v5.5.4
target: esp32
- idf: v6.0.2
target: esp32p4
steps:
- uses: actions/checkout@v4
- name: Build smoke-test app for esp32
- name: Build smoke-test app
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v5.5.4
target: esp32
esp_idf_version: ${{ matrix.idf }}
target: ${{ matrix.target }}
path: 'tests/esp-idf-smoke'
11 changes: 10 additions & 1 deletion tests/esp-idf-smoke/components/cUR/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@ file(GLOB CUR_SRCS
"${CUR_REPO_ROOT}/src/types/*.c"
)

# Mirror the repo-root CMakeLists.txt: mbedTLS v4 (ESP-IDF >= 6.0) needs the
# mbedtls_compat header shim (vendored next to this component for the smoke
# build; real consumers like Kern bring their own).
if(IDF_VERSION_MAJOR GREATER_EQUAL 6)
set(CUR_SMOKE_REQUIRES mbedtls mbedtls_compat)
else()
set(CUR_SMOKE_REQUIRES mbedtls)
endif()

idf_component_register(
SRCS ${CUR_SRCS}
INCLUDE_DIRS "${CUR_REPO_ROOT}/src"
REQUIRES mbedtls
REQUIRES ${CUR_SMOKE_REQUIRES}
)

target_compile_definitions(${COMPONENT_LIB} PUBLIC UR_USE_MBEDTLS_SHA256)
10 changes: 10 additions & 0 deletions tests/esp-idf-smoke/components/mbedtls_compat/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Minimal vendored copy of the Kern project's mbedtls_compat shim, trimmed
# to SHA-256 (the only mbedTLS API cUR uses). mbedTLS v4 (ESP-IDF >= 6.0)
# moved the crypto headers from mbedtls/ to mbedtls/private/; this
# header-only component redirects #include <mbedtls/sha256.h> so
# src/sha256/sha256_compat.h keeps working. Real consumers on IDF >= 6
# (e.g. Kern) provide their own copy — see the repo-root CMakeLists.txt.
idf_component_register(
INCLUDE_DIRS "."
REQUIRES mbedtls
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Compatibility shim (vendored from Kern): mbedTLS v4 moved sha256.h to
// mbedtls/private/. MBEDTLS_ALLOW_PRIVATE_ACCESS keeps the context struct
// fields reachable through the private header.
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
#include "mbedtls/private/sha256.h"
12 changes: 11 additions & 1 deletion uUR.c
Original file line number Diff line number Diff line change
Expand Up @@ -1026,8 +1026,18 @@ const mp_obj_module_t bc_ur_module = {
// legacy form and fail to compile. MICROPY_VERSION is
// (major << 16 | minor << 8 | micro); on builds too old to define it, the
// expression evaluates to 0 and correctly selects the legacy 3-arg form.
//
// The modern branch registers through the UR_REGISTER_MODULE alias, not the
// macro's own name: the legacy MaixPy (K210) build generates
// genhdr/moduledefs.h by regex-scanning the RAW source for the macro name,
// ignoring preprocessor conditionals, and with two visible registrations the
// scan mangles the generated header ("#else after #else"). The alias keeps
// the modern line invisible to that scanner; modern builds collect
// registrations from PREPROCESSED source, where the alias has already
// expanded to the real macro.
#if MICROPY_VERSION >= ((1 << 16) | (19 << 8)) // >= v1.19
MP_REGISTER_MODULE(MP_QSTR_uUR, bc_ur_module);
#define UR_REGISTER_MODULE MP_REGISTER_MODULE
UR_REGISTER_MODULE(MP_QSTR_uUR, bc_ur_module);
#else
MP_REGISTER_MODULE(MP_QSTR_uUR, bc_ur_module, MODULE_BC_UR_ENABLED);
#endif
Loading