UC-7420/7410 User’s Manual

Getting Started

Test Program—Developing Hello.c

In this section, we use the standard “Hello” programming example to illustrate how to develop a program for UC-7420/7410. In general, program development involves the following seven steps.

Step 1:

Connect UC-7420/7410 to a Linux PC.

Step 2:

x

 

Install Tool Chain (GNU Cross Compiler & glibc).

 

Step 3:

 

Set the cross compiler and glibc environment variables.

 

Step 4:

 

Code and compile the program.

 

Step 5:

 

Download the program to UC-7420/7410 Via FTP or

 

NFS.

 

Step 6:

 

Debug the program

 

ÆIf bugs are found, return to Step 4.

ÆIf no bugs are found, continue with Step 7

Step 7:

Back up the user directory (distribute the program to additional UC-7420/7410 units if needed).

Cross

Compiler

Installing the Tool Chain (Linux)

The PC must have the Linux Operating System pre-installed before installing the UC-7420/7410 GNU Tool Chain. Redhat 7.3/8.0, Fedora core, and compatible versions are recommended. The Tool Chain requires about 100 MB of hard disk space on your PC. The UC-7420/7410 Tool Chain software is located on the UC-7420/7410 CD. To install the Tool Chain, insert the CD into your PC and then issue the following commands:

#mount /dev/cdrom /mnt/cdrom

#rpm –ivh /mnt/cdrom/mxscaleeb-3.3.2-1.386.rpm

The Tool Chain will be installed automatically on your Linux PC within a few minutes. Before compiling the program, be sure to set the following path first, since the ToolChain files, including the compiler, link, library, and include files are located in this directory.

PATH=/usr/local/mxscaleb/bin:$PATH

Setting the path allows you to run the compiler from any directory.

NOTE Refer to Appendix B for an introduction to the Windows Tool Chain. In this chapter, we use the Linux tool chain to illustrate the cross compiling process.

Checking the Flash Memory Space

If the flash memory is full, you will not be able to save data to the Flash ROM. Use the following command to calculate the amount of “Available” flash memory:

/>df –h

2-13

Page 33
Image 33
Moxa Technologies UC-7420/7410 user manual Test Program-Developing Hello.c, Installing the Tool Chain Linux, Step