build system: generate the partition table by default for linux target

This fixes the issue that "idf.py partition-table" had to be run
manually in order for the partition table to be generated, when
building for linux target.
This commit is contained in:
Ivan Grokhotkov 2023-01-10 17:47:20 +01:00
parent 98d1f7de4b
commit ec8f38c9da
No known key found for this signature in database
GPG Key ID: 1E050E141B280628
5 changed files with 21 additions and 7 deletions

View File

@ -7,5 +7,3 @@ set(COMPONENTS main)
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")
project(partition_api_test)
add_dependencies(partition_api_test.elf partition-table)

View File

@ -8,9 +8,8 @@ Source the IDF environment as usual.
Once this is done, build the application:
```bash
idf.py build partition-table
idf.py build
```
Note that for the time being, `partition-table` target needs to be built manually.
# Run
```bash

View File

@ -8,5 +8,3 @@ set(COMPONENTS main)
list(APPEND EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/mocks/freertos/")
project(nvs_host_test)
add_dependencies(nvs_host_test.elf partition-table)

View File

@ -96,6 +96,24 @@ else()
"Either change partition table in menuconfig or create this input file.")
endif()
if(${target} STREQUAL "linux" AND EXISTS ${partition_csv})
# partition-table target is normally invoked as a dependency of 'flash' target.
# However, when building for "linux" target, 'flash' target doesn't exist,
# so we need to attach the partition table build to the executable target.
#
# The problem is that the executable target is not yet defined
# when the component CMakeLists.txt file is evaluated, so we
# can only get it as a generator expression. But generator expressions
# can't be used in 'add_dependencies':
# https://gitlab.kitware.com/cmake/cmake/-/issues/19467
#
# Therefore attach partition-table to the internal __idf_build_target
# target. This is a hack, since that target name is an implementation detail
# of the build system.
add_dependencies(__idf_build_target partition-table)
endif()
# Add signing steps
if(CONFIG_SECURE_SIGNED_APPS_ECDSA_SCHEME)
if(CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES)

View File

@ -22,4 +22,5 @@ set_property(
DIRECTORY
APPEND PROPERTY ADDITIONAL_CLEAN_FILES "../image.bin")
add_dependencies(host_test_spiffs.elf partition-table image.bin)
add_dependencies(host_test_spiffs.elf image.bin)