How to configure STM32CubeIDE for the STLink GDB Debugger

STM32CubeIDE Development Environment Settings

You can download the STM32CubeIDE from the official web-site.


Tutorial video


  1. Select a project, then select “Debug As->Debug Configurations” on the menu list or on the toolbar (see Figure 1А and Figure. 1B).

The project has to be compiled successfully at least once.

  1. Right-click “STM32 Cortex-M C/C++Application” on the configuration tree and select "New Configuration" on the context menu (see Figure 2).

If necessary, the configuration name can be changed right away, but in this example we will leave it as it is.

  1. If the project was not compiled successfully at least once, the "C/C++ Application" field will be left blank (in Figure 3 all fields are filled up correctly). In this case close configuration window, compile the project, then open configuration window again and run the file by clicking “Search Project”.
  2. Check “Connect to remote GDB server” at the “Debugger” tab. Specify IP-address and port in the corresponding fields (see Figure 4). IP-address and port are shown on the Connection and Tools page.

While using port forwarding, use localhost as the IP-address and serv_port as Port. serv_port is shown on the Connection and Tools page.

  1. Click “Debug”.

This configuration can be used more than once. Just select it as the target one during debugging.