Hello World program for the i.MX53 board

Mar 31, 2014

Assuming you’ve configured your environment correctly (you’ve installed eclipse, its plugins, the toolchain and the sysroot on the development machine; on the target machine booted the filesystem successfully), creating an application is as easy as the following steps:

Open Eclipse, on the menubar, click on “File” -> “New” -> “Project…”;

select “C Project”, click on “Next”;

type a name for your new project;

expand the “Yocto Project ADT Project” folder;

here you could select “Empty Project” if you wish, but let’s select “Hello World ANSI C Autotools Project”, this way Eclipse creates an Autotools project and its files and folders preconfigured. Click on “Next”;

here you can set more information about the project, like: “Author”, “Copyright notice”, “Hello world greeting”, the “Source” folder and the “License”;

Fill them as you wish and click “Finish”.

At this point your project was created. Let’s make sure that the Yocto configuration was set right:

On the menubar, click on “Project”, “Change Yocto Project Settings”;

here you can check the “Toolchain” and “Sysroot” locations and the “Target architecture” as well. Change them if needed or just close the window if everything is right.

Now that your project is set up, lets build it:

On the menubar, click on “Project”, “Reconfigure Project”. You don’t have to do this every time you build it, but only when a project configuration is changed;

on the menubar, click on “Project”, “Build Project”.

Your application binary is already created!

Now it’s time to test it. For the following steps, you need to setup the target device. This includes: boot the corresponding filesystem on it, have a network connection between the target device and the development machine and have started the TCF agent on the target device.

If the description above sounds simplified, it’s because it’s simple! The filesystem to be booted on the device is provided along with the toolchain and the sysroot. For the i.MX53, on the development machine you just have to do a binary copy of the filesystem to a SD card, plug the SD card on the board and power it on. To setup a valid network configuration, you can do it with a simple command (ex.: ifconfig eth0 10.9.0.1) and to start the TCF agent a single command as well (/etc/init.d/tcf-agent start).

After the device have been set up, let’s test and debug your application:

On the menubar, click on “Run”, “Debug configurations”;

on the left area, expand “C/C++ Remote Application”;

locate your project to bring the view of the Debug configurations on the right area;

at the right side of the “Connection” field, click on “New” to create a new connection with the target device;