User:Paulw:Development Environment

From OpenTom

Jump to: navigation, search

Contents

My Development Environment

The following are some suggestions for setting up a development environment for the TomTom based on my own setup, under Ubuntu Linux. The instructions and notes provided have not been tried on any other system, so YMMV.

Files and Directories

Basically, the idea is to establish and populate a single, "root" directory with config files, libraries and applications, in a structure somewhat similar to a standard linux root. This folder can then be copied directly onto media that the TomTom can access and execute from.

Before creating a "root" directory, first, choose a location in which to establish a working directory. This directory will contain everything, including the cross-compilation toolchain. This makes it easier to backup or archive your work, and saves you from potentially contaminating your system with cross-compiled binaries. It's also much neater too. A user home directory is a logical starting point. Create and populate thus:

cd ~/
mkdir work
cd work
mkdir toolchain
cd toolchain
tar -xf toolchain_redhat_gcc-3.3.4_glibc-2.3.2_20060131a.tar.gz
cd ..
mkdir root
cd root
mkdir etc
mkdir usr
cd usr
mkdir include
mkdir lib
cd ../../
tar -xf ttsysbuild.tar.gz
cd ttsysbuild
tar -xf golinux-tt1340.tar.gz
ln -s golinux-tt1340 ttlinux
cd ..
mkdir src

The ttsysbuild package from TomTom was included in this working directory setup to enable testing of the development environment using TomTom's "Hello World" example application.

Since I'm using Ubuntu as my development platform, my TomTom is automatically mounted as "/media/TomTom\ Disk". My shell scripting abilities are not good enough to overcome the havoc of filenames with spaces, so I work around this thus:

cd ~/work
ln -s /media/TomTom\ Disk device

The result of all this is a directory structure looking something like this:

~/work
~/work/device -> /media/TomTom\ Disk
~/work/root
~/work/root/etc
~/work/root/usr
~/work/root/usr/include
~/work/root/usr/lib
~/work/src
~/work/toolchain
~/work/toolchain/gcc-3.3.4_glibc-2.3.2
~/work/ttsysbuild
~/work/ttsysbuild/example
~/work/ttsysbuild/golinux-tt1340
~/work/ttsysbuild/makeimage
~/work/ttsysbuild/ramdisk
~/work/ttsysbuild/ttlinux -> golinux-tt1340

Environment Variables

With the the filesystem created, finish by adding some environmental variables to simplify later work, such as configuration scripts. Run the following commands from the "~/work" directory every time you open a new shell in which you wish to use the development environment:

export TT_WORK=$PWD
export TT_DEVICE=$TT_WORK/device
export TT_TARGETDIR=$TT_WORK/device/root
export TT_TOOLCHAIN=$TT_WORK/toolchain/gcc-3.3.4_glibc-2.3.2
export TT_ROOT=$TT_WORK/root
export TT_SOURCE=$TT_WORK/src
export TT_CONFIGDIR=$TT_ROOT/etc
export TT_INSTALLDIR=$TT_ROOT/usr
export TT_INCLUDEDIR=$TT_INSTALLDIR/include
export TT_LIBDIR=$TT_INSTALLDIR/lib
export TT_LINUXSOURCEDIR=$TT_WORK/ttsysbuild/ttlinux
export TT_LINUXINCLUDEDIR=$TT_LINUXSOURCEDIR/include
export PATH=$TT_TOOLCHAIN/bin:$PATH

The TT_INSTALL and TT_CONFIGDIR variables can be used during the "configure" processs to install files into TT_ROOT. TT_ROOT can then be copied directly onto the TomTom via USB. As the disk is fat formatted, SYMBOLIC LINKS ARE NOT ALLOWED! Remove the old root directory off the TomTom and copy the local root directory like this:

rm -R $TT_TARGETDIR
cp -RL $TT_ROOT $TT_DEVICE

The development environment is now ready for use. Don't forget to export the TT_* variables again for each new shell in which you wish to use the environment.

Testing

Test out the build environment by running the TomTom ttsystem build script. This should compile the example "Hello World" application and the golinux kernel, and build them both into a ttsystem file, without any errors.

cd $TT_WORK/ttsysbuild
./build.sh

This should output something like:

**** Building kernel...
**** Processing kernel #1340...
**** Building...
...
(lines cut for brevity)
...
**** Successfully built kernel #1340:
-rwxr-xr-x 1 paulw paulw 876636 2007-01-06 16:40 arch/arm/boot/zImage
**** Building example app...
**** Copying example app...
**** Building ramdisk (as root)...
Password:
**** Checking for root
**** Finding free loop device
**** Creating ramdisk image
**** Attaching loopback device
**** Creating filesystem
**** Mounting filesystem
**** Unpacking source file
**** Adding timestamp
**** Adding debug flag
**** Copying modules
**** Copying executables
**** Free ramdisk space left:
Filesystem           1K-blocks Used Available Use% Mounted on
/dev/loop0                4059      1923      2136  48% /home/paulw/work/ttsysbuild/ramdisk/src
Filesystem            Inodes IUsed IFree IUse% Mounted on
/dev/loop0               256     223      33   88% /home/paulw/work/ttsysbuild/ramdisk/src
**** Unmounting filesystem
**** Detaching loopback
**** Compressing ramdisk image
**** Cleaning up
**** Done
**** Building makeimage...
**** Building ttsystem file...
MakeImage $Revision: 1.3 $, (C) 2004 TomTom B.V. J.Taverne
**** Successfully built ttsystem file:
-rw-r--r-- 1 paulw paulw 1671692 2007-01-07 23:41 ttsystem
NOTE: It is not recommended to use the resulting ttsystem file on your TomTom. The "barc_hw.a" file created in the example directory can be used, however it is recommended that the screen dimensions are corrected to match your particular TomTom. This file also needed further tweaking to "un-rotate" the touchscreen on my 910.

While building the ttsystem is not essential, it is recommended that the golinux kernel source tree is initialised by running the TomTom build script once. This is particularly important when compiling code which includes headers from the kernel source.

cd $TT_WORK/ttsysbuild/ttlinux
./buildkern.sh

Resources

Personal tools