Debugging with Eclipse Print


This application note describes how to use Eclipse for building and debugging applications on the Emcraft i.MX 6SoloX BSP.

You will need a Linux version of the Eclipse IDE installed to you Linux development host.
Go to and select the latest version of Eclipse IDE for C/C++ Developers. At the moment of writing, the current version is the "Neon" release. Download and install Eclipse to your host.

Adding a Project to Eclipse

Here is how to create a single file project in Eclipse.

  • Go to the top of your Linux i.MX6 installation, activate the cross development environment and start Eclipse:
  • [sasha@liman linux-imx6sx-2.3.3]$ . ./
    [sasha@liman ~]$ ./eclipse/eclipse &

  • 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 Project, enter the name of the project, for example, c-example and click Next.
  • On the next screen you will be prompted to choose build configurations. Leave all the defaults and click Next to proceed.
  • On the next screen, enter arm-poky-linux-gnueabi- as a Cross compiler prefix and /opt/poky/1.8.1/sysroots/i686-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi as a Cross compiler path:
  • Click Finish.
  • Add your source file (see attached for 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.

Creating Build Configuration and Building the Project

Now, we need to instruct Eclipse on how to build the project for the Cortex‑A9 target.

  • Right-click on the just created project and select Properties. Navigate to C/C++ Build->Environment.
  • Click Add and add the INSTALL_ROOT variable as the root of your Emcraft BSP directory:
  • Click Apply.
  • Navigate to Settings.
  • In the Tool Settings tab on the right, select Include paths:
  • If needed, click on the + button and enter the include path ${INSTALL_ROOT}/target/root/usr/include, click OK when done:
  • Navigate to Miscellaneous and add -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a5 --sysroot=/opt/poky/1.8.1/sysroots/cortexa5hf-vfp-neon-poky-linux-gnueabi to Other flags.
  • In the same window, navigate to Cross GCC Linker -> Library search path:
  • If needed, click on the + button and enter the library search path ${INSTALL_ROOT}/target/root/usr/lib:
  • Navigate to Miscellaneous and add -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a5 --sysroot=/opt/poky/1.8.1/sysroots/cortexa5hf-vfp-neon-poky-linux-gnueabi -Wl,--hash-style=gnu -Wl,--as-needed to Linker flags, click OK when done:
  • To build the project, press Ctrl-B.

Debugging the Project on the Target

Now, we need to add Debug Configuration to the Eclipse project:

  • Open Run -> Debug Configurations:
  • Create a new configuration in C/C++ Remote Application by clicking + in the upper left part of the dialogue; select Project and C/C++ Application:
  • Create a new Connection by clicking New and choosing SSH connection type; click OK:
  • Edit properties of the new connection: specify the Host IP address, the User (root) and the Password based authentication (leave the Password empty); click Finish:
  • In the Main tab, specify Remote Absolute File Path for C/C++ Application and click Apply:
  • Now, switch to the Debugger tab and change gdb to arm-poky-linux-gnueabi-gdb:
  • On the Linux development host, create the c-example/.gdbinit GDB command file in your workspace and add the set sysroot /opt/poky/1.8.1/sysroots/cortexa5hf-vfp-neon-poky-linux-gnueabi command to it:
  • echo "set sysroot /opt/poky/1.8.1/sysroots/cortexa5hf-vfp-neon-poky-linux-gnueabi" > /home/sasha/workspace/c-example/.gdbinit

  • Click Apply and Debug. You will be asked to switch to the Debug Perspective window, accept it:

  • Click to enlarge

  • Eclipse will automatically deploy your application on the target and run gdbserver on it using the SSH protocol.
  • When started under remote debugger, the program automatically stops at the main() function. Now you can execute you program with steps, put breakpoints, and examine variables:

  • Click to enlarge