Registered User mNo edit summary |
Registered User mNo edit summary Tag: 2017 source edit |
||
(25 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{ApplicableFor | |||
|MPUs list=STM32MP13x, STM32MP15x, STM32MP23x, STM32MP25x | |||
|MPUs checklist=STM32MP13x, STM32MP15x, STM32MP23x, STM32MP25x | |||
}} | |||
<noinclude></noinclude> | |||
This article explains how to create a simple hello-world application with STM32CubeIDE. This application is similar to the one described in the [[Getting_started/STM32MP1_boards/STM32MP157x-DK2/Develop_on_Arm®_Cortex®-A7/Create_a_simple_hello-world_application| create a simple hello-world application]] article that uses Linux<sup>®</sup> command lines instead of STM32CubeIDE.” | |||
{{Important| This article is based onto {{MicroprocessorDevice | device=15}} but it is also applicable to any STM32 MPU device.}} | |||
[[File:BackToNavigationTree button.png|300px|link=How to debug a user space application with STM32CubeIDE]] | |||
==Create a GtkHelloWorld user space project== | |||
In Cortex<sup>®</sup>-A7 sub-project context, named here '''MP157C-DK2_CA7''', right-click and select '''''Create a userspace Project...''''' | |||
<div class="res-img"> | |||
[[File:UserSpaceShortCut.png|link=|center|'''User space project wizard shortcut''']] | |||
</div> | |||
Here, an ''Executable'' project type in C language is selected. | |||
[[File: | Note that the user space project uses by default the SDK version associated to the Cortex<sup>®</sup>-A7 sub-project. | ||
<div class="res-img"> | |||
[[File:CubeIDEUserSpaceGtkCreation.png|link=|center|''User space project creation wizard''']] | |||
</div> | |||
==Update GtkHelloWorld project sources and properties== | |||
In this chapter, the main.c source code is updated with gtk_hello_world.c as defined in article [[Getting_started/STM32MP1_boards/STM32MP157x-DK2/Develop_on_Arm®_Cortex®-A7/Create_a_simple_hello-world_application|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 [[Getting_started/STM32MP1_boards/STM32MP157x-DK2/Develop_on_Arm®_Cortex®-A7/Create_a_simple_hello-world_application| 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` ''''' | * main.c update and C flag: ''''' `pkg-config --cflags gtk+-3.0` ''''' | ||
<div class="res-img"> | <div class="res-img"> | ||
[[File:CubeIDEUserSpaceGtkBuildSetup.png|link=|center|'''GtkHelloWorld project source & properties update''']] | [[File:CubeIDEUserSpaceGtkBuildSetup.png|link=|center|'''GtkHelloWorld project source & properties update''']] | ||
</div> | </div> | ||
* | |||
* Linker flags update: ''''' `pkg-config --libs gtk+-3.0` ''''' | |||
<div class="res-img"> | <div class="res-img"> | ||
[[File:CubeIDEUserSpaceGtkBuildSetup2.png|link=|center|'''GtkHelloWorld project source & properties update''']] | [[File:CubeIDEUserSpaceGtkBuildSetup2.png|link=|center|'''GtkHelloWorld project source & properties update''']] | ||
</div> | </div> | ||
==Build== | |||
Select your GtKHelloWorld project , right-click and then '''''Build Project'''''. | |||
<div class="res-img"> | <div class="res-img"> | ||
[[File:CubeIDEUserSpaceGtkBuild.png|link=|center|'''GtkHelloWorld project source & properties update''']] | [[File:CubeIDEUserSpaceGtkBuild.png|link=|center|'''GtkHelloWorld project source & properties update''']] | ||
</div> | </div> | ||
[[File:CubeIDE-UserSpace-Debug1.png | ==Prepare ''Debug Configuration''== | ||
< | You can check boot messages via Linux<sup>®</sup> 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<sup>®</sup> booted and network connected. | |||
[[File:CubeIDELinuxConsole.png|200px|frame|center]] | |||
In order to check network connection, start the '''''Target Status''''' widget in the bottom right corner of the window. | |||
<div class="res-img"> | |||
[[File:CubeIDE-UserSpace-Debug1.png|center|'''Target Status - green''']] | |||
</div> | |||
Check [[How to set up proxy and P2P Ethernet connection with STM32CubeIDE|How to set up proxy and P2P Ethernet connection with STM32CubeIDE]] if you are in that case.<br> | |||
==''Debug Configuration''== | ==Set ''Debug Configuration''== | ||
Select your project, right-click ''Debug as... > Debug Configurations'', then select '''STM32 Cortex-A Remote Application''''. | *Select your project, right-click ''Debug as... > Debug Configurations'', | ||
*then select '''STM32 Cortex-A Remote Application''''. | |||
<div class="res-img"> | |||
[[File:CubeIDEUserSpaceDebugShortCut.png|link=|center|'''Debug configuration shortcut''']] | |||
</div> | |||
In the | 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''. | ||
<div class="res-img"> | <div class="res-img"> | ||
[[File:CubeIDEUserSpaceGtkDebugSetup.png|link=|center|'''Debug setup''']] | [[File:CubeIDEUserSpaceGtkDebugSetup.png|link=|center|'''Debug setup''']] | ||
</div> | </div> | ||
==Debug | <br> | ||
''64-bit SDK set-up'' | |||
{{Warning|For {{MicroprocessorDevice | device=23}} and {{MicroprocessorDevice | device=25}} absolute path to 64-bit SDK (MP2) GDB client is needed. | |||
/local/home/<username>/SDK_6.0.0_mp2/sysroots/x86_64-ostl_sdk-linux/usr/bin/aarch64-ostl-linux/aarch64-ostl-linux-gdb | |||
}} | |||
[[File:CubeIDEUserSpaceDebug.png|link=|center|'''User space debug configuration - main tab Debugger''']] | |||
==Debug == | |||
Click '''''Debug''''' : | Click '''''Debug''''' : | ||
# GtkHelloWorld is downloaded to the target, | # GtkHelloWorld is downloaded to the target, | ||
# ''GDBServer'' is launched on the target, | # ''GDBServer'' is launched on the target, | ||
# ''GDBClient'' is launched on the workstation and can exchange via network with ''GDBServer'' | # ''GDBClient'' is launched on the workstation and can exchange via the network with ''GDBServer''. | ||
<div class="res-img"> | <div class="res-img"> | ||
Line 65: | Line 100: | ||
</div> | </div> | ||
{{Info| | {{Info| In case of error, stop any ''GDBServer'' running on the target before launching a new debug session.}} | ||
[[ | [[File:BackToNavigationTree button.png|300px|link=How to debug a user space application with STM32CubeIDE]] | ||
<noinclude> | |||
{{PublicationRequestId | 19680 (LudovicB) |2021-04-20 }} | |||
</noinclude> |
Latest revision as of 17:02, 3 March 2025
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.”
1. Create a GtkHelloWorld user space project[edit | edit source]
In Cortex®-A7 sub-project context, named here MP157C-DK2_CA7, right-click and select Create a userspace Project...

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.

2. Update GtkHelloWorld project sources and properties[edit | 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`

- Linker flags update: `pkg-config --libs gtk+-3.0`

3. Build[edit | edit source]
Select your GtKHelloWorld project , right-click and then Build Project.

4. Prepare Debug Configuration[edit | 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.
Check How to set up proxy and P2P Ethernet connection with STM32CubeIDE if you are in that case.
5. Set Debug Configuration[edit | edit source]
- Select your project, right-click Debug as... > Debug Configurations,
- then select STM32 Cortex-A Remote Application'.

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.

64-bit SDK set-up

6. Debug[edit | edit source]
Click Debug :
- GtkHelloWorld is downloaded to the target,
- GDBServer is launched on the target,
- GDBClient is launched on the workstation and can exchange via the network with GDBServer.

![]() |
In case of error, stop any GDBServer running on the target before launching a new debug session. |