TS-7800: Difference between revisions

From embeddedTS Manuals
No edit summary
Line 245: Line 245:


We also provide a 2.6.36 kernel as is.  This will work on the SD card, but you will not be able to restore this SD image to the onboard nand without the correct MBR with the appropriate ATAGS.  The vanilla Linux Kernel also has support for the TS-7800.
We also provide a 2.6.36 kernel as is.  This will work on the SD card, but you will not be able to restore this SD image to the onboard nand without the correct MBR with the appropriate ATAGS.  The vanilla Linux Kernel also has support for the TS-7800.
When you compile source code there are always lots of options for toolchains (soft float vs hard float...) but the two major categories customers really need to know about are version of gcc and version of glibc. The version of gcc is important when compiling the kernel because the kernel is literally millions of lines of code, so a lot of corner cases are encountered in the kernel. As gcc releases new versions, they sometimes change the way they handle corner cases. For example, in one version they may call a certain corner case a warning and let the corner case go by, but in another version they might call it an error and stop compiling. So you need to make sure you have the version of gcc that is compatible with your particular kernel or you may get an error where another version would have given you a warning. For the 7800 use "arm-none-linux-gnueabi-gcc" as the toolchain. The version of glibc is important for people compiling user space applications. libc is the C library where all the standard C functions are implemented.
In order to make things more efficient from a code size standpoint, Technologic Systems put one copy of the libc libraries in user space and let everyone share this one copy as opposed to giving everyone their own copy of the libc library. This is called dynamic linking. Static linking is where each binary has it's own copy of all the libraries it needs. When you compile a program you have to link against a version of the C libraries so the compiler can verify functions like printf() really do exist and you are passing the right arguments and lots of other details the compiler needs to know.
If you link against a version of glibc when you compile it is a really good idea to ensure you have that same version of glibc running on the board. In theory glibc is backwards compatible so if you link against an older version you should be able to run using a newer version, but this isn't always the case. In embedded systems where stability is one of your major concerns taking risks is not a good idea. For really large projects like php or apache it's usually a good idea to take a look at what version of gcc is recommended also, although for the most part this is not an issue for user space programs because the probability of them having code for one of the corner cases gcc may have changed is much lower.


==== Recompiling the Kernel ====
==== Recompiling the Kernel ====

Revision as of 18:03, 2 September 2011

TS-7800
TS-7800.jpg
Product Page
Documentation
Schematic
Mechanical Drawing
FTP Path

Overview

The TS-7800 is a RoHS compliant Single Board Computer (SBC) based on a Marvell MV88F5182 500MHz ARM9 CPU. An internal 32-bit PCI bus provides a standard set of high-end on-board peripherals such as 10/100/1000 ethernet, dual SATA and dual High-Speed host/slave USB 2.0. The TS-7800 features 128MB of DDR-RAM and 512MB of high-speed NAND flash.

Getting Started

A Linux PC is recommended for development. For developers who use Windows, virtualized Linux using VMWare or similar are recommended in order to make the full power of Linux available. The developer will need to be comfortable with Linux anyway in order to work with embedded Linux on the target platform. The main reasons that Linux is useful are:

  • Linux filesystems on the microSD card can be accessed on the PC.
  • More ARM cross-compilers are available.
  • If recovery is needed, a bootable medium can be written.
  • A network filesystem can be served.
  • Builds such as Linux kernel, buildroot, yocto, distro-seed will not work from WSL1/2 on a case insensitive filesystem.
WARNING: Be sure to take appropriate Electrostatic Discharge (ESD) precautions. Disconnect the power source before moving, cabling, or performing any set up procedures. Inappropriate handling may cause damage to the board.

The TS-7800 receives power through the +5VDC power connector with a 1A minimum supply. If you have OP-SWITCHREG there will be a socket connector that will accept 8-30VDC.

Get a Console

The boot messages, by default, are all displayed on COM1 at 115200 baud. The TS-7800 board has Linux installed by default on onboard flash. Upon bootup, The board will boot within 1.1 seconds to a Linux prompt on UART #0 (/dev/ttyS0).

Use a null modem cable to connect the ARM system to your workstation. If you do not have a COM port on your system (as many newer systems do not), you can find a USB serial adapter that will bring out RS232.

Console from Linux

There are many serial clients for Linux, but 3 simple ones would be picocom, screen, and minicom. These examples assume that your COM device is /dev/ttyUSB0 (common for USB adapters), but replace them with the COM device on your workstation.

Linux has a few applications capable of connecting to the board over serial. You can use any of these clients that may be installed or available in your workstation's package manager:

Picocom is a very small and simple client.

picocom -b 115200 /dev/ttyUSB0

Screen is a terminal multiplexer which happens to have serial support.

screen /dev/ttyUSB0 115200

Or a very commonly used client is minicom which is quite powerful:

minicom -s
  • Navigate to 'serial port setup'
  • Type "a" and change location of serial device to '/dev/ttyUSB0' then hit "enter"
  • If needed, modify the settings to match this and hit "esc" when done:
     E - Bps/Par/Bits          : 115200 8N1
     F - Hardware Flow Control : No
     G - Software Flow Control : No
  • Navigate to 'Save setup as dfl', hit "enter", and then "esc"

Console from Windows

Putty is a small simple client available for download here. Open up Device Manager to determine your console port. See the putty configuration image for more details.

Device Manager Putty Configuration

Initrd / Busybox / Fastboot

After the TS-7800 is first booted you will be at this shell:

 >> TS-BOOTROM - built May 11 2011
 >> Copyright (c) 2008, Technologic Systems
 >> Booting from onboard NAND flash...
 .
 .
 .
 .
 Finished booting in 0.69 seconds
 Type 'tshelp' for help
 / #

This is a busybox shell which presents you with a very minimalistic system. This filesystem is loaded into memory, so none of the changes will be saved unless you type 'save', or mount a filesystem as read write. This can also provide a simple mechanism for running your application in an entirely read only environment. The linuxrc script will be the first thing executed as soon as the kernel is loaded. This sets the default IP address, starts the userspace ctl applications, and more. Read the linuxrc for more information.

While busybox itself doesn't contain much functionality, it does mount the Debian partition under /mnt/root/. It will also add common paths and load libraries from the Debian system. Many of the Debian applications will work by default. If an application relies on certain paths being in certain places, or running services, you should instead boot to Debian to run them.

This shell when started on the COM port is what is blocking a Debian boot. If you close it by typing 'exit', the boot process will continue. If you are connected through telnet, this will instead open up its own instance of the shell so typing 'exit' will only end that session. You would have to relink the linuxrc script to always boot to a specific partition from telnet.

The compiled instance of busybox includes internal commands listed below:

/ # /bin/busybox --help
BusyBox v1.7.1 (2008-07-16 14:59:19 MST) multi-call binary
Copyright (C) 1998-2006  Erik Andersen, Rob Landley, and others.
Licensed under GPLv2.  See source distribution for full notice.

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:
	[, [[, ash, basename, cal, catv, chgrp, chmod, chown,
	chroot, cksum, clear, comm, cp, cttyhack, cut, date, dd,
	df, dirname, dmesg, du, echo, egrep, env, eptime, expr,
	false, fdisk, fgrep, find, free, ftpget, ftpput, getopt,
	grep, gunzip, halt, head, hexdump, hostname, ifconfig,
	insmod, kill, killall, ln, ls, lsmod, md5sum, mdev, mkdir,
	mkfifo, mknod, modprobe, more, mount, mtdcp, mv, mvtime,
	netstat, nice, nohup, nslookup, peekpoke, ping, ping6,
	pivot_root, poweroff, printenv, printf, ps, pscan, pwd,
	reboot, rm, rmdir, rmmod, route, rx, sed, setconsole,
	setlogcons, sh, sha1sum, sleep, split, stat, stty, sum,
	sync, tail, tar, tee, telnetd, test, tftp, time, top,
	tr, traceroute, true, tty, udhcpc, umount, uname, unzip,
	uptime, usleep, uudecode, uuencode, vi, wget, which, xargs,
	zcat
Note: You may want to refer to the sources for some of these commands if they are not behaving as you would expect. Busybox implements them so they are incredibly small, but they don't always provide all of the functionality as is in the standard gnu/bash shell commands. Some commands will provide the same functionality like date, but may only work with very specific formats.

We also provide the ts7800.subr which provides the following functions:

 bit_set()
 bit_clr()
 bit_get()
 led0()
 pc104on()
 pc104off()
 tshelp()
 sdmount()
 mtdmount()
 help()

Changing Boot device

The MBR, kernel, and initrd can be loaded from MicroSD, SD, or the onboard flash. Once this is loaded you can boot to any other storage (SATA drive, USB, NFS, etc). JP1 will allow you to pick between booting between the SD card sockets and the onboard flash, but if both SD and MicroSD are populated preference will be given to MicroSD.

Once you are booted to the initrd, you can change the linuxrc script to boot into the full linux installation on any device. We provide several scripts that you can relink to linuxrc:

Script Function
linuxrc-fastboot (default) Boots to a shell. Once the shell is closed (type exit) it will boot to Debian on the full sized SD card.
linuxrc-mtdroot Boots directly to Debian on the onboard flash.
linuxrc-nfsroot Attempts to NFS root to 192.168.0.1:/tsarm-nfsroot. You can edit this script to use your own server host and path.
linuxrc-sdroot Boots directly to Debian on the full sized SD card.

To change the boot device to MicroSD card in these scripts, you can run a sed script on the linuxrc-fastboot or linuxrc-sdroot scripts:

sed --in-place 's/tssdcardb4/tssdcarda4/g' /linuxrc-sdroot

If you want to boot to USB or SATA you may want to modify the linuxrc-sdroot or linuxrc-fastboot to mount your storage device at /mnt/root/.

Jumper Configuration

Jumper Function
JP1 Boot to SD (Otherwise nand)
JP2 User Configurable
JP3 Lowers CPU clock
Note: See the FPGA Register Map for reading the states of the jumpers in software
Note: While JP3 does lower the clock speed, it does not lower power consumption

Backup / Restore

SD Card

If backing up on a separate workstation, keep in mind windows does not have direct block device support needed to write these images. You will also need to determine the SD card device. You can usually find this in the output of 'dmesg' after inserting the SD card and you will typically see something like '/dev/sdb' as the block device and '/dev/sdb1' for the first partition. On some newer kernels you will see '/dev/mmcblk0' as the block device and '/dev/mmcblkop1' for the first partition. For these examples I will use the '/dev/mmcblk0' format. Both of the sd cards will use the same commands, except when backing up or restoring on the TS-7800 you would replace /dev/tssdcarda (MicroSD) or /dev/tssdcardb (SD) depending on which device you want to use. These examples will use /dev/tssdcarda.

If you are backing up directly on the board you will likely need to use some kind of offboard storage like a thumbdrive or external hard drive.


From Workstation


Backup

Entire SD card

dd if=/dev/mmcblk0 of=/path/to/backup.dd bs=32k

Kernel

dd if=/dev/mmcblk0p2 of=/path/to/zImage bs=32k

Initrd

dd if=/dev/mmcblk0p3 of=/path/to/initrd bs=32k

Restore

Entire SD card

dd if=/path/to/backup.dd of=/dev/mmcblk0 bs=32k

Kernel

dd if=/path/to/zImage bs=32k of=/dev/mmcblk0p2

Initrd

dd if=/path/to/initrd bs=32k of=/dev/mmcblk0p3

From TS-7800


Backup

Entire card

dd if=/dev/tssdcarda of=/path/to/backup.dd bs=512

Kernel

dd if=/dev/tssdcarda2 of=/path/to/zImage bs=512

Initrd

dd if=/dev/tssdcarda3 of=/path/to/initrd bs=512

Restore

The entire card from SBC

dd if=/path/to/sdimage.dd of=/dev/tssdcarda conv=sync bs=512

Kernel

dd if=/path/to/zImage of=/dev/tssdcarda2 conv=sync bs=512

Initrd

dd if=/path/to/zImage of=/dev/tssdcarda3 conv=sync bs=512

Onboard Flash

To restore the onboard flash, you must first boot to a 512MB SD image. You can write that image to the onboard flash with this command:

createmtdboot && createmtdroot

This can take approximately 5 minutes.

WARNING: These scripts are only set up to copy the MBR that works with the 2.6.21 kernel image.

Operating Systems

Linux

Our supported OS is Debian 4.0 (Etch). This Marvell processor is also capable of running later EABI distributions. We do provide an EABI lenny distribution as is as well here. So far any of Debian's later distributions should work with this processor as well. If you want to pursue this, look into creating a debootstrap on your boot device.

Debian already has solid documentation for their distribution which you may want to refer to for actual usage of the OS.

Software Development

Linux Kernel

Marvell has strongly promoted running Linux on this chip and has done most of the legwork in creating a patch set to the Linux 2.6 kernels, but we have also had to modify the Linux Kernel (TS-Kernel) so it can support the on-board Flash chip (via mtd drivers) and the SD card driver. The TS-7800 SBC's are shipped standard with full-featured Debian linux operating system utilizing the Linux-boot-Linux boot loader installed in the on-board Flash memory. The supported TS-Kernel used is based upon the version 2.6.21, patched and compiled for the MV 88F5182 processor.

We also provide a 2.6.36 kernel as is. This will work on the SD card, but you will not be able to restore this SD image to the onboard nand without the correct MBR with the appropriate ATAGS. The vanilla Linux Kernel also has support for the TS-7800.

When you compile source code there are always lots of options for toolchains (soft float vs hard float...) but the two major categories customers really need to know about are version of gcc and version of glibc. The version of gcc is important when compiling the kernel because the kernel is literally millions of lines of code, so a lot of corner cases are encountered in the kernel. As gcc releases new versions, they sometimes change the way they handle corner cases. For example, in one version they may call a certain corner case a warning and let the corner case go by, but in another version they might call it an error and stop compiling. So you need to make sure you have the version of gcc that is compatible with your particular kernel or you may get an error where another version would have given you a warning. For the 7800 use "arm-none-linux-gnueabi-gcc" as the toolchain. The version of glibc is important for people compiling user space applications. libc is the C library where all the standard C functions are implemented.

In order to make things more efficient from a code size standpoint, Technologic Systems put one copy of the libc libraries in user space and let everyone share this one copy as opposed to giving everyone their own copy of the libc library. This is called dynamic linking. Static linking is where each binary has it's own copy of all the libraries it needs. When you compile a program you have to link against a version of the C libraries so the compiler can verify functions like printf() really do exist and you are passing the right arguments and lots of other details the compiler needs to know.

If you link against a version of glibc when you compile it is a really good idea to ensure you have that same version of glibc running on the board. In theory glibc is backwards compatible so if you link against an older version you should be able to run using a newer version, but this isn't always the case. In embedded systems where stability is one of your major concerns taking risks is not a good idea. For really large projects like php or apache it's usually a good idea to take a look at what version of gcc is recommended also, although for the most part this is not an issue for user space programs because the probability of them having code for one of the corner cases gcc may have changed is much lower.

Recompiling the Kernel

WARNING: BACKUP YOUR DATA FIRST

Prerequisites

RHEL/Fedora/CentOS:

yum install ncurses-devel ncurses
yum groupinstall "Development Tools" "Development Libraries"
Ubuntu/Debian:
apt-get install build-essential libncurses5-dev libncursesw5-dev

For other distributions, please refer to their documentation to find equivilant tools. Next you need to set up the cross compiler and sources:

# Download the cross compile toolchain (OABI)from Technologic Systems:
wget ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7800-linux/cross-toolchains/ts7800-crosstool-linux-gnueabi-2005q3-2.tar.gz

#Extract to current working directory:
tar xvf ts7800-crosstool-linux-gnueabi-2005q3-2.tar.gz

#Download the kernel sources
wget ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7800-linux/sources/linux-2.6.21-ts-src-latest.tar.gz

#Extract the Kernel Sources
mkdir linux-2.6.21-ts
cd linux-2.6.21-ts
gzip -dc ../linux-2.6.21-ts-src-latest.tar.gz | tar xf -

Edit the Makefile at the kernel root dir to point to the appropriate cross-compiler path. In our case, with the toolchain decompressed into the same directory as the kernel, we'll change line 186 of the Makefile to read:

 CROSS_COMPILE ?= ../arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-

At this point you can configure any additional options with:

make menuconfig

For Example, to include CIFS support, use the arrow and Enter keys to navigate to Filesystems -> Network File Systems -> CIFS Support. Press "y" to include CIFS support into the kernel (alternatively, you could modularize the feature with "m" so you can enable or disable the module on demand which will also enable you to simply copy/paste the cifs.ko into the correct path in the kernel instead of copying the entire kernel (outlined below in appendix)). Keep hitting "exit" until you're prompted to save changes, choose "yes".

After you have made your selection, you can build your kernel and modules with:

make && make modules

The new kernel will be at "arch/arm/boot" in a compressed format called zImage (the uncompressed version is simply called Image, but it is REQUIRED that it be < 3.1MB (3145728 bytes in size). If it does not fit, you can go back in and change any changed options from included (*) to modules (m).

Once you have a zImage that fits, you can copy this to the SD card using the same method in #Backup / Restore.

Modules also will need to be installed. To copy them all to a directory, run:

mkdir newmodules
INSTALL_MOD_PATH=newmodules make modules_install

Now you can copy the contents of newmodules/ to the root of the TS-7800. You may want to remove any old modules on the board in /lib/modules/* before copying them to the board to rule out any incompatibilities.

Once you boot up to the board, you need to run 'depmod' once to calculate module dependencies.

ATAGS

During the initial release of the board we used an internal ATAG identifier that the linux kernel would use to recognize the kernel. When we created the 2.6.36 kernel we had one officially registered with the mainline kernel. This is set in the MBR, so you will have to use the appropriate MBR with the ATAG for your kernel or the kernel will not recognize the board.

Kernel 2.6.21 MBR

Kernel 2.6.36 (and above) MBR

In our official images these will already be written, but you can simply use dd to write these to first 446 bytes of either of the SD cards or mtdcopy for onboard flash.

FAQ

Product Notes

FCC Advisory

This equipment generates, uses, and can radiate radio frequency energy and if not installed and used properly (that is, in strict accordance with the manufacturer's instructions), may cause interference to radio and television reception. It has been type tested and found to comply with the limits for a Class A digital device in accordance with the specifications in Part 15 of FCC Rules, which are designed to provide reasonable protection against such interference when operated in a commercial environment. Operation of this equipment in a residential area is likely to cause interference, in which case the owner will be required to correct the interference at his own expense.

If this equipment does cause interference, which can be determined by turning the unit on and off, the user is encouraged to try the following measures to correct the interference:

Reorient the receiving antenna. Relocate the unit with respect to the receiver. Plug the unit into a different outlet so that the unit and receiver are on different branch circuits. Ensure that mounting screws and connector attachment screws are tightly secured. Ensure that good quality, shielded, and grounded cables are used for all data communications. If necessary, the user should consult the dealer or an experienced radio/television technician for additional suggestions. The following booklets prepared by the Federal Communications Commission (FCC) may also prove helpful:

How to Identify and Resolve Radio-TV Interference Problems (Stock No. 004-000-000345-4) Interface Handbook (Stock No. 004-000-004505-7) These booklets may be purchased from the Superintendent of Documents, U.S. Government Printing Office, Washington, DC 20402.

Limited Warranty

See our Terms and Conditions for more details.