From 2b273388dd39288b9cca622c1d79920b91779a79 Mon Sep 17 00:00:00 2001 From: He Yin Ling Date: Tue, 18 Apr 2017 22:38:08 +0800 Subject: [PATCH 1/2] CI: save download config in CI build jobs: IDF built app download config may change with some modification. save the download configs for built APP in build stage. then we can use the correct download config in test stage. --- .gitlab-ci.yml | 3 +++ tools/unit-test-app/Makefile | 2 ++ 2 files changed, 5 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 25bf66a8b..9f6447d4b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -95,6 +95,7 @@ build_esp_idf_tests: - ./tools/unit-test-app/build/*.bin - ./tools/unit-test-app/build/*.elf - ./tools/unit-test-app/build/*.map + - ./tools/unit-test-app/build/download.config - ./tools/unit-test-app/build/bootloader/*.bin - ./components/idf_test/unit_test/TestCaseAll.yml - ./components/idf_test/unit_test/CIConfigs/*.yml @@ -103,6 +104,8 @@ build_esp_idf_tests: script: - cd tools/unit-test-app - make TESTS_ALL=1 + # cut last line in case make V=0/1 is set by default + - make print_flash_cmd | tail -n 1 > build/download.config - python tools/UnitTestParser.py build_examples: diff --git a/tools/unit-test-app/Makefile b/tools/unit-test-app/Makefile index 128e8a080..8ec75f82e 100644 --- a/tools/unit-test-app/Makefile +++ b/tools/unit-test-app/Makefile @@ -7,3 +7,5 @@ PROJECT_NAME := unit-test-app include $(IDF_PATH)/make/project.mk +print_flash_cmd: + echo $(ESPTOOL_WRITE_FLASH_OPTIONS) $(ESPTOOL_ALL_FLASH_ARGS) | sed -e 's:'$(PWD)/build/'::g' From 6c5e60943e0cc546de0dfe1a277b09437e0c5245 Mon Sep 17 00:00:00 2001 From: He Yin Ling Date: Tue, 25 Apr 2017 10:40:22 +0800 Subject: [PATCH 2/2] build: add document about how to save flash args --- docs/api-guides/build-system.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/api-guides/build-system.rst b/docs/api-guides/build-system.rst index ea4925f74..aa4a67032 100644 --- a/docs/api-guides/build-system.rst +++ b/docs/api-guides/build-system.rst @@ -506,3 +506,22 @@ For example projects or other projects where you don't want to specify a full sd To override the name of this file, set the ``SDKCONFIG_DEFAULTS`` environment variable. + +Save flash arguments +------------------------- + +There're some scenarios that we want to flash the target board without IDF. For this case we want to save the built binaries, esptool.py and esptool write_flash arguments. It's simple to write a script to save binaries and esptool.py. For flash arguments, we can add the following code to application project makefile: +:: + print_flash_cmd: + echo $(ESPTOOL_WRITE_FLASH_OPTIONS) $(ESPTOOL_ALL_FLASH_ARGS) | sed -e 's:'$(PWD)/build/'::g' + +the original ESPTOOL_ALL_FLASH_ARGS are absolute file name. Usually we want to save relative file name so we can move the bin folder to somewhere else. For this case we can use ``sed`` to convert to relative file name, like what we did in the example above. + +When running ``make print_flash_cmd``, it will print the flash arguments: +:: + --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 bootloader/bootloader.bin 0x10000 example_app.bin 0x8000 partition_table_unit_test_app.bin + +Then use flash arguments as the arguemnts for esptool write_flash arguments: +:: + python esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 bootloader/bootloader.bin 0x10000 example_app.bin 0x8000 partition_table_unit_test_app.bin +