Skip to content

Instantly share code, notes, and snippets.

@m3lixir
Created February 3, 2020 19:39
Show Gist options
  • Save m3lixir/0914e3cb7f25bccf53ffad1ce77f90a4 to your computer and use it in GitHub Desktop.
Save m3lixir/0914e3cb7f25bccf53ffad1ce77f90a4 to your computer and use it in GitHub Desktop.
How to debug the NUCLEO-L152RE using OpenOCD and GDB.

Window 1:

$ openocd -f nucleo-l152re.cfg # Starts the OpenOCD server.

You can find nucleo-l152re.cfg here.

Window 2:

$ telnet localhost 4444 # Connects to the OpenOCD server.
> reset halt # Performs as hard a reset as possible, and immediately halts the target.

Window 3:

$ arm-none-eabi-gdb
(gdb) target remote localhost:3333

Useful GDB Commands

Loads symbols from foo.elf:

(gdb) file foo.elf

Prints the name of a symbol which is stored at address <addr>:

(gdb) info symbol <addr>

Disassembles the next source line:

(gdb) set disassemble-next-line on

Prints the instruction to be executed next:

(gdb) x/i $pc

Examines memory at location <addr>:

(gdb) x/xw <addr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment