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.
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:
- Prepare a PC to act as a host PC and start a TFTP server on it.
- 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.
- Install the Abatron BDI2000 bdiGDB support software on the host PC.
Locate the file
bdi2000.at91sam7a3ek.cfgwithin the eCos platform HAL package in the source repository. This will be in the directory
packages/hal/arm/at91/at91sam7a3ek/relative to the root of your eCos installation.
Locate the file
reg920t.defwithin the installation of the BDI2000 bdiGDB support software.
- 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.
Similarly place the file
reg920t.defin a location accessible to the TFTP server.
bdi2000.at91sam7a3ek.cfgin an editor such as emacs or notepad and if necessary adjust the path of the
reg920t.deffile in the
[REGS]section to match its location relative to the TFTP server root.
Install and configure the Abatron BDI2000 in line with the bdiGDB
instruction manual. Configure the BDI2000 to use the
bdi2000.at91sam7a3ek.cfgconfiguration 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.
- 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.
- 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.
- 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.
- Power up the AT91SAM7A3-EK board.
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:
Confirm correct connection with the BDI2000 with the reset halt command as follows:
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 SAM7A3>
Installation into Flash
Installation of an application into the on-chip flash, or the installation of the GDB stubs take exactly the same form:
Locate the binary image of the executable to be installed. For the GDB
stubs do this by locating the file
loaderssubdirectory 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.
- Copy the file into a location on the host computer accessible to its TFTP server.
- Connect to the BDI2000 telnet port as before.
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 SAM7A3>
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.
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 SAM7A3>
As with the unlock command, the size of the area erased must be at least the size of the executable to be programmed.
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 SAM7A3>
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:
|2021-10-22||eCosPro Non-Commercial Public License|