XCode Setup and Usage

Installation

XCode is Apple's free IDE for development on Mac OS X computers. If your computer did not come with the developer tools pre-installed, you can download them from Apple.

You will need to install the developer tools in order to compile code, but afterward you do not have to use XCode itself for editing or compiling your code. The build process is also supported through Makefiles, and as such is completely available through a command line interface via either make or xcodebuild. Follow the linux-style build directions on the downloads and execution pages if you want to develop without using the XCode IDE.

Additionally, you will need to install two libraries: libpng and libjpeg. The easiest way to do this is to use our combo installer (below), but you can also build them yourself from source. (although building libjpeg on OS X is a little tricky due to antiquated build files)


combo installer

libjpeg installer

libpng installer
All packages contain universal binaries for both
i386 (aka Intel) and PowerPC architectures.

Finally, you will need Java 5.0. Currently (August 2007) the latest 5.0-branch is "J2SE 5.0 Release 5" available from Apple's Java Download page.

Setup

In order to build the provided XCode 2.4 project (project/Make.xcodeproj) you need to set a few environment variables within the "Source Trees" pane of the XCode preferences. To get to this preference panel, select "Preferences..." from the Xcode application menu (next to the Apple icon menu when Xcode is in the foreground), then scroll all the way to the right in the section on top, and click on the "Source Trees" tab. Add the two entries shown below:
xcode_setup_thumb.png
The "Source Trees" pane of XCode's preferences.
You will need to add the two values shown,
substituting the location of your Tekkotsu installation.

Building

There are four targets within XCode: "sim (ERS-7)", "sim (ERS-7) Light", "sim (ERS-210)", and "Aperios Build". The first 3 are different simulator configurations. "sim (ERS-7)" and "sim (ERS-210" differ only in the model specified. (See the -D flag under "Other C++ Flags" in the target build settings.) "sim (ERS-7) Light" shows how to link against an externally produced libtekkotu.a library file. This may be useful if you are often switching between command line and XCode development, or if you wish to set up the framework directory for read-only access, such as in a shared-access laboratory environment.

You can run the simulator either by running it from within XCode, which brings up an XCode terminal, or by switching to Terminal.app and running it from there. It is recommended to use the main Terminal.app because it provides better terminal emulation. If you run from Terminal.app, make sure to start the simulator from the root of the project, e.g:

project$ ./sim-ERS7

This is so the simulator can find the 'ms' directory in the current working directory. (You could also create a symlink to 'ms' from within an external directory if you really want to run the simulator from somewhere else.)

The final target, "Aperios Build" will run the normal 'make update' in order to build for the Aibo. It will wait for the memory stick to be mounted and then copy files over, just like a normal 'make update'. You may need to edit the "Aperios Build" target settings to specify the name of the memory stick so that it can be detected properly. (By default it looks for a Volume named "Untitled".)

XCode's build window will usually hilight the right code for errors in your project's files, but if errors occur within a framework file, XCode sometimes has trouble automatically showing the location of the error (partly due to the way we filter out extraneous warnings from system headers).

If this happens, you'll need to open the console pane to see the original error message:

Show "build transcript"
->
"build transcript" shown
Normally XCode can correctly locate files corresponding to errors in your project, but when building for Aperios, it can have trouble locating errors found in framework files. (this is in part due to the filtered output of our build system) You may need to show the build transcript to locate the source of such an error.

Template Files

You may already know that there is a project/template directory which holds template files for a variety of commonly inherited classes. We provide a script which will copy and modify these template files for use within XCode. To run the script, navigate to the Tekkotsu/tools directory in a console, and run ./installXCodeTemplates You will receive help text with other available options and an opportunity to cancel before anything is done.

Once you have installed the templates, you will see a "Tekkotsu" category in the "New file" selection box:

Tekkotsu template files available within XCode, provides automatic substitution of key values, such as class name and author.

Simulation - Debugging

You can use the XCode GUI debugger, but since XCode does not provide a way to attach to an arbitrary process you can only debug problems with the Main process. To debug the Motion, Sound, or Simulator processes, you would need to use the console commands as shown on the main simulator page.

To demonstrate this, we will go through the same example of debugging the StareAtBallBehavior which we use on the main simulator page. In this example, we will find information about the first VisionObjectEvent which is sent to the behavior.

To begin, find the StareAtBallBehavior.cc within Tekkotsu Source/Behaviors/Demos:

selecting the StareAtBallBehavior.cc source file

Set a breakpoint at the processEvent function by clicking on the line number before the function:

setting the breakpoint

Choose "Build and Debug" from the "Build" menu to launch the debugger:

launching debugger

To enter commands on the simulator prompt, open the "Standard I/O Log" from the "Debug" menu. You may need to load some images for the simulator to process (set Vision.Source=...) or to change the simulator's Speed setting (set Speed=1 or run) to allow the simulation to proceed. The main simulation page has more details on these and other commands.

showing the console

Once the simulator has started processing images, as soon as one with a pink ball is loaded, the debugger should cut in and you will be able to view information about variables in memory.

breakpoint triggered

Downloads

Last modified: 2007-08-17