...
Go to https://www.eclipse.org/downloads/eclipse-packages/ and select the latest version of Eclipse IDE for C/C++ Developers. At the moment of writing, the current version is the "Oxygen" release. Download and install Eclipse to your host.
1. Adding a Project to Eclipse
Here is how to create a single file project in Eclipse.
Download the Yocto toolchain from the Emcraft website.
Install the toolchain to your development host. The toolchain can be installed to an arbitrary directory:
Code Block $ sh ./meta-toolchain-qt5-openstlinux-weston-stm32mp1-som-x86_64-toolchain-2.4-snapshot.sh
Activate the cross-build environment:
Code Block $ source /opt/st/stm32mp1-som/2.4-snapshot/environment-setup-cortexa7hf-neon- vfpv4-openstlinux_weston-linux-gnueabi $ unset CCACHE_PATH
Select a workspace directory (an arbitrary directory, different from the directory where your source file is located):
Create an empty project, open File -> New -> C/C++ Project, select C Managed Build, enter the name of the project, for example,
c-example
, and click Next.On the next screen you will be prompted to select configurations. Leave all the defaults and click Next to proceed.
On the next screen, enter
arm-openstlinux_weston-linux-gnueabi-
as a Cross compiler prefix and/opt/st/stm32mp1-som/2.4-snapshot/sysroots/x86_64-openstlinux_weston_sdk-linux/usr/bin/arm-openstlinux_weston-linux-gnueabi/
as a Cross compiler path:Click Finish.
Add your source file (see attached for an example) to the project, open File -> Import, select File System:
Click Next, and, using Browse, navigate to the directory with your source file. Select the directory in the left window, this will add its content to the project:
Click Finish.
2. Creating Build Configuration and Building the Project
Now, we need to instruct Eclipse on how to build the project for the STM32MP1 Cortex A7 target.
Right-click on the just created project and select Properties. Navigate to C/C++ Build->Settings.
In the Tool Settings tab on the right, select Include paths:
If needed, click on the + button and enter an include path.
Navigate to Miscellaneous and add
--sysroot=/opt/st/stm32mp1-som/2.4-snapshot/sysroots/cortexa7hf-neon-vfpv4-openstlinux_weston-linux-gnueabi -marm -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7
to Other flags.In the same window, navigate to Cross GCC Linker -> Library search path:
If needed, click on the + button and enter a library search path.
Navigate to Miscellaneous and add
--sysroot=/opt/st/stm32mp1-som/2.4-snapshot/sysroots/cortexa7hf-neon-vfpv4-openstlinux_weston-linux-gnueabi -marm -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7
to Other flags:Repeat the configuration steps above for the Release configuration.
To build the project, press Ctrl-B.
3. Debugging the Project on the Target
Now, we need to add Debug Configuration to the Eclipse project:
...