Using ST-Link into an Eclipse environment

This guide will explain how to setup Eclipse in order to use an ST-Link probe for debugging. The guide applies to both the standalone ST-Link and the embedded ST-Link found in the various STMicroelectronics Discovery kits.

What this guide does not cover

This guide will not enter into details of common system tasks like and not limited to:

  • Installing applications (unless a special procedure is required).
  • Creating desktop shortcuts.
  • Adding paths to the PATH variable.
  • Creating environment variables.
  • Any other normal PC usage task.
  • Use of the toolchain, this topic is covered in the ”Using an Eclipse-based IDE” article.

Required Hardware

This guide requires at least one of:

Required Software

  • An Eclipse environment like the one described in Setting up an Eclipse-based IDE.
  • A GDB server compatible with the ST-Link, there are currently two options:
    • The GDB server from the free version of the TrueSTUDIO IDE.
    • The open source GDB server, author Texane, available here. Currently this solution is only available to Linux users.

This guide will cover the use of the GDB server from TrueSTUDIO. Note that less expert users could just use TrueSTUDIO as-is, this guide is mainly directed to those of us who like to create their own development environment.

Downloading the GDB Server

In order to get the TrueSTUDIO GDB server you need to download the TrueSTUDIO Lite for STM32 from here. The you have to extract the GDB server by opening the downloaded installer using an unpacker such as 7-Zip. truestudio-7zip1.jpg

The server is located under ”./$[31]/Servers”, extract the whole directory “ST-LINK_gdbserver” and store it somewhere in your filesystem, for example “c:/utils”.

Installing the GDB Server

The server requires no installation except unpacking but you may want to update your ST-Link firmware using the provided ST-LinkUpgrade.exe utility.

Preparing Eclipse

Now we may want to launch the server directly from Eclipse, we need to configure a launcher:

  1. Open “Run→External Tools→External Tools Configurations” and create a new launcher by right clicking on “Program” then select “New”. Configure the launcher as shown:truestudio-eclipse1.jpg
  2. Configure the “Common” tab as follow:truestudio-eclipse2.jpg
  3. Disable the “Build Before Launch” option from the “Build” tab.

Note that you have to create two launch configurations, one for the SWD mode and the other for the JTAG mode, the only difference is the ”-d” which selects the SWD mode and is not required in JTAG mode. Of course “Location” and “Working Directory” depend on where you unpacked the GDB Server.

Creating a GDB Debug Configuration

Now we need to create a debug configuration for our project, you may use one of the STM32 projects present in ChibiOS/RT after having imported them into Eclipse using the procedure described in Using an Eclipse-based IDE.

  1. Open the “Debug Configurations” dialog:eclipse2-006.jpg
  2. Create a new debug configuration for the “GDB Hardware Debugging”:eclipse2-007.jpg Note that the “GDB Hardware Debugging” extension must be already installed or you will not see that.
  3. Configure the various tabs as follow:
    • Main tab:stlink-eclipse1.jpg
    • Debugger tab:stlink-eclipse2.jpg
    • Startup tab:stlink-eclipse3.jpg
    • Common tab:stlink-eclipse4.jpg
  4. Press “Apply” and close the dialog.

Running the GDB Server

Just click the launcher on the Eclipse toolbar:stlink-eclipse5.jpg

Debugging using ST-Link

Before debugging you have to start the ST-Link GDB Server but debugging using ST-Link is not different than debugging using any other GDB Server, please refer to the guide Using an Eclipse-based IDE.

 
chibios/guides/stlink_eclipse.txt · Last modified: 2012/06/24 15:43 by giovanni
 
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.3