-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
executable file
·34 lines (28 loc) · 1.28 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# For more information about build system see
# https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html
# The following five lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(autobar3)
idf_build_set_property(MINIMAL_BUILD ON)
# Create merged firmware binary in static/firmware/
idf_build_get_property(build_dir BUILD_DIR)
set(out_path "${CMAKE_SOURCE_DIR}/static/firmware")
# Create output directory if it doesn't exist
file(MAKE_DIRECTORY ${out_path})
# Create merged binary using esptool.py
add_custom_command(
OUTPUT ${out_path}/merged-firmware-esp32.bin
DEPENDS bootloader partition-table ${PROJECT_NAME}.elf
COMMAND esptool.py --chip esp32 merge_bin
-o ${out_path}/merged-firmware-esp32.bin
--flash_mode dio
--flash_size 2MB
--flash_freq 40m
0x1000 ${build_dir}/bootloader/bootloader.bin
0x8000 ${build_dir}/partition_table/partition-table.bin
0x10000 ${build_dir}/${PROJECT_NAME}.bin
COMMENT "Creating merged firmware binary"
)
add_custom_target(merged_binary ALL DEPENDS ${out_path}/merged-firmware-esp32.bin)