Table of Contents

Advertisement

Quick Links

UC-7400-LX Plus User's Manual
Sixth Edition, December 2010
www.moxa.com/product
 2010 Moxa Inc. All rights reserved.
Reproduction without permission is prohibited.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the UC-7400-LX Plus and is the answer not in the manual?

Questions and answers

Summary of Contents for Moxa Technologies UC-7400-LX Plus

  • Page 1 UC-7400-LX Plus User’s Manual Sixth Edition, December 2010 www.moxa.com/product  2010 Moxa Inc. All rights reserved. Reproduction without permission is prohibited.
  • Page 2 UC-7400-LX Plus User’s Manual The software described in this manual is furnished under a license agreement and may be used only in accordance with the terms of that agreement. Copyright Notice Copyright  2010 Moxa Inc. All rights reserved. Reproduction without permission is prohibited.
  • Page 3: Table Of Contents

    Software Package ......................1-4 Chapter 2 Getting Started .....................2-1 Powering on the UC-7400-LX Plus ..................2-2 Connecting the UC-7400-LX Plus to a PC ................2-2 Serial Console....................... 2-2 Telnet Console......................2-3 SSH Console......................... 2-4 Configuring the Ethernet Interface ..................2-5 Modifying Network Settings with the Serial Console ..........
  • Page 4 Enabling NAT at Bootup ....................4-9 Dial-up Service—PPP......................4-10 PPPoE ............................ 4-13 NFS (Network File System)....................4-15 Setting up the UC-7400-LX Plus as an NFS Server ........... 4-15 Setting up the UC-7400-LX Plus as an NFS Client............ 4-17 Mail............................4-17 SNMP ............................ 4-18 OpenVPN..........................
  • Page 5: Chapter 1 Introduction

    Introduction Chapter 1 The Moxa UC-7400-LX Plus series of RISC-based commnication platforms are ideal for your embedded applications. All models come with 8 RS-232/422/485 serial ports, dual 10/100 Mbps Ethernet ports, a PCMCIA interface for wireless LAN communication, and CompactFlash and USB ports for mass storage for disk expansion.
  • Page 6: Overview

    If your application requires placing the UC-7400-LX Plus in a location that is not near an Ethernet LAN connection, you can use the UC-7400-LX Plus’s PCMCIA port to attach a wireless LAN card.
  • Page 7: Journaling Flash File System (Jffs2)

    The UC-7400-LX Plus’s built-in Flash ROM is partitioned into Boot Loader, Linux Kernel, Root File System, and User Root File System partitions. In order to prevent user applications from crashing the Root File System, the UC-7400-LX Plus uses a specially designed Root File System with protected configuration for emergency use. This Root File System comes with serial and Ethernet communication capability for users to load the Factory Default Image file.
  • Page 8: Software Package

    UC-7400-LX Plus User’s Manual Introduction Software Package Redboot (v1.92) Boot Loader Kernel Monta Vista embedded Linux 2.6.10 Protocol Stacks ARP, PPP, CHAP, PAP, IPv4, ICMP, TCP, UDP, DHCP, FTP, SNMP V1, HTTP, NTP, NFS, SMTP, SSH 1.0/2.0, SSL, Telnet, PPPoE, OpenVPN...
  • Page 9: Chapter 2 Getting Started

    Getting Started Chapter 2 In this chapter, we explain how to connect the UC-7400-LX Plus, turn on the power, and then get started using the programming and other functions. The following topics are covered in this chapter:  Powering on the UC-7400-LX Plus ...
  • Page 10: Powering On The Uc-7400-Lx Plus

    The green Ready LED will not turn on until the operating system is ready. Connecting the UC-7400-LX Plus to a PC There are two ways to connect the UC-7400-LX Plus to a PC: (1) Through the serial console port, and (2) via Telnet over the network. Serial Console The serial console port gives users a convenient way of connecting to the UC-7400-LX Plus console utility.
  • Page 11: Telnet Console

    When connecting to the UC-7400-LX Plus over a LAN, you must configure your PC’s Ethernet IP address to be on the same subnet as the UC-7400-LX Plus that you wish to contact. If you do not get connected on the first try, re-check the serial and IP settings, and then unplug and re-plug...
  • Page 12: Ssh Console

    Windows Users Click on the link http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html to download PuTTY (free software) to set up an SSH console for the UC-7400-LX Plus in a Windows environment. The following figure shows a simple example of the configuration that is required. Linux Users From a Linux machine, use the “ssh”...
  • Page 13: Configuring The Ethernet Interface

    UC-7400-LX Plus User’s Manual Getting Started Configuring the Ethernet Interface The network settings of the UC-7400-LX Plus can be modified from the serial Console, or online over the network. Modifying Network Settings with the Serial Console In this section, we use the serial console to configure the network settings of the target computer.
  • Page 14: Modifying Network Settings Over The Network

    After changing the IP settings, use the networking restart command to activate the new IP address. However, the LCM display will still show the old IP address. To update the LCM display, you will need to reboot the UC-7400-LX Plus. Modifying Network Settings over the Network IP settings can be activated over the network, but the new settings will not be saved to the flash ROM without modifying the file /etc/network/interfaces.
  • Page 15 UC-7400-LX Plus User’s Manual Getting Started After module is loaded, use the lsmod to check that the module shows up in the module list. root@Moxa:~# modprobe ipv6 root@Moxa:~# root@Moxa:~# lsmod ipv6 223420 6 - Live 0xbf0f7000 pcmcia 12068 4 - Live 0xbf0f3000...
  • Page 16: Configuring The Wlan Through The Pcmcia Interface

    UC-7400-LX Plus User’s Manual Getting Started Detecting an IPv6-based IP Address Use the ping6 command to detect a specific IPv6 address on the network. Type ping6 -h to see how to use this command: root@Moxa:~# ping6 –h BusyBox v1.14.1 (2010-10-29 18:42:35 CST) multi-call binary Usage: ping6 [OPTION]...
  • Page 17 UC-7400-LX Plus User’s Manual Getting Started To configure the WLAN for IEEE802.11g: 1. First unplug the CardBus wireless LAN card. 2. Use the command #vi /etc/networking/interfaces to open the “interfaces” configuration file with vi editor, and then edit the 802.11g network settings (the wireless interface name should be “eth2”...
  • Page 18 UC-7400-LX Plus User’s Manual Getting Started — CountryRegion sets the channels for your particular country / region Setting Explanation use channels 1 to 11 use channels 1 to 11 use channels 1 to 13 use channels 10, 11 use channels 10 to 13...
  • Page 19 UC-7400-LX Plus User’s Manual Getting Started — DefaultKeyID sets default key ID Setting 1 to 4 — Key1Str, Key2Str, Key3Str, Key4Str sets strings Key1 to Key4 Setting The keys can be input as 5 ascii characters, 10 hex numbers, 13 ascii characters, or 26 hex numbers —...
  • Page 20 UC-7400-LX Plus User’s Manual Getting Started — TxRate sets the TxRate Setting Explanation Auto 1 Mbps 2 Mbps 5.5 Mbps 11 Mbps 6 Mbps 9 Mbps 12 Mbps 18 Mbps 24 Mbps 36 Mbps 48 Mbps 54 Mbps — RTSThreshold...
  • Page 21 UC-7400-LX Plus User’s Manual Getting Started Example 2: Configure wireless LAN to link to AP that is SHARED/WEP (Authentication/Encryption) [Default] CountryRegion=0 WirelessMode=0 SSID=DN_3Com NetworkType=Infra Channel=0 AuthMode=SHARED EncrypType=WEP DefaultKeyID=1 Key1Str=0123456789 Key2Str= Key3Str= Key4Str= WPAPSK=1111111111 TXBurst=0 TurboRate=0 BGProtection=0 ShortSlot=0 TxRate=0 RTSThreshold=2312 FragThreshold=2312...
  • Page 22: Connecting To 3G Networks Through The Pcmcia Interface

    Note: This example is the message detected for the Vodafone Mobile Connect HSDPA/UMTS/EDGE datacard. For different cards, these messages will be slightly different. If you do not see these messages, it means that the UC-7400-LX Plus is unable to detect your 3G datacard.
  • Page 23 UC-7400-LX Plus User’s Manual Getting Started NOTE When the datacard is plugged into the card bus slot, your SIM card will ask for the PIN code. You can use minicom or Hyper terminal on a host computer to disable it. Enter the AT+CLCK command.
  • Page 24: Test Program-Developing Hello.c

    100 MB of hard disk space on your PC. The UC-7400-LX-Plus Tool Chain software is located on the UC-7400-LX Plus CD. To install the Tool Chain, insert the CD into your PC and then issue the following commands: #mount /dev/cdrom /mnt/cdrom #/mnt/cdrom/tool-chain/Linux/xscale_be-x.x.sh...
  • Page 25: Checking The Flash Memory Space

    If there isn’t enough “Available” space for your application, you will need to delete some existing files. To do this, use the console cable to connect your PC to the UC-7400-LX Plus, and then use the console utility to delete the files from the UC-7400-LX Plus flash memory.
  • Page 26: Uploading And Running The "Hello" Program

    PC 1 and the UC-7400-LX Plus through an RS-232 connection. At the remote site, data can be transferred between the UC-7400-LX Plus’s Ethernet port and PC 2 over an Ethernet connection.
  • Page 27: Compiling Tcps2.C

    UC-7400-LX Plus User’s Manual Getting Started Compiling tcps2.c The source code for the tcps2 example is located on the CD-ROM at CD-ROM://example/TCPServer2/tcps2.c. Use the following commands to copy the file to a specific directory on your PC. We use the direrctory /home/1st_application/. Note that you need to copy 3 files—Makefile, tcps2.c, tcpsp.c—from the CD-ROM to the target directory.
  • Page 28: Uploading And Running The "Tcps2-Release" Program

    UC-7400-LX Plus User’s Manual Getting Started Uploading and Running the “tcps2-release” Program Use the following commands to use FTP to upload tcps2-release to the UC-7400-LX Plus. 1. From the PC, type: #ftp 192.168.3.127 2. Next, use the bin command to set the transfer mode to Binary, and the put command to initiate the file transfer: ftp>...
  • Page 29 UC-7400-LX Plus User’s Manual Getting Started 4. The program should start running in the background. Use either the #jobs #ps –ef command to check if the tcps2 program is actually running in the background. #jobs // use this command to check if the program is running 192.168.3.127 - PuTTY...
  • Page 30: Testing Procedure Summary

    3. Check that the process is running (#jobs or #ps -ef) 4. Use a serial cable to connect PC1 to the UC-7400-LX Plus serial port 1. 5. Use an Ethernet cable to connect PC2 to the UC-7400-LX Plus. 6. On PC1: If running Windows, use HyperTerminal (11520, n, 8, 1) to open COMn.
  • Page 31: Managing Embedded Linux

    This chapter includes information about version control, deployment, updates, and peripherals. The information in this chapter will be particularly useful when you need to run the same application on several UC-7400-LX Plus units. The following topics are covered in this chapter: ...
  • Page 32: System Version Information

    YY MM DD HH indicating the build date and time. To upgrade the firmware, download the firmware file to a PC, and then transfer the file to the UC-7400-LX Plus unit through a serial Console or Telnet Console connection.
  • Page 33 UC-7400-LX Plus User’s Manual Managing Embedded Linux Since different Flash disks have different sizes, it is a good idea to check the size of your Flash disk before upgrading the firmware, or before using the disk to store your application and data files.
  • Page 34 1. Type the following commands to enable the RAM disk: #upramdisk #cd /mnt/ramdisk 2. Type the following commands to use the UC-7400-LX Plus’s built-in FTP client to transfer the firmware file (FWR_UC7400P_Va b_Build_YY MM DD HH) from the PC to the UC-7400-LX Plus: /mnt/ramdisk>...
  • Page 35: Loading Factory Defaults

    UC-7400-LX Plus User’s Manual Managing Embedded Linux 3. Next, use the command to upgrade the kernel and root file system: upfirm #upfirm FWR_UC7400P_V1.3_Build_07052922 192.168.3.127 - PuTTY root@Moxa:/mnt/ramdisk# upfirm FWR_UC7400P_V1.3_Build_07052922 UC-7400 Upgrade firmware utility version 1.2. To check source firmware file context.
  • Page 36 UC-7400-LX Plus User’s Manual Managing Embedded Linux Type the command “ps” to list all processes currently running. 192.168.3.127 - PuTTY root@Moxa:~# cd /etc root@Moxa:/etc# ps PID Uid VmSize Stat Command 1 root 532 S init [3] 2 root SWN [ksoftirqd/0] 3 root SW<...
  • Page 37 UC-7400-LX Plus User’s Manual Managing Embedded Linux 192.168.3.127 – PuTTY root@Moxa:/ect/rc.d/rc3.d# ls S19nfs-common S25nfs-user-server S99showreadyled S20snmpd S55ssh S24pcmcia S99rmnologin root@Moxa:/etc/rc.d/rc3.d# #cd /etc/rc.d/init.d Edit a shell script to execute /root/tcps2-release and save to tcps2 as an example. #cd /etc/rc.d/rc3.d #ln –s /etc/rc.d/init.d/tcps2 S60tcps2 SxxRUNFILE stands for: S: start the run file when linux boots up.
  • Page 38: Starting A Program Automatically At Run-Level

    UC-7400-LX Plus User’s Manual Managing Embedded Linux Starting a Program Automatically at Run-Level To configure a program to run automatically at run-level, add the following lines to the file rc.local: #cd /etc/rc.d #vi rc.local 192.168.3.127 – PuTTY root@Moxa:~# cd /etc/rc.d root@Moxa:/etc/rc.d# vi rc.local...
  • Page 39: Adjusting The System Time

    Adjusting the System Time Setting the Time Manually The UC-7400-LX Plus has two time settings. One is the system time, and the other is the RTC (Real-time Clock) time kept by the UC-7400-LX Plus hardware. Use the #date command to query the current system time or set a new system time.
  • Page 40: Ntp Client

    UC-7400-LX Plus User’s Manual Managing Embedded Linux NTP Client The UC-7400-LX Plus has a built-in NTP (Network Time Protocol) client that is used to initialize a time request to a remote NTP server. Use #ntpdate <this client utility> to update the system time.
  • Page 41: Cron-Daemon For Executing Scheduled Commands

    UC-7400-LX Plus User’s Manual Managing Embedded Linux Cron—Daemon for Executing Scheduled Commands Cron is a scheduling service in Linux. Cron wakes up every minute, and checks the configuration file named crontab to see if any scheduled command should be run in the current minute.
  • Page 42: Connecting Peripherals

    USB device to connect to the UC-7420-LX Plus. CF Mass Storage Some models of the UC-7400-LX Plus support PNP and hot pluggability for connecting a CF mass storage device.The UC-7400-LX Plus has a built-in auto mount utility that eases the mount procedure.
  • Page 43 /mnt/hda, the auto un-mount process will fail. If that happens, type #umount /mnt/hda to un-mount the CF device manually. The UC-7400-LX Plus only supports certain types of CF mass storage device. The following devices are supported:  Transcend CompactFlash 45x 2GB ...
  • Page 44: Chapter 4 Managing Communications

    Managing Communications Chapter 4 In this chapter, we explain how to configure the UC-7400-LX Plus’s various communication functions. The following topics are covered in this chapter:  Telnet / FTP  DNS  Web Service—Apache  IPTABLES  NAT  NAT Example ...
  • Page 45: Telnet / Ftp

    Disable the daemon by typing ‘#’ in front of the first character of the row to comment out the line. The UC-7400-LX Plus support DNS client (but not DNS server). To set up DNS client, you need to edit three configuration files: /etc/hosts, /etc/resolv.conf, and /etc/nsswitch.conf.
  • Page 46: Web Service-Apache

    UC-7400-LX Plus User’s Manual Managing Communications Web Service—Apache The Apache web server’s main configuration file is /etc/apache/conf/httpd.conf, with the default homepage located at /home/httpd/www/html/index.html. Save your own homepage to the following directory: /home/httpd/www/html/ Save your CGI page to the following directory:...
  • Page 47: Iptables

    A rule (such as a jump to a user-defined chain in the same table) is called a “target.” The UC-7400-LX Plus supports 3 types of IPTABLES table: Filter tables, NAT tables, and Mangle tables: A. Filter Table—includes three chains:...
  • Page 48 UC-7400-LX Plus User’s Manual Managing Communications B. NAT Table—includes three chains: PREROUTING chain—transfers the destination IP address (DNAT) POSTROUTING chain—works after the routing process and before the Ethernet device process to transfer the source IP address (SNAT) OUTPUT chain—produces local packets sub-tables Source NAT (SNAT)—changes the first source packet IP address...
  • Page 49 #lsmod #modprobe ip_tables #modprobe iptable_filter Use lsmod to check if the ip_tables module has already been loaded in the UC-7400-LX Plus. Use modprobe to insert and enable the module. Use the following command to load the modules (iptable_filter, iptable_mangle, iptable_nat):...
  • Page 50 INPUT: For packets coming into the UC-7400-LX Plus. OUTPUT: For locally-generated packets. FORWARD: For packets routed out through the UC-7400-LX Plus. PREROUTING: To alter packets as soon as they come in. POSTROUTING: To alter packets as they are about to be sent out.
  • Page 51: Nat

    IP addresses used on another network. One network is designated the inside network and the other is the outside network. Typically, the UC-7400-LX Plus connects several devices on a network and maps local inside network addresses to one or more global outside IP addresses, and un-maps the global IP addresses on incoming packets back into local IP addresses.
  • Page 52: Nat Example

    Enabling NAT at Bootup In most real world situations, you will want to use a simple shell script to enable NAT when the UC-7400-LX Plus boots up. The following script is an example. #!/bin/bash # If you put this shell script in the /home/nat.sh # Remember to chmod 744 /home/nat.sh...
  • Page 53: Dial-Up Service-Ppp

    Modem / PPP access is almost identical to connecting directly to a network through the UC-7400-LX Plus’s Ethernet port. Since PPP is a peer-to-peer system, the UC-7400-LX Plus can also use PPP to link two networks (or a local network to the Internet) to create a Wide Area Network (WAN).
  • Page 54 UC-7400-LX Plus User’s Manual Managing Communications remote computer. The entire command is enclosed in single quotes because pppd expects a one-word argument for the ‘connect’ option. The options for ‘chat’ are given below: verbose mode; log what we do to syslog “...
  • Page 55 UC-7400-LX Plus User’s Manual Managing Communications Example 2: Connecting to a PPP server over a hard-wired link If a username and password are not required, use the following command (note that noipdefault is optional): #pppd connect ‘chat –v“ “ “ “ ‘ noipdefault /dev/ttyM0 19200 crtscts...
  • Page 56: Pppoe

    The following example does not check the username and password: pppd /dev/ttyM0 115200 crtscts modem 192.168.16.1:192.168.16.2 PPPoE 1. Connect the UC-7400-LX Plus’s LAN port to an ADSL modem with a cross-over cable, HUB, or switch. 2. Login to the UC-7400-LX Plus as the root user.
  • Page 57 UC-7400-LX Plus User’s Manual Managing Communications 4. Edit the file /etc/ppp/pap-secrets and add the following: “username@hinet.net” * “password” * 192.168.3.127 - PuTTY support hostname “*” stats hostname “*” # OUTBOUND connections # ATTENTION: The definitions here can allow users to login without a # package already provides this option;...
  • Page 58: Nfs (Network File System)

    NFS allows users to develop applications for the UC-7400-LX Plus, without worrying about the amount of disk space that will be available. The UC-7400-LX Plus supports NFS protocol for both client and server.
  • Page 59 Example 2 /home/public 192.168.0.0/24(rw) *(ro) In this example, the UC-7400-LX Plus shares the directory /home/public to the local network with IP address 192.168.0.0/24, with read and write authority. NFS clients will just be able to read /home/public; they do not have write authority.
  • Page 60: Setting Up The Uc-7400-Lx Plus As An Nfs Client

    UC-7400-LX Plus User’s Manual Managing Communications Setting up the UC-7400-LX Plus as an NFS Client The following procedure is used to mount a remote NFS Server. 1. Scan the NFS Server’s shared directory. 2. Establish a mount point on the NFS Client site.
  • Page 61: Snmp

    Managing Communications SNMP The UC-7400-LX Plus has SNMP V1 (Simple Network Management Protocol) agent software built in. It supports RFC1317 RS-232 like groups and RFC 1213 MIB-II. The following simple example allows you to use an SNMP browser on the host site to query the UC-7400-LX Plus, which is the SNMP agent.
  • Page 62: Openvpn

    UC-7400-LX Plus User’s Manual Managing Communications OpenVPN OpenVPN provides two types of tunnels for users to implement VPNS: Routed IP Tunnels and Bridged Ethernet Tunnels. To begin with, check to make sure that the system has a virtual device /dev/net/tun. If not, issue the following command: # mknod /dev/net/tun c 10 200 An Ethernet bridge is used to connect different Ethernet networks together.
  • Page 63 UC-7400-LX Plus User’s Manual Managing Communications 2. The openvpn-bridge script file located at “/etc/openvpn/” reconfigures interface “eth1” as IP-less, creates logical bridge(s) and TAP interfaces, loads modules, enables IP forwarding, etc. #---------------------------------Start----------------------------- #!/bin/sh iface=eth1 # defines the internal interface maxtap=`expr 1` # defines the number of tap devices. I.e., # of tunnels...
  • Page 64 UC-7400-LX Plus User’s Manual Managing Communications ifcfg_vpn if [ ! \( -d “/dev/net” \) ]; then mkdir /dev/net if [ ! \( -r “/dev/net/tun” \) ]; then # create a device file if there is none mknod /dev/net/tun c 10 200 # load modules “tun”...
  • Page 65 UC-7400-LX Plus User’s Manual Managing Communications ifconfig br0 down ifconfig $iface $IPADDR netmask $NETMASK broadcast $BROADCAST killall -TERM openvpn case “$1” in start) start stop) stop restart) stop start echo “Usage: $0 [start|stop|restart]” exit 1 esac exit 0 #---------------------------------- end ----------------------------- Create link symbols to enable this script at boot time: # ln -s /etc/openvpn/openvpn-bridge /etc/rc.d/rc3.d/S32vpn-br # for example...
  • Page 66 UC-7400-LX Plus User’s Manual Managing Communications #----------------------------------Start------------------------------ #!/bin/sh # /etc/openvpn/tap0-br.sh # value after “-net” is the subnet behind the remote peer route add -net 192.168.2.0 netmask 255.255.255.0 dev br0 #---------------------------------- end ------------------------------ NOTE Select cipher by specifying cipher. To see which ciphers are available, type: # openvpn --show-ciphers 4.
  • Page 67 UC-7400-LX Plus User’s Manual Managing Communications Setup 2: Ethernet Bridging for Private Networks on the Same Subnet 1. Set up four machines as shown in the following diagram: local net OpenVPN A Host A LAN1: 192.168.2.173 LAN1: 192.168.2.171 LAN2: 192.168.8.173 LAN1: 192.168.8.174...
  • Page 68 UC-7400-LX Plus User’s Manual Managing Communications 2. On machine OpenVPN A, modify the remote address in the configuration file, /etc/openvpn/tun.conf. # point to the peer remote 192.168.8.174 dev tun secret /etc/openvpn/secrouter.key cipher DES-EDE3-CBC auth MD5 tun-mtu 1500 tun-mtu-extra 64 ping 40 ifconfig 192.168.2.173 192.168.4.174...
  • Page 69: Ipv6 To Ipv4 Tunneling

    UC-7400-LX Plus User’s Manual Managing Communications 3. Check the routing table after you run the OpenVPN programs, by typing the command: # route Destination Gateway Genmsk Flags Metric Ref Iface 192.168.4.174 255.255.255.255 tun0 192.168.4.0 192.168.4.174 255.255.255.0 tun0 192.168.2.0 255.255.255.0 eth1 192.168.8.0...
  • Page 70 UC-7400-LX Plus User’s Manual Managing Communications Use the following commands to configure these settings: 61.56.74.14 root@Moxa:~# ifconfig eth0 61.56.74.14 netmask 255.255.255.248 root@Moxa:~# route add default gw 61.56.74.9 Step 3: Configure WAN_LOCAL as eth0 in /etc/rc.d/init.d/tun6to4.sh. 61.56.74.14 #!/bin/bash TUN_INTF=tun6to4 # The name of the 6to4 tunnel link...
  • Page 71 UC-7400-LX Plus User’s Manual Managing Communications Step 4: Run the tun6to4.sh script to activate the 6to4 tunnel. You will be assigned a new IPv6-based IP address. 61.56.74.14 root@Moxa:~# /etc/init.d/tun6to4.sh start Creating tunnel interface... Setting tunnel interface up... Assigning 2002:3d38:4a0e::1/16 address to tunnel interface...
  • Page 72: Chapter 5 Programmer's Guide

    Programmer’s Guide Chapter 5 This chapter includes important information for programmers. The following functions are covered in this chapter:  Before Programming Your Embedded System  Caution When Using File Systems  Using RAM File System Instead of Flash File System ...
  • Page 73: Before Programming Your Embedded System

    UC-7400-LX Plus User’s Manual Programmer’s Guide Before Programming Your Embedded System Caution When Using File Systems We recommend placing only your programs into the on-board NOR Flash. For the log data generated by your programs, please store them into an external storage such as Compact Flash or Network File System.
  • Page 74: Linux Tool Chain Introduction

    Fedora core 1/2/3/4/5. The Tool Chain will need about 900 MB of hard disk space on your PC. The UC-7400-LX Plus Tool Chain is located on the UC-7400-LX Plus CD. To install the Tool Chain, insert the CD into your PC and then issue the following commands: #mount –t iso9660 /dev/cdrom /mnt/cdrom...
  • Page 75: Debugging With Gdb

    UC-7400-LX Plus User’s Manual Programmer’s Guide The following cross compiler tools are provided: Manage archives (static libraries) Assembler c++, g++ C++ compiler C preprocessor C compiler Debugger Linker Lists symbols from object files objcopy Copies and translates object files objdump...
  • Page 76: Device Api

    Description: set RTC time. Argument 3 will be passed to RTC. Buzzer The device node is located at /dev/console. The UC-7400-LX Plus supports Linux standard buzzer control, with the UC-7400-LX Plus’s buzzer running at a fixed frequency of 100 Hz. You must use include <sys/kd.h>. Function: KDMKTONE ioctl(fd, KDMKTONE, unsigned int arg);...
  • Page 77: Wdt (Watch Dog Timer)

    UC-7400-LX Plus User’s Manual Programmer’s Guide WDT (Watch dog Timer) 1. Introduction The WDT works like a watchdog to monitor system by protecting the system against unexpected errors. 2. How does the WDT work? WDT has two modes: kernel mode and user mode. When the system boots up, it enters the kernel mode by default.
  • Page 78 UC-7400-LX Plus User’s Manual Programmer’s Guide int swtd_disable(int fd) Description: Disable the watchdog in the application. The kernel will automatically acknowledge the watchdog. Input: int fd — the file handle from the return value of swtd_open(). Output: 0 if OK. An error occurs if you see a non-zero value. Use the function errno () to retrieve the error code.
  • Page 79 UC-7400-LX Plus User’s Manual Programmer’s Guide 4. Special Note When you “kill the application with -9” or “kill without option” or “Ctrl+c” the watchdog function will be changed from user mode to kernel mode. When your application enables the watchdog and does not acknowledge the WDT, your application may have a logical error, or your application has made a core dump.
  • Page 80: Uart

    The normal tty device node is located at /dev/ttyM0 … ttyM15, and the modem tty device node is located at /dev/cum0 … cum15. The UC-7400-LX Plus supports Linux standard termios control. The Moxa UART Device API allows you to configure ttyM0 to ttyM7 as RS-232, RS-422, 4-wire RS-485, or 2-wire RS-485.
  • Page 81 UC-7400-LX Plus User’s Manual Programmer’s Guide 1. Function: MOXA_SET_OP_MODE int ioctl(fd, MOXA_SET_OP_MODE, &mode) Description Set the interface mode. Argument 3 mode will pass to the UART device driver and change it. 2. Function: MOXA_GET_OP_MODE int ioctl(fd, MOXA_GET_OP_MODE, &mode) Description Get the interface mode. Argument 3 mode will return the interface mode.
  • Page 82: Lcm

    2. If you use stty to get the serial information, you will get speed equal to 0. The UC-7400-LX Plus only supports text mode display, with screen size of 16 cols by 8 rows. The device node is /dev/lcm. See the examples given below. We provide a private struct defined as...
  • Page 83: Make File Example

    UC-7400-LX Plus User’s Manual Programmer’s Guide Make File Example The following Makefile file example codes are copied from the Hello example on the UC-7400-LX Plus CD-ROM. CC = xscale_be-gcc CPP = xscale_be-gcc SOURCES = hello.c OBJS = $(SOURCES:.c=.o) all: hello...
  • Page 84: Chapter 6 Software Lock

    Software Lock Chapter 6 “Software Lock” is an innovative technology developed by Moxa’s engineers. It can be adopted by a system integrator or developer to protect applications from being copied. An applicaion is compiled into a binary format bound to the embedded computer and the operating system (OS) that the application runs on.
  • Page 85 UC-7400-LX Plus User’s Manual Software Lock NOTE 1. If you try to run an encrypted program on an embedded computer that does not have an encryption key installed, you will get the following error message. Error => Inconsistency detected by ld.so: dynamic-link.h: 62: elf_get_dynamic_info: Assertion `! “bad dynamic tag”‘...
  • Page 86: Appendix A System Commands

    System Commands Appendix A Linux normal command utility collection System 1. hwclock query and set the hardware clock (RTC) 2. klogd Kernel Log Daemon 3. logger a shell command interface to the syslog(3) system log module 4. mesg control write access to your terminal 5.
  • Page 87: Editor

    UC-7400-LX Plus User’s Manual System Commands Editor 1. vi text editor 2. cat dump file context 3. zcat compress or expand files 4. grep, egrep, fgrep search string on file 5. cut get string on file 6. find find file where are there 7.
  • Page 88: Other

    UC-7400-LX Plus User’s Manual System Commands Other 1. dmesg dump kernel log message 2. sty to set serial port 3. zcat dump .gz file context 4. mknod make device node 5. free display system memory usage 6. date print or set the system date and time 7.

Table of Contents