Building the SDK for NXP i.MX8M Plus board
Getting started with AI on NXP i.MX8M Plus RidgeRun documentation is currently under development. |
Building the toolchain
First of all, we need to set the environment for bitbaking the Software Development Kit from the imx-image-core:
cd $HOME/<your image folder>
If you have not built the image in the previous steps please execute the following commands, otherwise skip these commands:
# Create a build folder mkdir build_xwayland_imx_image_core # Creating the configuration files, but you will need to add the modules to local.conf and bblayers.conf source var-setup-release.sh -b build_xwayland_imx_image_core # Compiling the SDK bitbake imx-image-core -c populate_sdk
If you have followed the entire building process until here, just set the environment by:
source setup-environment build_xwayland_imx_image_core bitbake imx-image-core -c populate_sdk
Installing the SDK
After the bitbake command has finished, then an sdk folder is created at
cd $HOME/<your image folder>/build_xwayland_imx_image_core/tmp/deploy/sdk
At this path, then execute the bash script that looks like something like the following, in order to install the toolchain at an specific folder:
./fsl-imx-xwayland-glibc-x86_64-imx-image-core-cortexa53-crypto-imx8mp-var-dart-toolchain-5.10-gatesgarth.sh
After the installation a message like the following will appear:
SDK has been successfully set up and is ready to be used. Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g. $ . /opt/fsl-imx-xwayland/<your Yocto version>/environment-setup-cortexa53-crypto-poky-linux
Using the SDK
As shown in the last message from the previous section, you can configure your crosscompilation environment by executing the following command:
. /opt/fsl-imx-xwayland/<your Yocto version>/environment-setup-cortexa53-crypto-poky-linux
To ensure that your environment is configured properly, examine the $CC variable:
echo $CC
Simple example
Suppose you have a folder at your root directory($HOME) called test_toolcahin. Go there, configure the crosscompilation environment and write the following code in a file called test.cpp:
#include <stdio.h> int main () { printf("Hello from arm\n"); return 0; }
Once you have this code, open up a terminal and execute the following commands:
cd $HOME/test_toolcahin # Configuring the toolchain: source /opt/fsl-imx-xwayland/<your Yocto version>/environment-setup-cortexa53-crypto-poky-linux # Crosscompiling the test.cpp code: $CC -O test test.cpp