eCosPro® Reference Manual
Prev |  | Next

# Setup

## Name

Setup -- Preparing the DNP/9200 with DNP/EVA9 evaluation board for eCos Development

## Overview

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

The following RedBoot configurations are supported:

Configuration | Description | Use | File
--- | --- | --- | ---
ROM | RedBoot running from ROM | redboot_ROM.ecm | redboot_ROM.bin
RAM | RedBoot running from RAM | redboot_RAM.ecm | redboot_RAM.bin
ROMRAM | RedBoot running from RAM, but contained in the board's flash boot sector | redboot_ROMRAM.ecm | redboot_ROMRAM.bin
JTAG | RedBoot running from RAM, loaded via JTAG | redboot_JTAG.ecm | redboot_JTAG.bin
UBOOT | RedBoot running from RAM, loaded via U-Boot | redboot_UBOOT.ecm | redboot_UBOOT.bin

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

The ample provision of RAM memory on the board allows the ROMRAM version of RedBoot to be preferential to the standard ROM version which executes directly from Flash. Alternatively, if the ROM version is to be chosen, then the RAM version is provided to allow for updating the resident RedBoot image in Flash. The JTAG version is only used if loading RedBoot into RAM via a JTAG debugger or ICE. It is similar to the RAM version, but loads at a lower address within RAM, and so can be used to in turn load eCos applications, as if it is the normal resident boot monitor. The ELF format image of this JTAG version of RedBoot can also be loaded and executed from GDB using the Abatron BDI2000 bdiGDB support, to allow it to be debugged. The UBOOT version may be used to load RedBoot into RAM using the UBOOT bootloader. This is usually only used to then load a ROMRAM executable for programming into flash. Like the JTAG version it loads at a lower RAM address and can therefore be used to load RAM applications.

## Initial Installation

The on-chip boot program on the AT91RM9200 is only capable of loading programs into 12Kbytes of on-chip SRAM and is therefore quite restrictive. Consequently two mechanisms are described below to program RedBoot into Flash. The first requires a JTAG device while the other makes use of the U-Boot bootloader that is shipped with the board.

### Method 1 - Program RedBoot into Flash with RAM RedBoot loaded by JTAG

With this approach, the BDI2000 is used to load a RAM RedBoot image, which can then in turn be used to load and program a ROMRAM RedBoot image into Flash. In the following documentation it is assumed that the Abatron BDI2000 is being used. For a different JTAG device, equivalent operations will need to be performed.

There are three stages, firstly loading the RAM RedBoot image, then initializing RedBoot's Flash configuration, and finally loading and programming the ROMRAM RedBoot. First, however, we must set up the BDI2000 and the board.

#### Preparing the Abatron BDI2000 JTAG debugger

The BDI2000 must first be configured to allow communication with your local network, and configured with the parameters for interfacing with the target board. The following steps should be followed:

1. Prepare a PC to act as a host PC and start a TFTP server on it.

2. Connect the Abatron BDI2000 JTAG debugger via both serial and ethernet to the host PC and power it on. Use the serial cable supplied with the BDI2000.

3. Install the Abatron BDI2000 bdiGDB support software on the host PC.

4. Locate the file `bdi2000.dnp_sk23.cfg` within the eCos platform HAL package in the source repository. This will be in the directory `packages/hal/arm/arm9/dnp_sk23/VERSION/misc` relative to the root of your eCos installation.

5. Locate the file `reg920t.def` within the installation of the BDI2000 bdiGDB support software.

6. Place the bdi2000.dnp_sk23.cfg in a location on the PC accessible to the TFTP server. Later you will configure the BDI2000 to load this file via TFTP as its configuration file.

7. Similarly place the file `reg920t.def` in a location accessible to the TFTP server.

8. Open `bdi2000.dnp_sk23.cfg` in an editor such as emacs or notepad and if necessary adjust the path of the `reg920t.def` file in the [REGS] section to match its location relative to the TFTP server root.

9. Install and configure the Abatron BDI2000 in line with the bdiGDB instruction manual. Configure the BDI2000 to use the `bdi2000.dnp_sk23.cfg` configuration file at the appropriate point of this process.

#### Preparing the DNP/9200 with DNP/EVA9 evaluation board for programming

Follow the steps in this section in order to allow communication between the board and the host PC, and between the board and the JTAG device.

1. First you must connect a null modem DB9 serial cable between COM1 on the board and a serial port on the host computer.

2. Start a suitable terminal emulator on the host computer such as minicom or HyperTerminal. Set the communication parameters to 115200 baud, 8 data bits, no parity bit and 1 stop bit with no flow control.

3. Connect the board to your host PC's LAN with an Ethernet cable.

4. You should designate the board with a new Ethernet MAC address. The RedBoot binary image contains a default address, but each board requires its own unique address. It is advisable to mark each board with its programmed MAC address for future identification.

5. Connect the board to the BDI2000 using a 20-pin ARM/Xscale cable from the JTAG interface connector on the DNP/9200 to the Target A port on the BDI2000. Since the JTAG connector on the DNP/9200 is non-standard, this will require an adaptor cable.

6. Power up the DNP/EVA9 board. You should see the power LED and some of the ethernet LEDs illuminate.

7. Connect to the BDI2000's CLI interface via TCP/IP on the standard telnet port 23. The telnet application is suitable for this. You should see usage information followed by the prompt:

       Core#0>

8. Confirm correct connection with the BDI2000 with the reset halt command as follows:

       Core#0> reset halt
       - TARGET: processing reset request
       - TARGET: BDI asserts TRST and RESET
       - TARGET: BDI removes TRST
       - TARGET: Bypass check 0x00000001 => 0x00000001
       - TARGET: JTAG exists check passed
       - Core#0: ID code is 0x05B0203F
       - TARGET: All ICEBreaker access checks passed
       - TARGET: BDI removes RESET
       - TARGET: BDI waits for RESET inactive
       - TARGET: resetting target passed
       - TARGET: processing target startup ....
       - TARGET: processing target startup passed
       Core#0>

9. Locate the `redboot_ROMRAM.bin` image within the `loaders` subdirectory of the base of the eCos installation.

10. Copy the `redboot_ROMRAM.bin` file into a location on the host computer accessible to its TFTP server.

#### Loading a RAM RedBoot

1. Locate the `redboot_JTAG.bin` image within the `loaders` subdirectory of the base of the eCos installation.

2. Copy the `redboot_JTAG.bin` file into a location on the host computer accessible to its TFTP server.

3. With the BDI2000 telnet interface, execute the following command, replacing /RBPATH with the location of the redboot_JTAG.bin file relative to the TFTP server root directory:

       Core#0>load 0x20010000 /RBPATH/redboot_JTAG.bin bin
       Loading /RBPATH/redboot_JTAG.bin , please wait ....
       Loading program file passed
       Core#0>

4. Run the loaded RAM RedBoot:

       Core#0>go 0x20010040
       Core#0>

The terminal emulator connected to the serial debug port should now have displayed the RedBoot banner and prompt similar to the following:

    +**Warning** FLASH configuration checksum error or invalid key
    Use 'fconfig -i' to [re]initialize database
    PHY: Davicom DM9161A
    AT91RM9200 ETH: Waiting for link to come up.
    AT91RM9200 ETH: 100Mb
    ... waiting for BOOTP information
    Ethernet eth0: MAC address 00:23:31:37:00:1c
    IP: 10.0.2.9/255.0.0.0, Gateway: 10.0.0.3
    Default server: 10.0.1.2, DNS server IP: 10.0.0.1

    RedBoot(tm) bootstrap and debug environment [RAM]
    Non-certified release, version UNKNOWN - built 17:10:26, Jun  8 2006

    Platform: DNP/9200 with DNP/EVA9 (ARM9)
    Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
    Copyright (C) 2003, 2004, 2005, 2006 eCosCentric Limited

    RAM: 0x20000000-0x20800000, [0x2002f2e0-0x207dd000] available
    FLASH: 0x60000000-0x60ffffff, 128 x 0x20000 blocks
    RedBoot>

In the above output, a local BOOTP/DHCP server was able to serve an address to the device.

> Note: It is also possible to use the RAM startup version of RedBoot and the redboot_RAM.bin file instead of redboot_JTAG.bin above. If so, then the address to the load command must be 0x20100000, as must be the address to the go command.

#### RedBoot Flash configuration

The following steps describe how to initialize RedBoot's Flash configuration. This must be performed when using a RAM RedBoot to program Flash.

1. Use the following command to initialize RedBoot's Flash Information System (FIS):

       RedBoot> fis init
       About to initialize [format] FLASH image system - continue (y/n)? y
       *** Initialize FLASH Image System
       ... Unlocking from 0x60fe0000-0x60ffffff: .
       ... Erase from 0x60fe0000-0x60ffffff: .
       ... Program from 0x207e0000-0x20800000 to 0x60fe0000: .
       ... Locking from 0x60fe0000-0x60ffffff: .
       RedBoot>

2. Now configure RedBoot's Flash configuration with the command:

       RedBoot> fconfig -i

   Remember to substitute the appropriate MAC address for this board at the appropriate step. If a BOOTP/DHCP server is not available, then IP configuration may be set manually. The default server IP address can be set to a PC that will act as a TFTP host for future RedBoot load operations, or may be left unset. The following gives an example configuration:

       RedBoot> fconfig -i
       Initialize non-volatile configuration - continue (y/n)? y
       Run script at boot: false
       Use BOOTP for network configuration: false
       Gateway IP address: 192.168.7.11
       Local IP address: 192.168.7.222
       Local IP address mask: 255.255.255.0
       Default server IP address: 192.168.7.9
       Console baud rate: 115200
       DNS server IP address: 192.168.7.11
       Network hardware address [MAC]: 0x00:0x23:0x31:0x37:0x00:0x4e
       GDB connection port: 9000
       Force console for special debug messages: false
       Network debug at boot time: false
       Default network device: at91rm9200_eth
       Update RedBoot non-volatile configuration - continue (y/n)? y
       ... Unlocking from 0x60fe0000-0x60ffffff: .
       ... Erase from 0x60fe0000-0x60ffffff: .
       ... Program from 0x207e0000-0x20800000 to 0x60fe0000: .
       ... Locking from 0x60fe0000-0x60ffffff: .
       RedBoot>

#### Loading and programming the ROMRAM RedBoot

This section describes the steps required to load the ROMRAM RedBoot from the TFTP server and program it into Flash.

1. Load the RedBoot ROMRAM binary image from the TFTP server. Use the following command, replacing 111.222.333.444 with the TFTP server IP address (or domain name if a DNS server has been configured), and /RBPATH with the location of the `redboot_ROMRAM.bin` file relative to the TFTP server root directory:

       RedBoot> load -r -b %{freememlo} -h 111.222.333.444 /RBPATH/redboot_ROMRAM.bin
       Using default protocol (TFTP)
       Raw file loaded 0x20030000-0x2004e91b, assumed entry at 0x20030000
       RedBoot>

2. Finally install the loaded image into Flash:

       RedBoot> fis create RedBoot
       An image named 'RedBoot' exists - continue (y/n)? y
       ... Erase from 0x60000000-0x6003ffff: ..
       ... Program from 0x20030000-0x2004e91c to 0x60000000: .
       ... Locking from 0x60000000-0x6003ffff: ..
       ... Unlocking from 0x60fe0000-0x60ffffff: .
       ... Erase from 0x60fe0000-0x60ffffff: .
       ... Program from 0x21fe0000-0x22000000 to 0x60fe0000: .
       ... Locking from 0x60fe0000-0x60ffffff: .
       RedBoot>

   It is also possible to use the fis write command to write the image into Flash, but if so, the relevant Flash blocks must also be explicitly unlocked with the command:

       RedBoot> fis unlock -f 0x60000000 -l 0x30000

The RedBoot installation is now complete. This can be tested by powering off the board, disconnecting the JTAG, and then powering on the board again. Output similar to the following should be seen on the serial port. Verify the IP settings are as expected.

    +PHY: Davicom DM9161A
    AT91RM9200 ETH: 100Mb
    ... waiting for BOOTP information
    Ethernet eth0: MAC address 00:23:31:37:00:1c
    IP: 10.0.2.9/255.0.0.0, Gateway: 10.0.0.3
    Default server: 10.0.1.2, DNS server IP: 10.0.0.1

    RedBoot(tm) bootstrap and debug environment [ROMRAM]
    Non-certified release, version UNKNOWN - built 18:10:00, Jun  8 2006

    Platform: DNP/9200 with DNP/EVA9 (ARM9)
    Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
    Copyright (C) 2003, 2004, 2005, 2006 eCosCentric Limited

    RAM: 0x20000000-0x22000000, [0x2002ff78-0x21fdd000] available
    FLASH: 0x60000000-0x60ffffff, 128 x 0x20000 blocks
    RedBoot>

If it proves necessary to re-install RedBoot, this may be achieved by repeating the above process. Alternatively, a new image may be downloaded and programmed into flash more directly using RedBoot's own commands. See the RedBoot documentation for details.

### Method 2 - Program RedBoot into Flash with RAM Redboot loaded by U-Boot

With this approach, the existing U-Boot bootloader is used to load a RAM RedBoot which is then used to load and program a ROMRAM RedBoot image to replace U-Boot in Flash. A JTAG debugger is not needed for this method.

There are three stages, firstly loading the RAM RedBoot image, then initializing RedBoot's Flash configuration, and finally loading and programming the ROMRAM RedBoot. The first of these stages is described here, the remaining two stages are identical to the equivalent stages in Method 1, above.

#### Loading a RAM RedBoot

1. First you must connect a null modem DB9 serial cable between COM1 on the board and a serial port on the host computer.

2. Start a suitable terminal emulator on the host computer such as minicom or HyperTerminal. Set the communication parameters to 115200 baud, 8 data bits, no parity bit and 1 stop bit with no flow control.

3. Connect the board to your host PC's LAN with an Ethernet cable.

4. You should designate the board with a new Ethernet MAC address. The RedBoot binary image contains a default address, but each board requires its own unique address. It is advisable to mark each board with its programmed MAC address for future identification.

5. Locate the `redboot_UBOOT.bin` image within the `loaders` subdirectory of the base of the eCos installation.

6. Copy the `redboot_UBOOT.bin` file into a location on the host computer accessible to its TFTP server.

7. Power up the DNP/EVA9 board. You should see the power LED and some of the ethernet LEDs illuminate.

8. After a few seconds the following output should be seen on the serial line. Hit a key to stop the auto boot:

       U-Boot 1.1.2 (Dec 14 2005 - 13:12:14)

       U-Boot code: 21F00000 -> 21F1666C  BSS: -> 21F1AC44
       RAM Configuration:
       Bank #0: 20000000 32 MB
       Flash: 16 MB

       In:    serial
       Out:   serial
       Err:   serial
       Hit any key to stop autoboot:  0
       U-Boot>

9. Set up the environment of U-Boot to download the RAM RedBoot. Users with access to a TFTP server should substitute their own IP address, TFTP server address and netmask in the following commands:

       U-Boot> setenv ipaddr 10.0.2.22
       U-Boot> setenv serverip 10.0.1.2
       U-Boot> setenv netmask 255.0.0.0
       U-Boot> setenv bootfile redboot_UBOOT.bin

10. Download the RAM RedBoot. Users with access to a TFTP server should use the following command:

        U-Boot> tftpboot 0x20040000
        TFTP from server 10.0.1.2; our IP address is 10.0.2.22
        Filename 'redboot_UBOOT.bin'.
        Load address: 0x20040000
        Loading: ########################
        done
        Bytes transferred = 120760 (1d7b8 hex)

11. Users without access to a TFTP server may use Kermit to send the file `redboot_UBOOT.bin`:

        U-Boot> loadb 0x20040000

12. The downloaded RedBoot image may now be executed:

        U-Boot> go 0x20040000
        .+PHY: Davicom DM9161A
        AT91RM9200 ETH: 100Mb
        ... waiting for BOOTP information
        Ethernet eth0: MAC address 00:23:31:37:00:1c
        IP: 10.0.2.9/255.0.0.0, Gateway: 10.0.0.3
        Default server: 10.0.1.2, DNS server IP: 10.0.0.1

        RedBoot(tm) bootstrap and debug environment [UBOOT]
        Non-certified release, version UNKNOWN - built 18:18:48, Jun  8 2006

        Platform: DNP/9200 with DNP/EVA9 (ARM9)
        Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
        Copyright (C) 2003, 2004, 2005, 2006 eCosCentric Limited

        RAM: 0x20000000-0x22000000, [0x20067040-0x21fdd000] available
        FLASH: 0x60000000-0x60ffffff, 128 x 0x20000 blocks
        RedBoot>

13. Now follow the directions in the previous method to initialize the flash and program the ROMRAM 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 the ROMRAM version of RedBoot for the DNP/9200 with DNP/EVA9 are:

    $ mkdir redboot_dnp_sk23_romram
    $ cd redboot_dnp_sk23_romram
    $ ecosconfig new dnp_sk23 redboot
    $ ecosconfig import $ECOS_REPOSITORY/hal/arm/arm9/dnp_sk23/VERSION/misc/redboot_ROMRAM.ecm
    $ ecosconfig resolve
    $ ecosconfig tree
    $ make

At the end of the build the `install/bin` subdirectory should contain the file `redboot.bin`.

The other versions of RedBoot - ROM, RAM, JTAG or UBOOT - may be similarly built by choosing the appropriate alternative .ecm file.

Prev | Home | Next
Overview | Up | Configuration