Skip to content
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@ can be independently enabled or disabled. By default **US-English** and
Requires [ESP-IDF](https://docs.espressif.com/projects/esp-idf/en/stable/)
v5.3 or later (v5.3 - v5.5 confirmed working).

> **Note:** the e-paper boards (M5Stack PaperS3 and LilyGO T5 E-Paper
> S3 Pro / Pro Lite) currently require **ESP-IDF 5.5.x**. The
> `vroland/epdiy` driver is not yet compatible with ESP-IDF 6.x;
> please stay on the 5.5.x release line for these devices until the
> driver becomes compatible.

Keep in mind that M5Stack Tab5 uses a different MCU, so the tatget
should be set to 'esp32s4'.

Expand Down
9 changes: 8 additions & 1 deletion components/battery/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
idf_component_register(
SRCS "battery.cpp"
INCLUDE_DIRS "include"
PRIV_REQUIRES esp_adc driver
## ESP-IDF 6.0 removed the legacy `driver` component's public
## dependencies on the split `esp_driver_*` components (see the
## 6.0 peripherals migration guide). battery.cpp includes
## `driver/gpio.h` and `driver/i2c_master.h`, so the matching
## `esp_driver_gpio` and `esp_driver_i2c` components must be
## listed explicitly. They also exist on IDF 5.3+, so the same
## list works on older IDFs.
PRIV_REQUIRES esp_adc driver esp_driver_gpio esp_driver_i2c
)
9 changes: 8 additions & 1 deletion components/display/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
idf_component_register(
SRCS "display_rlcd.cpp" "display_epdiy.cpp" "epd_board_papers3.c" "display_axs15231b.cpp" "display_mipi_dsi.cpp" "lvgl_port.cpp"
INCLUDE_DIRS "include"
PRIV_REQUIRES driver esp_lcd esp_timer lvgl__lvgl
## ESP-IDF 6.0 removed the legacy `driver` component's public
## dependencies on the split `esp_driver_*` components (see the
## 6.0 peripherals migration guide). The display backends
## directly include `driver/gpio.h`, `driver/spi_master.h`,
## `driver/i2c_master.h`, and `driver/ledc.h`, so the matching
## `esp_driver_*` components must be listed explicitly. They
## also exist on IDF 5.3+, so the same list works on older IDFs.
PRIV_REQUIRES driver esp_driver_gpio esp_driver_spi esp_driver_i2c esp_driver_ledc esp_lcd esp_timer lvgl__lvgl
)

# Inject the LVGL custom-allocator hooks (lv_mem_init / lv_malloc_core /
Expand Down
10 changes: 10 additions & 0 deletions components/display/idf_component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,21 @@ dependencies:
## compile epd_board.h. display_epdiy.cpp is wrapped in
## `#if CONFIG_DRAFTLING_DISPLAY_EPDIY` so skipping the dep on
## non-epdiy targets is sufficient.
## epdiy does not yet compile against ESP-IDF 6.x: its
## `src/output_lcd/lcd_driver.c` includes `soc/lcd_periph.h`,
## which was removed in IDF 6.0. Tracked upstream in
## https://github.com/vroland/epdiy/issues/450. Until a fix lands,
## gate the dependency to `idf_version <6.0` so non-epdiy boards
## (Waveshare 3.49 / JC3248W535 / RLCD42, plus the ESP32-P4 Tab5)
## can still build on IDF 6.x. epdiy-based boards (LilyGO T5
## Pro / Pro Lite, M5Stack PaperS3) must stay on ESP-IDF 5.3-5.5
## for now.
vroland/epdiy:
git: "https://github.com/vroland/epdiy.git"
version: "a3426c0ec38f98282cf3ec33761e556f083b0f7c"
rules:
- if: "idf_version >=5.3.0"
- if: "idf_version <6.0"
- if: "target != esp32p4"
require: public
## espressif/m5stack_tab5 BSP, pulled in only for the ESP32-P4
Expand Down
21 changes: 20 additions & 1 deletion components/git_sync/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
## ESP-IDF 6.0 moved the bundled cJSON ("json") component out of the
## core tree into the espressif/cjson managed component (see the
## ESP-IDF 6.0 protocols migration guide). The managed component
## registers under the name "cjson", so the PRIV_REQUIRES entry must
## switch from "json" (IDF <=5.x built-in) to "cjson" (IDF >=6.0
## managed) depending on the running ESP-IDF version. The matching
## dependency declaration lives in idf_component.yml and is gated on
## the same idf_version >=6.0 rule so older IDFs keep using the
## built-in component without downloading it.
if(IDF_VERSION_MAJOR GREATER_EQUAL 6)
set(_git_sync_cjson_component cjson)
else()
set(_git_sync_cjson_component json)
endif()

idf_component_register(
SRCS "git_sync.cpp"
INCLUDE_DIRS "include"
PRIV_REQUIRES esp_http_client esp-tls json sd_card wifi_manager nvs_flash
## mbedtls is needed for mbedtls_base64_* and for the PSA Crypto
## API used by the git blob SHA-1 helper on ESP-IDF 6.x (Mbed
## TLS 4.x removed the legacy mbedtls_sha1_* API; see the
## ESP-IDF 6.0 security migration guide).
PRIV_REQUIRES esp_http_client esp-tls mbedtls ${_git_sync_cjson_component} sd_card wifi_manager nvs_flash
)
21 changes: 21 additions & 0 deletions components/git_sync/git_sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@
#include <esp_heap_caps.h>
#include <cJSON.h>
#include <mbedtls/base64.h>
#include <esp_idf_version.h>
#if ESP_IDF_VERSION_MAJOR >= 6
/* ESP-IDF 6.0 upgrades to Mbed TLS 4.x which removes the legacy
* `mbedtls/sha1.h` low-level API in favour of PSA Crypto (see the
* ESP-IDF 6.0 security migration guide). Use psa/crypto.h for the
* git blob SHA-1 helper instead. */
#include <psa/crypto.h>
#else
#include <mbedtls/sha1.h>
#endif

#include "git_sync.h"
#include "sd_card.h"
Expand Down Expand Up @@ -177,13 +186,25 @@ static void compute_blob_sha(const char *content, size_t len, char out_hex[41])
char header[32];
int hlen = snprintf(header, sizeof(header), "blob %zu", len);

#if ESP_IDF_VERSION_MAJOR >= 6
/* Mbed TLS 4.x removed the legacy mbedtls_sha1_* API; use PSA
* Crypto. ESP-IDF initialises PSA during normal startup, so no
* psa_crypto_init() call is needed here. */
psa_hash_operation_t op = PSA_HASH_OPERATION_INIT;
size_t hash_len = 0;
psa_hash_setup(&op, PSA_ALG_SHA_1);
psa_hash_update(&op, (const unsigned char *)header, hlen + 1);
psa_hash_update(&op, (const unsigned char *)content, len);
psa_hash_finish(&op, hash, sizeof(hash), &hash_len);
#else
mbedtls_sha1_context ctx;
mbedtls_sha1_init(&ctx);
mbedtls_sha1_starts(&ctx);
mbedtls_sha1_update(&ctx, (const unsigned char *)header, hlen + 1);
mbedtls_sha1_update(&ctx, (const unsigned char *)content, len);
mbedtls_sha1_finish(&ctx, hash);
mbedtls_sha1_free(&ctx);
#endif

for (int i = 0; i < 20; i++)
snprintf(out_hex + i * 2, 3, "%02x", hash[i]);
Expand Down
20 changes: 20 additions & 0 deletions components/git_sync/idf_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## IDF Component manifest for the git_sync component.
##
## git_sync parses GitHub REST API responses with cJSON. Through
## ESP-IDF 5.x, cJSON was bundled in-tree as the "json" core
## component and was pulled in via PRIV_REQUIRES alone. ESP-IDF 6.0
## removed the bundled component and moved it to the
## espressif/cjson managed component (see the ESP-IDF 6.0 protocols
## migration guide). Declare the managed dependency only on IDF
## >=6.0 so that 5.x builds keep using the built-in "json"
## component (the matching PRIV_REQUIRES switch lives in
## CMakeLists.txt and keys off IDF_VERSION_MAJOR).
##
## See:
## https://components.espressif.com/components/espressif/cjson
## https://github.com/espressif/idf-extra-components/tree/master/cjson
dependencies:
espressif/cjson:
version: "^1.7.18"
rules:
- if: "idf_version >=6.0"
9 changes: 8 additions & 1 deletion components/sd_card/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
idf_component_register(
SRCS "sd_card.cpp"
INCLUDE_DIRS "include"
PRIV_REQUIRES fatfs sdmmc vfs driver
## ESP-IDF 6.0 removed the legacy `driver` component's public
## dependencies on the split `esp_driver_*` components (see the
## 6.0 peripherals migration guide). sd_card.cpp includes
## `driver/sdmmc_host.h`, `driver/sdspi_host.h`,
## `driver/spi_common.h`, and `driver/gpio.h`, so the matching
## `esp_driver_*` components must be listed explicitly. They
## also exist on IDF 5.3+, so the same list works on older IDFs.
PRIV_REQUIRES fatfs sdmmc vfs driver esp_driver_sdmmc esp_driver_sdspi esp_driver_spi esp_driver_gpio
)
7 changes: 6 additions & 1 deletion components/standby/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
idf_component_register(
SRCS "standby.cpp"
INCLUDE_DIRS "include"
PRIV_REQUIRES nvs_flash esp_timer driver ble_keyboard display touchscreen power lvgl__lvgl
## ESP-IDF 6.0 removed the legacy `driver` component's public
## dependencies on the split `esp_driver_*` components (see the
## 6.0 peripherals migration guide). standby.cpp includes
## `driver/gpio.h` (now in esp_driver_gpio) and
## `driver/rtc_io.h` (still in the legacy `driver` component).
PRIV_REQUIRES nvs_flash esp_timer driver esp_driver_gpio ble_keyboard display touchscreen power lvgl__lvgl
)
idf_component_optional_requires(PRIVATE usb_kbd)
9 changes: 8 additions & 1 deletion main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
## init. We list it as a private requirement under a CONFIG guard so
## ESP32-S3 builds (which do not pull esp_hosted in at all) keep
## the same dependency set as before.
set(MAIN_PRIV_REQS display sd_card ble_keyboard editor wifi_manager git_sync standby battery touchscreen power nvs_flash bt esp_hid driver esp_event)
## ESP-IDF 6.0 removed the legacy `driver` component's public
## dependencies on the split `esp_driver_*` components (see the 6.0
## peripherals migration guide). main.cpp includes
## `driver/spi_common.h`, `driver/spi_master.h`, `driver/gpio.h`,
## `driver/i2c_master.h` (now in esp_driver_spi / esp_driver_gpio /
## esp_driver_i2c) and `driver/rtc_io.h` (still in the legacy
## `driver` component).
set(MAIN_PRIV_REQS display sd_card ble_keyboard editor wifi_manager git_sync standby battery touchscreen power nvs_flash bt esp_hid driver esp_driver_gpio esp_driver_spi esp_driver_i2c esp_event)
if(CONFIG_ESP_HOSTED_ENABLED)
list(APPEND MAIN_PRIV_REQS espressif__esp_hosted)
endif()
Expand Down