Name
Setup — Preparing the AT91SAM7A2-EK board for eCos Development
Overview
In a typical development environment, the AT91SAM7A2-EK boards boot 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 |
JTAG | RedBoot running from RAM, loaded via JTAG | redboot_JTAG.ecm | redboot_JTAG.bin |
For serial communications, all versions run with 8 bits, no parity, and 1 stop bit at 38400 baud.
The ROM version is programmed into flash to boot the system; however, it is not able to reprogram the RedBoot image in flash. 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. The ELF format image of this JTAG version of RedBoot can be loaded and executed from GDB using the Abatron BDI2000 bdiGDB support, to allow it to be debugged.
Initial Installation
For typical eCos development, a RedBoot image is programmed into the flash memory, and the board will boot into this image from reset. Two mechanisms are described below to program RedBoot into Flash. Both of them require a JTAG device. 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.
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.at91sam7a2ek.cfg
within the eCos platform HAL package in the source repository. This will be in the directorypackages/hal/arm/at91/at91sam7a2ek/
relative to the root of your eCos installation.VERSION
/misc -
Locate the file
reg920t.def
within the installation of the BDI2000 bdiGDB support software. - Place the bdi2000.at91sam7a2ek.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.def
in a location accessible to the TFTP server. -
Open
bdi2000.at91sam7a2ek.cfg
in an editor such as emacs or notepad and if necessary adjust the path of thereg920t.def
file 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.at91sam7a2ek.cfg
configuration file at the appropriate point of this process.
Preparing the AT91SAM7A2-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 AT91SAM7A2-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:
SAM7A2>
Confirm correct connection with the BDI2000 with the reset halt command as follows:
SAM7A2>
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 0x1F0F0F0F - 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 SAM7A2>-
Locate the
redboot_ROM.bin
image within theloaders
subdirectory of the base of the eCos installation. -
Copy the
redboot_ROM.bin
file into a location on the host computer accessible to its TFTP server.
Using the BDI2000 to directly program RedBoot into Flash
As previously mentioned, there are two methods of programming a RedBoot image into the parallel NOR Flash. This method uses the built-in capabilities of the BDI2000.
This is a three stage process. The relevant Flash blocks must first be unlocked, then erased, and finally programmed. This can be accomplished with the following steps:
- Connect to the BDI2000 telnet port as before.
Erase the 8 initial 8Kbyte sized Flash blocks, and the following 64Kbyte Flash block with the following command:
SAM7A>erase Erasing flash at 0x40000000 Erasing flash at 0x40002000 Erasing flash at 0x40004000 Erasing flash at 0x40006000 Erasing flash at 0x40008000 Erasing flash at 0x4000a000 Erasing flash at 0x4000c000 Erasing flash at 0x4000e000 Erasing flash at 0x40010000 Erasing flash passed SAM7A>
Program the RedBoot image into Flash with the following command, replacing
/RBPATH
with the location of the redboot_ROM.bin file relative to the TFTP server root directory:SAM7A>
prog 0x40000000
Programming redboot_ROM.bin , please wait .... Programming flash passed SAM7A>/RBPATH/
redboot_ROM.bin binThis operation can take some time.
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. The RedBoot banner should be visible on the serial port. RedBoot's Flash configuration can be initialized using the same procedure as required in Method 2 below.
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
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.
There are three stages, firstly loading the RAM RedBoot image, then initializing RedBoot's Flash configuration, and finally loading and programming the ROMRAM RedBoot.
Loading a RAM RedBoot
-
Locate the
redboot_JTAG.bin
image within theloaders
subdirectory of the base of the eCos installation. -
Copy the
redboot_JTAG.bin
file into a location on the host computer accessible to its TFTP server. 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:SAM7A>
load 0x48000000
Loading /RBPATH/redboot_JTAG.bin , please wait .... Loading program file passed SAM7A>/RBPATH
/redboot_JTAG.bin binRun the loaded RAM RedBoot:
SAM7A>
go 0x48000040
SAM7A>
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 RedBoot(tm) bootstrap and debug environment [JTAG] Non-certified release, version UNKNOWN - built 11:03:18, Oct 27 2006 Platform: Atmel AT91SAM7A2-EK (ARM7TDMI) Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Copyright (C) 2003, 2004, 2005, 2006 eCosCentric Limited RAM: 0x48000000-0x48040000, [0x48017078-0x4802d000] available FLASH: 0x40000000-0x401fffff, 31 x 0x10000 blocks, 8 x 0x2000 blocks RedBoot>
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 0x48008000, and the start address given to the go command should be 0x48008040. |
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, but is also applicable to initial configuration of a ROM RedBoot loaded using Method 1.
Use the following command to initialize RedBoot's Flash Information System (FIS):
RedBoot>
fis init -f
About to initialize [format] FLASH image system - continue (y/n)?y
*** Initialize FLASH Image System ... Erase from 0x40020000-0x401effff: ............................. ... Erase from 0x401f0000-0x401fffff: ........ ... Program from 0x48030000-0x48040000 to 0x401f0000: ........ RedBoot>Now configure RedBoot's Flash configuration with the command:
RedBoot>
fconfig -i
The following gives an example configuration:
RedBoot>
fconfig -i
Initialize non-volatile configuration - continue (y/n)?y
... Erase from 0x401f0000-0x401fffff: ........ ... Program from 0x48030000-0x48040000 to 0x401f0000: ........ RedBoot>
Loading and programming the ROM RedBoot
This section describes the steps required to load the ROM RedBoot from the TFTP server and program it into Flash.
Load the RedBoot ROM binary image using Y-Modem protocol over the serial line. First give this command to RedBoot:
RedBoot>
load -r -m y -b %{freememlo}
C RedBoot>Use the Y-Modem protocol support of your terminal emulator to send the
redboot_ROM.bin
file at this point. When the transfer is finished RedBoot will report:Raw file loaded 0x48017400-0x4802abd3, assumed entry at 0x48017400 xyzModem - CRC mode, 627(SOH)/0(STX)/0(CAN) packets, 8 retries RedBoot>
Finally install the loaded image into Flash:
RedBoot>
fis create RedBoot
An image named 'RedBoot' exists - continue (y/n)?y
... Erase from 0x40000000-0x4001ffff: ......... ... Program from 0x48017400-0x4802abd4 to 0x40000000: ......... ... Erase from 0x401f0000-0x401fffff: . ... Program from 0x48030000-0x48040000 to 0x401f0000: . RedBoot>
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.
+ RedBoot(tm) bootstrap and debug environment [ROM] Non-certified release, version UNKNOWN - built 11:41:25, Oct 27 2006 Platform: Atmel AT91SAM7A2-EK (ARM7TDMI) Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Copyright (C) 2003, 2004, 2005, 2006 eCosCentric Limited RAM: 0x48000000-0x48040000, [0x48005150-0x4802d000] available FLASH: 0x40000000-0x401fffff, 8 x 0x2000 blocks, 31 x 0x10000 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.
2024-03-18 | eCosPro Non-Commercial Public License |