Eclipse IDE Setup

This guide will walkthrough the setup of the Eclipse IDE to cross-develop applications for the phyCORE-i.MX8X development kit.

In order to follow this guide, you must have a valid BSP PD21.1.0 SDK installed. Steps for installing the SDK can be found in the Install the SDK guide.

Install Eclipse

To install the Eclipse IDE, run the following command:

Host (Ubuntu)
sudo apt-get update
sudo apt-get install eclipse

Launch Eclipse once it is installed:

Host (Ubuntu)
./eclipse

You will be greeted with a window to setup your workspace. The workspace directory will house your development, feel free to create this anywhere you would like but this guide will use the default location as suggested by eclipse so just press OK.

../_images/pcm-065_eclipse-setup-1.png

The first time you open the Eclipse IDE, you will also be presented with a Welcome screen. Go ahead and close this:

../_images/pcm-065_eclipse-setup-2.png

Adding Eclipse Plug-ins

We need to configure this workspace before creating a new project for our phyCORE-i.MX8X. Navigate to Help → Install New Software:

../_images/pcm-065_eclipse-setup-3.png

In the Install window that appears, select Add…:

../_images/pcm-065_eclipse-setup-4.png

Another window should have popped up for adding a repository.

../_images/pcm-065_eclipse-setup-5.png

C/C++ Plug-ins

In the Location field, enter the following URL before selecting Add: http://download.eclipse.org/releases/luna

The Install window should now show a couple of plug-in options available for installation. Locate and check-mark the following:

  • Mobile and Device Development → C/C++ GCC Cross Compiler Support

  • Programming Languages → C/C++ Autotools Support

  • Programming Languages → C/C++ Development Tools

Select Next and work through installation of the C/C++ Plug-ins. Once the installation is complete, restart Eclipse.

Tip

You can restart Eclipse manually at anytime by navigating to File → Restart.

Once Eclipse has restarted, let’s grab some more Plug-ins from another location. Navigate to Help → Install New Software.

Add another repository using this URL in the location field this time: http://downloads.yoctoproject.org/releases/eclipse-plugin/1.8/juno/

The Install window should now show some new plug-in options available for installation. Press the Select All button as we are going to install of these plug-ins.

../_images/pcm-065_eclipse-setup-6.png

Select Next and work through installation of the Yocto Plug-ins. Once the installation is complete, restart Eclipse.

Configuring the Yocto Plug-in

With the plug-ins installed we now need to further configure the Yocto Plug-in to leverage the phyCORE-i.MX8X Linux BSP PD21.1.0 SDK, which contains both the toolchain and sysroots directory that Eclipse is going to use to cross-compile projects.

Navigate to Window → Preferences:

../_images/pcm-065_eclipse-setup-7.png

In the Preferences window, in the left side panel, select Yocto Project ADT:

../_images/pcm-065_eclipse-setup-8.png

Fill out the fields in the Yocto Project ADT window with the following values:

  • Cross Compiler Options: Select “Standalone pre-built toolchain”

  • Toolchain Root Location: Enter “/opt/fsl-imx-xwayland/5.4-zeus”

  • Sysroots Location: Enter “/opt/fsl-imx-xwayland/5.4-zeus/sysroots”

    Note

    The toolchain and sysroots locations could be in another location if you did not install the SDK to the default location as suggested by the installer. These fields should reflect wherever you installed the SDK. If you haven’t yet installed the SDK, checkout the Install the SDK guide.

Click Apply and then OK.

../_images/pcm-065_eclipse-setup-9.png

Your Eclipse IDE should now automatically source the cross-compilation toolchain upon start up.

Creating and Configuring a New C Project

This section of the guide will setup and build a template Hello World application as a reference for those beginning development on the phyCORE-i.MX8X.

During cross-platform development, one of the biggest consumers of time can be transferring binaries back and forth between your development machine and the phyCORE-i.MX8X target. In an effort to aide in long term development, we will also be adding a post-build step to transfer the binary to the development kit and execute it automatically from within the Eclipse IDE.

Note

In order to complete this guide, the phyCORE-i.MX8X must be connected to your local area network and you must know its IPv4 address. Checkout the Ethernet interface guide for more information about this.

Create the Project

Navigate to File → New → Project:

../_images/pcm-065_eclipse-setup-10.jpg

In the New Project window, navigate to C/C++ → C Project:

../_images/pcm-065_eclipse-setup-11.jpg

In the C Project window, name the project HelloWorld

  • For the Project Type, select the Executable → Hello World ANSI C Project

  • For the Toolchain, select Linux GCC

../_images/pcm-065_eclipse-setup-12.jpg

You should now be able to navigate the project in the C/C++ Projects pane on the left.

../_images/pcm-065_eclipse-setup-13.jpg

Configure the Project Properties

Now with the project created, we need to configure the project to leverage the cross-compilation toolchain Eclipse already has sourced.

Right click the Project in the C/C++ Projects pane on the left and select Properties

../_images/pcm-065_eclipse-setup-14.jpg

In the Properties window, navigate to C/C++ Build → Settings

../_images/pcm-065_eclipse-setup-15.jpg

In the Tool Settings pane, select GCC C Compiler and replace the Command field with: ${CC}

../_images/pcm-065_eclipse-setup-16.jpg

In the Tool Settings pane, select GCC C Linker and replace the Command field with: ${CC}

Also, add ${LDFLAGS} between ${COMMAND} and ${FLAGS} in the “Command line pattern:” field.

../_images/pcm-065_eclipse-setup-17.jpg

In the Tool Settings pane, select GCC C Assembler and replace the Command field with: ${AS}

../_images/pcm-065_eclipse-setup-18.jpg

Select the Build Steps tab next to the Tool Settings tab:

../_images/pcm-065_eclipse-setup-19.jpg

In the Post-built steps Command field, enter the following line (replace the X’s with the IPv4 address of your phyCORE-i.MX8X):

Post-build Command
scp ./HelloWorld [email protected]:~; ssh [email protected] ./HelloWorld

This command is run automatically at the end of the build by Eclipse and it will transfer the output binary for the project to the phyCORE-i.MX8X and execute it there.

../_images/pcm-065_eclipse-setup-20.jpg

Select the Build Artifacts tab next to the Build Steps tab:

../_images/pcm-065_eclipse-setup-21.jpg

Clear the Output prefix field. This field should have no value when compiling executables.

../_images/pcm-065_eclipse-setup-22.jpg

Select Apply and OK.

Build the Project

Now that the project is configured, it is ready to be built. To build the project, select the little Hammer icon in the toolbar.

../_images/pcm-065_eclipse-setup-23.jpg

With that, the project should build and Eclipse should automatically process the post-build step. You should see confirmation of the successful build in the IDE console and the “Hello World” message being echoed there from the phyCORE-i.MX8X over the network.

../_images/pcm-065_eclipse-setup-24.jpg

Tip

If your build gets stuck and never seems to complete, try canceling the build and removing the post-built step to see if this was the issue. You might need to double check that you can manually SSH into the phyCORE-i.MX8X first to ensure that there are no underlying network issues with this. Steps for manually SSHing into the phyCORE-i.MX8X can be found in the Ethernet interface guide.