Skip to content

ESP32-C3 #11

@Marthaarman

Description

@Marthaarman

I'm trying to get this to work on a esp32-c3-devkitm-1 with esp32-c3-mini.

ESP-Prog connection:
ESP_TMS - GPIO4
ESP_TCK - GPIO6
ESP_TDO - GPIO7
ESP_TDI - GPIO5

launch.json:

{
	// Use IntelliSense to learn about possible attributes.
	// Hover to view descriptions of existing attributes.
	// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
	"version": "0.2.0",
	"configurations": [
		{
			"name": "ESP-Prog Debug",
			"type": "cppdbg",
			"request": "launch",
			"program": "${workspaceRoot}/build/DebugESP32.elf",
			"args": [],
			"cwd": "${workspaceRoot}",
			"environment": [
				{
					"name": "PATH",
					"value": "${config:esp_dev_env_path}:${env:PATH}"
				}
			],
			"externalConsole": true,
			"MIMode": "gdb",
			"miDebuggerPath": "${config:esp_toolchain_path}/riscv32-esp-elf-gdb.exe",
            // "miDebuggerPath": "C:/Espressif/tools/riscv32-esp-elf/esp-2021r2-patch3-8.4.0/riscv32-esp-elf/bin/riscv32-esp-elf-gdb.exe",
			//"miDebuggerPath":"${config:esp_toolchain_path}/xtensa-esp32-elf-gdb.exe",
            "miDebuggerServerAddress": ":3333",
			"useExtendedRemote": true,
			"debugServerPath": "${config:esp_openocd_path}/openocd",
			"debugServerArgs": "-f interface/ftdi/esp32_devkitj_v1.cfg -f target/esp32c3.cfg ", //-c \"esp32c3.cpu1 configure -rtos FreeRTOS\"
			"serverStarted": "Listening on port [0-9]+ for gdb connections",
			"filterStderr": true,
			"filterStdout": false,
			"launchCompleteCommand": "None",
			"postRemoteConnectCommands": [
				{
					"description": "Respect Hardware Limitations (as prescribed by Espressif)",
					"text": "set remote hardware-watchpoint-limit 2",
					"ignoreFailures": false
				},
				{
					"description": "Hard Reset and Immediately Halt",
					"text": "monitor reset halt",
					"ignoreFailures": false
				},
				{
					"description": "Flush Internal Register Cache",
					"text": "flushregs",
					"ignoreFailures": false
				},
				{
					"description": "Set Temporary Hardware Assisted Breakpoint at `app_main`",
					"text": "thbreak app_main",
					"ignoreFailures": false
				},
				{
					"description": "Shutdown GDB Server on GDB Detach",
					"text": "monitor [target current] configure -event gdb-detach { shutdown }",
					"ignoreFailures": false
				},
			],
			"stopAtConnect": false,
			"logging": {
				"exceptions": true,
				"engineLogging": true,
				"moduleLoad": true,
				"programOutput": true,
				"trace": true,
				"traceResponse": false
			},
		}
	]
}

settings.json:

    "idf.pythonBinPathWin": "C:\\Espressif\\python_env\\idf4.4_py3.8_env\\Scripts\\python.exe",
    "idf.toolsPathWin": "C:/Espressif",

    //  Settings for the debugger
    "esp_idf_path": "${config:idf.toolsPathWin}",
    "esp_idf_tools": "${config:idf.toolsPathWin}/tools",
    "esp_toolchain_root":"${config:idf.toolsPathWin}",
    "esp_binutils_path": "${config:esp_toolchain_root}/tools/esp32ulp-elf/2.28.51-esp-20191205/esp32ulp-elf-binutils/bin",
    "esp_openocd_path": "${config:esp_toolchain_root}/tools/openocd-esp32/v0.11.0-esp32-20220411/openocd-esp32/bin",
    "esp_python_path": "${config:esp_toolchain_root}/python_env/idf4.4_py3.8_env/bin",
    "esp_toolchain_path": "${config:esp_toolchain_root}/tools/riscv32-esp-elf/esp-2021r2-patch3-8.4.0/riscv32-esp-elf/bin",
    //"esp_toolchain_path":"${config:esp_toolchain_root}/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtensa-esp32-elf/bin",
    "esp_dev_env_path": "${config:esp_idf_tools}:${config:esp_binutils_path}:${config:esp_openocd_path}:${config:esp_python_path}:${config:esp_toolchain_path}",

when launching the debugger:
"unable to start debugging. Unexpected GDB output from command "-target-select extended-remote:3333". Remote connection closed. "

What might I be missing?

debug console output:

1: (194) Starting: "C:/Espressif/tools/riscv32-esp-elf/esp-2021r2-patch3-8.4.0/riscv32-esp-elf/bin/riscv32-esp-elf-gdb.exe" --interpreter=mi
1: (227) STDERR: C:\Espressif\tools\riscv32-esp-elf\esp-2021r2-patch3-8.4.0\riscv32-esp-elf\bin\riscv32-esp-elf-gdb.exe: warning: Couldn't determine a path for the index cache directory.
1: (229) ->~"GNU gdb (crosstool-NG esp-2021r2-patch3) 9.2.90.20200913-git\n"
1: (230) ->~"This GDB was configured as \"--host=x86_64-host_w64-mingw32 --target=riscv32-esp-elf\".\n"
1: (230) ->~"<http://www.gnu.org/software/gdb/bugs/>.\n"
1: (230) ->~"Find the GDB manual and other documentation resources online at:\n    <http://www.gnu.org/software/gdb/documentation/>."
1: (230) ->(gdb)
1: (235) <-1001-gdb-set mi-async on
1: (245) ->(gdb)
1: (245) ->(gdb)
1: (261) ->~"This GDB was configured as follows:\n   configure --host="
1: (261) ->~"             --with-gdb-datadir=/builds/idf/crosstool-NG/builds/riscv32-esp-elf/share/gdb (relocatable)\n"
1: (261) ->~"             --with-jit-reader-dir=/builds/idf/crosstool-NG/builds/riscv32-esp-elf/lib/gdb (relocatable)\n"
1: (261) ->~"\n(\"Relocatable\" means the directory can be moved with the GDB installation\ntree, and GDB will still find it.)\n"
1: (261) ->(gdb)
1: (261) ->(gdb)
1: (277) ->(gdb)
1: (277) ->(gdb)
1: (277) <-1004-gdb-set auto-solib-add on
1: (292) ->(gdb)
1: (292) ->(gdb)
1: (292) <-1005-gdb-set solib-search-path C:/Users/haarmanm/Documents/Projects/4.MyProjects/DebugESP32/build;
1: (307) ->(gdb)
1: (307) ->(gdb)
1: (308) ->(gdb)
1: (308) <-1007-gdb-set new-console on
1: (308) ->(gdb)
1: (308) ->(gdb)
1: (309) ->(gdb)
1: (340) ->(gdb)
1: (340) ->(gdb)
1: (340) ->(gdb)
1: (340) ->(gdb)
1: (354) ->(gdb)
1: (354) ->(gdb)
1: (2438) ->(gdb)
1: (2438) ->(gdb)
1: (2449) <--gdb-exit

Also, the ESP32 is running a blink example code, but keeps blinking while I would expect it to stall untill debugger is loaded?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions