Skip to content

Commit

Permalink
Merge branch 'contrib/github_pr_12558_v5.1' into 'release/v5.1'
Browse files Browse the repository at this point in the history
Fix: esptool_py incorrectly assumed target name equals binary name (GitHub PR) (v5.1)

See merge request espressif/esp-idf!27269
  • Loading branch information
dobairoland committed Nov 22, 2023
2 parents 3e04fba + 4c3beef commit 3e2dbfe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 3 additions & 4 deletions components/esptool_py/project_include.cmake
Expand Up @@ -121,7 +121,6 @@ idf_build_get_property(build_dir BUILD_DIR)

idf_build_get_property(elf_name EXECUTABLE_NAME GENERATOR_EXPRESSION)
idf_build_get_property(elf EXECUTABLE GENERATOR_EXPRESSION)
idf_build_get_property(elf_dir EXECUTABLE_DIR GENERATOR_EXPRESSION)

if(CONFIG_SECURE_BOOT_BUILD_SIGNED_BINARIES AND NOT BOOTLOADER_BUILD)
set(unsigned_project_binary "${elf_name}-unsigned.bin")
Expand All @@ -137,10 +136,10 @@ set(PROJECT_BIN "${elf_name}.bin")
if(CONFIG_APP_BUILD_GENERATE_BINARIES)
add_custom_command(OUTPUT "${build_dir}/.bin_timestamp"
COMMAND ${ESPTOOLPY} elf2image ${esptool_elf2image_args}
-o "${build_dir}/${unsigned_project_binary}" "${elf_dir}/${elf}"
-o "${build_dir}/${unsigned_project_binary}" "$<TARGET_FILE:$<GENEX_EVAL:${elf}>>"
COMMAND ${CMAKE_COMMAND} -E echo "Generated ${build_dir}/${unsigned_project_binary}"
COMMAND ${CMAKE_COMMAND} -E md5sum "${build_dir}/${unsigned_project_binary}" > "${build_dir}/.bin_timestamp"
DEPENDS ${elf}
DEPENDS "$<TARGET_FILE:$<GENEX_EVAL:${elf}>>"
VERBATIM
WORKING_DIRECTORY ${build_dir}
COMMENT "Generating binary image from built executable"
Expand Down Expand Up @@ -212,7 +211,7 @@ add_custom_target(monitor
COMMAND ${CMAKE_COMMAND}
-D "IDF_PATH=${idf_path}"
-D "SERIAL_TOOL=${ESPMONITOR}"
-D "SERIAL_TOOL_ARGS=--target;${target};${monitor_rev_args};${elf_dir}/${elf}"
-D "SERIAL_TOOL_ARGS=--target;${target};${monitor_rev_args};$<TARGET_FILE:$<GENEX_EVAL:${elf}>>"
-D "WORKING_DIRECTORY=${build_dir}"
-P run_serial_tool.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
Expand Down
7 changes: 7 additions & 0 deletions tools/test_build_system/test_build.py
Expand Up @@ -128,3 +128,10 @@ def test_build_with_sdkconfig_build_abspath(idf_py: IdfPyFunc, test_app_copy: Pa
build_path = test_app_copy / 'build_tmp'
sdkconfig_path = build_path / 'sdkconfig'
idf_py('-D', f'SDKCONFIG={sdkconfig_path}', '-B', str(build_path), 'build')


def test_build_cmake_executable_suffix(idf_py: IdfPyFunc, test_app_copy: Path) -> None:
logging.info('idf.py can build with CMAKE_EXECUTABLE_SUFFIX set')
append_to_file((test_app_copy / 'CMakeLists.txt'), 'set(CMAKE_EXECUTABLE_SUFFIX_CXX ".ext")')
ret = idf_py('build')
assert 'Project build complete' in ret.stdout, 'Build with CMAKE_EXECUTABLE_SUFFIX set failed'

0 comments on commit 3e2dbfe

Please sign in to comment.