5. Compiling and debugging applications

If everything is setup according to Chapter 4, Setting up a development system, you can start to develop programs.

1. Compiling the application sample

In the /examples directory on the Starterkit CD you will find the example1.c file, which contains C source code for a simple program for entering and printing text. For editing, first copy the file to the /develop directory on the development computer.

1.1. Stamp9G20/PortuxG20

Before running any compiler command, you have to source the environment setup in your shell:

. /usr/local/angstrom/arm/environment-setup

You can now compile the sample with the following command:

arm-angstrom-linux-gnueabi-gcc example1.c -o example1

1.2. Stamp9G45

Before running any compiler command, you have to source the environment setup in your shell:

. /usr/local/angstrom-eglibc-i686-armv5te/environment-setup-armv5te-angstrom-linux-gnueabi

or

. /usr/local/angstrom-eglibc-x86_64-armv5te/environment-setup-armv5te-angstrom-linux-gnueabi

on a 64-bit system.

You can now compile the sample with the following command:

arm-angstrom-linux-gnueabi-gcc $CFLAGS $LDFLAGS example1.c -o example1

The following works also, as the CC environment variable is set:

$CC $CFLAGS $LDFLAGS example1.c -o example1

The usage of the CFLAGS and LDFLAGS variables is essential, as without them, the compiler will not find all header files or libraries.