I am using the following commands to debug a program running on the Redwire Econotag r3 (which is based on a ARM microcontroller).
xterm -e "openocd -f interface/ftdi/redbee-econotag.cfg -f board /redbee.cfg" &
sleep 1
echo -e "soft_reset_halt\n set *0x80020010 = 0\n" | nc -i 1 localho st 4444 > /dev/null &
arm-none-eabi-gdb hello.elf -x debugOCD.gdb
where debugOCD.gdb
contains:
target remote localhost:3333
monitor soft_reset_halt
load hello.elf 0x00400000
b _start
I'd like to open the debugger inside VIM, using ConqueGDB (or any other debugging interface within VIM).
Any clues? Thank you!!
After some research, I've been able to find an answer to my question.
To use the desired debugger with ConqueGDB, it has to be specified in g:ConqueGdb_GdbExe
variable BEFORE the plugin is loaded.
To do so, I modified my .vimrc
file to look like this (note that I'm using Vundle to manage VIM plugins):
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"Specify the debugger to be used
let g:ConqueGdb_GdbExe = 'arm-none-eabi-gdb'
Plugin 'VundleVim/Vundle.vim'
"Load ConqueGDB
Plugin 'vim-scripts/Conque-GDB'
call vundle#end()
filetype plugin indent on
Now, ConqueGDB can be used to debug the remote board. From VIM command line, execute:
:ConqueGdb -q -x debugOCD.gdb
In order not to specify two different files in this command, the symbols can be loaded from the GDB commands file. OpenOCD execution and target connection can be handled the same way. Here is what my debugOCD.gdb
looks like.
#Load the debug symbols
file hello.elf
#Make sure that openOCD is running, otherwise load it
shell if [ ! `pgrep openocd` ]; then xterm -e "openocd -f interface/ftdi/redbee-econotag.cfg -f board/redbee.cfg" & sleep 1; fi
#Connect GDB to OpenOCD and reset the microcontroller
target remote localhost:3333
monitor soft_reset_halt
shell sleep 1
#Upload the image and wait for 1 second
monitor load_image hello.elf
shell sleep 1
#Set a breakpoint at SRAM start address and run from there
b *0x400000
monitor step 0x3ffffc
c
That's all, it would be fine to set an alias for this command, so it is easier to memorize, but I guess this is trivial. Here you can see a screenshot of VIM with ConqueGDB working.
User contributions licensed under CC BY-SA 3.0