|
1 | 1 | # SPDX-License-Identifier: Apache-2.0 |
2 | 2 |
|
3 | | - |
4 | 3 | if(CONFIG_BOOTLOADER_ESP_IDF) |
5 | 4 | include(ExternalProject) |
6 | 5 |
|
7 | 6 | ## we use hell-world project, but I think any can be used. |
8 | | - set(espidf_src_dir ${ESP_IDF_PATH}/examples/get-started/hello_world/) |
| 7 | + set(espidf_components_dir ${ESP_IDF_PATH}/components) |
9 | 8 | set(espidf_prefix ${CMAKE_BINARY_DIR}/esp-idf) |
10 | 9 | set(espidf_build_dir ${espidf_prefix}/build) |
11 | 10 |
|
12 | 11 | ExternalProject_Add( |
13 | 12 | EspIdfBootloader |
14 | 13 | PREFIX ${espidf_prefix} |
15 | | - SOURCE_DIR ${espidf_src_dir} |
16 | | - BINARY_DIR ${espidf_src_dir} |
17 | | - CONFIGURE_COMMAND "" # Skip configuring the project, e.g. with autoconf |
| 14 | + SOURCE_DIR ${espidf_components_dir}/bootloader/subproject |
| 15 | + BINARY_DIR ${espidf_build_dir}/bootloader |
| 16 | + CONFIGURE_COMMAND |
| 17 | + ${CMAKE_COMMAND} -G${CMAKE_GENERATOR} |
| 18 | + -S ${espidf_components_dir}/bootloader/subproject |
| 19 | + -B ${espidf_build_dir}/bootloader -DSDKCONFIG=${espidf_build_dir}/sdkconfig |
| 20 | + -DIDF_PATH=${ESP_IDF_PATH} -DIDF_TARGET=${CONFIG_BOARD} |
| 21 | + -DPYTHON_DEPS_CHECKED=1 |
18 | 22 | BUILD_COMMAND |
19 | | - PATH=$ENV{PATH}:${ESPRESSIF_TOOLCHAIN_PATH}/bin |
20 | | - make |
21 | | - IDF_PATH=${ESP_IDF_PATH} |
22 | | - BUILD_DIR_BASE=${espidf_build_dir} |
23 | | - SDKCONFIG=${espidf_build_dir}/sdkconfig |
24 | | - defconfig bootloader partition_table |
| 23 | + ${CMAKE_COMMAND} --build . |
25 | 24 | INSTALL_COMMAND "" # This particular build system has no install command |
26 | 25 | ) |
27 | 26 |
|
28 | | - add_dependencies(app EspIdfBootloader) |
| 27 | + ExternalProject_Add( |
| 28 | + EspPartitionTable |
| 29 | + SOURCE_DIR ${espidf_components_dir}/partition_table |
| 30 | + BINARY_DIR ${espidf_build_dir} |
| 31 | + CONFIGURE_COMMAND "" |
| 32 | + BUILD_COMMAND |
| 33 | + python ${ESP_IDF_PATH}/components/partition_table/gen_esp32part.py -q |
| 34 | + --offset 0x1000 --flash-size 4MB ${ESP_IDF_PATH}/components/partition_table/partitions_singleapp.csv ${espidf_build_dir}/partitions_singleapp.bin |
| 35 | + INSTALL_COMMAND "" |
| 36 | + ) |
| 37 | + |
| 38 | + add_dependencies(app EspIdfBootloader EspPartitionTable) |
29 | 39 |
|
30 | 40 | board_finalize_runner_args(esp32 "--esp-flash-bootloader=${espidf_build_dir}/bootloader/bootloader.bin") |
31 | 41 |
|
|
0 commit comments