From fc9383cb9d21edd7eff54f540cd16646440e89c0 Mon Sep 17 00:00:00 2001 From: me-no-dev Date: Tue, 3 Jan 2023 16:54:40 +0200 Subject: [PATCH] Copy JTAG files only if it's enabled in the board menu --- .gitignore | 3 +++ boards.txt | 26 ++++++++++++++++++++++---- platform.txt | 13 +++++++------ tools/ide-debug/esp32.json | 2 +- tools/ide-debug/esp32c3.json | 2 +- tools/ide-debug/esp32s2.json | 2 +- tools/ide-debug/esp32s3.json | 2 +- 7 files changed, 36 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index e3b184a4a..c9d6a46ba 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,6 @@ _build/ # Test log files *.log +debug.cfg +debug.svd +debug_custom.json diff --git a/boards.txt b/boards.txt index 18ca70f53..f9b2506e9 100644 --- a/boards.txt +++ b/boards.txt @@ -71,12 +71,17 @@ esp32s3.build.psram_type=qspi esp32s3.build.memory_type={build.boot}_{build.psram_type} ## IDE 2.0 Seems to not update the value -esp32s3.menu.JTAGAdapter.default=Integrated USB JTAG -esp32s3.menu.JTAGAdapter.default.build.openocdscript=esp32s3-builtin.cfg +esp32s3.menu.JTAGAdapter.default=Disabled +esp32s3.menu.JTAGAdapter.default.build.copy_jtag_files=0 +esp32s3.menu.JTAGAdapter.builtin=Integrated USB JTAG +esp32s3.menu.JTAGAdapter.builtin.build.openocdscript=esp32s3-builtin.cfg +esp32s3.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 esp32s3.menu.JTAGAdapter.external=FTDI Adapter esp32s3.menu.JTAGAdapter.external.build.openocdscript=esp32s3-ftdi.cfg +esp32s3.menu.JTAGAdapter.external.build.copy_jtag_files=1 esp32s3.menu.JTAGAdapter.bridge=ESP USB Bridge esp32s3.menu.JTAGAdapter.bridge.build.openocdscript=esp32s3-bridge.cfg +esp32s3.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 esp32s3.menu.PSRAM.disabled=Disabled esp32s3.menu.PSRAM.disabled.build.defines= @@ -280,12 +285,17 @@ esp32c3.build.partitions=default esp32c3.build.defines= ## IDE 2.0 Seems to not update the value -esp32c3.menu.JTAGAdapter.default=Integrated USB JTAG -esp32c3.menu.JTAGAdapter.default.build.openocdscript=esp32c3-builtin.cfg +esp32c3.menu.JTAGAdapter.default=Disabled +esp32c3.menu.JTAGAdapter.default.build.copy_jtag_files=0 +esp32c3.menu.JTAGAdapter.builtin=Integrated USB JTAG +esp32c3.menu.JTAGAdapter.builtin.build.openocdscript=esp32c3-builtin.cfg +esp32c3.menu.JTAGAdapter.builtin.build.copy_jtag_files=1 esp32c3.menu.JTAGAdapter.external=FTDI Adapter esp32c3.menu.JTAGAdapter.external.build.openocdscript=esp32c3-ftdi.cfg +esp32c3.menu.JTAGAdapter.external.build.copy_jtag_files=1 esp32c3.menu.JTAGAdapter.bridge=ESP USB Bridge esp32c3.menu.JTAGAdapter.bridge.build.openocdscript=esp32c3-bridge.cfg +esp32c3.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 esp32c3.menu.CDCOnBoot.default=Disabled esp32c3.menu.CDCOnBoot.default.build.cdc_on_boot=0 @@ -445,10 +455,14 @@ esp32s2.build.partitions=default esp32s2.build.defines= ## IDE 2.0 Seems to not update the value +esp32s2.menu.JTAGAdapter.default=Disabled +esp32s2.menu.JTAGAdapter.default.build.copy_jtag_files=0 esp32s2.menu.JTAGAdapter.external=FTDI Adapter esp32s2.menu.JTAGAdapter.external.build.openocdscript=esp32s2-kaluga-1.cfg +esp32s2.menu.JTAGAdapter.external.build.copy_jtag_files=1 esp32s2.menu.JTAGAdapter.bridge=ESP USB Bridge esp32s2.menu.JTAGAdapter.bridge.build.openocdscript=esp32s2-bridge.cfg +esp32s2.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 esp32s2.menu.CDCOnBoot.default=Disabled esp32s2.menu.CDCOnBoot.default.build.cdc_on_boot=0 @@ -627,10 +641,14 @@ esp32.build.loop_core= esp32.build.event_core= ## IDE 2.0 Seems to not update the value +esp32.menu.JTAGAdapter.default=Disabled +esp32.menu.JTAGAdapter.default.build.copy_jtag_files=0 esp32.menu.JTAGAdapter.external=FTDI Adapter esp32.menu.JTAGAdapter.external.build.openocdscript=esp32-wrover-kit-3.3v.cfg +esp32.menu.JTAGAdapter.external.build.copy_jtag_files=1 esp32.menu.JTAGAdapter.bridge=ESP USB Bridge esp32.menu.JTAGAdapter.bridge.build.openocdscript=esp32-bridge.cfg +esp32.menu.JTAGAdapter.bridge.build.copy_jtag_files=1 esp32.menu.PSRAM.disabled=Disabled esp32.menu.PSRAM.disabled.build.defines= diff --git a/platform.txt b/platform.txt index 5b22ba87d..7fc48d071 100644 --- a/platform.txt +++ b/platform.txt @@ -151,6 +151,7 @@ build.extra_libs= build.memory_type={build.boot}_qspi # OpenOCD default configs +build.copy_jtag_files=0 build.openocdscript.esp32=esp32-wrover-kit-3.3v.cfg build.openocdscript.esp32s2=esp32s2-kaluga-1.cfg build.openocdscript.esp32s3=esp32s3-builtin.cfg @@ -184,16 +185,16 @@ recipe.hooks.prebuild.5.pattern.windows=cmd /c if exist "{build.source.path}\bui recipe.hooks.prebuild.6.pattern.windows=cmd /c if not exist "{build.path}\build_opt.h" type nul > "{build.path}\build_opt.h" # Generate debug.cfg (must be postbuild) -recipe.hooks.postbuild.1.pattern=bash -c "cp -f "{debug.server.openocd.scripts_dir}"board/{build.openocdscript} "{build.source.path}"/debug.cfg" -recipe.hooks.postbuild.1.pattern.windows=cmd /c COPY /y "{debug.server.openocd.scripts_dir}board\{build.openocdscript}" "{build.source.path}\debug.cfg" +recipe.hooks.postbuild.1.pattern=bash -c "[ {build.copy_jtag_files} -eq 0 ] || cp -f "{debug.server.openocd.scripts_dir}"board/{build.openocdscript} "{build.source.path}"/debug.cfg" +recipe.hooks.postbuild.1.pattern.windows=cmd /c IF {build.copy_jtag_files}==1 COPY /y "{debug.server.openocd.scripts_dir}board\{build.openocdscript}" "{build.source.path}\debug.cfg" # Generate debug_custom.json -recipe.hooks.postbuild.2.pattern=bash -c "cp -f "{runtime.platform.path}"/tools/ide-debug/{build.mcu}.json "{build.source.path}"/debug_custom.json" -recipe.hooks.postbuild.2.pattern.windows=cmd /c COPY /y "{runtime.platform.path}\tools\ide-debug\{build.mcu}.json" "{build.source.path}\debug_custom.json" +recipe.hooks.postbuild.2.pattern=bash -c "[ {build.copy_jtag_files} -eq 0 ] || cp -f "{runtime.platform.path}"/tools/ide-debug/{build.mcu}.json "{build.source.path}"/debug_custom.json" +recipe.hooks.postbuild.2.pattern.windows=cmd /c IF {build.copy_jtag_files}==1 COPY /y "{runtime.platform.path}\tools\ide-debug\{build.mcu}.json" "{build.source.path}\debug_custom.json" # Generate chip.svd -recipe.hooks.postbuild.3.pattern=bash -c "cp -f "{runtime.platform.path}"/tools/ide-debug/svd/{build.mcu}.svd "{build.source.path}"/{build.mcu}.svd" -recipe.hooks.postbuild.3.pattern.windows=cmd /c COPY /y "{runtime.platform.path}\tools\ide-debug\svd\{build.mcu}.svd" "{build.source.path}\{build.mcu}.svd" +recipe.hooks.postbuild.3.pattern=bash -c "[ {build.copy_jtag_files} -eq 0 ] || cp -f "{runtime.platform.path}"/tools/ide-debug/svd/{build.mcu}.svd "{build.source.path}"/debug.svd" +recipe.hooks.postbuild.3.pattern.windows=cmd /c IF {build.copy_jtag_files}==1 COPY /y "{runtime.platform.path}\tools\ide-debug\svd\{build.mcu}.svd" "{build.source.path}\debug.svd" ## Compile c files recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.cpreprocessor.flags} {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} -DARDUINO_BOARD="{build.board}" -DARDUINO_VARIANT="{build.variant}" -DARDUINO_PARTITION_{build.partitions} {compiler.c.extra_flags} {build.extra_flags} "@{build.opt.path}" {includes} "{source_file}" -o "{object_file}" diff --git a/tools/ide-debug/esp32.json b/tools/ide-debug/esp32.json index b890268e1..4dbe4314e 100644 --- a/tools/ide-debug/esp32.json +++ b/tools/ide-debug/esp32.json @@ -1,7 +1,7 @@ { "name":"Arduino on ESP32", "toolchainPrefix":"xtensa-esp32-elf", - "svdFile":"esp32.svd", + "svdFile":"debug.svd", "request":"attach", "postAttachCommands":[ "set remote hardware-watchpoint-limit 2", diff --git a/tools/ide-debug/esp32c3.json b/tools/ide-debug/esp32c3.json index 22ae70110..5af69052f 100644 --- a/tools/ide-debug/esp32c3.json +++ b/tools/ide-debug/esp32c3.json @@ -1,7 +1,7 @@ { "name":"Arduino on ESP32-C3", "toolchainPrefix":"riscv32-esp-elf", - "svdFile":"esp32c3.svd", + "svdFile":"debug.svd", "request":"attach", "serverArgs":[ "-d3" diff --git a/tools/ide-debug/esp32s2.json b/tools/ide-debug/esp32s2.json index dd4625499..c60e912c0 100644 --- a/tools/ide-debug/esp32s2.json +++ b/tools/ide-debug/esp32s2.json @@ -1,7 +1,7 @@ { "name":"Arduino on ESP32-S2", "toolchainPrefix":"xtensa-esp32s2-elf", - "svdFile":"esp32s2.svd", + "svdFile":"debug.svd", "request":"attach", "postAttachCommands":[ "set remote hardware-watchpoint-limit 2", diff --git a/tools/ide-debug/esp32s3.json b/tools/ide-debug/esp32s3.json index 7f2146723..9f44e603f 100644 --- a/tools/ide-debug/esp32s3.json +++ b/tools/ide-debug/esp32s3.json @@ -1,7 +1,7 @@ { "name":"Arduino on ESP32-S3", "toolchainPrefix":"xtensa-esp32s3-elf", - "svdFile":"esp32s3.svd", + "svdFile":"debug.svd", "request":"attach", "overrideAttachCommands":[ "set remote hardware-watchpoint-limit 2", -- GitLab