Targeted Hardware | |
Targeted Software | BSP Yocto FSL iMX7 PD18.1.0 |
Date |
|
PHYTEC recommends Eclipse as a platform for building and debugging applications. This guide will show you how to set up the Yocto plugin for Eclipse to cross-develop applications for Yocto-based PHYTEC BSPs.
The instructions are based on a Host PC with a Virtual Machine running Ubuntu 16.04 LTS and Eclipse Photon installed. |
Once the BSP is built the following command needs to be run in the BSP directory to allow IDE support.
bitbake meta-ide-support |
Navigate to the BSP build directory and execute the following bitbake command to install the sdk. This will take a little while to complete.
The specific MACHINE configuration can be found in our release notes: BSP-Yocto-FSL-iMX7-PD18.1.0 Release Notes
MACHINE=imx7d-phyboard-zeta-001 bitbake fsl-image-gui -c populate_sdk |
The "populate_sdk" command creates a .sh file in the <BSP DIRECTORY>/build/tmp/deploy/sdk directory. Execute the created script to install the sdk on the host machine.
After the script starts it will ask for a directory to install the sdk too. Hit enter for the default location.
./<BSP DIRECTORY>/build/tmp/deploy/sdk/fsl-imx-x11-glibc-x86_64-fsl-image-gui-cortexa7hf-neon-toolchain-4.9.11-1.0.0.sh |
The instructions are applicable for Eclipse Oxygen and Photon running on Ubuntu 16.04 LTS. Older versions of Eclipse (ex. Luna or Neon) have similar steps but should be run on a Ubuntu 14.04 LTS system. |
Unpack the Eclipse Installer to a desired location. This will automatically create a directory called "eclipse-installer".
tar -xvzf eclipse-inst-linux64.tar.gz -C /<ECLIPSE DIRECTORY>/ |
Unpack the JDK into the "eclipse-installer" directory that was created in the previous step.
tar -xvzf jdk-10.0.1_linux-x64_bin.tar.gz -C /<ECLIPSE DIRECTORY>/eclipse-installer/ |
In the "eclipse-installer" directory edit the "eclipse-inst.ini" file. Add the following lines at the top of the file:
-vm /<ECLIPSE DIRECTORY>/eclipse-installer/jdk-10.0.1/bin/java |
The eclipse installer can now be run from the "eclipse-installer" directory.
./eclipse-inst |
The correct environment needs to be sourced. In the terminal navigate to the BSP directory and source the following environment.
source build/tmp/work/imx7d_phyboard_zeta_001-poky-linux-gnueabi/fsl-image-gui/1.0-r0/sdk/image/opt/fsl-imx-x11/4.9.11-1.0.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi |
Eclipse MUST be started in the same terminal window the environment was sourced from.
./eclipse/cpp-photon/eclipse/eclipse |
A few available plugins will show up in the window. Select all items and click Next to install.
In Eclipse go to Window -> Preferences.
Select the Yocto Project SDK option on the left.
Under "Cross Compiler Options" select the radial button for "Standalone pre-built toolchain".
Set the "Toolchain Root Location" to the SDK you just installed: /opt/fsl-imx-x11/4.9.11-1.0.0/
The "Target Architecture" field should automatically fill with "cortexa7hf-neon-poky-linux-gnueabi"
Set the "Sysroots Location": /opt/fsl-imx-x11/4.9.11-1.0.0/sysroots
Click "Apply and Close" to save settings.
Now that Eclipse is set up a test project can be created to verify everything is set up correctly. Go to File → New → Project
In the main window choose "GCC C Compiler" and change "Command:" to the following:
${CC} |
Now choose "GCC C Linker"
Change the "Command:" to the following:
${CC} |
Add in ${LDFLAGS} between ${COMMAND} and ${FLAGS} in the "Command line pattern:" field so it looks like the following:
${COMMAND} ${LDFLAGS} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} |
Under "GCC Assembler", change the "Command:" to the following:
${AS} |
Now switch to the "Build Steps" tab and change the "Post-build steps" "Command:" field to the following. Make sure to change the ip address of the command to match the address of the target hardware.
scp ./test root@192.168.xx.xx:/home/root/. ;ssh root@192.168.xx.xx /home/root/test |
Click "Apply and Close" when you are ready to build.
Build the project and you should see a similar output in Eclipse to the following:
09:40:47 **** Build of configuration Debug for project test **** make all Building file: ../src/test.c Invoking: GCC C Compiler arm-poky-linux-gnueabi-gcc -march=armv7ve -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/opt/fsl-imx-x11/4.9.11-1.0.0/sysroots/cortexa7hf-neon-poky-linux-gnueabi -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/test.d" -MT"src/test.o" -o "src/test.o" "../src/test.c" Finished building: ../src/test.c Building target: test Invoking: GCC C Linker arm-poky-linux-gnueabi-gcc -march=armv7ve -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/opt/fsl-imx-x11/4.9.11-1.0.0/sysroots/cortexa7hf-neon-poky-linux-gnueabi -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -o "test" ./src/test.o Finished building target: test make --no-print-directory post-build scp ./test root@192.168.3.67:/home/root/. ;ssh root@192.168.3.67 /home/root/test !!!Hello World!!! 09:40:48 Build Finished. 0 errors, 0 warnings. (took 1s.104ms) |