From da23a84f53c0aabb1156c2bcb5d0d3a89c45269d Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 16 Nov 2020 23:31:14 +0700 Subject: [PATCH] use partten_args to remove duplication for create bin and upload --- platform.txt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/platform.txt b/platform.txt index 03e6ef8d4..011969cf0 100644 --- a/platform.txt +++ b/platform.txt @@ -4,9 +4,10 @@ version=2.0.0 runtime.tools.xtensa-esp32-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32-elf runtime.tools.xtensa-esp32s2-elf-gcc.path={runtime.platform.path}/tools/xtensa-esp32s2-elf -tools.esptool_py.cmd={runtime.platform.path}/tools/esptool/esptool -tools.esptool_py.cmd.linux=python "{runtime.platform.path}/tools/esptool/esptool.py" -tools.esptool_py.cmd.windows={runtime.platform.path}/tools/esptool/esptool.exe +tools.esptool_py.path={runtime.platform.path}/tools/esptool +tools.esptool_py.cmd=esptool +tools.esptool_py.cmd.linux=esptool.py +tools.esptool_py.cmd.windows=esptool.exe tools.esptool_py.network_cmd=python "{runtime.platform.path}/tools/espota.py" tools.esptool_py.network_cmd.windows="{runtime.platform.path}/tools/espota.exe" @@ -125,7 +126,9 @@ recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-Wl,--Map={build recipe.objcopy.partitions.bin.pattern={tools.gen_esp32part.cmd} -q "{build.path}/partitions.csv" "{build.path}/{build.project_name}.partitions.bin" ## Create bin -recipe.objcopy.bin.pattern={tools.esptool_py.cmd} --chip {build.mcu} elf2image --flash_mode "{build.flash_mode}" --flash_freq "{build.flash_freq}" --flash_size "{build.flash_size}" -o "{build.path}/{build.project_name}.bin" "{build.path}/{build.project_name}.elf" +recipe.objcopy.bin.pattern_args=--chip {build.mcu} elf2image --flash_mode "{build.flash_mode}" --flash_freq "{build.flash_freq}" --flash_size "{build.flash_size}" -o "{build.path}/{build.project_name}.bin" "{build.path}/{build.project_name}.elf" +recipe.objcopy.bin.pattern="{tools.esptool_py.path}/{tools.esptool_py.cmd}" {recipe.objcopy.bin.pattern_args} +recipe.objcopy.bin.pattern.linux=python "{tools.esptool_py.path}/{tools.esptool_py.cmd}" {recipe.objcopy.bin.pattern_args} ## Save bin recipe.output.tmp_file={build.project_name}.{build.mcu}.bin @@ -141,5 +144,7 @@ recipe.size.regex.data=^(?:\.dram0\.data|\.dram0\.bss|\.noinit)\s+([0-9]+).* tools.esptool_py.upload.protocol=esp32 tools.esptool_py.upload.params.verbose= tools.esptool_py.upload.params.quiet= -tools.esptool_py.upload.pattern={cmd} --chip {build.mcu} --port "{serial.port}" --baud {upload.speed} {upload.flags} --before default_reset --after hard_reset write_flash -z --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size detect 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0x1000 "{build.path}/{build.project_name}.bootloader.bin" 0x10000 "{build.path}/{build.project_name}.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin" +tools.esptool_py.upload.pattern_args=--chip {build.mcu} --port "{serial.port}" --baud {upload.speed} {upload.flags} --before default_reset --after hard_reset write_flash -z --flash_mode {build.flash_mode} --flash_freq {build.flash_freq} --flash_size detect 0xe000 "{runtime.platform.path}/tools/partitions/boot_app0.bin" 0x1000 "{build.path}/{build.project_name}.bootloader.bin" 0x10000 "{build.path}/{build.project_name}.bin" 0x8000 "{build.path}/{build.project_name}.partitions.bin" +tools.esptool_py.upload.pattern="{path}/{cmd}" {upload.pattern_args} +tools.esptool_py.upload.pattern.linux=python "{path}/{cmd}" {upload.pattern_args} tools.esptool_py.upload.network_pattern={network_cmd} -i "{serial.port}" -p "{network.port}" "--auth={network.password}" -f "{build.path}/{build.project_name}.bin"