beautypg.com

Compiling hello.c, Compiling hello.c -14 – Moxa Technologies UC-7420/7410 User Manual

Page 34

background image

UC-7420/7410 User’s Manual

Getting Started

2-14

If there isn’t enough “Available” space for your application, you will need to delete some existing
files. To do this, connect your PC to the UC-7420/7410 with the console cable, and then use the
console utility to delete the files from UC-7420/7410’s flash memory.

NOTE

If the flash memory is full, you will need to free up some memory space before saving files to
the Flash ROM.

Compiling Hello.c

The UC-7420/7410 CD contains several example programs. Here we use Hello.c as an example to
show you how to compile and run your applications. Type the following commands from your PC
to copy the files used for this example from the CD to your computer’s hard drive:

# cd /tmp/
# mkdir example
# cp –r /mnt/cdrom/example/* /tmp/example

To compile the program, go to the Hello subdirectory and issue the following commands:

#cd example/hello
#make

You should receive the following response:

[root@localhost hello]# make
/usr/local/mxscaleb/bin/mxscaleb-gcc –o hello-release hello.c
/usr/local/mxscaleb/bin/mxscaleb-strip –s hello-release
/usr/local/mxscaleb/bin/mxscaleb-gcc –ggdb -o hello-debug hello.c
[root@localhost hello]# _

Next, execute the hello.exe to generate hello-release and hello-debug, which are described below:

hello-release—an IXP platform execution file (created specifically to run on UC-7420/7410)

hello-debug—an IXP platform GDB debug server execution file (see Chapter 5 for details about
the GDB debug tool).

NOTE

Be sure to type the #make command from within the /tmp/example/hello directory, since UC’s
tool chain puts a specially designed Makefile in that directory. This special Makefile uses the
mxscale-gcc compiler to compile the hello.c source code for the Xscale environment. If you type
the #make command from any other directory, Linux will use the x86 compiler (for example, cc
or gcc).
Refer to Chapter 5 to see a Make file example.