From 5e95bc1d214779e7bf2ed206ff8f16b4ce4baab5 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 4 May 2020 19:10:06 +0200 Subject: [PATCH 1/5] test_apps: make it possible to run gdb_loadable_elf app locally --- tools/test_apps/system/gdb_loadable_elf/app_test.py | 2 +- .../{sdkconfig.ci.default => sdkconfig.defaults} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tools/test_apps/system/gdb_loadable_elf/{sdkconfig.ci.default => sdkconfig.defaults} (100%) diff --git a/tools/test_apps/system/gdb_loadable_elf/app_test.py b/tools/test_apps/system/gdb_loadable_elf/app_test.py index 126cf433d..8b104bf33 100644 --- a/tools/test_apps/system/gdb_loadable_elf/app_test.py +++ b/tools/test_apps/system/gdb_loadable_elf/app_test.py @@ -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(): diff --git a/tools/test_apps/system/gdb_loadable_elf/sdkconfig.ci.default b/tools/test_apps/system/gdb_loadable_elf/sdkconfig.defaults similarity index 100% rename from tools/test_apps/system/gdb_loadable_elf/sdkconfig.ci.default rename to tools/test_apps/system/gdb_loadable_elf/sdkconfig.defaults From dafd50934d1fe1b8e08e455992fe00352907ac30 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 4 May 2020 19:11:00 +0200 Subject: [PATCH 2/5] esptool: don't generate flashing metadata in loadable elf build --- components/esptool_py/CMakeLists.txt | 14 ++++++++------ components/partition_table/CMakeLists.txt | 13 +++++++------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/components/esptool_py/CMakeLists.txt b/components/esptool_py/CMakeLists.txt index 6d3b01c80..f4ce6e0a9 100644 --- a/components/esptool_py/CMakeLists.txt +++ b/components/esptool_py/CMakeLists.txt @@ -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() diff --git a/components/partition_table/CMakeLists.txt b/components/partition_table/CMakeLists.txt index 7d42c4448..2b78a1f22 100644 --- a/components/partition_table/CMakeLists.txt +++ b/components/partition_table/CMakeLists.txt @@ -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() From b09ed2d2aa18a0d5e9ac4885062d7e84350248f6 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 4 May 2020 19:11:26 +0200 Subject: [PATCH 3/5] esptool: fix malformed json when no files are flashed --- components/esptool_py/flasher_args.json.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esptool_py/flasher_args.json.in b/components/esptool_py/flasher_args.json.in index 6b72fc9bf..2152d6877 100644 --- a/components/esptool_py/flasher_args.json.in +++ b/components/esptool_py/flasher_args.json.in @@ -12,7 +12,7 @@ > }, $,, - >, + >$<$>:,> "extra_esptool_args" : { "after" : "${ESPTOOLPY_AFTER}", "before" : "${ESPTOOLPY_BEFORE}", From 255dd631220dd0095a60bf011548682da9ebf3fd Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Mon, 4 May 2020 19:15:43 +0200 Subject: [PATCH 4/5] ci: add loadable ELF build system test --- tools/ci/test_build_system_cmake.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/ci/test_build_system_cmake.sh b/tools/ci/test_build_system_cmake.sh index 48a156a2f..6526ef2db 100755 --- a/tools/ci/test_build_system_cmake.sh +++ b/tools/ci/test_build_system_cmake.sh @@ -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 From 8a4cc99d90eeb25d5b46852df03a9af990d79785 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 5 May 2020 09:44:53 +0200 Subject: [PATCH 5/5] test_apps: don't download partition table in loadable elf test --- tools/test_apps/system/gdb_loadable_elf/app_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test_apps/system/gdb_loadable_elf/app_test.py b/tools/test_apps/system/gdb_loadable_elf/app_test.py index 8b104bf33..923c4077d 100644 --- a/tools/test_apps/system/gdb_loadable_elf/app_test.py +++ b/tools/test_apps/system/gdb_loadable_elf/app_test.py @@ -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)