Nano ESP32: add debug support (#8567)
* Nano ESP32: fix previous merge issues * platform: remove previous build options if file is missing "touch" would create the file if not present, but not delete its contents if a previous run left the file in the build dir. * platform: make debug_custom.json file customizable by board * platform: fix default debug prefix "debug.toolchain.prefix" must end with a dash, since only the tool name is appended to this string. The reason this is not a major issue is that the "debug_custom.json" file (copied in the sketch directory when debugging is enabled) forces its own prefix. And to make things more interesting, the "toolchainPrefix" entry in that file should _not_ end with a dash. * Nano ESP32: add debugging support
This commit is contained in:
parent
58761beb83
commit
7d1dd858bb
3 changed files with 31 additions and 7 deletions
|
|
@ -25673,8 +25673,11 @@ nano_nora.menu.PinNumbers.default=By Arduino pin (default)
|
|||
nano_nora.menu.PinNumbers.byGPIONumber=By GPIO number (legacy)
|
||||
nano_nora.menu.PinNumbers.byGPIONumber.build.disable_pin_remap=-DBOARD_USES_HW_GPIO_NUMBERS
|
||||
|
||||
nano_nora.menu.PinNumbers.default=By Arduino pin (default)
|
||||
nano_nora.menu.PinNumbers.byGPIONumber=By GPIO number (legacy)
|
||||
nano_nora.menu.PinNumbers.byGPIONumber.build.disable_pin_remap=-DBOARD_USES_HW_GPIO_NUMBERS
|
||||
nano_nora.menu.USBMode.default=Normal mode (TinyUSB)
|
||||
nano_nora.menu.USBMode.hwcdc=Debug mode (Hardware CDC)
|
||||
nano_nora.menu.USBMode.hwcdc.build.usb_mode=1
|
||||
nano_nora.menu.USBMode.hwcdc.build.copy_jtag_files=1
|
||||
nano_nora.menu.USBMode.hwcdc.build.openocdscript=esp32s3-builtin.cfg
|
||||
nano_nora.menu.USBMode.hwcdc.build.debugconfig=esp32s3-arduino.json
|
||||
|
||||
##############################################################
|
||||
|
|
|
|||
11
platform.txt
11
platform.txt
|
|
@ -160,6 +160,9 @@ build.openocdscript.esp32s3=esp32s3-builtin.cfg
|
|||
build.openocdscript.esp32c3=esp32c3-builtin.cfg
|
||||
build.openocdscript={build.openocdscript.{build.mcu}}
|
||||
|
||||
# Debug plugin configuration
|
||||
build.debugconfig={build.mcu}.json
|
||||
|
||||
# Custom build options
|
||||
build.opt.name=build_opt.h
|
||||
build.opt.path={build.path}/{build.opt.name}
|
||||
|
|
@ -181,7 +184,7 @@ recipe.hooks.prebuild.4.pattern.windows=cmd /c IF EXIST "{build.source.path}\boo
|
|||
|
||||
# Check if custom build options exist in the sketch folder
|
||||
recipe.hooks.prebuild.5.pattern=bash -c "[ ! -f "{build.source.path}"/build_opt.h ] || cp -f "{build.source.path}"/build_opt.h "{build.path}"/build_opt.h"
|
||||
recipe.hooks.prebuild.6.pattern=bash -c "[ -f "{build.path}"/build_opt.h ] || touch "{build.path}"/build_opt.h"
|
||||
recipe.hooks.prebuild.6.pattern=bash -c "[ -f "{build.path}"/build_opt.h ] || : > "{build.path}"/build_opt.h"
|
||||
|
||||
recipe.hooks.prebuild.5.pattern.windows=cmd /c if exist "{build.source.path}\build_opt.h" COPY /y "{build.source.path}\build_opt.h" "{build.path}\build_opt.h"
|
||||
recipe.hooks.prebuild.6.pattern.windows=cmd /c if not exist "{build.path}\build_opt.h" type nul > "{build.path}\build_opt.h"
|
||||
|
|
@ -201,8 +204,8 @@ recipe.hooks.postbuild.1.pattern=bash -c "[ {build.copy_jtag_files} -eq 0 ] || c
|
|||
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 "[ {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"
|
||||
recipe.hooks.postbuild.2.pattern=bash -c "[ {build.copy_jtag_files} -eq 0 ] || cp -f "{runtime.platform.path}"/tools/ide-debug/{build.debugconfig} "{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.debugconfig}" "{build.source.path}\debug_custom.json"
|
||||
|
||||
# Generate chip.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"
|
||||
|
|
@ -263,7 +266,7 @@ pluggable_monitor.required.serial=builtin:serial-monitor
|
|||
debug.executable={build.path}/{build.project_name}.elf
|
||||
debug.toolchain=gcc
|
||||
debug.toolchain.path={tools.{build.tarch}-esp-elf-gdb.path}/bin/
|
||||
debug.toolchain.prefix={build.tarch}-{build.target}-elf
|
||||
debug.toolchain.prefix={build.tarch}-{build.target}-elf-
|
||||
debug.server=openocd
|
||||
debug.server.openocd.script=debug.cfg
|
||||
|
||||
|
|
|
|||
18
tools/ide-debug/esp32s3-arduino.json
Normal file
18
tools/ide-debug/esp32s3-arduino.json
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name":"Arduino on ESP32-S3",
|
||||
"toolchainPrefix":"xtensa-esp32s3-elf",
|
||||
"svdFile":"debug.svd",
|
||||
"request":"attach",
|
||||
"overrideAttachCommands":[
|
||||
"set remote hardware-watchpoint-limit 2",
|
||||
"monitor reset halt",
|
||||
"monitor gdb_sync",
|
||||
"thb setup",
|
||||
"interrupt"
|
||||
],
|
||||
"overrideRestartCommands":[
|
||||
"monitor reset halt",
|
||||
"monitor gdb_sync",
|
||||
"interrupt"
|
||||
]
|
||||
}
|
||||
Loading…
Reference in a new issue