Carte Linux Acme Fox
De MicElectroLinGenMet.
Un système Linux complet sur une carte de 66 x 72 mm
Présentation
(Voir la documentation complète "FOX Board documentation index" sur le Acme systems.)
- Platine d'évaluation "FOX LX"
La platine "FOX" est un système embarqué prêt à l’emploi pour Linux. Conçue par la société Acme Systems. De trés faibles dimensions, cette dernière est architecturée autour d’un processeur RISC 32 bits ETRAX 100LX MCM 8+16 du fabricant Axis (un des principaux fournisseur mondial de caméras et imprimantes serveurs).
La platine "FOX" dispose de 2 ports hôte USB 1.1 pouvant être utilisés pour exploiter des clefs mémoire USB, des disques-durs USB, des Webcam, des dongles WI-FI ou Bluetooth, des adaptateurs ADSL, des cordons de convertion série/USB.
Un connecteur RJ45 (Ethernet Base 10/100) permet d'avoir accès à un serveur web, un serveur FTP, SSH, Telnet et à la gestion de pilote TCP/IP.
- Caractéristiques logiciel:
Linux: Default Kernel 2.6 Services: HTTP Server (WEB) FTP server SSH SCP TELNET Server PPP Driver: USB Pen driver, FTDI et PROLIFIC USB to Serial Converter SDK: Open source SDK pour Linux Systems Language: C Outils: Compilateur C GNU
- Caractéristiques matériel:
Dimensions: 66 x 72 mm Poids: 37 gr Mips: 100 Power: 1watt CPU: Axis ETRAX 100LX - 32 bit, RISC, 100MHz Mémoire: 16 MB de RAM - 8 MB de FLASH (version FOX LX816) Existe aussi en version 32 MB de RAM - 8 MB de Flash (version FOXLX832) Ports: 1 Ethernet (10/100 Mb/s) - 2 USB 1.1 Divers: 1 port/console série niveau TTL (3,3 Volt, tolérant 5 Volt) 2 connecteurs d'extension avec IDE, SCSI, lignes séries, ports paralleles, lignes E/S, bus I2C™, bus d'interface Entrée d'alimentation : 5 Volts / 280mA sans périphérique USB de connecté
La carte dispose de part et d'autre de 2 rangées de trous au pas de 2.54 mm destinés à recevoir des connecteurs optionnels qui
permettent de monter la carte "FOX" sur une platine principale.
Un connecteur mâle au pas de 2,54 mm en bout de carte permet également le raccordement d'une petite platine d'interface de mise à niveau du port série "console" (3,3 Vcc) de la carte de relier la carte "FOX" sur le port série d'un compatible PC.
De nombreux périphériques pourront être connectés sur ces connecteurs:
- Jusqu'à 2 ports parallèle ou un port parallèle étendu (*)
- Jusqu'à 4 ports IDE (8 IDE Hard Disks) (*)
- Jusqu'à 2 ports SCSI ou 1 port étendu SCSI (*)
- Un bus I2C™ (*)
- Jusqu'à 62 port E/S pour usage général (*)
- Jusqu'à 4 port série asynchrone (*)(**)
(*) Toutes les interfaces ne peuvent pas être utilisées en même temps. L'usage des périphériques dépend de la configuration du "Kernel" et de l'assignement des lignes de signaux.
(**) 1 port asynchrone est déjà utilisé comme port console (/dev/ttyS0) - 1 port peut être activé en désactivant le port USB1 (/dev/ttyS1) - 1 port peut être configuré en RS485 - 2 ports peuvent être configurés en ports synchrones - Le débit max. sur les ports asynchrones est de 6Mbit/s.
Decouverte du système
(Voir page First startup de chez "Acme Systems".)
Première connection
dan@vesta:~$ telnet 192.168.0.90 Trying 192.168.0.90... Connected to 192.168.0.90. Escape character is '^]'. axis-00408C168244 login: root Password: pass [root@axis-00408C168244 /root]#
Nom de machine
[root@axis-00408C168244 /root]# uname -a Linux axis-00408C168244 2.6.15 #10 PREEMPT Tue Jan 30 14:55:33 CET 2007 cris unknown
Type de processeur
[root@axis-00408C168244 /root]# cat /proc/cpuinfo processor : 0 cpu : CRIS cpu revision : 11 cpu model : ETRAX 100LX v2 cache size : 8 kB fpu : no mmu : yes mmu DMA bug : no ethernet : 10/100 Mbps token ring : no scsi : yes ata : yes usb : yes bogomips : 99.53
Mémoire
[root@axis-00408C168244 /root]# free
total used free shared buffers
Mem: 13968 9568 4400 0 1416
Swap: 0 0 0
Total: 13968 9568 4400
Système fichiers
[root@axis-00408C168244 /root]# mount /dev/flash3 on / type cramfs (ro) /dev/flash2 on /mnt/flash type jffs2 (rw,noatime) proc on /proc type proc (rw,nodiratime) tmpfs on /var type tmpfs (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw) none on /proc/bus/usb type usbfs (rw)
[root@axis-00408C168244 /root]# df -h Filesystem Size Used Available Use% Mounted on /dev/flash3 9.1M 9.1M 0 100% / /dev/flash2 4.6M 464.0k 4.2M 10% /mnt/flash tmpfs 6.8M 176.0k 6.6M 3% /var
Configuration réseau
[root@axis-00408C168244 /root]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:40:8C:16:82:44
inet addr:192.168.0.90 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:6118 errors:0 dropped:0 overruns:3 frame:0
TX packets:3920 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:866603 (846.2 KiB) TX bytes:419524 (409.6 KiB)
Interrupt:17 DMA chan:1
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
[root@axis-00408c168244 /etc/conf.d]# cat net.eth0 ... # Change MAC if you want a MAC address different than the serial number. MAC="00:40:8C:16:82:44" ... # If you are using DHCP the following variables will not be used. IP="192.168.0.90" NETMASK="255.255.255.0" BROADCAST="192.168.0.255" GATEWAY="192.168.0.1"
[root@axis-00408c168244 /tmp]# cat /etc/resolv.conf nameserver 194.25.2.129
Fonction BusyBox
(Ceci est la version modifié lors du 'flashage' d'une nouvelle image)
[root@axis-00408C168244 /root]# busybox
BusyBox v1.00 (2007.09.01-22:43+0000) multi-call binary
Usage: busybox [function] [arguments]...
or: [function] [arguments]...
BusyBox is a multi-call binary that combines many common Unix
utilities into a single executable. Most people will create a
link to busybox for each function they wish to use, and BusyBox
will act like whatever it was invoked as.
Currently defined functions:
[, addgroup, adduser, ar, arping, ash, awk, basename, bunzip2, busybox, bzcat, cat,
chgrp, chmod, chown, clear, cmp, cp, cpio, crond, crontab, cut, date, dc, dd, delgroup,
deluser, df, dirname, dmesg, du, echo, egrep, env, expr, false, fgrep, find, free,
ftpget, ftpput, getty, grep, gunzip, gzip, halt, head, hostname, hwclock, id, ifconfig,
insmod, kill, killall, klogd, ln, loadkmap, logger, login, logname, logread, ls, lsmod,
md5sum, mkdir, mkfifo, mknod, mktemp, more, mount, mv, nc, netstat, passwd, pidof,
ping, poweroff, printf, ps, pwd, rdate, readlink, realpath, reboot, renice, reset,
rm, rmdir, rmmod, route, sed, sh, sleep, sort, stty, sync, syslogd, tail, tar, tee,
telnet, test, top, touch, tr, true, tty, udhcpc, umount, uname, uniq, unzip, uptime,
usleep, vi, watch, wc, wget, which, who, whoami, xargs, yes, zcat
Messages au boot
[root@axis-00408C168244 /root]# dmesg Linux version 2.6.15 (newsdk201@hpp4Bob) (gcc version 3.2.1 Axis release R61/1.61) #10 PREEMPT Tue Jan 30 14:55:33 CET 2007 Setting up paging and the MMU. On node 0 totalpages: 2048 DMA zone: 2048 pages, LIFO batch:0 DMA32 zone: 0 pages, LIFO batch:0 Normal zone: 0 pages, LIFO batch:0 HighMem zone: 0 pages, LIFO batch:0 Linux/CRIS port on ETRAX 100LX (c) 2001 Axis Communications AB Built 1 zonelists Kernel command line: root=/dev/mtdblock3 init=/linuxrc PID hash table entries: 128 (order: 7, 2048 bytes) ds1302: RTC not found. Enabling watchdog... Dentry cache hash table entries: 4096 (order: 1, 16384 bytes) Inode-cache hash table entries: 2048 (order: 0, 8192 bytes) Memory: 13904k/16384k available (1320k kernel code, 2480k reserved, 312k data, 64k init) Calibrating delay loop... 99.53 BogoMIPS (lpj=497664) Mount-cache hash table entries: 1024 NET: Registered protocol family 16 SCSI subsystem initialized usbcore: registered new driver usbfs usbcore: registered new driver hub JFFS version 1.0, (C) 1999, 2000 Axis Communications AB JFFS2 version 2.2. (NAND) (C) 2001-2003 Red Hat, Inc. io scheduler noop registered io scheduler cfq registered ETRAX 100LX serial-driver 1.25 $, (c) 2000-2004 Axis Communications AB ttyS0 at 0xb0000060 is a builtin UART with DMA ttyS2 at 0xb0000070 is a builtin UART with DMA ttyS3 at 0xb0000078 is a builtin UART with DMA fast_timer_init() RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize PPP generic driver version 2.4.2 PPP Deflate Compression module registered ETRAX 100LX 10/100MBit ethernet v2.0 (c) 2000-2003 Axis Communications AB eth0: changed MAC to 00:40:8C:CD:00:00 usbmon: debugfs is not available ETRAX 100LX USB Host Controller version 1.00 (c) 2005, 2006 Axis Communications AB usb_devdrv: Etrax 100LX USB Revision 16 v1,2 usb_devdrv: Bulk timer interval, start:3 eot:6 usb_devdrv: Claimed interface for USB physical port 1 usb_devdrv: Claimed interface for USB physical port 2 crisv10_irq dbg: ctr_status_irq, controller status: host_mode hc-crisv10 hc-crisv10.0: ETRAX 100LX USB Host Controller hc-crisv10 hc-crisv10.0: reset hc-crisv10 hc-crisv10.0: new USB bus registered, assigned bus number 1 hc-crisv10 hc-crisv10.0: start hub 1-0:1.0: USB hub found hub 1-0:1.0: 2 ports detected Initializing USB Mass Storage driver... usbcore: registered new driver usb-storage USB Mass Storage support registered. usbcore: registered new driver usbserial drivers/usb/serial/usb-serial.c: USB Serial Driver core drivers/usb/serial/usb-serial.c: USB Serial support registered for FTDI USB Serial Device usbcore: registered new driver ftdi_sio drivers/usb/serial/ftdi_sio.c: v1.4.3:USB FTDI Serial Converters Driver drivers/usb/serial/usb-serial.c: USB Serial support registered for pl2303 usbcore: registered new driver pl2303 drivers/usb/serial/pl2303.c: Prolific PL2303 USB to serial adaptor driver cse0: Probing a 0x04000000 bytes large window at 0xe0000000. cse0: Probing for AMD compatible flash... cse0: unknown flash device at 0x0, mfr id 0xec, dev id 0x22e0 cse0: Found no AMD compatible device at location zero cse0: Found 1 x16 devices at 0x0 in 16-bit bank cse0: Found an alias at 0x800000 for the chip at 0x0 cse0: Found an alias at 0x1000000 for the chip at 0x0 cse0: Found an alias at 0x1800000 for the chip at 0x0 cse0: Found an alias at 0x2000000 for the chip at 0x0 cse0: Found an alias at 0x2800000 for the chip at 0x0 cse0: Found an alias at 0x3000000 for the chip at 0x0 cse0: Found an alias at 0x3800000 for the chip at 0x0 Amd/Fujitsu Extended Query Table at 0x0040 cse0: Swapping erase regions for broken CFI table. number of CFI chips: 1 cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness. cse1: Probing a 0x04000000 bytes large window at 0xe4000000. cse1: Probing for AMD compatible flash... cse1: unknown flash device at 0x0, mfr id 0x90, dev id 0x2c4 cse1: Found no AMD compatible device at location zero CFI: Found no cse1 device at location zero cse0: 0x00800000 bytes of flash memory. Found a valid partition table at 0xf001000a-0xf0010056. /dev/flash1 at 0x00010000, size 0x00350000 /dev/flash2 at 0x00360000, size 0x004a0000 Adding readonly flash partition for romfs image: /dev/flash3 at 0x000e3476, size 0x00202000 Creating 4 MTD partitions on "cse0": 0x00000000-0x00010000 : "part0" 0x00010000-0x00360000 : "part1" 0x00360000-0x00800000 : "part2" 0x000e3476-0x002e5476 : "romfs" I2C driver v2.2, (c) 1999-2004 Axis Communications AB ==> Improvements done by Geert Vancompernolle - December 2006 I2C Major: 123 / I2C Name: i2cgvc gpio init GPIO port G: in_bits: 0x01FFFF3F out_bits: 0x3200003E val: F1FFFFFF GPIO port G: dir: 00000000 changeable: 01FFFF01 ETRAX 100LX GPIO driver v2.5, (c) 2001, 2002, 2003, 2004 Axis Communications AB err: timer0 irq for gpio err: PA irq for gpio ds1302: RTC not found. NET: Registered protocol family 2 IP route cache hash table entries: 256 (order: -3, 1024 bytes) TCP established hash table entries: 1024 (order: -1, 4096 bytes) TCP bind hash table entries: 1024 (order: -1, 4096 bytes) TCP: Hash tables configured (established 1024 bind 1024) TCP reno registered ip_conntrack version 2.4 (128 buckets, 1024 max) - 166 bytes per conntrack ip_tables: (C) 2000-2002 Netfilter core team TCP bic registered NET: Registered protocol family 1 NET: Registered protocol family 17 VFS: Mounted root (cramfs filesystem) readonly. Freeing unused kernel memory: 64k freed eth0: changed MAC to 00:40:8C:16:82:44 crisv10_irq dbg: ctr_status_irq, controller status: host_mode started crisv10_irq dbg: ctr_status_irq, controller status: host_mode started running
Configuration du système
Modification du prompt de commande
Modification du fichier:
[root@axis-00408C168244 /root]# cat /etc/profile.d/prompt.sh
cdprompt ()
{
cd $*
PS1="[$LOGNAME@$HOSTNAME $PWD]"
if [ `id -u` = 0 ]; then
PS1=$PS1"# "
else
PS1=$PS1"$ "
fi
}
case "$-" in
*i*)
# Use it
alias cd=cdprompt
# Initialise PS1
cdprompt `pwd`
esac
Création d'alias
Rajout du script:
[root@axis-00408C168244 /root]# cat /etc/profile.d/alias.sh alias l='ls -lhF' alias log='tail -20 /var/log/messages'
avec droits d'execution.
chmod +x /etc/profile.d/alias.sh
Rajout fichier hosts
[root@axis-00408C168244 /root]# cat /etc/hosts 127.0.0.1 localhost 192.168.0.4 vesta # Serveur Debian
Modification du hostname
[root@axis-00408C168244 /root]# cat /etc/conf.d/hostname HOSTNAME="fox"
[root@fox /root]#
Modification route par defaut et DNS
- Pour la route par défaut, modifier le fichier /etc/conf.d/net.eth0:
# Uncomment the following line to override the generic hardware address # (usually the serial number) for this interface only. # MAC="00:40:8C:CD:00:00" # Valid boot protocols are "dhcp" and "none" (anything other than "dhcp" works). BOOTPROTO="none" DHCP_CLIENT="/sbin/udhcpc -i eth0" # Valid media types are "auto", "10baseT-HD", "10baseT-FD", "100baseTX-HD", # "100baseTX-FD" and "" (nothing). MEDIA="auto" # If you are using DHCP the following variables will not be used. IP="192.168.0.90" NETMASK="255.255.255.0" BROADCAST="192.168.0.255" GATEWAY="192.168.0.254"
- Pour le(s) DNS, modifier le fichier /etc/resolv.conf.def
nameserver 80.10.246.2
Rajout syslog.conf
Renvoi des messages syslog sur serveur Debian vesta:
[root@fox /root]# cat /etc/syslog.conf # Log messages to the console. *.debug;kern.none /dev/ttyS0 # Log anything (except mail) of level info or higher. # Don't log private authentication messages! *.info;mail.none;authpriv.none /var/log/messages # The authpriv file has restricted access. authpriv.* /var/log/secure # Log all the mail messages in one place. mail.* /var/log/maillog # Everybody gets emergency messages, plus log them on another # machine. *.emerg * # Save mail and news errors of level err and higher in a # special file. uucp,news.crit /var/log/spooler # Save boot messages also to boot.log local7.* /var/log/boot.log *.* @vesta
Mise à l'heure de l'horloge
Rajout de la commande rdate dans busybox (flashage d'une nouvelle image)
Cette commnande permet de synchroniser l'horloge sur un serveur de temp utilisant le protocol de la RFC 868.
Exemple:
# rdate -s ntp.unice.fr ou # rdate -s rdate.dedibox.com
Rajout du script /etc/init.d/boottime/rdate (pour exécution au boot):
#!/bin/sh
sleep 2
if ! /usr/sbin/rdate -s rdate.dedibox.com
then
/usr/sbin/rdate -s vesta
fi
Ainsi qu'en crontab (Voir How to install crond and crontab):
5 1 * * * /usr/sbin/rdate -s rdate.dedibox.com
La variable timezone (TZ) est à initialiser dans le fichier /etc/TZ, (NE FONCTIONNE PAS !)
# cat /etc/TZ GMT-1
Modification de l'adresse MAC
Aprés le flashage, la carte FOX reprend une adresse MAC par défaut: 00:40:8C:CD:00:00
Pour initialiser une nouvelle adresse MAC, utiliser la commande suivante:
[root@fox /root]# bootblocktool -a SERNO 00408C0168244
Seuls les 3 derniers octets peuvent être changés.
L'adresse MAC peut ausi être déclarée dans le fichier /etc/conf.d/net.eth0
Ajout clefs ssh
Copie clefs ssh public du serveur Debian dans le fichier /root/.ssh/authorized_keys.
dan@vesta:~$ scp /home/dan/.ssh/authorized_keys.client root@fox:/root/.ssh/authorized_keys
Configuration système dans le SDK
- Modification du fichier /etc/profile.d/prompt.sh pour prise en compte par le SDK:
dan@vesta:devboard-R2_01$ vi ./packages/shell/ash/profile/prompt-R1_0_1/prompt.sh (voir contenu Modification_du_prompt_de_commande)
- Rajout du fichier /etc/profile.d/alias.sh pour prise en compte par le SDK:
dan@vesta:devboard-R2_01$ mkdir ./packages/shell/ash/profile/alias dan@vesta:devboard-R2_01$ vi ./packages/shell/ash/profile/alias/alias.sh (voir contenu Création d'alias) dan@vesta:devboard-R2_01$ vi ./packages/shell/ash/profile/alias/Makefile (voir ci-dessous) dan@vesta:devboard-R2_01$ vi Makefile (Makefile principal, voir ci-dessous)
dan@vesta:devboard-R2_01$ cat ./packages/shell/ash/profile/alias/Makefile include $(AXIS_TOP_DIR)/tools/build/Rules.axis OWN = -o root -g root install: $(INSTALL) $(OWN) -m 0755 alias.sh $(prefix)/etc/profile.d/alias.sh
dan@vesta:devboard-R2_01$ cat Makefile
...
SUBDIRS = \
packages/romfs_meta/common \
...
packages/shell/ash/profile/common \
packages/shell/ash/profile/prompt \
packages/shell/ash/profile/alias \
...
- Hosts : /etc/hosts
dan@vesta:devboard-R2_01$ vi ./packages/base-files-R1_2_0/hosts
- Nom machine : /etc/hostname
dan@vesta:devboard-R2_01$ vi ./packages/initscripts/hostname/conf
- Passerelle par defaut : /etc/conf.d/net.eth0
dan@vesta:devboard-R2_01$ vi ./packages/initscripts/net.eth0-static/Makefile (Modification valeur par defaut, sinon passer par make menuconfig)
include $(AXIS_TOP_DIR)/tools/build/Rules.axis
OWN = -o root -g root
install:
...
@if test "$(AXIS_CONFIG_ACME_IP_CUSTOM)" != "y" ; then \
cat conf.orig | sed "s/_PROTO_/none/g" | \
sed "s/_IP_/192.168.0.90/g" | \
sed "s/_NETMASK_/255.255.255.0/g" | \
sed "s/_BROADCAST_/192.168.0.255/g" | \
sed "s/_GATEWAY_/192.168.0.254/g" > conf ;\
fi
...
- Adresse MAC : /etc/conf.d/net.eth0
dan@vesta:devboard-R2_01$ vi ./packages/initscripts/net.eth0-static/conf.orig # Uncomment the following line to override the generic hardware address # (usually the serial number) for this interface only. MAC="00:40:8C:16:82:44" ...
Problème: L'adresse MAC est prise en compte mais la LED rouge clignote néanmoins pour signaler que l'adrresse MAC n'est pas initiliaser !
- DNS : /etc/resolv.conf.def
dan@vesta:devboard-R2_01$ vi packages/initscripts/resolv/Makefile (Modification valeur par defaut, sinon passer par make menuconfig)
include $(AXIS_TOP_DIR)/tools/build/Rules.axis OWN = -o root -g root install: if test "$(AXIS_CONFIG_ACME_CUSTOM_DNS)" = "y" ; then \ cat resolv.conf.def.orig | sed "s/_NAMESERVER_/$(AXIS_CONFIG_ACME_IP_DNS)/g" > resolv.conf.def; \ fi if test "$(AXIS_CONFIG_ACME_CUSTOM_DNS)" != "y" ; then \ cat resolv.conf.def.orig | sed "s/_NAMESERVER_/80.10.246.2/g" > resolv.conf.def; \ fi $(INSTALL) $(OWN) -m 0755 rc "$(prefix)"/etc/init.d/resolv $(LN) -sf ../init.d/resolv "$(prefix)"/etc/rcS.d/S27resolv $(INSTALL) $(OWN) -m 0644 resolv.conf.def "$(prefix)"/etc/ $(LN) -sf ../../../var/lib/resolv.conf "$(prefix)"/etc/resolv.conf
- SYSLOG : /etc/syslog.conf
dan@vesta:devboard-R2_01$ vi ./packages/param/syslog/development/syslog.conf
- Rajout du fichier /etc/init.d/boottime/rdate
dan@vesta:devboard-R2_01$ vi ./packages/initscripts/acme/boottime/rdate (voir contenu Mise à l'heure de l'horloge) dan@vesta:devboard-R2_01$ vi ./packages/initscripts/acme/boottime/Makefile
dan@vesta:devboard-R2_01$ cat ./packages/initscripts/acme/boottime/Makefile
# $Id: Makefile,v 1.1 2004/05/11 13:41:51 anderstj Exp $
include $(AXIS_TOP_DIR)/tools/build/Rules.axis
# set root as owner and group owner for all files
OWN = -o root -g root
install:
$(INSTALL) $(OWN) -d $(prefix)/etc
$(INSTALL) $(OWN) -d $(prefix)/etc/init.d
$(INSTALL) $(OWN) -d "$(prefix)"/etc/init.d/boottime
$(INSTALL) $(OWN) -m 0755 rdate "$(prefix)"/etc/init.d/boottime
uninstall:
echo "Uninstall not implemented"
A la compilation les programmes/fichiers configurés dans ./packages sont copiés dans le répetoire ./target/cris-axis-linux-gnu/mnt/flash.
L'image "fimage" contiendra les modifications personnelles à chaque recompilation.
Connecteurs de la carte Fox
Détails des connecteurs
(Voir page FOX pinout de chez "Acme Systems".)
Port console
(Voir page FOX Console de chez "Acme Systems".)
(Voir aussi Using serial ports in C)
La carte Fox a un port console série disponible sur le connecteur J10 accessible depuis le device /dev/ttyS0.
- Brochage du connecteur
J10 - PIN OUT
1. VCC (3.3 Volt) 2. RTS (Out) 3. TXD (Out) 4. RXD (Inp) 5. CTS (Inp) 6. GND
- Connection à un PC
Les signaux du port console étant en 3,3V, il est necessaire de les adapter pour relier la console à un port série de PC.
Shéma de connection du port console J10 au port RS232 du PC.
Exemple de shéma électronique pour adapter les signaux 3.3V en signaux RS232
ou à base de CI Max3232
- Configuration du port
Debit de la console: 115200 8N1.
- Messages de la console au boot
Aprés les messages du noyau (voir dmesg) démarrage du système
Freeing unused kernel memory: 64k freed /linuxrc: Mounting /mnt/flash... Using fallback suid method done /linuxrc: Starting init. init: starting up. Starting system initialization. Axis Linux, http://developer.axis.com/ Copyright (C) 2000-2005 Axis Communications AB FOX release 2.01 * Mounting filesystems... [ ok ] * Initializing /var... [ ok ] * Determining MAC address... + using saved MAC address: 00:40:8C:16:82:44 [ ok ] * Initializing random number generator... [ ok ] * Setting hostname... + hostname: "fox" [ ok ] * Initializing volatile resolver configuration... [ ok ] System initialization is done. New runlevel: 3 * Starting respawn daemon... [ ok ] * Starting system and kernel logger... Jan 1 00:00:06 fox syslogd 1.4.1: restart. Jan 1 00:00:06 fox syslogd: sendto: Network is unreachable + system logger started + kernel logger started [ ok ] * Bringing lo up... [ ok ] * Bringing eth0 up... + hardware address: 00:40:8C:16:82:44 + media: auto + IP address: 192.168.0.90 + netmask: 255.255.255.0 + broadcast address: 192.168.0.255 + default gateway: 192.168.0.254 + boot protocol: none [ ok ] * Waiting for a network interface... + eth0 is up [ ok ] * Starting telnet server... telnetd: starting port: 23; interface: any; login program: /bin/login; maximum number of allowed simultaneous clients: unlimited [ ok ] * Starting ftp server... Sep 27 13:36:26 fox vftpd[666]: Starting vftpd 0.01 [ ok ] * Starting ssh server... [ ok ] Sep 27 13:36:27 fox dropbear[678]: Running in background Sep 27 13:36:27 fox crond[685]: crond 2.3.2 dillon, started, log level 8 * Starting web server... [ ok ] All scripts for runlevel 3 are done. /bin/sh: can't access tty; job control turned off #
Ports d'entrés/sorties (GPIO)
(Voir page GPIO General purpose I/O de chez "Acme Systems".)
Developper des programmes pour la carte FOX
Installation du SDK
Il faut suivre la procédure pour Debian décrite sur le site d'ACME: Install the SDK on Linux
En résumé:
- Installation de subversion
# apt-get install subversion
- Télécharger ces 'packages' et les installer
pmake_1.98-3_i386.deb cris-dist_1.63-1_i386.deb
# dpkg -i pmake_1.98-3_i386.deb # dpkg -i cris-dist_1.63-1_i386.deb
- Télécharger le script d'installation install_svn_sdk.sh
dans le répertoire de travail.
wget http://www.acmesystems.it/download/install_svn_sdk.sh
- Exécuter le script:
# chmod +x install_svn_sdk.sh # ./install_svn_sdk.sh
Aprés quelques minutes de téchargement:
... ### Selected product: "fox" ### etrax100boot must be run by root. To make this easier (but less secure) you can make etrax100boot setuid root. Do you want to make etrax100boot setuid root now [yn]? (default n):
répondre 'yes' à la question posée.
- Maintenenat le SDK est installé, il suffit d'aller dans le répertoire:
# cd devboard-R2_01
et de lancer le menu de configuration du SDK
# make menuconfig
Configuration du SDK
Page ACME SDK config and update
...
Penser à sauvegarder les fichiers de configuration Acme/Kernel/Busybox avec la commande: acme_config
dan@vesta:devboard-R2_01$ ./acme_config save perso saving your configuration as perso
dan@vesta:devboard-R2_01$ ls -la acme_configs/perso/ total 76K drwxr-xr-x 2 dan dan 4,0K jun 5 00:07 ./ drwxr-xr-x 20 dan dan 4,0K jun 5 00:07 ../ -rw-r--r-- 1 dan dan 3,6K jun 5 00:07 .config -rwxr-xr-x 1 dan dan 8,5K jun 5 00:07 .config.busybox* -rw-r--r-- 1 dan dan 25K jun 5 00:07 kernelconfig -rw-r--r-- 1 dan dan 24K jun 5 00:07 kernelconfig-2.6
Compiler des programmes C pour la carte FOX
Page ACME How to compile a C application
Compiler des programmes client MySql
Page ACME How to compile MySQL C client API
J'ai suivi les indications de cette page et j'ai pu tester un programme simple qui va lire les dernières données de la Station meteo. Lacross Technology WS2300 dans la base MySql du serveur Debian (Vesta) à partir de la carte Fox.
- Source du programme de test: fox_ws2300mysql.c
- Compilation: (A partir du répertoire du SDK)
$ cd ~/fox-sdk/devboard-R2_01/ $ . init_env $ cd apps/mysqlclient/ $ gcc-cris -mlinux -isystem /$AXIS_TOP_DIR/target/cris-axis-linux-gnu -lm -o ws2300mysql ws2300mysql.c /$AXIS_TOP_DIR//mysql-5.0.21/libmysql/.libs/libmysqlclient.a /$AXIS_TOP_DIR/mysql-5.0.21/zlib/.libs/libz.a $ cris-strip ws2300mysql $ scp ws2300mysql root@fox:/var
- Test du binaire sur Fox:
[root@fox /root]# /mnt/flash/bin/ws2300mysql 2007-09-24 16:51:09 20.9° 18.3° 58% 67% 0.00km/h WNW 0.0mm 1019.2hP
Programmation Web
Exemple personnel de script CGI qui affiche les données météo (voir ci-dessus) sur la page web:
#!/bin/sh echo "Content-type: text/html\n" # our html code echo "<html>" echo "<head><title>Ws2300 Data</title></head>" echo "<body>" echo "<h2>Ws2300 Data</h2>" echo "<pre>" /mnt/flash/bin/ws2300mysql | while read date time temp_in temp_out hum_in hum_out winspeed winddir rain_total pressure do echo "Date: $date" echo "Heure: $time" echo "Temp.Int: $temp_in" echo "Temp.Ext: $temp_out" echo "Hum.Int: $hum_in" echo "Hum.Ext: $hum_out" echo "Vent: $winspeed" echo "Dir: $winddir" echo "Pluie: $rain_total" echo "Pression: $pressure" done echo "</pre>" echo "</body>" echo "</html>"
Page web affichée:
http://fox/cgi/ws2300cgi.sh
Flasher une nouvelle image sur la carte FOX
How to reflash a FOX Board: http://www.acmesystems.it/?id=703
- Local network flashing
Lorsque la carte FOX redémarre avec JP8 fermé, un code interne va charger en mémoire interne les packets réseaux broadcastés sur le réseau. Le processeur Axis va ensuite executer une partie du code compris dans ces packets et commencer la procédure de flashage.
Cette methode fonctionne seulement en réseau local sans routage IP.
- Flashage à distance
Cette méthode utilise le FTP ou HTTP et peut se faire à distance sur un résezau IP. La "fimage" est téléchargée dans la mémoire flash de la carte FOX . Cette méthode ne focntionne pas si Linux ne tourne pas sur la carte.
Flashage réseau avec Linux
Utilisation des outils fournis avec le SDK Cette méthode necessite que le PC et la carte FOX soient sur le même réseau.
Dans le répertoire root du SDK (./devboard-R2_01/) lancer:
# . init_env # boot_linux -F -i image_filename ...
Si vous n'avez pas installé le SDK, téléchargé seulement l'exécutable etrax100boot et le script boot_linux.
Using internal boot loader: INTERNAL_NW - Network boot (default). Starting boot... We're doing a flash write, this may take up to a few minutes...
A ce moment, il faut éteindre la carte FOX et placer le cavalier sur JP8 (Ethernet flashing).
Rallumer ensuite la carte.
Si tout fonctionne le programme continue avec ces messages:
... 0x80360000: Writing 0x00010000 bytes 0x80370000: Writing 0x00010000 bytes 0x80380000: No need to write 0x80390000: No need to write 0x803a0000: Writing 0x00010000 bytes 0x80000000: Verifying...OK JUMP 0x00000000 END Exiting with code 0
Pendant la programmation, la LED rouge (DL1) de la carte FOX est toujours allumée.
A la fin de la programmation, la carte FOX rédemarre automatiquement.
Note: Ne pas oublier d'enlever le cavalier sur JP8 sinon au prochain boot la carte FOX restera bloquée.
Il y a quelques options qu'il est possible d'utiliser avec la commande boot_linux:
* -d "device" The network interface to use, default is eth0. * -f Save the whole firmware image to flash except the rescue partition. * -F Save the whole firmware image to flash. NOTE that this will overwrite parameters stored in the rescue partition such as the serial number/MAC address. * -h Print help text (information on additional options not showed here) * -i "image" The path and name of the image to use, default is fimage. * -p Print the resulting etraxboot command instead of executing it.
Aprés le flashage, la carte FOX reprend une adresse MAC par défaut: 00:40:8C:CD:00:00
Voir pour la modifier: Modification de l'adresse MAC
Flashage réseau par FTP
Description de la méthode par FTP client
La carte FOX a un serveur FTP qui permet de transférer des fichiers.
Il ya 2 fichiers spéciaux qui permet de reprogrammer la mémoire flash.
Cette procédure qui permet de mettre à jour la partie kernel et la mnt/fash, garde néanmoins l'adresse MAC stockée dans le FLASH bootblock
Les 2 fichiers spéciaux:
* flash that permits to update the FOX FLASH read only partition of the FOX filesystem containing the kernel image maintaining the personal data on the FOX FLASH read write partition.
* flash_all that permits to rewrite completely all tha FLASH memory inside the FOX. All the new data transferred into the FOX after the previous flash_all will be lost.
Il est possible d'utiliser un client ftp quelconque avec ce compte: username root and password pass.
Exemple:
$ftp 192.168.0.90 Connected to 192.168.0.90. 220 Fox Linux Board release 2.00 (mag 26 2005) ready. Name (192.168.0.90): root 331 User name okay, need password. Password: pass 230 User logged in, proceed. Remote system type is UNIX. Using binary mode to transfer files. ftp> put fimage flash_all local: fimage remote: flash_all 227 Entering Passive Mode (192,168,0,90,12,0) 150-Shutting down processes. Preparing system for upgrade ...
Pendant la programmation, la LED rouge (DL1) de la carte FOX est toujours allumée.
Flashage réseau par page WEB
Description de la méthode utilisant un naviguateur.
Sur la page web par défaut disponible sur la carte FOX, il y a 2 liens qui permettent de télécharger une nouvelle image.
* Update FOX firmware - system area
this link enable the update the read only partition of the FOX board containing the kernel image maintaining the
personal data on the FOX Board flash read write partition
* Update FOX firmware - entire system
this link enable to upgrade all the FLASH memory. All the data inside the FOX memory will be overwritten.
Il faut cliquer sur le lien au choix et choisir le fichier image à flasher.
Pendant la programmation, la LED rouge (DL1) de la carte FOX est toujours allumée.
Autres méthodes possibles
- Network flashing sous Windows XP
- Network flashing sous MAC OS X
- Network flashing avec une autre FOX Board
Utilisation de la carte FOX
Test port série ttyS2
Voir page sur le site acme: Using serial ports in C
- Config. port série avec commande stty:
Sur le PC
dan@vesta:bin$ stty 1200 cs7 parenb -crtscts -F /dev/ttyS2 dan@vesta:bin$ stty -a -F /dev/ttyS2 speed 1200 baud; rows 0; columns 0; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0; parenb -parodd cs7 -hupcl -cstopb cread clocal -crtscts ignbrk -brkint ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8 -opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 -isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke
Testé avec /dev/ttyS2 sur port J6 relié au PC avec l'interface à base Max3232.
echo "Bonjour" > /dev/ttyS2 cat /dev/ttyS2
Test bus I2C
Voir page : Using the I2C bus sur le site d'Acme Systems
Méthode User space
Voir exemple source pour piloter le circuit PCF8591 chez Acme System ou en local.
Exemple personnel pour lire un DS1621
(Répertoire de travail : ~/tampon/fox-sdk/devboard-R2_01/apps/perso/i2c_bitbanging-gpiosyscall)
- Shéma du cablâge avec le DS1621:
- Source pour lire le DS1621 (thermomètre/thermostat): Fox ds1621.c
Ceci n'est qu'un programme de test à améliorer selon les besoins.
Quelques modifications et rajouts ont été apportés pour plus de portabilité.
Le port B a été utilisé à la place du G par choix pratique.
- Photos du cablâge
Méthode Kernel driver
Impossibilté pour l'instant de faire fonctionner cette méthode.
Le driver i2c est bien activé dans le kernel (/dev/i2c bien present) mais au lancement du binaire, l'erreur suivante apparait:
[root@fox /tmp]# ./pcf8591d Reading from a PCF8591 (4 chanel A/D at 8 bits with I2C bus) Open error on /dev/i2c (errorno = 6, No such device or address)
Carte FOX avec Interface rs485
Montage perso. fonctionnant sous un PC Debian:
Voir article sur Interface rs485-i2c
Test de l'interface sur la carte FOX:
Streaming Video avec une Webcam USB
Voir page : Video streaming with an USB Webcam sur le site d'Acme Systems
Testé avec une webcam Labtec Webcam Pro
Configuration de l'image
- Rajout pilote: Video For Linux
- Rajout pilote webcam: spca5xx
- Rajout app. Servfox
Lancement manuel du serveur video
[root@axis /root]106# spcaload Using /lib/modules/2.6.15/kernel/drivers/media/video/videodev.ko Using /lib/modules/2.6.15/kernel/drivers/usb/media/spca5xx/spca5xx.ko
[root@axis /root]106# servfox -d /dev/video0 -s 640x480 -w 7070 servfox version: 1.1.3 date: 11:12:2005 (C) mxhaard@magic.fr wrong spca5xx device Waiting .... for connection. CTrl_c to stop !!!!
La video sera visible dans un navigateur sur la page de carte FOX avec le lien ; Video streaming with an USB Webcam
septembre 2007










