User space GTK library project

Revision as of 15:35, 13 March 2023 by Registered User
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Applicable for STM32MP13x lines, STM32MP15x lines

This article explains how to create a simple hello-world application with STM32CubeIDE. This application is similar to the one described in the create a simple hello-world application article that uses Linux® command lines instead of STM32CubeIDE.”

Warning DB.png Important
This article has been written with the example of STM32MP15x lines More info.png but it is applicable to any lines present in applicability field displayed on the top of this article

BackToNavigationTree button.png

1. Create a GtkHelloWorld user space project[edit source]

In Cortex®-A7 sub-project context, named here MP157C-DK2_CA7, right-click and select Create a userspace Project...

User space project wizard shortcut

Here, an Executable project type in C language is selected.

Note that the user space project uses by default the SDK version associated to the Cortex®-A7 sub-project.

User space project creation wizard'

2. Update GtkHelloWorld project sources and properties[edit source]

In this chapter, the main.c source code is updated with gtk_hello_world.c as defined in article create a simple hello-world application.

The proposal to reference the Gtk library is to use the pkg-config command to update the compiler and linker flags, just like it is done in the Makefile of article create a simple hello-world application. This properties update is done inside menu GtkHelloWorld properties: C/C++ Build > Settings > Tool Settings.

  • main.c update and C flag: `pkg-config --cflags gtk+-3.0`
GtkHelloWorld project source & properties update

  • Linker flags update: `pkg-config --libs gtk+-3.0`
GtkHelloWorld project source & properties update

3. Build[edit source]

Select your GtKHelloWorld project , right-click and then Build Project.

GtkHelloWorld project source & properties update

4. Prepare Debug Configuration[edit source]

You can check boot messages via Linux® console opened with butterfly icon (shown below), but remember this console cannot be shared outside STM32CubeIDE (minicom,...). In order to debug user space application, your target must be Linux® booted and network connected.


In order to check network connection, start the Target Status widget in the bottom right corner of the window.

Target Status - green

Check How to set up proxy and P2P Ethernet connection with STM32CubeIDE if you are in that case.

5. Set Debug Configuration[edit source]

  • Select your project, right-click Debug as... > Debug Configurations,
  • then select STM32 Cortex-A Remote Application'.
Debug configuration shortcut

In the Main tab, select connection "MPU SSH Weston", corresponding to the target IP address discovered by the Target Status widget, it's destination directory is /home/weston.

Debug setup

6. Debug[edit source]

Click Debug :

  1. GtkHelloWorld is downloaded to the target,
  2. GDBServer is launched on the target,
  3. GDBClient is launched on the workstation and can exchange via the network with GDBServer.
GtkHelloWorld debug
Info white.png Information
In case of error, stop any GDBServer running on the target before launching a new debug session.

BackToNavigationTree button.png