Kenge : Eclipse-Howto

Eclipse on Iguana HowTo


Introduction

The Eclipse IDE equipped with the C/C++ plugin CDT, is an increasing popular development environment for embedded systems. This document shows step-by-step how to configure Eclipse and CDT in order to import the Iguana source tree as an Eclipse project, and then build and run one of the Iguana examples from within Eclipse.
Most of the issues that need to be addressed stem from the fact that Eclipse assume an hortodox Unix application development environment, while Iguana, being aimed at highly configurable microkernel-based systems, does some things differently.
In general, Eclipse assumes that CVS is the standard version control system; CDT bases on Make, and expects the user level include files to be in standard directories. Iguana instead uses GNU Arch as version control system, SCons as build system, and the layout of its sources and the position of the includes files are different from the typical Linux system.
One consequence is, for example, that GNU Arch naming conventions clash with Eclipse's workspace metadata files, and the tool baz refuses to operate in the directory of an Eclipse Project. Fortunately the tools on both sides are highly configurable, and all the defaults values can be easily adapted to suit Iguana and Kenge conventions.

Assumptions

In this HowTo I will assume that:
  • the proper development tools for Iguana/Kenge are installed as described here.
  • you installed Eclipse 3.1.0 and CDT 2.1.1 (but other versions should work, too).
  • ... and you already familiarized with all of them, separately.
Do not underestimate the last point. Eclipse, Iguana OS and the Kenge system (GNU Arch, SCons etc.) are not trivial: trying to learn any two of them at the same time can be a challenge.
I also assume that you are trying this on a GNU/Linux system, or something similar. Any BSD Unix should work, but we heard that Mac OS X may have issues with Python; hybrid environments like CygWin on Windows may have issues, too, especially with GNU Arch file naming conventions.

Step-by-Step How-To

  1. Move into the Eclipse workspace directory, typically with:
    	$ cd /home/<your_login>/workspace
    
  2. Check-out Kenge/Iguana from GNU Arch repository. Either get latest public release with:
    	$ baz get disy@cse.unsw.edu.au--2004/iguana-project--releases iguana-project
    
    or get the -HEAD revision with:
    	$ baz get disy@cse.unsw.edu.au--2004/kenge--mainline iguana-project
    
    As usual, the -HEAD revision will contain the latest features and bug fixes, but may even not compile.
  3. Populate the whole Iguana project tree:
    	$ cd iguana-project
    	$ ./tla_config.sh iguana update
    	[ lots of output ]
    
    The instructions above differ from the official ones you can find here for two details:
    • the tool used to extract the initial Iguana archive is 'baz', new and recommended, and not 'tla', old and now deprecated.
    • the baz/tla command to download the rest of Iguana is 'update', and not 'replay' (for the differences see the tools documentation).
  4. Create a new Eclipse Project.
    File=>New=>Project... C++ => Standard Make C++ Project
    Insert Iguana_Eclipse as the project name (or any other name that fancies you). Leave the default for Project contents.
    Do not click [Finish]. Click instead Next to define some settings.
    In Tab [Projects], do nothing.
    In Tab [Make Builder], uncheck [Use default],
    This temporary hack will hardcode a proper set of parameters for scons to build and possibly execute a standard Iguana demo:
    • as [Build command] insert scons.
    • as [Incremental Build] insert arch=arm config=iguana example=iguana
    • as [Rebuild (Full Build)] insert arch=arm config=iguana example=iguana simulate
    • as [Clean] insert -c
    Note that the Rebuild will also run the code on the simulator.
    In Tab [Error Parsers], do nothing.
    In Tab [Binary Parsers], do nothing.
    In Tab [Discovery Options], uncheck [Automatic discovery of path and symbols] to disable it.
    In Tab [C/C++ Indexer], uncheck [Enable C/C++ Indexing] to disable it.
    Click [Finish].
  5. Show C/C++ Projects with Window => ShowView => C/C++ Projects
  6. Select the project Iguana_Eclipse, press the right mouse button, and select Import...File System..
  7. Select the directory in the filesystem from which to import the full Iguana tree. If you followed this HowTo to the letter, it will be in the directory ~/workplace/iguana-project.
  8. Pick all files. GNU Arch subdirectoryies like {arch} and .arch-ids will be necessary for the revision control systems.
  9. Click [Finish]. The import of the Iguana tree into an Eclipse Project will now begin.
  10. Once the import is finished the directory iguana-project can be removed. Then move to the now populated Eclipse Project directory cd ../Iguana_Eclipse .
  11. While Eclipse now can use this tree, some Eclipse metadata are not accepted by baz:
    	$ cd ~/workspace/Iguana_Eclipse
    	$ baz lint
    	These files violate naming conventions:
    
    	.cdtproject
    	.project
    	
  12. Tweak Iguana_Eclipse/{arch}/=tagging-method to ignore the metadata files .project|.cdtproject used by Eclipse/CDT.
    Add to the REGEX definition of precious two entries at the end, so that 'baz/tla' are not confused by Eclipse project metadata files that violate their naming conventions.
    	# for Eclipse
    	#
    
    	precious ^(\+.*|\.gdbinit|\.#ckpts-lock|build|build\..*|=install\.*|CVS|CVS\.adm|RC
    	S|RCSLOG|SCCS|TAGS|\.svn|\.sconsign.*|\.conf|\.project|\.cdtproject)$ 
  13. Configure the Eclipse Project
    With the right button of the mouse select access the menu of the Iguana_Eclipse project from the View on the left.
    Select Properties
    Select Include paths and symbols
    Select Add Preprocessor Symbol and
    • add the symbol __ARM__ = TRUE . This is necessary across Pistachio source code found in pistachio directory and all Kenge libraries.
    • Click Add Include path from workspace and add the path to workspace/iguana/libs.
    Make sure that Indexer is disabled, otherwise it will try to index {arch} subdirectories forever.
    Close the Properties window
  14. Show the Target view with Window=>Show View=>Make Target
    Open the context menu with the right mouse button, and select Add Make Target.
    If desidered, give a shorter name for the target, and close the window.
  15. Build an image with Iguana and the example
    In the Make Targets view select the just created Make Target, and with the right mouse button select Build Make Target from the context menu. In the Console View should appear:
    	scons arch=arm config=iguana example=demotr simulate 
    	scons: Reading SConscript files ...
    	scons: done reading SConscript files.
    	scons: Building targets ...
    	skyeye_sim(["simulate"], ["build/bootimg.dite"])
    	Simulating build/bootimg.dite
    
    The output of the simulation will not appear on the Eclipse console. You should run the simulator from a standard shell, passing the boot image location ["build/bootimg.dite"] as parameter.

Screenshots

Here is a huge screenshot of Eclipse and the CDT plugin in action on the Iguana source code.
The Eclipse environment opened on some Iguana source files is in the top half. In the bottom half a console is logged into the local build server, Vampire. In Shell 2 the command baz changes just reported the changes made to the source opened in the Eclipse editor with respect the version in the repository. Shell 1 (not visible) runs the build image in the SkyEye ARM simulator on a local machine.