Processing Platform

From OrbSWARM
Revision as of 17:31, 15 January 2010 by Niladri (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Reflash the Daughter Board

On 1-12-10 Niladri installed the toolchain on Lee's Win7 laptop and was able to reflash the 7800 SPU with a new firmware. Here's how: First, install the toolchain...

Note that we found the version of AVRDude installed with WinAVR had a problem. We saw the following error until reinstalling a fresh version of AVRdude. The workaround instructions are here http://tom-itx.dyndns.org:81/~webpage/usbtiny_programmer/testing_index.php
C:\Users\Lee>avrdude -c usbtiny -p m8
avrdude: error: no usb support. Please compile again with libusb installed.
avrdude: programmer operation not supported

On Lee's laptop run the following to reflash the SPU

Lee@Lee-PC /cygdrive/c/SWARM-SVN/swarm/dboard/atmega168
$ /cygdrive/c/avrdude/avrdude.exe -v -c usbtiny -p m168 -U flsh:w:dboard.hex

TS 7800 SPU

6 Technologic 7800's arrived. Some are in the hands of SWARMies

  • 1 to Dillo
  • 1 to Rick Taylor (maybe he's buying it)
  • 1 to Michael


see here for the older 7260-based Old_SPU info (now superseded by the TS-7800)


embedded ARM board

The TS-7200 Yahoo group is the first place to look when you have questions or issues: http://tech.groups.yahoo.com/group/ts-7000/

There's a lot of supplemental data right here on the Wiki at SPU_ARM_Board

IP addresses

Orbs are addressed (and named) by their least significant IP octet (the last number).


The 7800s are Debian-based and have a pretty full-featured install flashed onto them. Hence they are using the Debian directory structure which places networking parameters under /etc/network with additional options in one of several files under /etc/default.

The 7800s by default come up on IP address 192.168.0.50 for both eth0 and eth1. This is not really a problem for us since we have just the one eth0 interface and will be using that only for maintenance and debugging.

You will want to change the 3rd octet of this to 1. So 192.168.1.x instead of 192.168.0.x

IP addresses are set on the 7800s by editing the file /etc/network/interfaces. It looks like this:


# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.

auto lo
iface lo inet loopback

auto eth0

iface eth0 inet static
      address 192.168.0.50
      network 192.168.0.0
      netmask 255.255.255.0
      broadcast 192.168.0.255
      gateway 192.168.0.1
iface eth1 inet static
      address 192.168.1.50
      network 192.168.1.0
      netmask 255.255.255.0
      broadcast 192.168.1.255

   * 192.168.1.60
   * 192.168.1.61
   * 192.168.1.62
   * 192.168.1.63
   * 192.168.1.64
   * 192.168.1.65 

(for future use/development)

   * 192.168.1.66
   * 192.168.1.67
   * 192.168.1.68
   * 192.168.1.69 

Port List

This is a canonical list of which modules talk to which TS-7280 ports.

The aggregator is on COM2 is /dev/ttyS1 at 38400 kbaud. You need to comment out the getty in /etc/inittab

The daughterboard is on /dev/ttts4, at 115kbaud

The illuminators and sound module are on /dev/ttts5, at 38400 baud


Protocols

If you need a refresher on serial communication (I did!) this is a good one: http://www.easysw.com/~mike/serial/serial.html#2_1

Serial protocols for the various modules are linked to from here. If you change or modify a protocol, make sure the person on the other end knows about it!


Daughterboard API: http://svn.lee.org/swarm/trunk/dboard/daughterboard_API.txt

Illuminator API: http://svn.lee.org/swarm/trunk/Illuminator/illuminator_src/Illuminator_API.txt

SPU configuration

See SPU_research for kernel config, etc.

TS7800 downloads are here (under the "resources" tab): http://www.embeddedarm.com/products/board-detail.php?product=TS-7800


Config info from http://www.embeddedarm.com/documentation/ts-7800-gs-sheet.pdf (Mirrored on svn in media/datasheets)

Should you wish to automatically bypass the fastboot and proceed directly into starting the SD card version of Linux, you can do so with the following command issued to the fastboot shell:

ln -sf /linuxrc-sdroot /linuxrc; save

For the onboard flash the command is:

ln -sf /linuxrc-mtdroot /linuxrc; save

To get back to the fastboot shell, you can do so by placing the file "/fastboot" in the root directory of the filesystem. The '/linuxrc' file is a shell script that is the very first thing run by the kernel on startup.

System software and utilities (updaterc.d, spumond, etc.)

Kill the getty on COM2 (/dev/ttS1) by commenting out the line in /etc/initrc

In addition to kernel modules/drivers, there are some things that exist on the SPU and live somewhere between the kernel/driver level and the dispatcher/application level.

  • spumond - spumond is a pretty simple program but with an important job: Keep watch over whatever program is handed to it and restart it if it dies, ad-infinitum if necessary. By running the dispatcher inside spumond, we try to make sure that if the Orb ever stops responding, it probably won't be because the dispatcher crashed and didn't restart.

spumond is started either from the command line or from a startup script like so:

spumond <full-path-to-executable>

So spumond /root/dispatcher & will yield:

Using /root/dispatcher
Launched /root/dispatcher with pid 1009

If dispatcher ever died you would see something like this redirected to stderr:

ACK! /root/dispatcher died unexpectedly!!
Restarting /root/dispatcher...
Launching /root/dispatcher..
Launched /root/dispatcher with pid 1027

spumond can run any ARM binary executable, it doesn't have to be used to monitor just dispatcher. In fact, you could probably run multiple spumond processes to watch multiple critical tasks if you wanted.

The spumond code lives under the swarm/trunk/spu/src tree in SVN.

  • update-rc.d One thing you might have noticed with the 7800-series SPUs is that they come with a much fuller, more complete install of Debian. Which is great if you want to run a webserver or MySQL out of your NAND flash, but we don't. So we need to turn most of these off without trashing the install itself. It turns out thatDebian has thought of this.

Normally update-rc.d is run as part of a pre/postinstall stanza in a .deb package. It gets called to add/remove the startup/shutdown scripts in /etc/init.d and /etc/rc[0-6].d as part of installing or removing a package. You can use it from the command line however, to turn on/off services that you don't want to start at boot, but that you want to keep on the system.

You do this like so:

/usr/sbin/update-rc.d -f <program/service> remove

Here's an example where we turn off NFS services:

root@ts7800:root# update-rc.d -f nfs-common remove  
update-rc.d: /etc/init.d/nfs-common exists during rc.d purge (continuing)
 Removing any system startup links for /etc/init.d/nfs-common ...
   /etc/rc0.d/K20nfs-common
   /etc/rc1.d/K20nfs-common
   /etc/rc2.d/S20nfs-common
   /etc/rc3.d/S20nfs-common
   /etc/rc4.d/S20nfs-common
   /etc/rc5.d/S20nfs-common
   /etc/rc6.d/K20nfs-common
root@ts7800:root# 

Reversing this is as simple as:

update-rc.d nfs-common defaults

SPU-holders will want to run these on their 7800 to shut off services we won't be using (now) on the Orbs.

update-rc.d -f mysql-ndb remove
update-rc.d -f apache2 remove
update-rc.d -f mysql remove
update-rc.d -f exim4 remove

If the last one doesn't work then to kill the MTA (which takes forever to boot)

dpkg --purge mailx exim4-daemon-light
dpkg --purge exim4

Now that you've done that, there are a few remaining steps to get things in place for spumond to run on the 7800.

compile spumond.c and upload the binary onto the SPU. Place it in /usr/sbin with 0755 permissions(rwxr-x-r-x).

cp spumond /usr/sbin/spumond

cp spumond.init /etc/init.d/spumond

cd /etc/rcS.d

ln -s ../spumond S37spumond

Should give you a directory that looks something like:

total 200
-rw-r--r--   1 root  root  701 Oct 19  2007 README
lrwxr-xr-x   1 root  root   18 Jul 23 22:51 S01glibc.sh -> ../init.d/glibc.sh
lrwxr-xr-x   1 root  root   21 Jul 23 22:51 S02mountvirtfs -> ../init.d/mountvirtfs
lrwxr-xr-x   1 root  root   14 Jul 23 22:51 S03udev -> ../init.d/udev
.
.
.
lrwxr-xr-x   1 root  root   19 Jul 23 22:51 S36udev-mtab -> ../init.d/udev-mtab
lrwxr-xr-x   1 root  root   17 Jul 23 22:51 S37spumond -> ../init.d/spumond
lrwxr-xr-x   1 root  root   18 Jul 23 22:51 S38pppd-dns -> ../init.d/pppd-dns
lrwxr-xr-x   1 root  root   18 Jul 23 22:51 S39ifupdown -> ../init.d/ifupdown
.
.
.

An alternate method is to use the spumon.sh script.

in /etc/init.d make a shell script /etc/init.d/spumon that says

if [ "$1" == "start" ]; then
   nohup /root/spumon.sh >/dev/null 2>/dev/null &
fi
chmod +x  /etc/init.d/spumon

Then make a symbolic link

 cd /etc/rcS.d/
 ln -sf ../init.d/spumon S37spumon

Make sure the /root/spumon.sh (from the dispatcher svn directory) is there and chmod +x

Change spumon.sh to change the process that automatically runs (right now joypatcher)

copying files using scp

scp <filename> eclipse@192.168.1.65:/root/ pw: eclipse


Emulation

Instructions to set up an emulated environment on your Linux box to run ARM code are on the QEMU page.

Flashing a New Root Filesystem

Download the latest filesystem tarball from ftp://ftp.embeddedarm.com/

Mount an SD card on your laptop. Unzip the package onto the SD Card and untar. You want all the top level directories (e.g. usr/, bin/, etc) in the top level of card, as well as the tar file. You may need to do the "tar" command as root or with sudo, so that it can create special files and preserve file ownership. Example commands run on your laptop:

IMG=debian-sarge-udev-512MB-latest.tar.gz
wget ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7800-linux/distributions/$IMG
cp $IMG /mnt/media1/image.tar.gz
cd /mnt/media1
gzip -d image.tar.gz
sudo tar xvf image.tar
cd
umount /mnt/media1

Be sure to unmount the card before removing. Then plug it into the TS-7800.

Boot TS-7800 into monitor mode (initrd only, no mounted root filesystem).

The SD card should be present as e.g. /dev/tscard2. It should be reported in the bootup messages (or by typing "dmesg"). To see a list of block devices type

ls -l /dev | grep ^b

Ignore loopN, ramN, and mtdblockN; whatever is left should be the various partitions of the SD card.

Mount the SD card, for example

mount /dev/tscard2 /mnt/root

If your flash filesystem is not empty, reformat it using the eraseall program on the SD card. For example:

eraseall /dev/mtd3

or if eraseall is not in your path:

/mnt/root/usr/local/bin/eraseall /dev/mtd3

Note mtd3 is the character (byte) interface to the flash filesystem partition, while mtdblock3 is the block (disk) interface.

Now mount the NAND Flash disk and untar the image there:

mkdir /mnt/mtd
mount /dev/mtdblock3 /mnt/mtd 
cd /mnt/mtd
tar xvf /mnt/root/image.tar

Watch for errors. If there is an error at the end on /var/spool/exim4 this seems to be OK.

Unmount the SD card from /mnt/root and mount the NAND flash there. Exit the initrd. The kernel should now boot with the flash disk as root filesystem.

umount /mnt/root
umount /mnt/mtd
mount /dev/mtdblock3 /mnt/root
exit

If this does not work it may be necessary to power cycle, or you may have to point the /linuxrc symlink in monitor mode to /linuxrc-mtdroot or so.

Personal tools
Namespaces

Variants
Actions
The SWARM Project
Tools