Setting-up Eclipse Plug-in to cross compile for iMX6 series

From ESS-WIKI
Revision as of 08:30, 9 August 2016 by Winston.huang (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Prerequisites

All operations in this guide are based on Ubuntu 12.04 LTS 64bit only.
First please install Ubuntu 12.04 LTS 64bit* with minimum 2GB memory.
* ubuntu-12.04.1-desktop-amd64.iso

Installing required packages

Please login and perform the following commands:

$ sudo apt-get install ssh
$ sudo apt-get install ia32-libs libx11-dev:i386 libreadline6-dev:i386 \
libgl1-mesa-glx:i386 zlib1g-dev:i386 uuid-dev:i386 liblzo2-dev:i386 \ 
libncurses5-dev:i386
$ sudo apt-get install \
bison build-essential ccache dpkg flex gcc g++ gettext intltool \
libarchive-zip-perl libfreetype6-dev libdbus-glib-1-dev liborbit2-dev \
libxml2-dev libx11-dev libgtk2.0-dev liblzo2-2 libtool m4 \
patch rpm tcl uboot-mkimage uuid zlib1g zlib1g-dev \
git gnupg flex bison gperf build-essential  zip \
curl libc6-dev libncurses5-dev x11proto-core-dev libx11-dev:i386 \
libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib \
mingw32 tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 \
gcc-4.6 g++-4.6 cpp-4.6 gcc-4.6-multilib uuid-dev liblzo2-dev \
uboot-mkimage libarchive-zip-perl \
wget git-core unzip texinfo gawk diffstat build-essential chrpath \
sed cvs subversion coreutils texi2html \
docbook-utils python-pysqlite2 help2man make gcc g++ \
desktop-file-utils libgl1-mesa-dev libglu1-mesa-dev mercurial \
autoconf automake groff curl lzop asciidoc xterm
$ sudo apt-get install libncurses5-dev:i386 liblzo2-dev:i386 uuid-dev:i386
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
$ tar zcvf ~/usr_lib_i386-linux-gnu_for_Building_Android_KK.tar.gz \
/usr/lib/i386-linux-gnu/{libuuid.a,libuuid.so,liblzo2.so,liblzo2.a}
$ sudo apt-get install uuid-dev liblzo2-dev
$ sudo tar zxvf ~/usr_lib_i386-linux-gnu_for_Building_Android_KK.tar.gz -C /

Installing JDK

Please download "jdk-6u45-linux-x64.bin" manually, put it to directory ~/FILES/ and perform the following commands:

$ cd /usr/lib
$ sudo ~/FILES/jdk-6u45-linux-x64.bin
$ sudo mkdir jvm
$ cd jvm
$ sudo mv ../jdk1.6.0_45 .
$ cd jdk1.6.0_45/
$ sudo update-alternatives --install /usr/bin/java    java    /usr/lib/jvm/jdk1.6.0_45/jre/bin/java    2
$ sudo update-alternatives --install /usr/bin/javac   javac   /usr/lib/jvm/jdk1.6.0_45/bin/javac   2
$ sudo update-alternatives --install /usr/bin/jar     jar     /usr/lib/jvm/jdk1.6.0_45/bin/jar     2
$ sudo update-alternatives --install /usr/bin/javap   javap   /usr/lib/jvm/jdk1.6.0_45/bin/javap   2
$ sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_45/bin/javadoc 2
$ sudo update-alternatives --config javap
$ sudo update-alternatives --config javadoc
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config jar
$ cd ~/
$ sudo sh -c "echo "JAVA_HOME=/usr/lib/jvm/jdk1.6.0_45" >> /etc/environment"

Installing cross toolchain

Please use bitbake command to build one toolchain installer or get a pre-built one.

Qt4 SDK

Please perform following command to make toolchain installer.
$ bitbake fsl-image-x11 -c populate-sdk
Please change working directory to where installer located and perform the following command.
$ sudo ./poky-eglibc-x86_64-fsl-image-x11-cortexa9hf-vfp-neon-toolchain-qt4-1.5.3.sh

Qt5 SDK

Please perform following command to make toolchain installer.
$ bitbake fsl-image-x11-qt5 -c populate-sdk
Please change working directory to where installer located and perform the following command.
$ sudo ./poky-eglibc-x86_64-fsl-image-x11-qt5-cortexa9hf-vfp-neon-toolchain-1.5.3.sh


Working with Eclipse

Installing the Eclipse IDE

Please download "eclipse-standard-kepler-R-linux-gtk-x86_64.tar.gz" manually, put it to directory ~/FILES/ and perform the following commands:

$ cd ~/
$ tar xvf ~/FILES/eclipse-standard-kepler-R-linux-gtk-x86_64.tar.gz

Starting the Eclipse IDE

$ source /opt/poky/1.5.3/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
$ ~/eclipse/eclipse
  1. select your workspace location
    2015-02-06 114519.png
  2. Make sure you are in your Workbench and select "Install New Software" from the "Help" pull-down menu.
    2015-03-10 101130.png
  3. Select "Kepler - http://download.eclipse.org/releases/kepler" from the "Work with:" pull-down menu.
    2015-02-10 140503.png
  4. Expand the box next to "Linux Tools" and select the LTTng - Linux Tracing Toolkit boxes.
    2015-01-27 152608.png
  5. Expand the box next to "Mobile and Device Development" and select the following boxes:
    2015-01-27 152635.png
    2015-02-10 141921.png
  6. Expand the box next to "Programming Languages" and select the following boxes:
    2015-01-27 152817.png
  7. Complete the installation and restart the Eclipse IDE.
    2015-01-27 153323.png

Installing the Pre-built Plug-in

  1. Start up the Eclipse IDE.
  2. In Eclipse, select "Install New Software" from the "Help" menu.
  3. Click "Add..." in the "Work with:" area.
  4. Enter "http://downloads.yoctoproject.org/releases/eclipse-plugin/1.5.4/kepler" in the URL field and provide a meaningful name in the "Name" field.
    2015-01-27 155542.png
  5. Click "OK" to have the entry added to the "Work with:" drop-down list.
  6. Check the boxes next to following items:
    2015-01-27 160318.png
  7. Complete the remaining software installation steps and then restart the Eclipse IDE to finish the installation of the plug-in.
    2015-01-27 161306.png
  8. Click OK to continue when following dialog shows up.
    2015-01-27 161455.png

Configuring the Cross-Compiler Options

  1. Choose "Preferences" from the "Windows" menu to display the Preferences dialog.
  2. Click "Yocto Project ADT"
    2015-01-27 162351.png
  3. Specify corret "Toolchain Root Location" & "Sysroot Location".
    2015-01-27 163339.png

Creating the Project

  1. Select "Project" from the "File -> New" menu.
  2. Expand "C/C++".
  3. Double click "C Project" to create the project.
    2015-01-27 165522.png
  4. Expand "Yocto Project ADT Autotools Project".
  5. Select "Hello World ANSI C Autotools Project".
  6. Put a name in the "Project name:" field. Do not use hyphens as part of the name.
    2015-01-27 170036.png
  7. Click "Next".
  8. Add information in the Author and Copyright notice fields.
  9. Be sure the License field is correct.
  10. Click "Finish".
    2015-01-27 170314.png
  11. If the "open perspective" prompt appears, click "Yes" to open the C/C++ perspective.
    2015-01-27 170222.png
  12. The left-hand navigation pane shows your project. You can display your source by double clicking the project's source file.
    2015-01-27 170700.png

Building the Project

Select "Build Project" from the "Project" menu. The console should update and you can note the cross-compiler you are using. 2015-01-27 171739.png

You can also use command, file, to verify the program, helloworld, just compiled in Ubuntu 12.04. 2015-01-27 171835.png

Deploying and Running the Application

  1. Select "Run Configurations..." from the "Run" menu.
    2015-01-27 172515.png
  2. In the left area, expand "C/C++Remote Application".
  3. Locate your project and select it to bring up a new tabbed view in the Run Configurations Dialog.
    2015-02-12 115123.png
  4. Create a new connection to the target instance by clicking on "New...".
    2015-01-27 173140.png
  5. Select TCF, and click "Next>".
    2015-01-27 173219.png
  6. Clear out the "host name" field and enter the IP Address of target board.
  7. Click "Finish" to close the New Connection Dialog.
    2015-01-28 113408.png
  8. Choose correct connection earlier created
    2015-01-28 113705.png
  9. Enter the absolute path into which you want to deploy the application. Use the "Remote Absolute File Path for C/C++Application:" field.
    2015-01-27 175136.png
  10. Click "Run" to bring up a login screen and login.
    2015-01-27 174319.png

Deploying and Debugging the Application

  1. Select "Debug Configurations..." from the "Run" menu.
    2015-01-28 102749.png
  2. In the left area, expand "C/C++Remote Application".
  3. Locate your project and select it to bring up a new tabbed view in the Debug Configurations Dialog.
    2015-01-28 114751.png
  4. Choose correct connection and enter the absolute path into which you want to deploy the application.
    2015-01-28 143015.png
  5. Click on the "Debugger" tab to see the cross-tool debugger you are using.
  6. Click "Browse..." to choose GDB debugger.
    2015-01-28 145534.png
  7. Choose "arm-poky-linux-gnueabi-gdb" located in "/opt/poky/1.5.3/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi".
  8. Click "OK
    2015-01-28 145746.png
  9. Click "Debug".
    2015-01-28 150706.png
  10. Login if login screen brings up.
    2015-01-28 124422.png
  11. Accept the debug perspective.
    2015-01-28 144213.png
  12. The debug perspective shows up.
    2015-01-28 144541.png


References

  1. 12.04 LTS (Precise Pangolin)
  2. Java Archive - SE 6
  3. Project Development Manual
  4. Kepler R Packages