Building a hello world application

From Openmoko

(Difference between revisions)
Jump to: navigation, search
 
Line 12: Line 12:
 
   return 0;
 
   return 0;
 
  }
 
  }
 +
 +
=== Compiling it the ''wrong'' way ===
 +
Assuming your current working directory is '''/home/moko''',<br>
 +
and that you stored the code in '''/home/moko/hello.c'''
 +
 +
It should now be possible to compile the application using
 +
./build/tmp/cross/arm-linux/bin/gcc -o hello hello.c
 +
 +
==== Testing it ====
 +
Assuming you have followed [[OpenMoko_under_QEMU#Setting_up_USB_connection|Setting up USB connection]] and you have a working network concetion to either a qemu Neo or a real Neo.
 +
scp hello root@192.168.0.202:/tmp/
 +
ssh root@192.168.0.202 /tmp/hello
 +
This sequence of commands ought to give you a nice ''Hello World'', btw. the default root password is blank, just press return.

Revision as of 17:41, 16 July 2007

Contents

Preparation

This guide assumes that you have performed the steps in Building_OpenMoko_from_scratch

The commandline program

Store the following more or less standard hello world code in hello.c

#include <stdio.h>

int main()
{
  printf ("Hello World\n");
  return 0;
}

Compiling it the wrong way

Assuming your current working directory is /home/moko,
and that you stored the code in /home/moko/hello.c

It should now be possible to compile the application using

./build/tmp/cross/arm-linux/bin/gcc -o hello hello.c

Testing it

Assuming you have followed Setting up USB connection and you have a working network concetion to either a qemu Neo or a real Neo.

scp hello root@192.168.0.202:/tmp/
ssh root@192.168.0.202 /tmp/hello

This sequence of commands ought to give you a nice Hello World, btw. the default root password is blank, just press return.

Personal tools

Preparation

This guide assumes that you have performed the steps in Building_OpenMoko_from_scratch

The commandline program

Store the following more or less standard hello world code in hello.c

#include <stdio.h>

int main()
{
  printf ("Hello World\n");
  return 0;
}