Regardless of your operating system, you need to handle the following pieces:
-
Debugger server: An application that will forward requests to/from STM32 and a local TCP port via GDB protocol.
- Install st-util or openocd
-
Debugger executable: specifically
arm-none-eabi-gdb
-
Probably a compiler:
arm-none-eabi-gcc
-
Add your libraries if there are any (RTOS source code, drivers, etc)
OPTIONAL: Setting up GUI debugger:
git submodule add https://github.com/aktos-io/mcu-debug
Include mcu-debug makefiles in your main Makefile:
include ./mcu-debug/main.mk
Add the following instructions to your project's README
:
A. Flashing (without debugging): `make write`
B. Debugging with command line:
* In terminal 1: `make start-gdb-server-with-reset`
* In terminal 2: `make cmd-debugger` (or `make gui-debugger`)
- texane/STLink or OpenOCD
- gdb-arm-none-eabi
This variable is used to avoid users from blindly using this tool if any major change has been made.
MCU_DEBUG_MAJOR := 2
App := Src/* my_lib/*
This is the variable that we use to identify the files which are to be used generate the breakpoints from // debugger
lines. Use the /*
wildcard postfix and use a space character to point multiple directories. Required.
ELF_FILE := path/to/app.elf # make sure this is built with debug symbols
BIN_FILE := path/to/app.bin
This is the compiled application files.
GCC_PATH := $(HOME)/embedded/gcc/gcc-arm-none-eabi-5_3-2016q1/bin
Optional, you may omit if you won't compile your application.
GDB_ADDR := 192.168.56.103:4242
GDB Server address:port
.
If you use OpenOCD as your debugger, use the following settings:
FLASHER := openocd
OPENOCD_INTERFACE := stlink-v2.cfg
OPENOCD_TARGET := stm32f0x.cfg
If you use Stlink as your debugger, use the following settings:
FLASHER := stlink
If you want to use terminal UI, use the following setting:
USE_TUI := 1