VIPER RedBoot and Arcom Embedded PC/104 400MHz PXA255 Single Board Computer Quickstart Manual

Product Information

Full information about other Arcom products is available by contacting our Website at: www.arcom.com Useful Contact Information

Customer Support US Customer Support Europe Tel: 913 549 1000 Tel: +44 (0)1223 412 428 Fax: 913 549 1002 Fax: +44 (0)1223 403 409 E-mail: [email protected] E-mail: [email protected]

Sales offices Sales hotlines United States: United Kingdom: Belgium: Germany: Italy: Arcom Arcom Groen Nummer: Kostenlose Infoline: Numero Verde: 7500 West 161st Street Clifton Road Tel: 0800 7 3192 Tel: 08001 824 511 Tel: 0800 790841 Overland Park Cambridge Fax: 0800 7 3191 Fax: 08001 824 512 Fax: 0800 780841 KS 66085, USA CB1 7EA, UK Tel: 913 549 1000 Tel: 01223 411 200 France: Netherlands: Fax: 913 549 1002 Fax: 01223 410 457 Numero Vert: Gratis Nummer: Tel: 0800 90 84 06 Tel: 0800 0221136 Fax: 0800 90 84 12 Fax: 0800 0221148 E-mail: E-mail: [email protected] [email protected]

Whilst Arcom’s sales team is always available to assist you in making your decision, the final choice of boards or systems is solely and wholly the responsibility of the buyer. Arcom’s entire liability in respect of the boards or systems is as set out in Arcom’s standard terms and conditions of sale.

If you intend to write your own low level software, you can start with the source code supplied by Arcom. This is example code only to illustrate use on Arcom’s products. It has not been commercially tested. No warranty is made in respect of this code and Arcom shall incur no Arcom Control Systems Ltd liability whatsoever or howsoever arising from any use made of the code. operate a company-wide quality management system which has © 2003 Arcom Control Systems Ltd. been certified by the British Arcom Control Systems is a subsidiary of Spectris plc Standards Institution (BSI) as All trademarks recognized. compliant with ISO9001:2000 2192-12113-000-000

Contents

Contents ...... 2 Revision History ...... 2 Preface...... 3 Definition ...... 3 Disclaimer...... 3 Environmental ...... 3 Anti-Static Handling...... 3 Packaging...... 3 Acknowledgements ...... 3 Technical Support ...... 4 Getting Started...... 5 What’s in the Kit? ...... 5 What Else Do I Need?...... 5 What Peripherals are Supported? ...... 5 Unpacking & Connecting Up ...... 6 Power Supply...... 7 RedBoot...... 7 What Is RedBoot? ...... 7 Configuring and Using RedBoot...... 8 The RedBoot Flash Configuration Block ...... 8 Loading an Image...... 8 Managing Images in Flash ...... 9 Executing an Image...... 10 Arcom Embedded Linux ...... 12 What is in Arcom Embedded Linux? ...... 12 the System ...... 12 The File System ...... 13 Setting up Networking ...... 14 Support Software...... 14 Target Support Software ...... 14 Detailed Information...... 15

Revision History

Manual Date Comments Issue A 26th June 2003 First release of Manual

Page 2 2192-12113-000-000

Preface Definition Arcom is the trading name for Arcom Control Systems Inc and Arcom Control Systems Ltd.

Disclaimer The information in this manual has been carefully checked and is believed to be accurate. Arcom assumes no responsibility for any infringement of patents or other rights of third parties that may result from its use.

Arcom assumes no responsibility for any inaccuracies that may be contained in this document. Arcom makes no commitment to update or keep current the information contained in this manual.

Arcom reserves the right to make improvements to this document and/or product at any time and without notice.

Environmental The VIPER Enclosure is fitted with the VIPER-UPS. The battery fitted to the VIPER-UPS is a 7- cell battery pack containing Varta V500 HRT NiMH (Nickel Metal Hydride) cells. These cells contain 0% Lead, 0% Mercury and 0% Cadmium.

Anti-Static Handling The SBC and other circuit boards fitted inside the VIPER ICE contain CMOS devices. These could be damaged in the event of static electricity being discharged through them. At all times, please observe anti-static precautions when handling circuit boards. This includes storing boards in appropriate anti-static packaging and wearing a wrist strap when handling.

Packaging In the event of having to send this product back to Arcom for repair please use adequate packaging to ensure safe transportation.

Acknowledgements Linux is a registered trademark of Linus Torvalds.

Red HatTM is a registered trademark of Red Hat, Inc. This product contains copies of the Red Hat Linux 7.3 installation CD’s. These are not a product of Red Hat, Inc. and are not endorsed by Red Hat, Inc. They are a product of Arcom and we have no relationship with Red Hat, Inc. The CDs are identical in every respect to a standard Red Hat Linux 7.3 CD set.

Java and all Java-based trademarks are trademarks of Sun Microsystems in the United States, other countries or both.

Page 3 2192-12113-000-000

WebSphere is a registered trademark of IBM Corporation in the United States and other countries.

ARM and StrongARM are registered trademarks of ARM, Ltd.

Intel and XScale are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

All other trademarks and copyrights referred to are the property of their respective owners.

This product includes software developed by the University of California, Berkeley and its contributors.

Technical Support Arcom has a team of technical support engineers who will be able to provide assistance if you have any problems with this product:

US [email protected] Tel +1 913 549 1000 Europe [email protected] Tel +44(0) 1223 412 428

Page 4 2192-12113-000-000

Getting Started What’s in the Kit? The VIPER RedBoot and Arcom Embedded Linux Development Kit includes the following items:

• Processor board and Industrial Compact Enclosure (ICE) VIPER-400-M64-F16 • Optional LCD Flat Panel and Touch Screen (in enclosure) • +24V @ 2.5A max (85-264 VAC input) power supply • Power supply interface cable • US, UK or EURO power cords • Crossover RJ45 Ethernet cable • Null modem cable • VIPER RedBoot and Arcom Embedded Linux Quick Start manual (this document) • Development Kit storage case

In addition the Arcom Embedded Linux Development Kit includes the following:

• Arcom Embedded Linux support and Installation CD • RedHat Linux 7.3 OEM (3 CD’s) • Arcom Embedded Linux Technical Manual (on CD) • WebSphere Studio Device Developer Technical Manual (on CD)

What Else Do I Need? You will need a host system capable of running the Arcom Embedded Linux Host Environment. Arcom recommends Red Hat Linux 7.3 or greater as a host system.

In addition, the following information may be useful. • Networking details for the VIPER. If your network does not have a DHCP server, consult your network or system administrator for the following: o IP address and subnet mask (netmask) o Default gateway IP address (if required) o Nameserver (DNS) IP address (optional) • Networking details for the host machine.

What Peripherals are Supported? Linux supports the following peripherals in this release:

1. 5 UARTs, COM1 through COM5 including the internal FFUART, BTUART and STUART 2. On board Flash array 3. CompactFlash+ 4. Ethernet interface 5. Audio 6. Supplied flat panel running at 320x240 (optional) 7. Touchscreen 8. Basic Power Management 9. GPIO

Page 5 2192-12113-000-000

10. Real Time Clock

Linux will support the following peripherals in a future release:

11. SRAM 12. USB host controller 13. Full power management 14. Support for a wider range of flat panel devices 15. Drivers for a range of Arcom PC104 peripheral boards

Unpacking & Connecting Up

This section guides you through the step-by-step process of connecting up the VIPER board for the first time and powering up the system. The VIPER is delivered 'Ready to Run'. There are no link settings or configuration switches that need adjusting to ensure that the board will operate. Remember that a number of the components are static sensitive and so standard anti-static precautions must be taken during use. If you follow the steps described, the board will automatically power up and load the RedBoot bootloader from the on board Flash array. If you have an Arcom Embedded Linux Development Kit will then it will continue to automatically load and boot Linux. The locations of the connectors referenced are shown on the following diagram.

1. Remove the VIPER ICE (Industrial Compact Enclosure) from the development it packaging. If it shows any signs of damage during transit please contact Arcom before proceeding. 2. Fit the VIPER power supply interface cable to the socket on the enclosure and to the power supply adapter. Fit the mains cable.

Page 6 2192-12113-000-000

3. Connect a serial terminal emulator1 to COM1 using the supplied NULL modem cable 4. Configure the serial terminal to 115200 baud, no parity, 8 data bits and no handshaking. 5. Once the terminal emulator is set up on the Host PC, switch on the VIPER Board 6. The VIPER will start to initialise the board and display information on Host PC screen 7. The next step depends on whether you have a basic RedBoot Development Kit or an Arcom Embedded Linux Development Kit

a. If you have a RedBoot Development Kit then you will be dropped to the RedBoot command prompt where you can upload and execute your application.The section “Configuring and Using RedBoot” on page 7 describes the facilities available to do this

b. If you have an Arcom Embedded Linux Development Kit then the Linux will be loaded from the on board Flash array and the board will display a Linux prompt. Arcom Embedded Linux is described in “Arcom Embedded Linux” on page 12 and in the Arcom Embedded Linux Technical Manual in the directory /manuals/ on the Development Kit CD

Power Supply

The AC PSU supplied in the kit is rated at 2.5A @ +24V DC. This is designed to support the requirements of the VIPER ICE. If additional devices are powered from this supply please ensure that the overall current rating is not exceeded.

The UPS signal /POWER_DOWN is connected to D0 in PL8 of the VIPER board. This allows the UPS to be shut down using GPIO20.

RedBoot What Is RedBoot? RedBoot is a complete bootstrap environment for embedded systems. Based on the eCos Layer, RedBoot inherits the eCos qualities of reliability, compactness, configurability, and portability.

RedBoot allows download and execution of embedded applications via serial or Ethernet, including embedded Linux and eCos applications. It can be used for both product development (debug support) and in deployed products in the field (flash update and network booting).

Ethernet download and debug support is included, allowing RedBoot to retrieve its IP parameters via BOOTP or DHCP, and program images to be downloaded using TFTP. Images can also be downloaded over serial, using X- or Y-modem.

RedBoot can be used to communicate with GDB (the GNU Debugger) to debug applications via serial or Ethernet, including the ability to interrupt a running application started by GDB.

An interactive command-line interface is provided to allow management of the Flash images, image download, RedBoot configuration, etc., accessible via serial or Ethernet. For unattended

1 Such as Minicom running on Linux PC or Hyper Terminal on a Windows PC.

Page 7 2192-12113-000-000 or automated startup, boot scripts can be stored in Flash allowing for example loading of images from Flash or a TFTP server.

Configuring and Using RedBoot This section provides a brief outline of the RedBoot commands available on the VIPER. For more detailed information please consult the eCos Reference Manual which is available in /manuals/ on the Development Kit CD. Help can also be obtained on individual RedBoot commands by typing help .

The RedBoot Flash Configuration Block RedBoot contains a Flash config system (fconfig) that contains information such as a boot script and networking configuration. The options can be examined and modified using the fconfig command. If called with no parameters fconfig will prompt you for each available option in turn. Alternatively fconfig can take the following options

fconfig [-I] [-l] [-n] [-d] nickname [value]

-i Initialize the Flash configuration block to default values. -l List the settings in the Flash configuration block -n Use nicknames rather than fullnames nickname Only act on the named configuration item value Value to set to

The most interesting configuration options are those that allow the option to use bootp or a static network configuration to configure the onboard Ethernet and the option to run a script at boot. Typically the script would use the commands below to load the application. e.g. fis load application go 0x200000

If you have a Linux Development Kit then the boot script is set out of the box to fis load kernel exec

Loading an Image Applications can be downloaded to the VIPER via serial line (using Xmodem) or via TFTP. The load command takes the following parameters: load [-r] [-b ] [-h ] [-m ]

-r Load a raw image. The default is to load an SREC format image -m Specify the transfer type. Can be ‘tftp’ or ‘xmodem’ -h Specifies the address of the tftp server if you are using the tftp method. The default is to use the address given in the Flash configuration block or the address supplied by the bootp server. -b Specifies the address to load the image to. The name of the file to load if you are using tftp.

For example:

Page 8 2192-12113-000-000

load –r –b 0x200000 –m tftp application.img would load the raw file application.img from the default tftp server to address 0x200000.

Managing Images in Flash RedBoot manages the Flash memory using the Flash Image System (FIS). FIS provides a simple way to partition the Flash device and to specify the properties of the images in each partition. Each image has the following properties

Name A descriptive name for the image. Flash Base The virtual address of the base of the image in Flash. The address is absolute not relative to the start of the Flash. Memory Base The virtual address of the address in memory that the image should be loaded to by the fis load command. Size The total length of the image Data Length The length of the data currently stored in the image Entry Point The entry point of the image. Usually this is equal to the Flash base (for execute in place images) or the memory base.

The FIS table is initialized using the fis init command and you can view the current Flash partition list using the command fis list.

An Arcom Embedded Linux Development Kit has the following FIS directory by default.

Name Flash Address Length FIS Directory 0x00000000 0x00001000 RedBoot Config 0x0001F000 0x0001F000 kernel 0x00020000 0x000A0000 filesystem 0x000C0000 0x00F40000

A RedBoot Development Kit only contains the FIS Directory and RedBoot Config entries.

Images are created in the FIS table using the fis create command. The fis create command takes the following parameters: fis create –b -l [-s ] [-f ] [-e ] [-r ] [-n]

Page 9 2192-12113-000-000

-b The address in memory of the image to write to Flash. Defaults to the last image loaded by the load command -l The length of the image in Flash. Defaults to the length of an existing image with the same name or to the size of the last image loaded with the load command (rounded up to a whole erase block). Corresponds to the Size property above -s The length of the data stored in this imag. Defaults to the length of the last image loaded with load (rounded up to a complete erase block). Corresponds to the Data Length property above -f The address in Flash where this image resides. Corresponds to flash base above. -e The entry point of this image. Defaults to the base address of the last image loaded with the load command. Corresponds to Entry Point above -r The address this image should be loaded to. Defaults to the address given by –b above. Corresponds to Memory Base above -n If given then then fis create will only update the image table and not the image itself. The name of the image

For example: fis create –f 0x50002000 –l 0xfe000 –b 0x200000 –e 0x200000 –n application will create an image table entry named “application”, it does not update the image itself. The image resides from 0x50002000 to 0x50100000 and has memory address and entry point of 0x200000.

The following command will update the data stored in the “application” image with an image downloaded via tftp: load –r –b 0x200000 –m tftp application.img fis create application The fis create command derives defaults for its –s and –b parameters from the load command.

An image can be loaded from Flash into RAM using the fis load command, for example, to load the image created above to address 0x200000 (the RAM address for the image) fis load application

Executing an Image RedBoot runs with the memory management unit (MMU) enabled in order to remap certain peripherals (see the VIPER Technical Manual for details).

The go command will jump directly to the supplied virtual address (or the entry address of the most recently loaded image if none is given, this could be specified by the FIS table entry or may default to the load address of the image). The MMU is left enabled and setup as described in the VIPER technical manual, in addition the processor will be placed into supervisor (SVC)

Page 10 2192-12113-000-000 mode. For example if your application binary is linked to run at virtual address 0x200000 (which is in RAM while the MMU is enabled) then the following command would jump to the application go 0x200000 At this point control is transferred directly to your application at 0x200000. The application may choose to continue using the existing MMU settings or may tear down the current configuration and reinitialize using the desired options.

In addition to the go command there also exists the exec command that will disable the MMU before jumping to the physical address supplied. The exec command is provided largely with the purpose of executing a Linux kernel image but could be used to launch any application. The main requirement is that the image must be linked to be loaded at physical address 0xa0200000 since the exec command will copy the image from the provided virtual address to this address. The entry point doesn’t necessarily have to be at 0xa0200000, although this would be a common configuration. For example if your application has been loaded into RAM at virtual address 0x300000 and is linked to be loaded at physical address 0xa0200000 with an entry point at 0xa0200100 (0x100 bytes into the image). exec –b 0x300000 –l 0x100000 0xa0200100 This command will copy 0x100000 bytes from virtual address 0x300000 to 0xa0200000 and then disable the MMU and interrupts, setup the initial environment (see below) and then jump to physical address 0xa0200100. As with the go command the processor is placed into supervisor mode (SVC) before jumping to the application.

The exec command can take the following parameters: exec [–b ] [-l ] [–c “command line”] []

-b The physical base address of the image. This will default to the base address of the last loaded image. -l The length in bytes of the image. This will default to the length of the last image loaded. -c “” The command line to pass to the application The physical address of the entry point of the application. The application is always relocated to physical address 0xa02000000 but the entry point may be elsewhere.

The exec command passes several values to the launched application according to the ARM Linux boot loader guidelines, these guidelines are described on the ARM Linux website at http://www.arm.linux.org.uk and in Documentation/arm/Booting in the Linux kernel source tree. According to the guidelines, r0 will always be zero, r1 will always be set to 283 indicating a VIPER platform and r2 will be a pointer to a Linux tagged parameter list2. The tagged parameter list is described in include/asm-arm/setup.h in the Linux kernel source code. The most useful tags are ATAG_MEM and ATAG_CMDLINE.

Each tag consists of a header and then some tag specific data. The header is specified as: struct tag_header { u32 size; /* Length of header + data */ u32 tag; /* Tag identifier */

2 The use of r2 in the Linux ARM boot loader guidelines has been recently introduced in place of the old scheme that placed the parameter list at a fixed physical address. In order to support a clean transition the contents of r2 on the VIPER is currently guaranteed to be 0xa0000100. In the future this may change.

Page 11 2192-12113-000-000

RedBoot will pass a subset of the following tags.

Name ATAG_CORE Identifier 0x54410001 Comment This tag must always be first and specifies Linux specific configuration information. Data struct tag_core { u32 flags; /* Bit 0 == Readonly */ u32 pagesize; /* Linux page size */ u32 rootdev; /* Linux root device */ };

Name ATAG_MEM Identifier 0x54410002 Comment This tag specifies the amount of RAM fitted to the board. Data struct tag_mem32 { u32 size; /* Total ammount of RAM installed */ u32 start; /* Physical address of RAM */ };

Name ATAG_CMDLINE Identifier 0x54410009 Comment This tag is included if the –c parameter is passed to the exec command. It is a variable length tag. Data struct tag_cmdline { char cmdline[1]; /* Minimum size */ };

Name ATAG_NONE Identifier 0x00000000 Comment This tag signals the end of the tag list Data None

Arcom Embedded Linux What is in Arcom Embedded Linux? Arcom Embedded Linux is a space optimized standard Linux including many of the standard file, shell and text utilities. In addition there are: • Telnet, FTP, HTTP servers and Telnet, FTP clients • OpenSSH (Secure Shell)

For a complete list of software and how to add and remove packages please consult the technical manual supplied on the CD.

Booting the System Once the system has been connected and powered up as described in “Unpacking & Connecting Up” on page 6. Then the board will automatically boot to a Linux prompt.

Page 12 2192-12113-000-000

Uncompressing Linux...... done, booting the kernel. Linux version 2.4.19-rmk7-pxa2-arcom1 CPU: XScale-PXA255 revision 6 Machine: Arcom VIPER SBC Memory clock: 99.53MHz (*27) Run Mode clock: 199.07MHz (*2) Turbo Mode clock: 199.07MHz (*1.0, active) On node 0 totalpages: 16384 zone(0): 16384 pages. zone(1): 0 pages. zone(2): 0 pages. Kernel command line: ro console=ttyS0,115200n8 root=/dev/mtdblock3 Console: colour dummy device 80x30 Calibrating delay loop... 198.65 BogoMIPS Memory: 64MB = 64MB total Memory: 63420KB available (1042K code, 265K data, 60K init) Dentry cache hash table entries: 8192 (order: 4, 65536 bytes) Inode cache hash table entries: 4096 (order: 3, 32768 bytes) Mount-cache hash table entries: 1024 (order: 1, 8192 bytes) Buffer-cache hash table entries: 4096 (order: 2, 16384 bytes) Page-cache hash table entries: 16384 (order: 4, 65536 bytes) POSIX conformance testing by UNIFIX Linux NET4.0 for Linux 2.4 Based upon Swansea University Computer Society NET3.039 Initializing RT netlink socket ... Using PXA255 frequency points. Registering CPU frequency change support. CPU clock: 199.065 MHz (99.000-400.000 MHz) Creating 4 MTD partitions on "VIPER Application Flash": ... 0x00000000-0x0001f000 : "FIS directory" 0x0001f000-0x00020000 : "RedBoot config" 0x00020000-0x000c0000 : "kernel" 0x000c0000-0x01000000 : "filesystem" ... Initializing random number generator... done. INIT: Entering runlevel: 3 Starting system log daemon: syslogd. Note: If you do not have a DHCP server and you Starting kernel log daemon: klogd. have not configured a static IP address then the Starting DHCP client: eth0. board will pause at this point while it searches for Loading /etc/config/console/keymap.gz Starting PCMCIA services: done. a DHCP server. See “Setting up Networking “. Starting internet superserver: inetd. Starting http server: thttpd. Starting OpenBSD Secure Shell Server: sshd. Starting periodic command scheduler: cron.

Arcom Embedded Linux 3.1 (ttyS0) viper login:

The File System The file system used on the VIPER Flash is a compressed Journaling Flash File System (JFFS2). JFFS2 has the following advantages: • Robust • Power fail safe • No integrity scan (fsck) is required at boot time • Flash wear leveling • Transparent compression with a typical compression ratio of 2:1 The onboard Flash has been divided into two partitions (boot partition and root file system).

In addition a 4 Megabyte tmpfs filesystem is mounted on /var/tmp for temporary files - these will be lost after a reboot.

Page 13 2192-12113-000-000

Setting up Networking As supplied the board will use the DHCP protocol to configure the network. This requires a DHCP server to be available on your network. For details please consult your network administrator. To configure the VIPER to use a static IP address carry out the following steps:

1. Login to the VIPER (Login name root password arcom). 2. Change to the interfaces directory cd /etc/config/network/interfaces 3. Edit the file eth0 using the nano editor nano eth0 4. Modify the file to look like the following (substituting your ip address and netmask) DEVICE=eth0 USEDHCP=no IPADDR=10.7.28.2 NETMASK=255.255.0.0 5. Press Ctrl-O to save the file and the Ctrl-X to exit. 6. Set up a Domain Name Server (DNS) if required. This is needed if you wish to use Domain names (e.g. www.arcom.com) when accessing the Internet. To setup DNS edit the file: ‘/etc/resolv.conf ‘ and add your DNS server address as follows nameserver 10.7.1.9 7. Set up default gateway if required, by creating and editing the file ‘/etc/config/network/routes/gateway‘ with you own gateway address. GATEWAY=10.7.1.1 8. Reinitialize the networking by typing /etc/init.d/network restart

Chapters 25 and 26 of the RUTE Manual (in /manuals/ on the Development Kit CD) contain a useful introduction to TCP/IP networking.

Support Software Target Support Software Building applications for the VIPER board requires the use of the Arcom Embedded Linux Host Environment. This is a set of utilities that provide a cross compile environment targeting the VIPER board. A cross compile environment is required in order to produce binaries for the XScale processor.

Consult the Arcom Embedded Linux Technical Manual for the details of how to install the host environment.

In addition the CD includes example source code for utilizing the Arcom specific device drivers and utility programs.

Also included is IBM WebSphere Studio Device Developer IDE, which you may wish to use to build and test application on your host system before downloading to the VIPER board.

To install the WSDD IDE on your host system follow the instructions given in the WebSphere Studio Device Developer Technical Manual, found in /manuals/ on the Development Kit CD.

Page 14 2192-12113-000-000

Detailed Information The following detailed information can be found in the Arcom Embedded Linux Technical Manual, which can be found on the CD.

• Detailed Software List • File System Layout • Configuration files and boot scripts • Making an Application Run Automatically at boot • Arcom Embedded Linux Contents • Installation • Utilities • Secure Shell (SSH) • Compiling a Kernel

Information regarding WebSphere Studio Device Developer can be found in the WebSphere Studio Device Developer Technical Manual, which can be found on the Development Kit CD.

Page 15