Name

Setup — Preparing the IQ80321 board for eCos Development

Overview

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

The following RedBoot configurations are supported:

ConfigurationDescriptionUseFile
ROMRedBoot running from flash ROM boot sectorredboot_ROM.ecmredboot_ROM.bin
RAM RedBoot running from RAM with RedBoot in the flash boot sector redboot_RAM.ecmredboot_RAM.bin

For serial communications, all versions run with 8 bits, no parity, and 1 stop bit at 38400 baud. RedBoot also supports ethernet communication and flash management.

Hardware Setup

The 80321 board is highly configurable through a number of switches and jumpers. RedBoot and eCos make some assumptions about board configuration and attention must be paid to these assumptions for reliable operation:

  • The onboard ethernet and the secondary slot may be placed in a private space so that they are not seen by a PC BIOS. If the board is to be used in a PC with BIOS, then the ethernet should be placed in this private space so that RedBoot/eCos and the BIOS do not conflict.
  • RedBoot assumes that the board is plugged into a PC with BIOS. This requires RedBoot to detect when the BIOS has configured the PCI-X secondary bus. If the board is placed in a backplane, RedBoot will never see the BIOS configure the secondary bus. To prevent this wait, set switch S7E1-3 to ON when using the board in a backplane.
  • For the remaining switch settings, the following is a known good configuration:

    S1D1All OFF
    S7E17 is ON, all others OFF
    S8E12,3,5,6 are ON, all others OFF
    S8E22,3 are ON, all others OFF
    S9E13 is ON, all others OFF
    S4D11,3 are ON, all others OFF
    J9E12,3 jumpered
    J9F12,3 jumpered
    J3F1Nothing jumpered
    J3G12,3 jumpered
    J1G22,3 jumpered

Initial Installation

Flash Installation

The IQ80321 is supplied with a version of RedBoot in flash. It is recommended that this version of RedBoot be replaced with one that is built from the same set of sources as the eCos system to be run on it. There are several ways of doing this.

The board manufacturer provides a DOS application which is capable of programming the flash over the PCI bus, and this is required for initial installations of RedBoot. Please see the board manual for information on using this utility. In general, the process involves programming the ROM mode RedBoot image to flash. RedBoot should be programmed to flash address 0x00000000 using the DOS utility.

If a JTAG debugger is available (such as the Abatron BDI2000) that supports programming the flash, then this may be used to install the new RedBoot. See the documentation for the JTAG device to find out how to initialize the board and program the flash. RedBoot needs to be programmed to flash address 0x00000000.

Finally, RedBoot may be installed by using the resident RedBoot. Installing RedBoot is a matter of downloading a new binary image and overwriting the existing Boot monitor ROM image. This is a two stage process, you must first download a RAM-resident version of RedBoot and then use that to download the ROM image to be programmed into the flash memory.

Connect to RedBoot as described in the IQ80321 documentation using a terminal emulator (for example HyperTerminal on Windows, minicom on Linux). You should see the RedBoot startup banner, similar to the following:

RedBoot(tm) bootstrap and debug environment [ROM]

Platform: IQ80321 (XScale)
Copyright (C) 2000, 2001, 2002, Free Software Foundation, Inc.

RAM: 0x00000000-0x08000000, [0x0001b068-0x07fd1000] available
FLASH: 0xf0000000 - 0xf0800000, 64 blocks of 0x00020000 bytes each.
RedBoot>

The RAM image can be downloaded using the following RedBoot command:

RedBoot> load -m ymodem

Use the terminal emulator's Ymodem support to send the file redboot_RAM.srec. This should result in something like the following output:

Entry point: 0x00020040, address range: 0x00020000-0x000479f8
xyzModem - CRC mode, 2(SOH)/456(STX)/0(CAN) packets, 5 retries
RedBoot>

Now start the RAM version of RedBoot:

RedBoot> go
+No network interfaces found

RedBoot(tm) bootstrap and debug environment [RAM]
Non-certified release, version v2_0_24a1 - built 12:57:43, Sep 14 2004

Platform: IQ80321 (XScale)
Copyright (C) 2000, 2001, 2002, Free Software Foundation, Inc.
Copyright (C) 2003, 2004, eCosCentric Limited

RAM: 0x00000000-0x08000000, [0x00059668-0x07dd1000] available
FLASH: 0xf0000000 - 0xf0800000, 64 blocks of 0x00020000 bytes each.
RedBoot>

Now, the ROM image can be downloaded using the following RedBoot command:

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

Use the terminal emulator's Ymodem support to send the file redboot_ROM.bin. This should result in something like the following output:

Raw file loaded 0x0005a000-0x000819f8, assumed entry at 0x0005a000
xyzModem - CRC mode, 911(SOH)/0(STX)/0(CAN) packets, 4 retries
RedBoot>

Once the file has been uploaded, you can check that it has been transferred correctly using the cksum command. On the host (Linux or Cygwin) run the cksum program on the binary file:

$ cksum redboot_ROM.bin
140216855 116332 redboot_ROM.bin

In RedBoot, run the cksum command on the data that has just been loaded:

RedBoot> cksum -b %{FREEMEMLO} -l 116332
POSIX cksum = 140216855 116332 (0x085b8a17 0x0001c66c)

The second number in the output of the host cksum program is the file size, which should be used as the argument to the -l option in the RedBoot cksum command. The first numbers in each instance are the checksums, which should be equal.

If the program has downloaded successfully, then it can be programmed into the flash using the following commands:

RedBoot> fis init
About to initialize [format] FLASH image system - continue (y/n)?y
*** Initialize FLASH Image System
... Unlock from 0xf07e0000-0xf0800000: .
... Erase from 0xf07e0000-0xf0800000: .
... Program from 0x07cc0000-0x07d00000 at 0xf07e0000: .
... Lock from 0xf07e0000-0xf0800000: .
RedBoot> fis create -b %{FREEMEMLO} RedBoot
An image named 'RedBoot' exists - continue (y/n)?y
... Unlock from 0xf0000000-0xf0040000: ..
... Erase from 0xf0000000-0xf0040000: ..
... Program from 0x0001c000-0x0005c000 at 0xf0000000: .
... Lock from 0xf0000000-0xf0040000: .
... Unlock from 0xf07e0000-0xf0800000: .
... Erase from 0xf07e0000-0xf0800000: .
... Program from 0x07cc0000-0x07d00000 at 0xf07e0000: .
... Lock from 0xf07e0000-0xf0800000: .
RedBoot>

The IQ80321 board may now be reset either by cycling the power, or with the reset command. It should then display the startup screen for the ROM version of RedBoot:

+No network interfaces found

RedBoot(tm) bootstrap and debug environment [ROM]
Non-certified release, version v2_0_24a1 - built 12:59:55, Sep 14 2004

Platform: IQ80321 (XScale)
Copyright (C) 2000, 2001, 2002, Free Software Foundation, Inc.
Copyright (C) 2003, 2004, eCosCentric Limited

RAM: 0x00000000-0x08000000, [0x0001b068-0x07fd1000] available
FLASH: 0xf0000000 - 0xf0800000, 64 blocks of 0x00020000 bytes each.
RedBoot>

LED Codes

RedBoot uses the two digit LED display to indicate status during board initialization. Possible codes are:

LED     Actions
-------------------------------------------------------------
    Power-On/Reset
88
        Set the CPSR
        Enable coprocessor access
        Drain write and fill buffer
        Setup PBIU chip selects
A1
        Enable the Icache
A2
        Move FLASH chip select from 0x0 to 0xF0000000
        Jump to new FLASH location
A3
        Setup and enable the MMU
A4
        I²C interface initialization
90
        Wait for I²C initialization to complete
91
        Send address (via I²C) to the DIMM
92
        Wait for transmit complete
93
        Read SDRAM PD data from DIMM
94
        Read remainder of EEPROM data.
        An error will result in one of the following
        error codes on the LEDs:
        77 BAD EEPROM checksum
        55 I²C protocol error
        FF bank size error
A5
        Setup DDR memory interface
A6
        Enable branch target buffer
        Drain the write & fill buffers
        Flush Icache, Dcache and BTB
        Flush instruction and data TLBs
        Drain the write & fill buffers
SL
        ECC Scrub Loop
SE
A7
        Clean, drain, flush the main Dcache
A8
        Clean, drain, flush the mini Dcache
        Flush Dcache
        Drain the write & fill buffers
A9
        Enable ECC
AA
        Save SDRAM size
        Move MMU tables into RAM
AB
        Clean, drain, flush the main Dcache
        Clean, drain, flush the mini Dcache
        Drain the write & fill buffers
AC
        Set the TTB register to DRAM mmu_table
AD
        Set mode to IRQ mode
A7
        Move SWI & Undefined "vectors" to RAM (at 0x0)
A6
        Switch to supervisor mode
A5
        Move remaining "vectors" to RAM (at 0x0)
A4
        Copy DATA to RAM
        Initialize interrupt exception environment
        Initialize stack
        Clear BSS section
A3
        Call platform specific hardware initialization
A2
        Run through static constructors
A1
        Start up the eCos kernel or RedBoot

Special RedBoot Commands

A special RedBoot command, diag, is used to access a set of hardware diagnostics. To access the diagnostic menu, enter diag at the RedBoot prompt:

RedBoot> diag
Entering Hardware Diagnostics - Disabling Data Cache!

  IQ80321 Hardware Tests

 1 - Memory Tests
 2 - Repeating Memory Tests
 3 - Repeat-On-Fail Memory Tests
 4 - Rotary Switch S1 Test
 5 - 7 Segment LED Tests
 6 - i82544 Ethernet Configuration
 7 - Battery Status Test
 8 - Battery Backup SDRAM Memory Test
 9 - Timer Test
10 - PCI Bus test
11 - CPU Cache Loop (No Return)
 0 - quit
Enter the menu item number (0 to quit):

Tests for various hardware subsystems are provided, and some tests require special hardware in order to execute normally. The Ethernet Configuration item may be used to set the board ethernet address.

Memory Tests

This test is used to test installed DDR SDRAM memory. Five different tests are run over the given address ranges. If errors are encountered, the test is aborted and information about the failure is printed. When selected, the user will be prompted to enter the base address of the test range and its size. The numbers must be in hex with no leading “0x”

Enter the menu item number (0 to quit): 1

Base address of memory to test (in hex): 100000

Size of memory to test (in hex): 200000

Testing memory from 0x00100000 to 0x002fffff.

Walking 1's test:
0000000100000002000000040000000800000010000000200000004000000080
0000010000000200000004000000080000001000000020000000400000008000
0001000000020000000400000008000000100000002000000040000000800000
0100000002000000040000000800000010000000200000004000000080000000
passed
32-bit address test: passed
32-bit address bar test: passed
8-bit address test: passed
Byte address bar test: passed
Memory test done.

Repeating Memory Tests

The repeating memory tests are exactly the same as the above memory tests, except that the tests are automatically rerun after completion. The only way out of this test is to reset the board.

Repeat-On-Fail Memory Tests

This is similar to the repeating memory tests except that when an error is found, the failing test continuously retries on the failing address.

Rotary Switch S1 Test

This tests the operation of the sixteen position rotary switch. When run, this test will display the current position of the rotary switch on the LED display. Slowly dial through each position and confirm reading on LED.

7 Segment LED Tests

This tests the operation of the seven segment displays. When run, each LED cycles through 0 through F and a decimal point.

i82544 Ethernet Configuration

This test initializes the ethernet controller‚s serial EEPROM if the current contents are invalid. In any case, this test will also allow the user to enter a six byte ethernet MAC address into the serial EEPROM.

Enter the menu item number (0 to quit): 6


Current MAC address: 00:80:4d:46:00:02
Enter desired MAC address: 00:80:4d:46:00:01
Writing to the Serial EEPROM... Done

******** Reset The Board To Have Changes Take Effect ********

Battery Status Test

This tests the current status of the battery. First, the test checks to see if the battery is installed and reports that finding. If the battery is installed, the test further determines whether the battery status is one or more of the following:

  • Battery is charging.
  • Battery is fully discharged.
  • Battery voltage measures within normal operating range.

Battery Backup SDRAM Memory Test

This tests the battery backup of SDRAM memory. This test is a three step process:

  1. Select Battery backup test from main diag menu, then write data to SDRAM.
  2. Turn off power for 60 seconds, then repower the board.
  3. Select Battery backup test from main diag menu, then check data that was written in step 1.

Timer Test

This tests the internal timer by printing a number of dots at one second intervals.

PCI Bus Test

This tests the secondary PCI-X bus and socket. This test requires that an IQ80310 board be plugged into the secondary slot of the IOP80321 board. The test assumes at least 32MB of installed memory on the IQ80310. That memory is mapped into the IOP80321 address space and the memory tests are run on that memory.

CPU Cache Loop

This test puts the CPU into a tight loop run entirely from the ICache. This should prevent all external bus accesses.

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 the ROM version of RedBoot for the IQ80321 are:

$ mkdir redboot_iq80321_rom
$ cd redboot_iq80321_rom
$ ecosconfig new iq80321 redboot
$ ecosconfig import $ECOS_REPOSITORY/hal/arm/arm9/iq80321/current/misc/redboot_ROM.ecm
$ ecosconfig resolve
$ ecosconfig tree
$ make

To rebuild the RAM RedBoot:

$ mkdir redboot_iq80321_ram
$ cd redboot_iq80321_ram
$ ecosconfig new iq80321 redboot
$ ecosconfig import $ECOS_REPOSITORY/hal/arm/arm9/iq80321/current/misc/redboot_RAM.ecm
$ ecosconfig resolve
$ ecosconfig tree
$ make

At the end of the build the install/bin subdirectory should contain the file redboot.bin. This is the case for both the above builds, take care not to mix the two files up, since programming the RAM RedBoot into the ROM will render the board unbootable.