This will establish a connection with the board and communicate between the board and GDB. Fire up GDB, and connect to the server you start started.
That last command can be shortened to '
tar rem :4242'. Finally, if you have compiled your binary with debugging symbols ('
-g' or '
-g3' in GCC), you can load the symbols into GDB so that you can view the source and symbols as you execute.
file os.elf
Now you should be good to go to watch your program execute. Some neat commands you may wish to use are '
info regs' to view the registers, and 'layout asm', 'layout source', and 'layout split' to view the source and assembly that is executing.
If you want to avoid all of that setup each time you open GDB, you can add my little alias to your bashrc, which takes your symbol file as an argument and starts up st-util and GDB to be fully ready to run.
alias stm32-gdb='st-util &> /dev/null & arm-none-eabi-gdb -q -ex "tar rem :4242" --symbol \!^'