Setup — Preparing the AT91SAM7A3-EK board for eCos Development


eCos applications are either programmed into the on-chip flash, or run from RAM using either a JTAG device or the GDB stubs ROM. To install a flash-resident application, or the GDB stubs requires use of a JTAG device to write to the flash. So, in all cases it is necessary to set up a JTAG device for the board. This document describes how to set up an Abatron BDI2000 and then use it to program an application into the flash.

Initial Installation

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.at91sam7a3ek.cfg within the eCos platform HAL package in the source repository. This will be in the directory packages/hal/arm/at91/at91sam7a3ek/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.at91sam7a3ek.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.at91sam7a3ek.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.at91sam7a3ek.cfg configuration file at the appropriate point of this process.

Preparing the AT91SAM7A3-EK 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 the Serial Debug Port 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 38400 baud, 8 data bits, no parity bit and 1 stop bit with no flow control.
  3. Connect the board to the BDI2000 using a 20-pin ARM/Xscale cable from the JTAG interface connector to the Target A port on the BDI2000.
  4. Power up the AT91SAM7A3-EK board.
  5. 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:

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

    SAM7A3> reset halt
    - TARGET: processing reset request
    - TARGET: BDI asserts TRST and RESET
    - TARGET: BDI removes TRST
    - TARGET: Bypass check 0x000000001 => 0x00000001
    - TARGET: JTAG exists check passed
    - Core#0: ID code is 0x3F0F0F0F
    - 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

Installation into Flash

Installation of an application into the on-chip flash, or the installation of the GDB stubs take exactly the same form:

  1. Locate the binary image of the executable to be installed. For the GDB stubs do this by locating the file gdb.module.bin within the loaders subdirectory of the base of the eCos installation. For applications use arm-elf-objcopy -O binary to convert the ELF output of the linker into binary.
  2. Copy the file into a location on the host computer accessible to its TFTP server.
  3. Connect to the BDI2000 telnet port as before.
  4. Give the unlock command to ensure that the flash area we want to program is writable:

    SAM7A3>unlock 0x100000 0x100 256
    Unlocking flash at 0x00100000
    Unlocking flash at 0x00100100
    Unlocking flash at 0x00100200
    Unlocking flash at 0x0010fe00
    Unlocking flash at 0x0010ff00
    Unlocking flash passed

    This command unlocks 256 pages, i.e. 64KiB. The number of pages unlocked should match at least the size of the executable to be programmed.

  5. Give the erase command to clear any previous contents:

    SAM7A3>erase 0x100000 0x100 256
    Erasing flash at 0x00100000
    Erasing flash at 0x00100100
    Erasing flash at 0x00100200
    Erasing flash at 0x0010fe00
    Erasing flash at 0x0010ff00
    Erasing flash passed

    As with the unlock command, the size of the area erased must be at least the size of the executable to be programmed.

  6. Now give the prog command to fetch the executable from the TFTP server and program it to the flash.

    SAM7A3>prog 0x100000 sam7.bin bin
    Programming sam7.bin , please wait ....
    Programming flash passed

The installation is now complete. This can be tested by powering off the board, disconnecting the JTAG, and then powering on the board again. A ROM based application should start immediately, and any output will be seen on the serial connection. If the GDB stub ROM has been installed, then something similar to the following will be seen on the serial port: