UC-7420/7410 User’s Manual

Programmer’s Guide

Obtaining help

Use the Linux man utility to obtain help on many of the utilities provided by the tool chain. For example to get help on the armv5b-linux-gcccompiler, issue the command:

#man armv5b-linux-gcc

Cross Compiling Applications and Libraries

To compile a simple C application, just use the cross compiler instead of the regular compiler:

#mxscaleb-gcc –o example –Wall –g –O2 example.c #mxscaleb-strip –s example

#mxscaleb-gcc -ggdb –o example-debug example.c

Tools Available in the Host Environment

Most of the cross compiler tools are the same as their native compiler counterparts, but with an additional prefix that specifies the target system. In the case of x86 environments, the prefix is i386-linux-and in the case of UC-7420/7410 Xscale boards, it is mxscaleb-.

For example the native C compiler is gcc and the cross C compiler for Xscale in UC-7420/7410 is

mxscaleb-gcc.

The following cross compiler tools are provided:

ar

Manage archives (static libraries)

as

Assembler

 

 

c++, g++

C++ compiler

 

 

cpp

C preprocessor

gcc

C compiler

gdb

Debugger

ld

Linker

 

 

nm

Lists symbols from object files

objcopy

Copies and translates object files

 

 

objdump

Displays information about object files

ranlib

Generates indexes to archives (static libraries)

readelf

Displays information about ELF files

 

 

size

Lists object file section sizes

 

 

strings

Prints strings of printable characters from files (usually object files)

strip

Removes symbols and sections from object files (usually debugging information)

Debugging with GDB

First compile the program must with option -ggdb. Use the following steps:

1.To debug a program called hello-debugon the target, use the command:

#gdbserver 192.168.4.142:2000 hello-debug

This is where 2000 is the network port number on which the server waits for a connection from the client. This can be any available port number on the target. Following this are the name of the program to be debugged (hello-debug), plus that program’s arguments. Output similar to the following will be sent to the console:

Process hello-debug created; pid=38

5-3

Page 79
Image 79
Moxa Technologies UC-7420/7410 user manual Debugging with GDB, Obtaining help, Cross Compiling Applications and Libraries