dimanche 12 juillet 2009

Programming the CarTrek600



It is possible to write programs for the Cartrek 600 on an Ubuntu platform using CeGCC.

First, get the software. The .rpm did not work so I used the .tgz from http://sourceforge.net/projects/cegcc/files/
(I don't know exactly which ones I really needed)

$ sudo bash
...
# cd /
# tar xvfz ~/mandriva-cegcc-cegcc-0.55.tar.gz
...
# tar xvfz ~/mandriva-cegcc-mingw32ce-0.55.tar.gz
...
# tar xvfz ~/mandriva-gdb-mingw32ce-arm-0.55.tar.gz
...
# exit
$ export PATH=$PATH:/opt/cegcc/bin:/opt/mingw32ce/bin
$ arm-cegcc-g++ -static -static-libgcc hello.c -o hello.exe

and put the hello.exe on the SD card under the name /MobileNavigator/MobileNavigator.exe (where the CarTrek 600 thinks the application is).

The first program is the trivial example :

#include <windows.h>
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
MessageBox(0, L"Hello!", L"CeGCC says...", MB_OK);
}


Now, the problem is to find documentation about Windows CE and its API. (Maybe read the gosmore sources, it is not that long).

A little bit further...

#include
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
wchar_t argv0[80];

GetModuleFileName (NULL, argv0, sizeof (argv0) / sizeof (argv0[0]));
MessageBox(0, argv0, L"CeGCC says...", MB_OK);
}

gives the full name of the program :
' \SDMMC\MobileNavigator\MobileNavigator.exe'

----
Gosmore

# apt-get install libxml2-dev

$ svn co http://svn.openstreetmap.org/applications/rendering/gosmore/
$ cd gosmore
$ make
$ make gosm_arm.exe

(I had to correct 'ARCH=arm-mingw32ce' in the Makefile (it was 'ARCH=arm-wince-mingw32ce')
And I have a gosm_arm.exe compiled on my computer (Hardy Heron - Ubuntu 8.04) working on the CarTrek 600. (see another entry in this blog on how to install the software)

The self-compiled version doesn't seem to show the map (abut the binary does).