HOWTO Configure Eclipse to Work with Jowles: Difference between revisions

From HBMobile
Jump to navigationJump to search
No edit summary
No edit summary
 
Line 197: Line 197:
# add the string "i686-pc-linux-gnu" for the "Host Platform (--host)" entry and "arm-linux-gnu" for the "Build Platform (--build)" entry.
# add the string "i686-pc-linux-gnu" for the "Host Platform (--host)" entry and "arm-linux-gnu" for the "Build Platform (--build)" entry.
# Now hit the "OK" button down at the bottom of the dialog.
# Now hit the "OK" button down at the bottom of the dialog.
[[Category:HOWTO]]

Latest revision as of 19:30, 16 December 2007

Introduction

This "HOWTO" guide describes how to configure Eclipse on a Xubuntu 7.10 development workstation to:

  • compile 'C' code for the ARM toolchain
  • automatically install the compiled code onto a test GumStix based myPhone, and
  • use remote debugging so you can debug code on the GumStix system in the graphical Eclipse environment on the development workstation.

We assume you've already:

  • assembled your GumStix / Goliath or GumStix / ConsoleLCD based myPhone
  • installed Linux on your development workstation (or are running it as a VMWare virtual image)
  • connected the myPhone to the development workstation using a serial cable
  • downloaded, compiled and installed a recent buildroot from GumStix, and
  • can successfully log into the myPhone via Minicom (or a similar terminal emulator)

Options

This HOWTO assumes you're connecting to your GumStix device via the serial cable. We're going to configure PPP over this serial link so we can use ssh, scp and sftp to make a "network" connection to the device. Using the serial cable is convenient because if you're going to be flashing new images onto your GumStix device, you're already going to need to access the console via the serial port. So we assume that you already have the appropriate null modem cable and are writing this HOWTO to use PPP over the serial port since this is the configuration that requires no hardware beyond what we think is typical for a myPhone developer.

Some people will have added WiFi or Ethernet adapters to their devices, and there's no reason you can't use these high speed network devices instead of the relatively slower serial PPP link described here. However... if you want to do this, you'll have to make the appropriate changes to the procedure described below.

Configure OpenSSH and Dropbear

Before you can use the Eclipse tools to automatically distribute code to the gumstix, you have to get SFTP working. You could try the command:

sftp root@192.168.3.2:/

but you would likely get an error. The reason for the error is the default configuration for dropbear is that it doesn't support SFTP. So, we'll have to use the patch packages from http://razzle.dk/. The easiest way I found to use them was to download them, untar them, and then remake the root image. So assuming you put your gumstix-buildroot in the ~/Projects directory, the commands would look something like this:

cd $HOME/Projects/gumstix-buildroot/package
wget 'http://razzle.dk/gumstix/package/dropbear.tgz'
wget 'http://razzle.dk/gumstix/package/openssh.tgz'
tar xzvf dropbear.tgz
tar xzvf openssh.tgz
cd ..

Next we have to tell the buildroot system to include OpenSSH into the build. The simplest way of doing this is to:

  1. type make menuconfig from the base buildroot directory; this should put you into the curses-based configuration utility.
  2. hit the down arrow button until "Package Selection for the target" is selected
  3. hit enter; this should bring you to the "Package Selection for the target" form
  4. hit the down arrow until you see the "dropbear" entry; there should be an asterisk (*) next to it
  5. keep hitting the down arrow until you see the "openssh" entry; if you're working with the "standard" configuration, it probably won't be selected.
  6. select the OpenSSH package by hitting the space bar; you should see an asterisk (*) appear next to it.
  7. hit the right arrow key to select the "<Exit>" action at the bottom of the form and hit ENTER; this should take you back to the "Buildroot Configuration" screen
  8. hit the right arrow key to again select the "<Exit>" action at the bottom of the form ant hit ENTER; you should see a dialog that says "Do you wish to save your new Buildroot configuration?"
  9. Ensure that "<Yes>" is highlighted and press ENTER; this should exist the buildroot menu configuration
  10. enter the make command

If this is the second time you've build the root filesystem, it will probably not take nearly as long as the first time.

Re-Flashing the GumStix

You're now at a point where you can re-flash the root filesystem and the kernel image (you don't need to reflash the boot loader.) I tried simply transferring the openssh related files (including the sftp-server) over to the gumstix, but it didn't seem to work. There may in fact be a way to do this, but I haven't found it yet.

However... if you want to make the PPP changes in the next section permanent, you may want to wait until the end of the "Configuring PPP" section before re-flashing your device.

Configuring PPP

If you have a WiFi or Ethernet connection to your GumStix device, you won't need to do this step.

Manual Connection

Fortunately, PPP is preconfigured for both the gumstix and Xubuntu 7.10. All you have to do is launch the pppd daemon on both sides of the connection. The simplest way of doing this is:

  1. replace the stock /etc/ppp/options file on your Xubuntu 7.10 development host with the one available at http://www.hbmobile.org/downloads/XU710_HBMOBILE003/options.mobo.
  2. Use minicom to connect to the gumstix. You should be able to login to the root account using the gumstix password.
  3. launch the pppd daemon on the gumstix with the command pppd.
  4. quit minicom without resetting the connection (with the Ctrl-A Q sequence.)
  5. launch the pppd daemon on the Xubuntu development host with the command /usr/sbin/pppd /dev/ttyS0 192.168.3.1:192.168.3.2

Automatic Connection

Another way to manage this is to have the ppp daemon automatically launched at boot time. Note that the daemon will displace the getty that allows you to login via the serial port. But this shouldn't be too big of a deal because a) if PPP is functioning correctly, you'll be able to use ssh to get a login prompt and b) you can always connect a USB keyboard to the gumstix's USB port and login that way.

The advantages of using PPP are that you can use the ssh, scp and sftp commands to log into or copy files to or from the gumstix. Additionally, the Eclipse plugin that allows you to do remote device management requires SFTP to be working.

Download the Script for the Gumstix

I put together a quick script that can be run on the gumstix device to start PPP:

#!/bin/sh
if [ ! -c /dev/ppp ] ; then
/bin/mknod /dev/ppp c 108 0
fi
/usr/sbin/pppd 115200 /dev/ttyS0
/bin/sleep 5

Or you can download this script from http://www.hbmobile.org/downloads/XU710_HBMOBILE003/do_ppp.gumstix .

For the purposes of this HOWTO, let's assume you put this script in the /usr/bin directory.

Modify the /etc/inittab file

In order to replace the getty that launches automatically on /dev/ttyS0, you'll have to comment out the following line in /etc/inittab (on the gumstix):

null::respawn:/sbin/getty -L ttyS0 1115200 vt100

and add the line:

null::respawn:/usr/bin/do_ppp.gumstix

Then execute the /sbin/reboot command to reboot the system.

Launch ppp on the development host

Now that the gumstix device is configured to run pppd automatically, you can run the following command on the Xubuntu development host:

sudo /usr/sbin/pppd 115200 /dev/ttyS0 192.168.3.1:192.168.3.2

This should setup a PPP link between the gumstix and the Xubuntu development host with the gumstix's IP address being 192.168.3.2.

Re-Flashing the GumStix

If you want to make the PPP related changes permanent, it's not terribly hard to do. After verifying that the process above works, you can simply modify the files in the buildroot that are placed in the filesystem on the GumStix. Here's a rundown of what you'll want to change:

  1. Add the do_ppp.gumstix script to the gumstix-buildroot/build_arm_nofpu/root/usr/bin directory.
  2. Modify the inittab file in the gumstix-buildroot/build_arm_nofpu/root/etc directory to include the do_ppp.gumstix line as described above.

Once you make these changes, change directories to the base gumstix-buildroot directory, remove the flash file image and the kernel image and rebuild. I used the following commands:

cd ~/Projects/gumstix-buildroot
rm rootfs.arm_nofpu.jffs2 uImage
make

You're now ready to re-flash the device using the technique described on the Loading the Software section of the Getting the ConsoleLCD-VX Working page. Note: If you have a recent boot loader image, you probably don't need to re-load the boot-loader; only the root file system and the kernel image.

Installing and Configuring Eclipse

Downloading Eclipse

While you're waiting for the new root image to transfer over, you can start installing the Eclipse environment. Installing Eclipse is pretty straight forward:

  1. Point your browser to eclipse.org.
  2. Hit the "Download" link in the option bar across the top of the main Eclipse page.
  3. Hit the "Linux" link to the right of the large "Eclipse IDE for C/C++ Developers" link.
  4. Follow the instructions.

You'll eventually wind up with a file named eclipse-cpp-europa-fall2-linux-gtk.tar.gz. Untar the contents of this file somewhere convenient. Personally, I put the contents in a directory called "~/Applications".

Downloading the Eclipse Plug-Ins

Eclipse Plugins are downloaded from within Eclipse;

install the subversion plugin

  1. Go to the "Help >> Software Updates >> Find and Install...",
  2. On the next screen, insure that the "Search for new features to install" item is checked and hit "Next >".
  3. Click on the "New Remote Site" button, insert the values "Tigris SubClipse" for *Name* and "http://subclipse.tigris.org/update_1.2.x" for *URL*
  4. Click on the okay button, this should add a "Tigris SubClipse" entry in the "Install" window.
  5. Make sure the "Tigris SubClipse" item is checked and click the "Finish" button. This should bring up the "Update" window.
  6. In the "update" window, click on the triangle next to the "Tigris SubClipse" entry to expand it's feature tree.
  7. Click on the checkbox next to the "Subclipse Plugin" item and hit the "Next >" button.
  8. This should bring you to the EULA. Listen for the sound of a lawyer laughing maniacally while you click the "I accept the terms of the license agreement" after failing to read the text of the agreement. Click the "Next >" button.
  9. You should see a "Features to Install" list with Subclipse listed as the only item in the list. Click "Finish"
  10. The update manager will draw a progress bar and you'll eventually see the "Verification" window. Click on the "Install" button.
  11. The update manager will come back and encourage you to restart eclipse. Who am I to argue?

install the Autotools plugin

(this is very similar to the previous step, only the name and location of the plugin is changed)

  1. Go to the "Help >> Software Updates >> Find and Install...",
  2. On the next screen, insure that the "Search for new features to install" item is checked and hit "Next >".
  3. Click on the "New Remote Site" button, insert the values "Sourceware" for *Name* and "http://sourceware.org/eclipse/update/" for *URL*
  4. Click on the okay button, this should add a "Tigris SubClipse" entry in the "Install" window.
  5. Make sure the "Sourceware" item is checked and click the "Finish" button. This should bring up the "Update" window.
  6. In the "update" window, click on the triangle next to the "Sourceware" entry to expand it's feature tree.
  7. Click on the checkbox next to the "autotools" item and hit the "Next >" button.
  8. This should bring you to the EULA. Listen for the sound of a lawyer laughing maniacally while you click the "I accept the terms of the license agreement" after failing to read the text of the agreement. Click the "Next >" button.
  9. You should see a "Features to Install" list with Autotools listed as the only item in the list. Click "Finish"
  10. The update manager will draw a progress bar and you'll eventually see the "Verification" window. Click on the "Install" button.
  11. The update manager will come back and encourage you to restart eclipse.

Install the Remote Tools plugin

  1. Go to the "Help >> Software Updates >> Find and Install...",
  2. On the next screen, insure that the "Search for new features to install" item is checked and hit "Next >".
  3. Select the "Europa Discovery Site" and hit the "Finish" button.
  4. Click on the triangle next to the "Europa Discovery Site" entry and scroll down 'til you see the "Remote Access and Device Development" entry.
  5. Click on the triangle next to the "Remote Access and Device Development" entry and select at least the "Remote System Explorer Core", "RSE FTP Service" and "RSE SSH Services". You may be prompted to add more items to satisfy prerequisites for these items.
  6. Click on the "Next>" button to continue.
  7. This should bring you to the EULA. Listen for the sound of a lawyer laughing maniacally while you click the "I accept the terms of the license agreement" after failing to read the text of the agreement. Click the "Next >" button.
  8. You should see a "Features to Install" list with Autotools listed as the only item in the list. Click "Finish"
  9. The update manager will draw a progress bar and you'll eventually see the "Verification" window. Click on the "Install" button.
  10. The update manager will come back and encourage you to restart eclipse.

Check out a Sample Project

Tell Eclipse about the hbmobile code repository

  1. Open the "Subversion Explorer" perspective by following the "Window >> Open Perspective >> Other..." to get to the "Open Perspective" window. Select the "SVN Repository Explorer" perspective from the list and click "Okay."
  2. You should see a rather large subwindow to the left titled "SVN Repository." Right-click on this window to bring up the context menu. Select "New >> Repository Location" from the menu.
  3. You should now see the "Add SVN Repository" window. If you're a project committer, the URL is https://hbmobile.googlecode.com/svn/trunk/voom/ . Otherwise, it's http://hbmobile.googlecode.com/svn/trunk/voom/ (the difference is if you login as a committer, your connection goes over SSL to protect your password.)
  4. Click the "Finish" button.
  5. If you logged in as a committer, Eclipse will ask you for your username and password. You should be able to get this information from the Google Code Site.

Add Voom to the Eclipse Project List

  1. Go back to the C/C++ Perspective by clicking on the "C/C++" button in the upper-right corner of Eclipse's workbench (if it's there); or follow the "Window >> Open Perspective >> Other..." to the "Open Perspective" window. Select the "C/C++" perspective from the list and click "Okay."
  2. Right Click in the "Project Explorer" sub-window to the left to bring up the context menu. Select "New >> Other..." to bring up the "New" window.
  3. Click on the triangle beside the "SVN" item to expand the SVN options tree. Select the "Checkout Projects from SVN" item and hit the "Next >" button.
  4. This should bring up the "Checkout from SVN" window. Select the "Use existing repository location" radio button and select the hbmobile.googlecode.com entry and hit the "Next >" button.
  5. This should bring up the "select folder" window. Select the http(s)://hbmobile.googlecode.com/svn/trunk/voom/ entry (which should be on the top) and hit the "Finish" button.
  6. Now the "New Project" window opens. Click on the triangle next to the "C" entry to expand the C project type tree. You should see an entry below it titled "GNU C Autotools Project." Select this item and hit the "Next >" button.
  7. The next screen gives a name to the local version of this project. I named mine "jowles". Hit the "Next >" button.
  8. The "Select a configuration" screen that comes up next should have the "BUILD (GNU)" item already selected. If not, select it and hit the "Next >" button.
  9. Hit the "Finish" button on the next screen. Don't select any foreign project references unless you know this is what you want to do.
  10. At this point, I got a dialog box asking me to confirm I knew what I was doing. I clicked "Continue"

Compile the Voom Project for x86

After the project is checked out, you can click on the "Console" tab near the bottom of the screen and see the progress of the configure script running.

If you look at the top of the "voom" section of the "Project Explorer" you'll see a "Binaries" item. If you expand it, you should see the voom libraries and the 'voomer' executable listed. In theory, you're supposed to be able to run the 'voomer' program, but for whatever reason, I get an error while loading libraries. I'm sure this can be cleared up by properly setting one of Eclipse's many configuration settings. Or.. you could simply launch a terminal window, cd into the directory with the voomer executable and run it. The output should look something like this:

config: little
test: little
char: 1
short: 2
int: 4
long: 4
ll: 8

Tell Eclipse about the ARM Tool Chain

  1. In the main "C/C++" perspective, highlight the root Voom project (the line that says voom [trunk/voom]
  2. Now open the Build Configurations window by selecting the "Project >> Build Configurations >> Manage" menu item. This should bring up the "Manage Configurations" window.
  3. Click on the "New" button. This should bring up the "MBS: create configuration" dialog. I used the name "BUILD (GNU Arm)" and left the description field blank. After ensuring that the "Copy Settings from:" radio button was checked for the "Existing Configuration BUILD (GNU)", hit the "OK" button. This will bring you back to the Manage Configurations window.
  4. Select the "BUILD (GNU Arm)" configuration and hit the "Set Active" button. Then hit "OK". (But wait! you're not finished)
  5. Open the Properties window by selecting the "Project >> Properties" menu item.
  6. Expand the C/C++ Build Tree by clicking on the triangle next to the "C/C++ Build" item in the properties list.
  7. Select the "Environment" item. You should see a list of environment variables. Add the following variables:

    CC : /home/mobo/Projects/gumstix-buildroot/build_arm_nofpu/staging_dir/bin/arm-linux-cc
    LD : /home/mobo/Projects/gumstix-buildroot/build_arm_nofpu/staging_dir/bin/arm-linux-ld
    RANLIB : /home/mobo/Projects/gumstix-buildroot/build_arm_nofpu/staging_dir/bin/arm-linux-ranlib

  8. Then hit the "Apply" button.
  9. Now hit the "settings" tab (it's right below the Environment tab.) This will bring up the settings pane. Hit the "Platform Specifiers" item in the "configure" list.
  10. add the string "i686-pc-linux-gnu" for the "Host Platform (--host)" entry and "arm-linux-gnu" for the "Build Platform (--build)" entry.
  11. Now hit the "OK" button down at the bottom of the dialog.