- Last edited 8 months ago ago
User space shared library project
This article explains how to create, build and debug a shared library, dynamically linked with a Linux® user space application on STM32 MPU.
In the Cortex®-A7 sub-project context, named here MP157C-DK2_CA7, right-click and select Create a userspace Project...
A Shared Library 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.
- Select your project, right-click and then Build Project.
Hereafter is an updated code for main() to call mySharedLib function say_hello().
You must also reference mySharedLib project inside myExe properties: C/C++ General > Paths and Symbols > References, as depicted below.
4 Prepare Debug Configuration
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 Linux® deployment configuration
Select the shared library project, right-click Run as... > Run Configurations, then select STM32 Cortex-A Linux Deployment'.
6 Set Debug Configuration
Select your project, right-click Debug as... > Debug Configurations, then select STM32 Cortex-A Remote Application'.
The default connection proposed is "MPU SSH", corresponding to the target IP address discovered by the Target Status widget. The default destination directory is /home/root.
For the executable myExe to load the mySharedLib dynamic library, a setup of LD_LIBRARY_PATH with the path to mySharedLib is needed before starting debug.
Click Debug :
- Executable 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.