From 8508f7043ba2d0e178d75563febf756e45cd8464 Mon Sep 17 00:00:00 2001 From: "Deomid \"rojer\" Ryabkov" Date: Tue, 26 Jul 2022 23:00:03 +0100 Subject: [PATCH] esp32c3: Enable core dumps https://github.com/cesanta/mongoose-os/issues/564 --- cli/debug_core_dump/debug_core_dump.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cli/debug_core_dump/debug_core_dump.go b/cli/debug_core_dump/debug_core_dump.go index fac9ef91..bd85ca76 100644 --- a/cli/debug_core_dump/debug_core_dump.go +++ b/cli/debug_core_dump/debug_core_dump.go @@ -43,6 +43,7 @@ const ( type platformDebugParams struct { image string + gdb string extraGDBArgs []string extraServeCoreArgs []string } @@ -66,6 +67,12 @@ var ( extraGDBArgs: []string{"-ex", "add-symbol-file /opt/Espressif/rom/rom.elf 0x40000000"}, extraServeCoreArgs: []string{"--rom=/opt/Espressif/rom/rom.bin", "--rom_addr=0x40000000", "--xtensa_addr_fixup=true"}, }, + "esp32c3": platformDebugParams{ + image: "docker.io/mgos/esp32-build:4.4.1-r3", + gdb: "/opt/Espressif/riscv32-esp-elf/bin/riscv32-esp-elf-gdb", + extraGDBArgs: []string{"-ex", "add-symbol-file /opt/Espressif/rom/esp32c3_rev3_rom.elf 0x40000000"}, + extraServeCoreArgs: []string{"--rom=/opt/Espressif/rom/esp32c3_rev3_rom.bin", "--rom_addr=0x40000000"}, + }, "esp8266": platformDebugParams{ image: "docker.io/mgos/esp8266-build:2.2.1-1.5.0-r4", extraGDBArgs: []string{"-ex", "add-symbol-file /opt/Espressif/rom/rom.elf 0x40000000"}, @@ -246,12 +253,16 @@ func DebugCoreDumpF(cdFile, elfFile string, traceOnly bool) error { cmd = append(cmd, dockerImage) input := os.Stdin var shellCmd []string + gdb := dp.gdb + if gdb == "" { + gdb = "$MGOS_TARGET_GDB" // Defined in the Docker build image. + } if cdFile != "" { shellCmd = append(shellCmd, *flags.GDBServerCmd) shellCmd = append(shellCmd, dp.extraServeCoreArgs...) shellCmd = append(shellCmd, "/fw.elf", "/core", "&") shellCmd = append(shellCmd, - "$MGOS_TARGET_GDB", // Defined in the Docker build image. + gdb, "/fw.elf", "-ex", "'target remote 127.0.0.1:1234'", "-ex", "'set confirm off'",