OpenOCD with CLion (debugging)
OpenOCD with CLion (debugging)
Has somebody managed it to use OpenOCD within CLion for debugging the ESP32? I cannot get it running.
-
- Posts: 69
- Joined: Thu Nov 01, 2018 8:32 am
Re: OpenOCD with CLion (debugging)
Hi,
Remote debugging works good with CLion on linux and macOS (in theory should also work on windows, but have never tried)
* Go to Run->Edit Debug configuration
- Add GDB Remote Debug
- fill in GDB custom executable as xtensa-esp32-elf-gdb
- setup target remote as :3333
- set Symbol file to the actual elf file application being built/debigged
- set Sysroot to an existing path (no important, but must be existent)
* Optional: Setup openocd to be executed before debugging
- Configure external tool to be executed prior debugging
- Create shell script running valid openocd configuration (as a child process), for example:
* Create custom gdbinit file:
- in $HOME directory create file named .gdbinit containing:
Remote debugging works good with CLion on linux and macOS (in theory should also work on windows, but have never tried)
* Go to Run->Edit Debug configuration
- Add GDB Remote Debug
- fill in GDB custom executable as xtensa-esp32-elf-gdb
- setup target remote as :3333
- set Symbol file to the actual elf file application being built/debigged
- set Sysroot to an existing path (no important, but must be existent)
* Optional: Setup openocd to be executed before debugging
- Configure external tool to be executed prior debugging
- Create shell script running valid openocd configuration (as a child process), for example:
Code: Select all
cd $OPENOCD_DIR/openocd-esp32
pkill -9 openocd
bin/openocd -s share/openocd/scripts -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp32-wrover.cfg &
sleep 1
exit 0
- in $HOME directory create file named .gdbinit containing:
Code: Select all
set $esp_reset = 0
define hook-stop
if ($esp_reset == 0)
set $esp_reset = 1
printf "Reset ESP with halt command\n"
stop
mon reset halt
flushregs
thb app_main
end
end
Re: OpenOCD with CLion (debugging)
I can confirm CLion debugging works on Windows, thanks to cermak's instructions. The shell scripts don't apply, of course, but I added the openocd executable as an external tool and run it before starting the debugger.
Who is online
Users browsing this forum: No registered users and 61 guests