mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-10-15 18:20:02 +00:00
- boards/**/zephcore.yml: one manifest per board/preset (release roles, variants, catalog metadata, capabilities); scripts/board_manifest.py validates and serves them to build.sh, gen_provider_catalog.py and docs/supported_boards.md - cmake/zephcore_board.cmake: board dir -> platform, shared by app and sysbuild; removes the board-name regex lists and 7 separate globs - conf chain: exact-name role/debug classification checked against Kconfig, idempotent across non-pristine reconfigures, version string single-sourced (BT DIS rev generated), day-granular build epoch - Doom easter egg: Kconfig default for the wio_tracker_l1 companion instead of a build.sh-only flag - catalog: maker for the LR2021 EVK (KeyError before); CI installs PyYAML - user -DEXTRA_DTC_OVERLAY_FILE overlays now take precedence over derived overlays Verified: identical .config, DTS and source lists for 97 board/role configs; identical images for 4 reference builds; identical build.sh command/artifact set and catalog content.
77 lines
3.7 KiB
CMake
77 lines
3.7 KiB
CMake
# Sysbuild resolves the board BEFORE the application CMakeLists.txt runs,
|
|
# so the BOARD_ROOT set there never fires. Set it here, before find_package(Sysbuild).
|
|
set(BOARD_ROOT "${APP_DIR}" CACHE STRING "" FORCE)
|
|
|
|
# Same story for the Zephyr patches and the files ZephCore adds to the Zephyr
|
|
# tree: the app applies/copies them in its own CMakeLists, but MCUboot is
|
|
# configured first and runs a devicetree pass over the same board DTS. A board
|
|
# whose radio node uses a ZephCore-only binding (the LR11xx / LR20xx LoRa
|
|
# drivers) or a property only a patch adds (lna-bypass-gpios, patch 0003) needs
|
|
# it present before MCUboot's DTS pass, not after. See cmake/zephyr_patches.cmake
|
|
# and cmake/zephyr_new_files.cmake.
|
|
set(ZEPHCORE_SOURCE_DIR "${APP_DIR}")
|
|
set(ZEPHCORE_ZEPHYR_DIR "$ENV{ZEPHYR_BASE}")
|
|
get_filename_component(ZEPHCORE_MODULES_DIR "${APP_DIR}/../modules" ABSOLUTE)
|
|
include("${APP_DIR}/cmake/zephyr_patches.cmake")
|
|
include("${APP_DIR}/cmake/zephyr_new_files.cmake")
|
|
|
|
# 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).
|
|
#
|
|
# The board directory comes from the same resolver the app uses, so both images
|
|
# always read the same board.
|
|
include("${APP_DIR}/cmake/zephcore_board.cmake")
|
|
zephcore_board_file(_board_conf board.conf)
|
|
if(_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()
|
|
|
|
# Share the app's flash partition layout with MCUboot.
|
|
#
|
|
# The app's board.overlay is applied to the app image only. Without this, MCUboot
|
|
# falls back to the upstream Espressif base partition table, whose slot0/slot1
|
|
# differ from the app's customised layout. The two images then agree only on
|
|
# slot0's *start* (so the device boots), but their image-1 (OTA) slots land at
|
|
# different addresses: the app stages an update where MCUboot never looks, so OTA
|
|
# uploads report success and then silently boot the old image on reset.
|
|
#
|
|
# Feeding the same partitions.overlay to MCUboot keeps both flash maps identical.
|
|
zephcore_board_file(_board_partitions_file partitions.overlay)
|
|
if(_board_partitions_file)
|
|
set(mcuboot_EXTRA_DTC_OVERLAY_FILE "${_board_partitions_file}"
|
|
CACHE INTERNAL "MCUboot partitions overlay: shared with the app image")
|
|
endif()
|
|
|
|
find_package(Sysbuild REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
|
project(sysbuild LANGUAGES)
|