add espc6 fix heltec v3

This commit is contained in:
liquidraver
2026-04-05 21:38:33 +02:00
parent 1a20cdb4ea
commit 7acd08cbd9
6 changed files with 57 additions and 2 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ SWD flash: `west flash` (requires J-Link, pyocd, or nrfjprog connected).
| Board | Build string | Flash |
|----------------------|-----------------------------------------------------------|-----------------|
| XIAO ESP32-C3 | `west build -b xiao_esp32c3 zephcore` | `west flash` |
| XIAO ESP32-C6 | `west build -b xiao_esp32c6 zephcore` | `west flash` |
| XIAO ESP32-C6 | `west build -b xiao_esp32c6/esp32c6/hpcore zephcore` | `west flash` |
| LilyGo TLoRa C6 | `west build -b lilygo_tlora_c6/esp32c6/hpcore zephcore` | `west flash` |
| XIAO ESP32-S3 | `west build -b xiao_esp32s3/esp32s3/procpu zephcore` | `west flash` |
| Station G2 | `west build -b station_g2/esp32s3/procpu zephcore` | `west flash` |
+1 -1
View File
@@ -21,7 +21,7 @@ promicro_lr2021
```
xiao_esp32c3
xiao_esp32c6
xiao_esp32c6/esp32c6/hpcore
xiao_esp32s3/esp32s3/procpu
lilygo_tlora_c6/esp32c6/hpcore
station_g2/esp32s3/procpu
+47
View File
@@ -2,5 +2,52 @@
# so the BOARD_ROOT set there never fires. Set it here, before find_package(Sysbuild).
set(BOARD_ROOT "${APP_DIR}" CACHE STRING "" FORCE)
# Auto-propagate flash size from board.conf to MCUboot.
#
# MCUboot is built as a separate image and does NOT inherit the app's board.conf
# or esp32_common.conf. Boards with non-default flash sizes set
# CONFIG_ESPTOOLPY_FLASHSIZE_<N>MB=y in their board.conf, but without this
# block MCUboot builds with whatever its defconfig/Kconfig default is.
# A mismatch between MCUboot's image header flash size and the actual hardware
# causes the ROM bootloader to misconfigure the SPI flash controller, making
# MCUboot hang at "spi_flash: detected chip:".
#
# We set mcuboot_EXTRA_CONF_FILE BEFORE find_package(Sysbuild) so it takes
# priority — sysbuild_extensions.cmake uses CACHE INTERNAL (no FORCE) which
# only writes if the variable is not already set.
#
# Static conf files (mcuboot_flashsize_*.conf) are used instead of generating
# a temp file to avoid Windows line-ending issues with cmake file(WRITE).
string(REPLACE "/" ";" _board_parts "${BOARD}")
list(GET _board_parts 0 _board_base)
file(GLOB_RECURSE _board_conf_candidates
"${APP_DIR}/boards/*/${_board_base}/board.conf")
if(NOT _board_conf_candidates AND
EXISTS "${APP_DIR}/boards/${_board_base}/board.conf")
set(_board_conf_candidates "${APP_DIR}/boards/${_board_base}/board.conf")
endif()
if(_board_conf_candidates)
list(GET _board_conf_candidates 0 _board_conf)
file(READ "${_board_conf}" _board_conf_content)
set(_flashsize_fragment "")
foreach(_size 16MB 8MB 32MB 64MB 128MB)
if(_board_conf_content MATCHES "CONFIG_ESPTOOLPY_FLASHSIZE_${_size}=y")
string(TOLOWER "${_size}" _size_lower)
set(_flashsize_fragment
"${CMAKE_CURRENT_SOURCE_DIR}/mcuboot_flashsize_${_size_lower}.conf")
break()
endif()
endforeach()
if(_flashsize_fragment AND EXISTS "${_flashsize_fragment}")
set(mcuboot_EXTRA_CONF_FILE
"${CMAKE_CURRENT_SOURCE_DIR}/mcuboot.conf;${_flashsize_fragment}"
CACHE INTERNAL "MCUboot conf: global + flash size auto-propagated from board.conf")
endif()
endif()
find_package(Sysbuild REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(sysbuild LANGUAGES)
+6
View File
@@ -28,5 +28,11 @@ CONFIG_SPI=n
# unavailable in MCUboot's minimal kernel.
CONFIG_POWER_DOMAIN=n
# Flash size baseline — Kconfig default is 2MB, but all zephcore boards use at
# least 4MB. Boards with larger flash (8MB, 16MB) override this via the
# auto-propagation logic in sysbuild/CMakeLists.txt which appends
# mcuboot_flashsize_<n>mb.conf when the app's board.conf sets a larger size.
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
# ESP32 HAL's mcuboot_config.h is patched (patches/modules/hal/espressif/...)
# to respect Zephyr Kconfig: mbedTLS detection, AUTO sector count, slot0 validation.
@@ -0,0 +1 @@
CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y
@@ -0,0 +1 @@
CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y