User`s manual

Moxa C Programmable RTU Controllers Getting Started
2-15
#mount/dev/cdrom /mnt/cdrom
#sh /mnt/cdrom/Software/toolchain/arm-linux_3.3.2_V1.X_BuildXXXXXXXX.sh
The Tool Chain will be installed automatically on the host Linux PC within a few minutes. Before compiling the
program, be sure to set the following path first, since the Tool Chain files (including the compiler, link, and
library) are located in this directory.
PATH=/usr/local/arm-linux/bin:$PATH
Setting the path allows you to run the compiler from any directory.
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
If there isn’t enough “Available” space for users program, users must delete some existing files. To do this,
connect the host PC to the RTU controller with the console cable, and then use the console utility to remove the
none-using files from the flash memory. To check the amount of available space, look at the directories in the
read/write directory /dev/mtdblock3. Note that the directories /home and /etc are both mounted on the
directory /dev/mtdblock3.
NOTE
If the flash me
mory is full, users must release some memory space before saving files to the Flash ROM.
Compiling Hello.c
The Software and Document CD contains an example Hello.c program allowing users to run pilot tests to the
RTU controller. Type the following commands from the host PC to copy the files used for this example.
# cd /tmp/
# mkdir example
# cp r /mnt/cdrom/example/hello/* /tmp/example
To compile the program, go to the Hello subdirectory and issue the following commands:
# cd example/hello
# make
Users should see the following response:
[root@localhost hello]# make
/usr/local/arm-linux/bin/arm-linux-gcc –o hello-release hello.c
/usr/local/arm-linux/bin/arm-linux-strip –s hello-release
/usr/local/arm-linux/bin/arm-linux-gcc –ggdb -o hello-debug hello.c
[root@localhost hello]# _
The hello-release and hello-debug are described as below:
hello-release—An ARM platform executable file (created specifically to run on the Moxa RTU Controllers)