/
CMakeLists.txt
49 lines (40 loc) · 2.13 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
register_component()
idf_build_get_property(build_dir BUILD_DIR)
idf_build_get_property(project_dir PROJECT_DIR)
set(flash_customized_partition_args ${build_dir}/flash_customized_partition_args)
set(module_info ${build_dir}/module_info)
STRING(REGEX REPLACE ".*/(.*)\.csv" "\\1" customize_bin ${CONFIG_AT_CUSTOMIZED_PARTITION_TABLE_FILE})
set(customize_bin_full_name ${customize_bin}.bin)
execute_process (
COMMAND ${PYTHON} ${IDF_PATH}/components/partition_table/gen_esp32part.py
${project_dir}/${CONFIG_AT_CUSTOMIZED_PARTITION_TABLE_FILE} ${build_dir}/${customize_bin_full_name}
)
esptool_py_flash_project_args(${customize_bin} ${CONFIG_AT_CUSTOMIZED_PARTITION_TABLE_OFFSET} ${build_dir}/${customize_bin_full_name} FLASH_IN_PROJECT)
execute_process (
COMMAND ${PYTHON} ${COMPONENT_DIR}/raw_data/at_customized_partition_parse.py
--sdkconfig_file ${project_dir}/sdkconfig
--dependency_file ${COMPONENT_DIR}/AT_partition_dependency
--partition_file ${project_dir}/${CONFIG_AT_CUSTOMIZED_PARTITION_TABLE_FILE}
--output_dir ${build_dir}/${COMPONENT_NAME}
--flash_args_file ${flash_customized_partition_args}
)
file(STRINGS ${flash_customized_partition_args} customized_partition_args)
foreach(partition_args ${customized_partition_args})
string(STRIP ${partition_args} args_value)
string(REPLACE " " ";" args_lists ${args_value})
list(GET args_lists 0 offset)
list(GET args_lists 1 file_path)
STRING(REGEX REPLACE ".*/(.*)\.bin" "\\1" file_name ${file_path})
esptool_py_flash_project_args(${file_name} ${offset} ${file_path} FLASH_IN_PROJECT)
endforeach(partition_args)
add_custom_target(customized_bin ALL DEPENDS app)
add_custom_command(TARGET customized_bin
POST_BUILD
COMMAND mkdir -p ${build_dir}/include
COMMAND cp ${build_dir}/config/sdkconfig.h ${build_dir}/include/sdkconfig.h
COMMAND ${PYTHON} ${COMPONENT_DIR}/raw_data/at_customized_partition_gen.py
--tools_dir ${COMPONENT_DIR}/generation_tools
--output_dir ${build_dir}/${COMPONENT_NAME}
--flash_args_file ${flash_customized_partition_args}
COMMENT "Create customized_bin..."
)