Setup

Name

Setup -- Preparing the AT91SAM9260-EK board for eCos Development

Overview

In a typical development environment, the AT91SAM9260-EK board boots from the DataFlash and runs the RedBoot ROM monitor from SDRAM. eCos applications are configured for RAM startup and then downloaded and run on the board via the debugger arm-eabi-gdb. Preparing the board therefore usually involves programming a suitable RedBoot image into flash memory.

The following RedBoot configurations are supported:

ConfigurationDescriptionUseFile
ROMRedBoot loaded from Dataflash to SDRAMredboot_ROM.ecmredboot_ROM.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.

Note that the use of the term ROM for the initial RedBoot configuration is a historical accident. RedBoot actually runs from SDRAM after being loaded there from Dataflash by the second-level bootstrap. The use of ROM for this configuration is intended to indicate that it initializes the microprocessor and board peripherals, as opposed to the RAM configuration which assumes that this has already been done.

Initial Installation

The on-chip boot program on the AT91SAM9260 is only capable of loading programs from Dataflash or NAND flash into 4Kbytes of on-chip SRAM and is therefore quite restrictive. Consequently RedBoot cannot be booted directly and a second-level bootstrap must be used. Such a second-level bootstrap is supplied by Atmel in the form of AT91Bootstrap. This is therefore programmed into the start of Dataflash and is then responsible for initializing the SDRAM and loading RedBoot from Dataflash and executing it.

Caution

There is a size limit on the size of applications which the AT91Bootstrap second level bootstrap will load. Images larger than 320Kbytes will require the AT91Bootstrap application to be rebuilt with a larger IMG_SIZE definition in AT91Bootstrap/board/at91sam9260ek/dataflash/at91sam9260ek.h within the sam9260ek HAL package in the eCos source repository (packages/hal/arm/arm9/sam9260ek/VERSION/).

There are basically two ways to write the second-level bootstrap and RedBoot to the Dataflash. The first is to use the Atmel-supplied SAM-BA program that interacts with the on-chip boot program. The second is to use a JTAG debugger that understands the microcontroller and can write to the dataflash (for example the Ronetix PEEDI). Since the availability of the latter cannot be guaranteed, only the first method will be described here.

Programming RedBoot into DataFlash using SAM-BA

The following gives the steps needed to program the second-level bootstrap and RedBoot into the DataFlash using SAM-BA. The user should refer to the SAM-BA documentation for full details of how to run the program.

  1. Download the AT91 In-system Programmer software package from the Atmel website and install it. Atmel provide both Linux and Windows versions of SAM-BA so ensure you select the version appropriate to your host operating system. The remainder of this document describes the process according to a Windows installation. The steps for the Linux version of SAM-BA are similar and can easily be determined from the Windows process.

  2. Copy dataflash_at91sam9260ek.bin and redboot_ROM.bin to a suitable location on the Windows PC.

  3. Connect a null-modem serial cable between the DEBUG serial port of the board and a serial port on a convenient host (which need not be the PC running SAM-BA). Run a terminal emulator (Hyperterm or minicom) at 115200 baud. Connect a USB cable between the PC and the AT91SAM9260-EK board.

  4. Power up or reset the board and Windows should recognize the USB device. If it does not, hold down switch BP4 while powering up or resetting the board. This will erase any previous bootloader from the dataflash. Reset the board again and it should be recognized now. Windows may ask you to install a new driver, in which case follow the instructions. If the USB device does not appear, check the USB cable.

    Note: Under Linux this device may appear as /dev/ACM0 or /dev/ttyUSB0. SAM-BA currently only recognises the latter so you may have to create a symbolic link from /dev/ACM0 to /dev/ttyUSB0.

  5. Start SAM-BA. Select "\usb\ARM0" for the communication interface, and "AT91SAM9260-EK" for the board. If the USB option does not appear, look in the Windows Device Manager for the active device. If all is well, click on "Connect".

  6. In the SAM-BA main window, select the "DataFlash AT45DB/DBC" tab and in the "Scripts" dropdown menu select "Enable Dataflash (SPIO CS1)", to program the on-board Dataflash device. Click Execute and SAM-BA should emit the following in the message area:

    (AT91-ISP v1.13) 1 % DATAFLASH::Init 1
    -I- DATAFLASH::Init 1 (trace level : 4)
    -I- Loading applet isp-dataflash-at91sam9260.bin at address 0x20000000
    -I- Memory Size : 0x840000 bytes
    -I- Buffer address : 0x20002A70
    -I- Buffer size: 0x80E80 bytes
    -I- Applet initialization done
    The actual options and output of SAM-BA may vary according to the version you are using. The behaviour documented here is that of SAM-BA 2.9.

  7. Now select the DataFlash tab again, "Send BootFile" from the "Scripts" menu and "Execute" it. When the file open dialog appears, select the dataflash_at91sam9260ek.bin file and click "Open". The following output should be seen:

    (AT91-ISP v1.13) 1 % GENERIC::SendBootFileGUI
    GENERIC::SendFile dataflash_at91sam9260ek.bin at address 0x0
    -I- File size : 0xF82 byte(s)
    -I- 	Writing: 0xF82 bytes at 0x0 (buffer addr : 0x20002A70)
    -I- 	0xF82 bytes written by applet

  8. The second-level bootstrap has now been written to DataFlash, we must now write RedBoot.

  9. In the "Send File Name" box type in the path name to the redboot_ROM.bin file, or use the Open Folder button and browse to it.

  10. In the Address field set the value to 0x8400.

  11. Click the "Send File" button. SAM-BA will put up a dialog box while it is writing the file to the DataFlash, and will output something similar to the following in the message area:

    (AT91-ISP v1.13) 1 % send_file {DataFlash AT45DB/DCB} "redboot_ROM.bin" 0x8400 0
    -I- Send File //bert/Shared/Releng/sam9260ek/redboot_ROM.bin at address 0x8400
    GENERIC::SendFile //bert/Shared/Releng/sam9260ek/redboot_ROM.bin at address 0x8400
    -I- File size : 0x243D0 byte(s)
    -I- 	Writing: 0x243D0 bytes at 0x8400 (buffer addr : 0x20002A70)
    -I- 	0x243D0 bytes written by applet

  12. Shut down SAM-BA and disconnect the USB cable. Press the reset button on the board and something similar to the following should be output on the DEBUG serial line.

    RomBOOT
    >Start AT91Bootstrap...
    +**Warning** FLASH configuration checksum error or invalid key
    Use 'fconfig -i' to [re]initialize database
    No space to add 'net_device'
    AT91_ETH: Waiting for PHY to reset.
    AT91_ETH: Waiting for link to come up..
    Ethernet eth0: MAC address 12:34:56:78:9a:bc
    No IP info for device!
    
    RedBoot(tm) bootstrap and debug environment [ROM]
    eCosCentric certified release, version v3_0_3 - built 12:50:09, Sep 24 2009
    
    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
    Free Software Foundation, Inc.
    Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 eCosCentric Limited
    RedBoot is free software, covered by the eCos license, derived from the
    GNU General Public License. You are welcome to change it and/or distribute
    copies of it under certain conditions. Under the license terms, RedBoot's
    source code and full license terms must have been made available to you.
    Redboot comes with ABSOLUTELY NO WARRANTY.
    
    Platform: AT91SAM9260-EK (ARM9)
    RAM: 0x20000000-0x24000000 [0x20035d08-0x23ffef80 available]
    FLASH: 0x40000000-0x4083ffff, 8192 x 0x420 blocks
    RedBoot>

RedBoot Flash configuration

The following steps describe how to initialize RedBoot's Flash configuration.

  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
    ... Erase from 0x4083fbe0-0x4083ffff: .
    ... Program from 0x23fffbe0-0x24000000 to 0x4083fbe0: .
    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.83
    Local IP address mask: 255.255.255.0
    Default server IP address: 192.168.7.11
    Console baud rate: 115200
    DNS domain name: farm.ecoscentric.com
    DNS server IP address: 192.168.7.11
    Network hardware address [MAC]: 0x0E:0x00:0x00:0xEA:0x18:0xF0
    GDB connection port: 9000
    Force console for special debug messages: false
    Update RedBoot non-volatile configuration - continue (y/n)? y
    ... Erase from 0x4083f7c0-0x4083fbdf: .
    ... Program from 0x23fff7c0-0x23fffbe0 to 0x4083f7c0: .
    RedBoot>

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

Ethernet eth0: MAC address 0e:00:00:ea:18:a2
IP: 192.168.7.83/255.255.255.0, Gateway: 192.168.7.11
Default server: 192.168.7.11
DNS server IP: 192.168.7.11, DNS domain name: <null>

RedBoot(tm) bootstrap and debug environment [ROM]
eCosCentric certified release, version v3_0_3 - built 12:50:09, Sep 24 2009

Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 eCosCentric Limited
RedBoot is free software, covered by the eCos license, derived from the
GNU General Public License. You are welcome to change it and/or distribute
copies of it under certain conditions. Under the license terms, RedBoot's
source code and full license terms must have been made available to you.
Redboot comes with ABSOLUTELY NO WARRANTY.

Platform: AT91SAM9260-EK (ARM9)
RAM: 0x20000000-0x24000000 [0x20035d08-0x23ffef80 available]
FLASH: 0x40000000-0x4083ffff, 8192 x 0x420 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.

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 ROM version of RedBoot for the AT91SAM9260-EK are:

$ mkdir redboot_at91sam9260ek_rom
$ cd redboot_at91sam9260ek_rom
$ ecosconfig new at91sam9260ek redboot
$ ecosconfig import $ECOS_REPOSITORY/hal/arm/arm9/sam9260ek/VERSION/misc/redboot_ROM.ecm
$ ecosconfig resolve
$ ecosconfig tree
$ make
    

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

Rebuilding AT91Bootstrap

The sources of AT91Bootstrap are found in the AT91Bootstrap directory of the sam9260ek package. This is a copy of the software as supplied by Atmel with some slight modifications to permit it to be built with the same tools as eCos.

To rebuild the second-level bootstrap for the AT91SAM9260-EK execute the following commands:

$ cd $ECOS_REPOSITORY/hal/arm/arm9/sam9260ek/VERSION/AT91Bootstrap/board/at91sam9260ek/dataflash
$ make

This should result in the creation of a number of files, including dataflash_at91sam9260ek.bin which can be copied out.

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