Pdaxrom: On Board Development

From OESF

Jump to: navigation, search

The native sdk provides an easy way to start developing (c/c++) on board. It contains gcc, the header files and the commmon utilities (make..) used to compile applications.

Contents

Installing the sdk

Just install prce, gcc and gcc-headers from the feed

The following is old

Install pcre.

Because the version of grep from the sdk needs it, and it will comes first in your path, before the busybox version.

Download the zgcc-XXX.img

For rc12: zgcc-3.4.4.img

Mount the image file

One way to do this is to put the zgcc-XXX.img in /home/root and reboot.
You can also put the file somewhere, create a link to this file in /home/root and reboot. For instance if you put the file in /mnt/card you need to type:

ln -s /mnt/card/zggc-3.4.4.img /home/root

You can also mount the image by hand, but you have to make sure that the image is mounted at the right place. Otherwise gcc will not work correctly.
You can find the path by doing the following in a terminal

# grep zgcc /etc/rc.d/rc.sysinit
if [ -f /home/root/zgcc-3.4.4.img ]; then
    mount -o loop /home/root/zgcc-3.4.4.img /opt/native/arm/3.4.4-xscale-softvfp
#

In my case the right path is /opt/native/arm/3.4.4-xscale-softvfp. To mount the image you first need to create the directory if it does not exist and mount the image. For instance, assuming the image is in /mnt/card:

# mkdir -p /opt/native/arm/3.4.4-xscale-softvfp
# mount -o loop /mnt/card/zggc-3.4.4.img /opt/native/arm/3.4.4-xscale-softvfp

That's it


Compiling

If you want to see gcc in action try:

# echo -e '#include "stdio.h"\n int main(){ printf("Hello World\\n"); }' > hello.c
# gcc -o hello hello.c
# ./hello
Hello World
#

Common Problem

if you get the following error:

gcc: Internal error: Terminated (program cc1)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions

It's most probably because you have run out of memory. Compiling requires ram, especially c++ compilation. You can first try to compile without X running, if this is not enough then you have to create a swap.

Alternative: Using GCC from the Feeds

Since at least PdaXrom-1.1.0beta3, a complete and fully working native toolchain has been available in the main feed. To install everything you need, just type this command:

ipkg install gcc gcc-headers binutils make automake

...and you should have a working toolchain in short order. It's best to install this to your root directory - gcc can act funny if it's symlinked all over the place.

After installing, usage is just like on a full desktop; no image mounting required. Just ./configure && make && make install whatever you like!

Personal tools