Name

Setup — Preparing the STB220 board for eCos Development

Overview

In a typical development environment the STB220 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 parallel flashredboot_ROM.ecmredboot_rom.bin
ROMRAMRedBoot copied from flash into RAMredboot_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_STB220_DIAG_BAUD and rebuilding RedBoot. RedBoot will support communication on either UART. Flash management is supported. Ethernet communication and flash management are also supported.

For EV8330 boards with DDR RAM there are alternative configuration files for the ROM and ROMRAM configurations. These have the same names as the files given above, with _DDR added giving redboot_ROM_DDR.ecm and redboot_ROMRAM_DDR.ecm.

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 STB220'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).

Ensure that SW801 is set to the CSn0 position, SW802 is set to OFF and that SW803 is set to 16b. It will also be necessary to configure the JTAG software to make both the FLASH and SDRAM accessible.

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:

**Warning** FLASH configuration checksum error or invalid key
Use 'fconfig -i' to [re]initialize database

RedBoot(tm) bootstrap and debug environment [JTAG]
Non-certified release, version UNKNOWN - built 15:19:46, Dec  1 2005

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

RAM: 0x80000000-0x84000000, [0x8001aec0-0x83fdd000] available
FLASH: 0x98000000 - 0x98ffffff 128 x 0x20000 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. 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 0x98020000-0x98fdffff: ...............................................................................
...............................................
... Unlocking from 0x98fe0000-0x98ffffff: .
... Erase from 0x98fe0000-0x98ffffff: .
... Program from 0x83fe0000-0x84000000 to 0x98fe0000: .
... Locking from 0x98fe0000-0x98ffffff: .
RedBoot>

At this stage the block of flash at location 0x98FE0000 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
Update RedBoot non-volatile configuration - continue (y/n)? y
... Unlocking from 0x98fe0000-0x98ffffff: .
... Erase from 0x98fe0000-0x98ffffff: .
... Program from 0x83fe0000-0x84000000 to 0x98fe0000: .
... Locking from 0x98fe0000-0x98ffffff: .
RedBoot>

For most of these configuration variables the default value is correct.

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 0x8001b000-0x80031887, assumed entry at 0x8001b000
xyzModem - CRC mode, 724(SOH)/0(STX)/0(CAN) packets, 4 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
... Unlocking from 0x98000000-0x9801ffff: .
... Erase from 0x98000000-0x9801ffff: .
... Program from 0x8001b000-0x8003b000 to 0x98000000: .
... Locking from 0x98000000-0x9801ffff: .
... Unlocking from 0x98fe0000-0x98ffffff: .
... Erase from 0x98fe0000-0x98ffffff: .
... Program from 0x83fe0000-0x84000000 to 0x98fe0000: .
... Locking from 0x98fe0000-0x98ffffff: .
RedBoot>

The flash-resident version of RedBoot has now been programmed at location 0x98000000, and the flash info block at 0x98FE0000 has been updated. The initial setup is now complete and the board can now boot from flash. To do this, power the board down, detach the JTAG module and power the board up. It should produce the following output:

+
RedBoot(tm) bootstrap and debug environment [ROMRAM]
Non-certified release, version UNKNOWN - built 14:37:14, Dec  1 2005

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

RAM: 0x80000000-0x84000000, [0x8001b350-0x83fdd000] available
FLASH: 0x98000000 - 0x98ffffff 128 x 0x20000 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 stb220 redboot
$ ecosconfig import $ECOS_REPOSITORY/hal/mips/pnx83xx/pnx8330/stb220/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 0x80100000 and executed from there.