How to write a C program for Angstrom - Newbie

Hi everyone,

Firstly thanks for the time taken to read this.

I've been playing with my beagleboard for some time now, just working
it out etc. I'm a complete newbie to the Linux way of things so I've
been finding my feet.
Now, I wish to write C program, just a simple "hello world" for now. I
understand there are two ways to this, native and cross compiler.
Is there any guide to get me on my feet from scratch on how I can
write a program, compile it and make it run on the beagle board? What
tools to use etc.
I've only really written basic programs for Windows and I have gone
quite in depth for PIC C programming and some ARM processors.

Any advice on how to get started would be great.

Thank you again for your time,


You can create a cross compiler by following these directions: (on a ubuntu linux

if you arent using ubuntu (or something close enough) this can help:

Using the open embedded system under windows and cygwin may not work.

the cross compiler will end up in <tmpdir>/cross and will most likely
be called arm-angstrom-linux-gnueabi-gcc. Then use that like you would
any other command line compiler.

Hope this helps.

You can create a cross compiler by following these directions:BeagleBoardAndOpenEmbeddedGit - a ubuntu linux

if you arent using ubuntu (or something close enough) this can help:Openembedded-Hotels, Villen, Unterk├╝nfte in Leipzig

Hi , thank you very much. I am using ubuntu so this is the route I
will take :slight_smile:

Thank you again,



From what I've read, cross compiling is better at this time. recommends the
CodeSourcery C++ tool chain version 2007q3-51. You can get the "lite"
version for free from
The "lite" version has no GUI and no support. The CodeSourcery tool
chain is basically the standard gcc compiler, but has been compiled
for ARM with the myriad compiler compilation options set to reasonable
values. I've had plenty of success with 2007q3-51.

Most people do cross compiling on a Linux machine, which is generally
the easiest way to go. For various reasons -- including sheer
perversity -- I'm one of the few who compiles under Windows 2000 using
Cygwin. There are some notes about this at

One of the tricky aspects of cross compiling is the use of shared
object libraries (.so files), the Linux equivalent of DLLs. It's
critical that the application code that calls these modules uses the
same linking conventions as the .so files, and that the application
code is linked using a compatible (preferably identical) version of
the .so files.

I'm not aware of a nice step-by-step tutorial, unfortunately.


Even though this is for's still a pretty good guide on getting
started with open embedded by creating a hello world bitbake recipe and


I just got my card and managed to get it running using Koen's Angstrom
image and following the guide on google code:

Now I'd like to develop C++ code for a robotic application: the
BeagleBoard would be the main CPU to control the robot via some helper
cards that we are developing. Ideally I'd like to reuse code that I
have developed for some other projects for the PC104 platform.

I am very confused as how to proceed. I'd like to summarize things
that I understood from what I have been reading over the last 2 days.
Please comment my assumptions and tell me if I'm wrong.

There seems to be essentially 2 ways to develop on BeagleBoard. One is
to use OE as suggested above by Jesse, the second is to use
CodeSourcery C++ tool chain version 2007q3-51 as recommended on the
"official site"

1) OE
Apparently, with OE it is possible to build the whole operating system
file system and kernel, ready to be loaded on the SD card. Besides, OE
compiles the CodeSourcery compiler that can be used to cross compile
This seems pretty clear, however, I haven't found clear documentation
on how to choose what get included in the rootfs and in the kernel.
The gumstix hello world tutorial is nice, but it uses the gumstix-
basic-image recipe; is there such thing for BB?

2) CS
Since I already have Koen's angstrom demo image running, and since
Koen created an online tool for building custom images, I could also
use CS to cross-compile my code and upload it on the board. Is it
possible to directly work on the BeagleBoard, or is it compulsory to
cross-compile? Since I might have a long cycle of debugging, might be
faster to directly work on the board via SSH. I was working like this
with the PC104 platform... Then how can I install the compiler on the
board? Is there a make utility?

My code is using GSL and libpthread. Will it be a problem to compile
GSL. Would it be better to use OE and include GSL in the rootfs or can
I just compile the GSL library with the CS compiler. What about


National University of Singapore