esptool_py: pass flash mode/frequency/size to elf2image

Otherwise the image gets generated with wrong parameters, and the
binary does not boot unless it has been "fixed" by esptool during the
upload.
This commit is contained in:
Ivan Grokhotkov 2020-01-22 17:40:10 +01:00
parent c1ab87b580
commit 09950797cb
2 changed files with 12 additions and 13 deletions

View file

@ -22,15 +22,7 @@ if(NOT BOOTLOADER_BUILD)
# Generate flasher_args.json for tools that need it. The variables below are used
# in configuring the template flasher_args.json.in.
set(ESPFLASHMODE ${CONFIG_ESPTOOLPY_FLASHMODE})
set(ESPFLASHFREQ ${CONFIG_ESPTOOLPY_FLASHFREQ})
set(ESPFLASHSIZE ${CONFIG_ESPTOOLPY_FLASHSIZE})
set(ESPTOOLPY_FLASH_OPTIONS
--flash_mode ${ESPFLASHMODE}
--flash_freq ${ESPFLASHFREQ}
--flash_size ${ESPFLASHSIZE}
)
# Some of the variables (flash mode, size, frequency) are already set in project_include.cmake.
set(ESPTOOLPY_BEFORE "${CONFIG_ESPTOOLPY_BEFORE}")
set(ESPTOOLPY_AFTER "${CONFIG_ESPTOOLPY_AFTER}")

View file

@ -8,6 +8,16 @@ set(ESPTOOLPY ${python} "${CMAKE_CURRENT_LIST_DIR}/esptool/esptool.py" --chip ${
set(ESPSECUREPY ${python} "${CMAKE_CURRENT_LIST_DIR}/esptool/espsecure.py")
set(ESPEFUSEPY ${python} "${CMAKE_CURRENT_LIST_DIR}/esptool/espefuse.py")
set(ESPFLASHMODE ${CONFIG_ESPTOOLPY_FLASHMODE})
set(ESPFLASHFREQ ${CONFIG_ESPTOOLPY_FLASHFREQ})
set(ESPFLASHSIZE ${CONFIG_ESPTOOLPY_FLASHSIZE})
set(ESPTOOLPY_FLASH_OPTIONS
--flash_mode ${ESPFLASHMODE}
--flash_freq ${ESPFLASHFREQ}
--flash_size ${ESPFLASHSIZE}
)
if(NOT BOOTLOADER_BUILD)
set(esptool_elf2image_args --elf-sha256-offset 0xb0)
endif()
@ -128,12 +138,9 @@ else()
list(APPEND esptool_flash_main_args "--after=${CONFIG_ESPTOOLPY_AFTER}")
endif()
set(esptool_flash_sub_args "--flash_mode=${CONFIG_ESPTOOLPY_FLASHMODE}"
"--flash_freq=${CONFIG_ESPTOOLPY_FLASHFREQ}"
"--flash_size=${CONFIG_ESPTOOLPY_FLASHSIZE}")
idf_component_set_property(esptool_py FLASH_ARGS "${esptool_flash_main_args}")
idf_component_set_property(esptool_py FLASH_SUB_ARGS "${esptool_flash_sub_args}")
idf_component_set_property(esptool_py FLASH_SUB_ARGS "${ESPTOOLPY_FLASH_OPTIONS}")
function(esptool_py_flash_target_image target_name image_name offset image)
idf_build_get_property(build_dir BUILD_DIR)