Skip to content

Commit 5cfe834

Browse files
shubhamkulkarni97nashif
authored andcommitted
boards: esp32: use cmake to build ESP-IDF bootloader
Make builds are not supported on Windows command prompt Signed-off-by: Shubham Kulkarni <[email protected]>
1 parent 940f92e commit 5cfe834

File tree

1 file changed

+22
-12
lines changed

1 file changed

+22
-12
lines changed

boards/xtensa/esp32/CMakeLists.txt

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,41 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3-
43
if(CONFIG_BOOTLOADER_ESP_IDF)
54
include(ExternalProject)
65

76
## 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)
98
set(espidf_prefix ${CMAKE_BINARY_DIR}/esp-idf)
109
set(espidf_build_dir ${espidf_prefix}/build)
1110

1211
ExternalProject_Add(
1312
EspIdfBootloader
1413
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
1822
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 .
2524
INSTALL_COMMAND "" # This particular build system has no install command
2625
)
2726

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)
2939

3040
board_finalize_runner_args(esp32 "--esp-flash-bootloader=${espidf_build_dir}/bootloader/bootloader.bin")
3141

0 commit comments

Comments
 (0)