From 7e808b34ec7b40f1db14d3b7d3ebf5658eb6bcff Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Tue, 9 Sep 2025 10:04:21 +0200 Subject: [PATCH] feat(cmakev2/test): add binary image generation and flash targets Generate binary images and add flash targets for hello_world_example and fatfs_example. Signed-off-by: Frantisek Hrbata --- tools/cmakev2/test/CMakeLists.txt | 39 ++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/tools/cmakev2/test/CMakeLists.txt b/tools/cmakev2/test/CMakeLists.txt index b21ed1cfe20..377c66a4f11 100644 --- a/tools/cmakev2/test/CMakeLists.txt +++ b/tools/cmakev2/test/CMakeLists.txt @@ -203,16 +203,39 @@ function(test_include_component) endif() endfunction() -# Add two executables fatfs_example and hello_world_example +# Add two executables fatfs_example and hello_world_example, generate +# binary images for them and add flash targets. # After configuration these can be build with -# cmake --build build/ --target hello_world_example -# cmake --build build/ --target fatfs_example +# idf.py hello_world_example_bin +# idf.py fatfs_example_bin +# or simply +# idf.py hello_world_example-flash monitor +# idf.py fatfs-flash monitor function(test_executable) - idf_build_get_property(build_dir BUILD_DIR) - idf_build_executable(fatfs_example COMPONENTS fatfs_example) - idf_build_generate_metadata(fatfs_example OUTPUT_FILE project_description_fatfs.json) - idf_build_executable(hello_world_example COMPONENTS hello_world_example) - idf_build_generate_metadata(hello_world_example OUTPUT_FILE project_description_hello_world.json) + idf_build_executable(fatfs_example + COMPONENTS fatfs_example) + idf_build_binary(fatfs_example + TARGET fatfs_example_bin + OUTPUT_FILE fatfs_example.bin) + idf_check_binary_size(fatfs_example_bin) + idf_flash_binary(fatfs_example_bin + TARGET fatfs_example-flash + NAME fatfs_example) + idf_build_generate_metadata(fatfs_example + OUTPUT_FILE project_description_fatfs.json) + + + idf_build_executable(hello_world_example + COMPONENTS hello_world_example) + idf_build_binary(hello_world_example + TARGET hello_world_example_bin + OUTPUT_FILE hello_world_example.bin) + idf_check_binary_size(hello_world_example_bin) + idf_flash_binary(hello_world_example_bin + TARGET hello_world_example-flash + NAME hello_world_example) + idf_build_generate_metadata(hello_world_example + OUTPUT_FILE project_description_hello_world.json) endfunction() # Run tests