Merge branch 'bugfix/loadable_elf_fixes' into 'master'

cmake: loadable elf fixes

See merge request espressif/esp-idf!8603
This commit is contained in:
Ivan Grokhotkov 2020-05-05 17:02:48 +08:00
commit d73470a8a6
6 changed files with 25 additions and 15 deletions

View file

@ -34,12 +34,14 @@ if(NOT BOOTLOADER_BUILD)
set(ESPTOOLPY_AFTER "no_reset")
endif()
file(READ "flasher_args.json.in" flasher_args_content)
string(CONFIGURE "${flasher_args_content}" flasher_args_content)
if(CONFIG_APP_BUILD_GENERATE_BINARIES)
file(READ "flasher_args.json.in" flasher_args_content)
string(CONFIGURE "${flasher_args_content}" flasher_args_content)
file_generate("${CMAKE_CURRENT_BINARY_DIR}/flasher_args.json.in"
CONTENT "${flasher_args_content}")
file_generate("${CMAKE_BINARY_DIR}/flasher_args.json"
INPUT "${CMAKE_CURRENT_BINARY_DIR}/flasher_args.json.in")
file_generate("${CMAKE_CURRENT_BINARY_DIR}/flasher_args.json.in"
CONTENT "${flasher_args_content}")
file_generate("${CMAKE_BINARY_DIR}/flasher_args.json"
INPUT "${CMAKE_CURRENT_BINARY_DIR}/flasher_args.json.in")
endif()
endif()

View file

@ -12,7 +12,7 @@
>
},
$<JOIN:$<TARGET_PROPERTY:flash,FLASH_ENTRY>,,
>,
>$<$<BOOL:$<TARGET_PROPERTY:flash,FLASH_ENTRY>>:,>
"extra_esptool_args" : {
"after" : "${ESPTOOLPY_AFTER}",
"before" : "${ESPTOOLPY_BEFORE}",

View file

@ -97,9 +97,10 @@ endif()
idf_component_get_property(main_args esptool_py FLASH_ARGS)
idf_component_get_property(sub_args esptool_py FLASH_SUB_ARGS)
esptool_py_flash_target(partition_table-flash "${main_args}" "${sub_args}")
esptool_py_flash_target_image(partition_table-flash partition_table "${PARTITION_TABLE_OFFSET}"
"${build_dir}/partition_table/partition-table.bin")
esptool_py_flash_target_image(flash partition_table "${PARTITION_TABLE_OFFSET}"
"${build_dir}/partition_table/partition-table.bin")
if(CONFIG_APP_BUILD_GENERATE_BINARIES)
esptool_py_flash_target(partition_table-flash "${main_args}" "${sub_args}")
esptool_py_flash_target_image(partition_table-flash partition_table "${PARTITION_TABLE_OFFSET}"
"${build_dir}/partition_table/partition-table.bin")
esptool_py_flash_target_image(flash partition_table "${PARTITION_TABLE_OFFSET}"
"${build_dir}/partition_table/partition-table.bin")
endif()

View file

@ -716,6 +716,13 @@ endmenu\n" >> ${IDF_PATH}/Kconfig
grep "build/dfu.bin\" has been written. You may proceed with DFU flashing." tmp.log || (tail -n 100 tmp.log ; failure "DFU build should succeed for esp32s2")
rm tmp.log
assert_built ${APP_BINS} ${BOOTLOADER_BINS} ${PARTITION_BIN} "dfu.bin"
rm -rf build sdkconfig
print_status "Loadable ELF build works"
echo "CONFIG_APP_BUILD_TYPE_ELF_RAM=y" > sdkconfig
idf.py reconfigure || failure "Couldn't configure for loadable ELF file"
test -f build/flasher_args.json && failure "flasher_args.json should not be generated in a loadable ELF build"
idf.py build || failure "Couldn't build a loadable ELF file"
print_status "All tests completed"
if [ -n "${FAILURES}" ]; then

View file

@ -12,7 +12,7 @@ import ttfw_idf
class SerialThread(object):
def run(self, log_path, exit_event):
with serial.Serial('/dev/ttyUSB1', 115200) as ser, open(log_path, 'wb') as f:
with serial.Serial(os.getenv('ESPPORT', '/dev/ttyUSB1'), 115200) as ser, open(log_path, 'wb') as f:
while True:
f.write(ser.read(ser.in_waiting))
if exit_event.is_set():
@ -38,7 +38,7 @@ class SerialThread(object):
def test_app_loadable_elf(env, extra_data):
rel_project_path = os.path.join('tools', 'test_apps', 'system', 'gdb_loadable_elf')
app_files = ['gdb_loadable_elf.elf', 'partition_table/partition-table.bin']
app_files = ['gdb_loadable_elf.elf']
example = ttfw_idf.LoadableElfTestApp(rel_project_path, app_files, target="esp32")
idf_path = example.get_sdk_path()
proj_path = os.path.join(idf_path, rel_project_path)