Add pytest test coverage for cmakev2 build system examples that had none. CMakeLists.txt fixes required to enable testing: conditional_component and plugins: added idf_build_generate_flasher_args() since these use the low-level build API (idf_build_executable / idf_flash_binary) which unlike idf_project_default() does not call it automatically. Without it, flasher_args.json was missing from the build output and pytest-embedded could not initialize the DUT. multi_binary: both app1 and app2 were registered in the global flash target via idf_flash_binary(...FLASH), creating a duplicate key at offset 0x10000 in the flasher_args.json generator expression and preventing the file from being generated. Fixed by removing FLASH from app2's call so only app1 is registered in the global flash target. idf_build_generate_flasher_args() now produces a valid flasher_args.json with app1 as the default app binary. The test patches the binary path to app2.bin when testing the second app.
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H21 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 | ESP32-S31 |
|---|
Import Prebuilt Library Example
This example illustrates how to import a prebuilt static library in the ESP-IDF build system.
Example Flow
Users need to first build the project in the prebuilt subdirectory:
cd prebuilt
idf.py build
This builds a component named prebuilt, which has private dependency on ESP-IDF components spi_flash, log and app_update (see its CMakeLists.txt). Once built, the archive file libprebuilt.a, along with the header file prebuilt.h, is automatically copied to the main component of this example project.
The main component's CMakeLists.txt demonstrates how to import libprebuilt.a and link it to main so that the definitions inside can be used.
It also demonstrates how to specify the same dependencies the original component had so as to properly resolve symbols used inside the prebuilt library.
Users can then return to this directory and build the main example:
cd ..
idf.py build
Output
The example simply outputs the current running partition.
I (319) prebuilt: The running partition is 'factory'!
There is a discussion on importing prebuilt libraries in the programming guide under API Guides -> Build System -> Using Prebuilt Libraries with Components