Development Environment for UFS-910 Applications
To develop applications for the UFS-910 you need a PC running Linux and STLinux 2.0. You may also use a virtual machine running Linux rather than using a real PC. STMicroelectronics is the manufacturer of ST40 processor used in the UFS-910. STLinux is the operating system running on the UFS-910.
Selection and Installation of the host system
Supported Linux distribution for STLinux are RedHat and Fedora (see STLinux: Linux installation on the host PC). I'm using Fedora Core 6 because I already have experience in using it. STLinux 2.0 is officially supported with Fedora Core 4 but Core 6 can be also used when following thes instructions below.
Installation of Fedora Core 6 using VirtualPC
VirtualPC 2007 is a free virtual machine software from Mircosoft for Windows XP.
- Download Fedora Core 6 ISO Image FC-6-i386-DVD.iso
- Create a new virtual machine
- Name e.g. 'Fedora Core 6'
- 256 MB RAM
- 1. Harddisk: 16 GB (min. 5 GB)
- Network: Netword interface of host PC with internet connection
- No Hardware Virtualisierung (Fedora installation hanging on my Athlon XP2 machine)
- Start machine
- Assign FC ISO image to CD
- Restart machine
- Enter 'linux text' at the Fedora boot prompt
- Select packages and finish installation
- Configuration using text mode
- Append 'clock=pit' to the 'kernel' line in /boot/grub/menu.lst
- Change value of 'DEfaultDepth' form 24 to 16 in /etc/X11/xorg.conf
- Optional add '/dev/cdrom /media iso9660 ro,user 0 0' to /etc/fstab
- Fedora Configuration
- Start X-Window ('startx')
- Disable Firewall and SELinux at 'System - Administration - Security Level and Firewall'
- Install compat-libstdc++-33-3.2.3-61.i386.rpm using 'Application - Add/Remove Software - List'
The DefaultDepth value must be adjusted before starting X11 because Fedora does not recognize the 16-Bit settings used by VirtualPC. For the same reason installation must be done in text mode.
Firewall and SELinux must be disabled zo avoid problems when using STLinux
The compat-libstdc++ library is required when using STLinux 2.0.
- Download STLinux 2.0 ISO Images release-2.0-sh4-install.iso
- Optional Download STLinux 2.0 Source ISO Images release-2.0-sh4-source.iso
- Assign ST ISO Image to CD (or put CD into drive)
- If not in text mode open a shell (Applications - Accessories - Terminal)
- If not logged in as root change to root using 'su'
- If CD image not mounted automatically enter 'mount /media'
- Change to installation directory of CD: 'cd /media/ST_Linux_2.0_RPMS/ST_Installer'
- Install: 'sh install -a'
STLinux should be now installed to '/opt/STM/STLinux-2.0'. Please see the STLinux web page for installation of the optional source packages.
Configuration of development environment
You should add a new user for development. When using avirtual machine, this user will be probably the only one on the system. Add these lines to the '~/.bashrc' file of the user. So the STLinux Cross compilers will be used rather the X86 ones:
export CC="/opt/STM/STLinux-2.0/devkit/sh4/bin/sh4-linux-gcc" export CXX="/opt/STM/STLinux-2.0/devkit/sh4/bin/sh4-linux-g++"
Packages with 'configure' script must be configured using './configure --host=sh4-linux'.
Now you should create a directory in the user's home directory that will be used to hold the UFS-910 applications (you may name it 'ufs-910'. This directory may be also mounted to an external NFS share.
Copy files to the UFS-910
To copy files, the development machine and the UFS-910 must be both connected to your local network.
When you have installed a FTP server on the UFS-910, you may use this script to upload files (the script may be also called from within the install section of Makefiles):
# !/bin/bash # to-ufs.sh: Copy a file to UFS-910 using ftp # # Jochen Arndt <email@example.com> # IP address of UFS-910 UFS_IP="192.168.178.19" # Default destination directory DESTDIR="/data" # Use "-v" to be verbose or "" to be not verbose #VERBOSE="" VERBOSE="-v" FTP=`which ftp` if [ "$FTP" = "" ]; then echo "Error: ftp program not found." exit 1 fi CHMOD="" if [ "$1" = "-c" ]; then CHMOD="yes" shift fi if [ "$1" = "" -o "$1" = "-h" -o "$1" = "--help" ]; then echo "Usage: $0 [-c] <file-name> [dest-dir [dest-file]]" echo " -c = change mode to 755 after copying" echo " file-name = file to be copied" echo " dest-dir = destination directory (/data by default)" echo " dest-file = file name on target (basename of file-name by default)" exit 0 fi if [ ! -e "$1" ]; then echo "Error: File '$1' not found." exit 1 fi if [ ! -f "$1" ]; then echo "Error: '$1' is not a file." exit 1 fi # Default name on destination host DESTNAME=`basename $1` test -n "$2" && DESTDIR="$2" test -n "$3" && DESTNAME="$3" test -n "$CHMOD" && CHMOD="chmod 755 $DESTNAME" "$FTP" "$VERBOSE" -u -n "$UFS_IP" <<-EOF user root kathrein binary cd $DESTDIR put $1 $DESTNAME $CHMOD quit EOF
You may also install a NFS server on the development system and create a share to the local directory holding the UFS-910 files (if it is'nt a mounted NFS share). The UFS can automatically mount the NFS share upon booting when creating the file '/config/nfs':
NFS <IP>:<SHARE> false soft,udp,nolock,async,wsize=8192,rsize=8192,noatime
To mount a NFS share manually use:
mkdir /tmp/nfs mount -t nfs -o soft,udp,nolock,async,wsize=8192,rsize=8192,noatime <IP>:<SHARE> /tmp/usb/nfs