Name

Setup — Preparing the STB200 board for eCos Development

Overview

In a typical development environment the STB200 board boots from flash into the RedBoot ROM monitor. eCos applications are configured for a RAM startup, and then downloaded and run on the board via the debugger mipsisa32-elf-gdb. Preparing the board therefore involves programming a suitable RedBoot image into flash memory.

The following RedBoot configurations are supported:

ConfigurationDescriptionUseFile
ROMRedBoot running from the board's flashredboot_ROMRAM.ecmredboot_romram.bin
JTAGUsed for initial setupredboot_JTAG.ecmredboot.elf
RAMFor debugging RedBootredboot_RAM.ecmredboot_ram.bin

For serial communications all versions run at 384000 baud with 8 bits, no parity, and 1 stop bit. The baud rates can be changed via the configuration option CYGNUM_HAL_MIPS_STB200_DIAG_BAUD and rebuilding RedBoot. Only uart1 has a serial connector so RedBoot will use that. Ethernet communication and flash management are also supported.

Initial Installation

This process assumes that RedBoot has not yet been installed into flash, so JTAG has to be used to program the redboot_romram.bin file into flash. This can be done either via a flash programming utility or by first running a JTAG version of RedBoot and using that to initialize and program the flash. This second approach is described here.

The first step is to set up a suitable JTAG module and associated debug software, as per the instructions supplied with the JTAG kit. Next connect a straight-throught RS232 cable between the STB200's serial port and the host PC, and start a terminal emulation application such as HyperTerminal or minicom on the host PC. The serial communication parameters should be 38400 baud, 8 data bits, no parity, 1 stop bit (8N1) and no flow control (handshaking).

It is now necessary to load and run a JTAG build of RedBoot. A prebuilt image redboot_JTAG.elf is supplied with eCos, or can be rebuilt as described below. This file is an ELF executable complete with relocation and debug information, and may need to be converted to another format for use with the JTAG software. For example, when using an Ashling Opella unit, the SymFinder utility sfdwarf should be used to convert the ELF executable to a .CSO file. This utility may give numerous warnings which can be ignored. The .CSO file can be loaded via the JTAG debugger, and it can be started running at location 0x80001000. At this point RedBoot will output text similar to the following on the serial port:

+FLASH configuration checksum error or invalid key
Ethernet eth0: MAC address 00:FF:12:34:56:78
... waiting for BOOTP information
Can't get BOOTP info for device!

RedBoot(tm) bootstrap and debug environment [JTAG]
Non-certified release, version UNKNOWN - built 20:35:11, Sep 29 2005

Platform: STB200 (Philips PNX8310)
Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Copyright (C) 2003, 2004, 2005 eCosCentric Limited

RAM: 0x80000000-0x81000000, [0x80028720-0x80fed000] available
FLASH: 0x98000000 - 0x983fffff 8 x 0x2000 blocks 63 x 0x10000 blocks
RedBoot>

The exact details may vary slightly, depending on the flash chip present and whether or not the ethernet is plugged in yet. At this stage the RedBoot flash management initialization has not yet happened so the warning about the configuration checksum error is expected. There will also be a delay while RedBoot tries to contact a local BOOTP server. To perform the flash initialization use the fis init -f command:

RedBoot> fis init -f
About to initialize [format] FLASH image system - continue (y/n)? y
*** Initialize FLASH Image System
... Erase from 0x983f0000-0x983fffff: .
... Program from 0x80ff0000-0x81000000 to 0x983f0000: .
RedBoot>

At this stage the block of flash at location 0x983F0000 holds information about the various flash blocks, allowing other flash management operations to be performed. The next step is to set up RedBoot's non-volatile configuration values:

RedBoot> fconfig -i
Initialize non-volatile configuration - continue (y/n)? y
Run script at boot: false
Use BOOTP for network configuration: true
Default server IP address: 10.1.1.1
GDB connection port: 9000
Force console for special debug messages: false
Network hardware address [MAC]: 0x00:0xff:0x12:0x34:0x01:0x0C
Network debug at boot time: false
Update RedBoot non-volatile configuration - continue (y/n)? y
... Erase from 0x983f0000-0x983fffff: .
... Program from 0x80ff0000-0x81000000 to 0x983f0000: .
RedBoot>

For most of these configuration variables the default value is correct. If there is no suitable BOOTP service running on the local network then BOOTP should be disabled, and instead RedBoot will prompt for a fixed IP address, netmask, and addresses for the local gateway and DNS server. The other exception is the network hardware address, also known as MAC address. All boards should be given a unique MAC address, not the one in the above example. If there are two boards on the same network trying to use the same MAC address then the resulting behaviour is undefined.

It is now possible to load the flash-resident version of RedBoot. Because of the way that flash chips work it is better to first load it into RAM and then program it into flash.

RedBoot> load -r -m ymodem -b %{freememlo}

The file redboot_romram.bin should now be uploaded using the terminal emulator. The file is a raw binary and should be transferred using the Y-modem protocol.

CRaw file loaded 0x80028800-0x8004568f, assumed entry at 0x80028800
xyzModem - CRC mode, 930(SOH)/0(STX)/0(CAN) packets, 5 retries
RedBoot>

Once RedBoot has been loaded into RAM it can be programmed into flash:

RedBoot> fis create RedBoot -b %{freememlo}
An image named 'RedBoot' exists - continue (y/n)? y
... Erase from 0x98000000-0x9801ffff: .........
... Program from 0x80028800-0x80048800 to 0x98000000: .........
... Erase from 0x983f0000-0x983fffff: .
... Program from 0x80ff0000-0x81000000 to 0x983f0000: .
RedBoot>

The flash-resident version of RedBoot has now been programmed at location 0x98000000, and the flash info block at 0x983F0000 has been updated. The initial setup is now complete and the board can now boot from flash. This can be done either by powering the board down and back up, or simply by using RedBoot's reset command:

RedBoot> reset
... Resetting.+... waiting for BOOTP information
Ethernet eth0: MAC address 00:ff:12:34:01:0c
IP: 10.1.1.153/255.255.255.0, Gateway: 10.1.1.241
Default server: 10.1.1.1

RedBoot(tm) bootstrap and debug environment [ROMRAM]
Non-certified release, version UNKNOWN - built 12:46:19, Oct  2 2005

Platform: STB200 (Philips PNX8310)
Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Copyright (C) 2003, 2004, 2005 eCosCentric Limited

RAM: 0x80000000-0x81000000, [0x800288e0-0x80fed000] available
FLASH: 0x98000000 - 0x983fffff 8 x 0x2000 blocks 63 x 0x10000 blocks
RedBoot>

When RedBoot issues its prompt it is also ready to accept connections from mipsisa32-elf-gdb, allowing eCos applications to be downloaded and debugged.

Occasionally it may prove necessary to update the installed RedBoot image. This can be done at the ROMRAM RedBoot prompt - there is no need to run the JTAG version again unless the version already installed has been corrupted. It involves loading the new image into RAM using RedBoot's load command, and then programming it into flash using fis create RedBoot

Rebuilding RedBoot

Should it prove necessary to rebuild a RedBoot binary, this is done most conveniently at the command line. The steps needed to rebuild the ROMRAM version of RedBoot are:

$ mkdir redboot_romram
$ cd redboot_romram
$ ecosconfig new stb200 redboot
$ ecosconfig import $ECOS_REPOSITORY/hal/mips/pnx83xx/pnx8310/stb200/current/misc/redboot_ROMRAM.ecm
$ ecosconfig resolve
$ ecosconfig tree
$ make

At the end of the build the install/bin subdirectory should contain the required file redboot_romram.bin.

Rebuilding the JTAG and RAM versions involves basically the same process. The JTAG version uses the file redboot_JTAG.ecm and generates an ELF executable redboot.elf, which may need to be converted to another format before it can be used with the JTAG software. The RAM version uses the file redboot_RAM.ecm and generates a raw binary redboot.ram.bin which can be loaded into memory at 0x80040000 and executed from there.