Setup

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:

ConfigurationDescriptionUseFile
ROMRedBoot running from ROMredboot_ROM.ecmredboot_ROM.bin
RAMRedBoot running from RAMredboot_RAM.ecmredboot_RAM.bin
JTAGRedBoot running from RAM, loaded via JTAGredboot_JTAG.ecmredboot_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:

  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.at91sam7a2ek.cfg within the eCos platform HAL package in the source repository. This will be in the directory packages/hal/arm/at91/at91sam7a2ek/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.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.

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

  8. Open bdi2000.at91sam7a2ek.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.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.

  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 AT91SAM7A2-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:

    SAM7A2>

  6. 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>

  7. Locate the redboot_ROM.bin image within the loaders subdirectory of the base of the eCos installation.

  8. 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:

  1. Connect to the BDI2000 telnet port as before.

  2. 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>

  3. 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 /RBPATH/redboot_ROM.bin bin
    Programming redboot_ROM.bin , please wait ....
    Programming flash passed
    SAM7A>
    This 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

  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:

    SAM7A>load 0x48000000 /RBPATH/redboot_JTAG.bin bin
    Loading /RBPATH/redboot_JTAG.bin , please wait ....
    Loading program file passed
    SAM7A>

  4. Run 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.

  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>

  2. 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.

  1. 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> 
  2. 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.

2017-02-09
Documentation license for this page: eCosPro License