Tux
Communication
Mailing lists
Documentation
User Manual
Target board info.
Target chip info.
Support
Linux support
Bugzilla
Downloads
STLinux
Updates
Search
Google


The web
stlinux.com
Getting Started
Hello world
ST Logo
Previous   Contents   Next

Executables for ST40 Linux are built on the host, using gcc as a cross compiler. They then need to be made visible to the ST40, and the easiest way to do this is to simply place them within the part of the host PC's file system which has been NFS mounted by the ST40. Finally they are run like any other program from the target shell.

In order to build programs to run on the ST40 Linux, you will need to have some of the development tools installed. For a simple C program, all that will be needed is:

stm-cross-sh4-gcc
stm-cross-sh4-cpp
stm-cross-sh4-binutils
stm-cross-sh4-glibc-dev

Refer back to the target installation section for a reminder how to do this.

Next create your hello world source file:

#include <stdio.h>

void main(void)
{
    printf("Hello from ST40 Linux\n");
}

and compile it using gcc:

host% sh4-linux-gcc -o hello hello.c

Next copy the executable file to the NFS mounted file system:

host% cp hello /opt/STM/ST40Linux-1.0/devkit/sh4/target/root/hello

And finally run it from the shell prompt on the target:

target% /root/hello
Hello from ST40 Linux
target%
Previous   Contents   Next
Valid HTML 4.01! Last updated: 2002/08/02 03:56:59
© Copyright STMicroelectronics Limited, 2005
Printer