This article proposes to manage a shared library, dynamically linked with a Linux user space application on STM32 MPU.
Back to: How to debug a user space application with STM32CubeIDE
[edit source]
In context of Cortex-A7 sub-project, MP157C-DK2_CA7 here, right click and select Create a userspace Project..
We select here Shared Library project type, in C language. Note that our user space project will use by default the SDK version associated to Cortex-A7 sub-project.
2. Build[edit source]
- Select your project, right-click and then Build Project.
[edit source]
Hereafter is an updated code in order main() to call mySharedLib function say_hello().
You also have to reference mySharedLib project inside myExe properties: C/C++ General > Paths and Symbols > References; as depicted hereafter.
4. Preparing Debug Configuration[edit source]
Your target must be Linux booted and network connected. Please, start Target Status widget on the bottom right and check for the green light.
Please also check How to set up proxy and P2P Ethernet connection with STM32CubeIDE if you are in that case.
5. Linux deployment Configuration[edit source]
In order to run or debug the executable myExe and its shared library mySharedLib it is required to download the shared library object (.so) to the STM32MP15x device.
Select the shared library project, right-click Run as... > Run Configurations, then select STM32 Cortex-A Linux Deployment'.
6. Debug Configuration[edit source]
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 Target Status. The default destination directory is /home/root.
In order 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.
[edit source]
Click Debug :
- Executable is downloaded to the target,
- GDBServer is launched on the target,
- GDBClient is launched on the workstation and can exchange via network with GDBServer,
Information |
in case of error; please stop any GDBServer running on the target before launching a new debug session. |
Back to: How to debug a user space application with STM32CubeIDE