mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
feat(esp_partition): Add esp_partition_flash_binary() CMake function
Add a new CMake function esp_partition_flash_binary() that provides a unified API for registering partition data binaries to be flashed. It replaces the direct esptool_py_flash_target calls scattered across components (spiffs, fatfs, nvs_flash) with a single function that: - Resolves partition offset from the partition table automatically - Determines encryption requirements (auto-detect or ALWAYS_PLAINTEXT) - Creates per-partition flash targets (e.g. idf.py <partition>-flash) - Optionally includes the binary in `idf.py flash` via FLASH_IN_PROJECT On the linux target, the function registers binaries for pre-loading into the emulated flash. A build-time manifest (linux_flash_data.txt) is generated via file(GENERATE), and partition_linux.c reads it at runtime to copy each binary into the memory-mapped flash buffer at the correct offset. The partition_ops example is updated to use the new function and includes a custom_partition with pre-built data to demonstrate the full workflow, including on the linux target.
This commit is contained in:
@@ -25,6 +25,7 @@ add_custom_target(blank_bin ALL DEPENDS ${blank_file})
|
||||
idf_build_get_property(target IDF_TARGET)
|
||||
|
||||
if(NOT ${target} STREQUAL "linux")
|
||||
add_dependencies(flash blank_bin)
|
||||
esptool_py_flash_to_partition(flash "${partition}" "${blank_file}")
|
||||
esp_partition_register_target("${partition}" "${blank_file}"
|
||||
DEPENDS blank_bin
|
||||
FLASH_IN_PROJECT)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user