diff --git a/examples/chatgpt_demo/factory_nvs/main/idf_component.yml b/examples/chatgpt_demo/factory_nvs/main/idf_component.yml index 0499b5f..0079072 100644 --- a/examples/chatgpt_demo/factory_nvs/main/idf_component.yml +++ b/examples/chatgpt_demo/factory_nvs/main/idf_component.yml @@ -1,7 +1,7 @@ ## IDF Component Manager Manifest File dependencies: espressif/esp_tinyuf2: - version: "0.2.*" + version: ">=0.2.2" # espressif/esp-box: "~2.2.0" ## Required IDF version idf: diff --git a/examples/chatgpt_demo/main/CMakeLists.txt b/examples/chatgpt_demo/main/CMakeLists.txt index 301c0bc..ab89f36 100644 --- a/examples/chatgpt_demo/main/CMakeLists.txt +++ b/examples/chatgpt_demo/main/CMakeLists.txt @@ -29,13 +29,14 @@ if(NOT EXISTS ${nvs_src_file}) message(FATAL_ERROR "Please ensure that the 'factory_nvs' is built first, and make sure to keep the 'HMI Board Config' consistent.") endif() +add_custom_target(nvs_uf2_bin ALL) add_custom_command( - OUTPUT ${nvs_dst_file} - COMMENT "Generate factory_nvs..." - COMMAND python ${MV_UF2_BIN_EXE} -d1 ${nvs_src_file} -d2 ${nvs_dst_file} + TARGET nvs_uf2_bin + COMMAND ${CMAKE_COMMAND} -E make_directory ${build_dir}/uf2 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${nvs_src_file} ${nvs_dst_file} + COMMAND ${CMAKE_COMMAND} -E echo "Copying factory_nvs.bin to destination if it is different..." VERBATIM) -add_custom_target(nvs_uf2_bin ALL DEPENDS ${nvs_dst_file}) add_dependencies(flash nvs_uf2_bin) partition_table_get_partition_info(size "--partition-name ota_0" "size") diff --git a/examples/chatgpt_demo/main/generateuf2.py b/examples/chatgpt_demo/main/generateuf2.py deleted file mode 100644 index c0b7217..0000000 --- a/examples/chatgpt_demo/main/generateuf2.py +++ /dev/null @@ -1,28 +0,0 @@ -# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD -# SPDX-License-Identifier: CC0-1.0 -import io -import os -import argparse -import shutil -import math -import sys - -sys.dont_write_bytecode = True - -def copy_files(nvs_src_file, nvs_dst_file): - dst_folder = os.path.dirname(nvs_dst_file) - - if not os.path.exists(dst_folder): - os.makedirs(dst_folder) - - shutil.copyfile(nvs_src_file, nvs_dst_file) - print(f"File copied from {nvs_src_file} to {nvs_dst_file}") - -if __name__ == '__main__': - parser = argparse.ArgumentParser(description='move uf2 fw') - parser.add_argument('-d1', '--nvs_src_file') - parser.add_argument('-d2', '--nvs_dst_file') - args = parser.parse_args() - - if os.path.exists(args.nvs_src_file): - copy_files(args.nvs_src_file, args.nvs_dst_file)