VAR-SOM-MX6 Yocto Jethro Eclipse: Difference between revisions
(Created page with "{{PageHeader|VAR-SOM-MX6 Programming with Eclipse and Yocto version 3 (Yocto Fido)}} {{DocImage|category1=VAR-SOM-MX6|category2=Yocto}} __toc__ Variscite's Yocto release incl...") |
No edit summary |
||
Line 7: | Line 7: | ||
== Build == | == Build == | ||
Change directory to your build directory and verify that your environment settings is set correctly. | Change directory to your build directory and verify that your environment settings is set correctly. | ||
<pre> | <pre> | ||
Line 42: | Line 41: | ||
= Eclipse installation = | = Eclipse installation = | ||
== Download Eclipse == | |||
Download Eclipse Luna from here: http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/lunasr2<br> | |||
Run the following command to unpack and install the downloaded Eclipse IDE tarball into a clean directory using the default name eclipse: | |||
<pre> | |||
$ cd ~ | |||
$ tar -xf ~/Downloads/eclipse-cpp-luna-SR2-linux-gtk-x86_64.tar.gz | |||
</pre> | |||
== Configuring the Eclipse IDE == | |||
Run the Eclipse IDE with the following command: | |||
<pre> | |||
$ cd eclipse | |||
$ ./eclipse | |||
</pre> | |||
Select a new workspace (you can just click OK).<br> | |||
<br> | |||
Choose "Install New Software" from the "Help" pull-down menu.<br> | |||
* In the "Work with" area select "Luna - http://download.eclipse.org/releases/luna".<br> | |||
* Uncheck the "Hide items that are already installed" box.<br> | |||
* Expand the "Linux Tools" option and select:<br> | |||
<pre> | |||
Linux Tools LTTng Tracer Control | |||
Linux Tools LTTng Userspace Analysis | |||
LTTng Kernel Analysis | |||
</pre> | |||
* Expand the "Mobile and Device Development" option and select: | |||
<pre> | |||
C/C++ Remote Launch (Requires RSE Remote System Explorer) | |||
Remote System Explorer End-user Runtime | |||
Remote System Explorer User Actions | |||
Target Management Terminal (Core SDK) | |||
TCF Remote System Explorer add-in | |||
TCF Target Explorer | |||
</pre> | |||
* Expand the "Programming Languages" option and select: | |||
<pre> | |||
C/C++ Autotools Support | |||
C/C++ Development Tools | |||
</pre> | |||
* Click Next twice, accept the necessary EULA and click Finish.<br> | |||
* Click to restart Eclipse when asked to. | |||
== Adding the Yocto Plug-in to the Eclipse IDE == | |||
In Eclipse, select "Install new Software" from the "Help" menu.<br> | |||
* Click the "Add..." button to add a repository, enter the following and click OK. | |||
<pre> | |||
Name: Yocto Jethro (you can actually use any name) | |||
Location: http://downloads.yoctoproject.org/releases/eclipse-plugin/2.0/luna/ | |||
</pre> | |||
* Make sure the repository above is selected on the "Work with" drop-down menu and select the following plug-ins from the list: | |||
<pre> | |||
Yocto Project ADT Plug-in | |||
Yocto Project Bitbake Commander Plug-in | |||
Yocto Project Documentation plug-in | |||
</pre> | |||
* Click Next twice, accept the necessary EULA and click Finish.<br> | |||
* Click to restart Eclipse when asked to.<br> | |||
== Configuring the Eclipse Yocto Plug-in == | |||
In this section we will configure the Cross Compiler and the Target options. These will then be used as default for your projects from within your workspace.<br> | |||
<br> | |||
Select "Preferences" from the "Window" menu.<br> | |||
* Click on "Yocto Project ADT" from the left options and then under "Cross Compiler Options:" select the "Standalone pre-built toolchain" radio button. | |||
* Under "Toolchain Root Location:" enter "/opt/fsl-imx-x11/4.1.15-1.1.0". | |||
* Under "Sysroot Location:" enter "~/var-som-mx6-yocto-jethro/build_x11/tmp/sysroots/var-som-mx6" (replace the "~" with your actual home directory, as Eclipse doesn't like it) | |||
* Under "Target Options:" make sure "External HW" is selected. | |||
* Click OK. | |||
= Create and run a simple application = | = Create and run a simple application = | ||
== Create the Project == | == Create the Project == | ||
You can create two types of projects: Autotools-based, or Makefile-based. This section describes how to create Autotools-based projects from within the Eclipse IDE. To create a project based on a Yocto template and then display the source code, follow these steps: | You can create two types of projects: Autotools-based, or Makefile-based. This section describes how to create Autotools-based projects from within the Eclipse IDE. To create a project based on a Yocto template and then display the source code, follow these steps: | ||
*File->New->C Project | * File->New->C Project | ||
*Click Yocto Project ADT Project. | * Click "Yocto Project ADT Autotools Project". | ||
*Select Hello World ANSI C Autotools Project. This is an Autotools-based project based on a Yocto template. | * Select "Hello World ANSI C Autotools Project". This is an Autotools-based project based on a Yocto template. | ||
[[File:Prj1.jpg]] | [[File:Prj1.jpg]] | ||
* | * Enter a name for the project under the "Project name" field. Do not use hyphens as part of the name. | ||
*Click "Next". | * Click "Next". | ||
*Add information in the Author and | * Add information in the Author field and make sure the License field is correct. | ||
* Click "Finish". | |||
* Click on "Workbench". | |||
<br> | |||
* You should now be in the C/C++ perspective. The left-hand navigation pane shows your project. You can display your source by double clicking the project's source file. | |||
* Hit Ctrl+B or click the hammer icon to build your project. | |||
[[File: | [[File:C_perspective.png]] | ||
== Create communication link == | == Create communication link == | ||
Using the console of your target set a password with "passwd" command. choose a simple one named "root".<br> | |||
The target should be connected to the network via Ethernet or WIFI.<br> | |||
Use the "ifconfig" command on the target to get its IP address.<br> | |||
From Eclipse: | |||
* Window->Open Perspective->Other | |||
* Double click on ''Remote System Explorer'' | |||
[[File:Tcf1.png]] | |||
* In the left bar right click and New->Connection | |||
* Choose TCF and click Next | |||
[[File:Tcf2.png]] | |||
* Set the Host name to the target's IP address and click Finish | |||
*Set the Host name to the target IP | |||
[[File:Tcf3.jpg]] | [[File:Tcf3.jpg]] | ||
* On the left bar right click on the target IP and select connect | |||
*On the left bar right click on the | * Set "User ID:" to root, "Password:" to root and check the "Save password" | ||
*Set "User ID:" to root, "Password:" to root and check the "Save password" | * Enter the root password again in the next poop up. | ||
Once connected you can browse the target file system, browse target process and lunch a terminal to the target. | |||
Once connected you can browse target file system, browse target process and lunch a terminal to the target. | |||
== Remote debug == | == Remote debug == | ||
Line 102: | Line 159: | ||
Follow the below steps to remotely debug your application on the VAR-SOM-MX6. | Follow the below steps to remotely debug your application on the VAR-SOM-MX6. | ||
*Select "Debug Configurations..." from the "Run" menu. | * Select "Debug Configurations..." from the "Run" menu. | ||
*In the left area, expand C/C++Remote Application. | * In the left area, expand C/C++ Remote Application. | ||
*Locate your project and select it to pop up a new tabbed view in the Debug Configurations Dialog. | * Locate your project and select it to pop up a new tabbed view in the Debug Configurations Dialog. | ||
*Enter the absolute path which you want to deploy the application to. Use the "Remote Absolute File Path for C/C++Application:" field. For example, enter /home/root/hello | * Enter the absolute path which you want to deploy the application to. Use the "Remote Absolute File Path for C/C++Application:" field. For example, enter /home/root/hello | ||
[[File:Dbg1.jpg]] | [[File:Dbg1.jpg]] | ||
Line 115: | Line 172: | ||
[[File:Dbg2.jpg]] | [[File:Dbg2.jpg]] | ||
You can now run and debug your program via eclipse. The actual program execution is done on the target, and the output is seen on the Remote Shell on Eclipse. |
Revision as of 15:03, 15 May 2016
Variscite's Yocto release includes the required packages to the build images fsl-image-qt5 with Eclipse debug support. This guide will describe how to use Eclipse to develop applications to run on the VAR-SOM-MX6.
Detail information can be found:
http://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#application-development-workflow
previous version
Host tools
Build
Change directory to your build directory and verify that your environment settings is set correctly.
$ cd ~/var-som-mx6-yocto-jethro $ DISTRO=fsl-imx-x11 MACHINE=var-som-mx6 source var-setup-release.sh -b build_x11
Build the tools:
bitbake meta-toolchain
The build creates the tools installer
$ ls tmp/deploy/sdk/
The outcome should be:
fsl-imx-x11-glibc-x86_64-meta-toolchain-cortexa9hf-vfp-neon-toolchain-4.1.15-1.1.0.host.manifest fsl-imx-x11-glibc-x86_64-meta-toolchain-cortexa9hf-vfp-neon-toolchain-4.1.15-1.1.0.sh fsl-imx-x11-glibc-x86_64-meta-toolchain-cortexa9hf-vfp-neon-toolchain-4.1.15-1.1.0.target.manifest
Install SDK
$ tmp/deploy/sdk/fsl-imx-x11-glibc-x86_64-meta-toolchain-cortexa9hf-vfp-neon-toolchain-4.1.15-1.1.0.sh
When system prompts "Enter target directory for SDK (default: /opt/fsl-imx-x11/4.1.15-1.1.0):" hit enter.
When system prompts "You are about to install the SDK to "/opt/fsl-imx-x11/4.1.15-1.1.0". Proceed[Y/n]?" hit y and enter.
At the end of the installation you should see the following:
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-x11/4.1.15-1.1.0/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
Eclipse installation
Download Eclipse
Download Eclipse Luna from here: http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/lunasr2
Run the following command to unpack and install the downloaded Eclipse IDE tarball into a clean directory using the default name eclipse:
$ cd ~ $ tar -xf ~/Downloads/eclipse-cpp-luna-SR2-linux-gtk-x86_64.tar.gz
Configuring the Eclipse IDE
Run the Eclipse IDE with the following command:
$ cd eclipse $ ./eclipse
Select a new workspace (you can just click OK).
Choose "Install New Software" from the "Help" pull-down menu.
- In the "Work with" area select "Luna - http://download.eclipse.org/releases/luna".
- Uncheck the "Hide items that are already installed" box.
- Expand the "Linux Tools" option and select:
Linux Tools LTTng Tracer Control Linux Tools LTTng Userspace Analysis LTTng Kernel Analysis
- Expand the "Mobile and Device Development" option and select:
C/C++ Remote Launch (Requires RSE Remote System Explorer) Remote System Explorer End-user Runtime Remote System Explorer User Actions Target Management Terminal (Core SDK) TCF Remote System Explorer add-in TCF Target Explorer
- Expand the "Programming Languages" option and select:
C/C++ Autotools Support C/C++ Development Tools
- Click Next twice, accept the necessary EULA and click Finish.
- Click to restart Eclipse when asked to.
Adding the Yocto Plug-in to the Eclipse IDE
In Eclipse, select "Install new Software" from the "Help" menu.
- Click the "Add..." button to add a repository, enter the following and click OK.
Name: Yocto Jethro (you can actually use any name) Location: http://downloads.yoctoproject.org/releases/eclipse-plugin/2.0/luna/
- Make sure the repository above is selected on the "Work with" drop-down menu and select the following plug-ins from the list:
Yocto Project ADT Plug-in Yocto Project Bitbake Commander Plug-in Yocto Project Documentation plug-in
- Click Next twice, accept the necessary EULA and click Finish.
- Click to restart Eclipse when asked to.
Configuring the Eclipse Yocto Plug-in
In this section we will configure the Cross Compiler and the Target options. These will then be used as default for your projects from within your workspace.
Select "Preferences" from the "Window" menu.
- Click on "Yocto Project ADT" from the left options and then under "Cross Compiler Options:" select the "Standalone pre-built toolchain" radio button.
- Under "Toolchain Root Location:" enter "/opt/fsl-imx-x11/4.1.15-1.1.0".
- Under "Sysroot Location:" enter "~/var-som-mx6-yocto-jethro/build_x11/tmp/sysroots/var-som-mx6" (replace the "~" with your actual home directory, as Eclipse doesn't like it)
- Under "Target Options:" make sure "External HW" is selected.
- Click OK.
Create and run a simple application
Create the Project
You can create two types of projects: Autotools-based, or Makefile-based. This section describes how to create Autotools-based projects from within the Eclipse IDE. To create a project based on a Yocto template and then display the source code, follow these steps:
- File->New->C Project
- Click "Yocto Project ADT Autotools Project".
- Select "Hello World ANSI C Autotools Project". This is an Autotools-based project based on a Yocto template.
- Enter a name for the project under the "Project name" field. Do not use hyphens as part of the name.
- Click "Next".
- Add information in the Author field and make sure the License field is correct.
- Click "Finish".
- Click on "Workbench".
- You should now be in the C/C++ perspective. The left-hand navigation pane shows your project. You can display your source by double clicking the project's source file.
- Hit Ctrl+B or click the hammer icon to build your project.
Create communication link
Using the console of your target set a password with "passwd" command. choose a simple one named "root".
The target should be connected to the network via Ethernet or WIFI.
Use the "ifconfig" command on the target to get its IP address.
From Eclipse:
- Window->Open Perspective->Other
- Double click on Remote System Explorer
- In the left bar right click and New->Connection
- Choose TCF and click Next
- Set the Host name to the target's IP address and click Finish
- On the left bar right click on the target IP and select connect
- Set "User ID:" to root, "Password:" to root and check the "Save password"
- Enter the root password again in the next poop up.
Once connected you can browse the target file system, browse target process and lunch a terminal to the target.
Remote debug
Follow the below steps to remotely debug your application on the VAR-SOM-MX6.
- Select "Debug Configurations..." from the "Run" menu.
- In the left area, expand C/C++ Remote Application.
- Locate your project and select it to pop up a new tabbed view in the Debug Configurations Dialog.
- Enter the absolute path which you want to deploy the application to. Use the "Remote Absolute File Path for C/C++Application:" field. For example, enter /home/root/hello
- Click on the "Debugger" tab to see the cross-tool debugger you are using.
- Click on the "Main" tab.
- Hit Debug
- Accept the debug perspective.
You can now run and debug your program via eclipse. The actual program execution is done on the target, and the output is seen on the Remote Shell on Eclipse.