This document covers the configuration and usage of eCos and RedBoot on the Atmel AT91SAM9G20 Evaluation Kit. The AT91SAM9G20 Evaluation Kit contains the AT91SAM9G20 microprocessor, 64Mbytes of SDRAM, 256Mbytes of NAND flash memory, an Atmel Dataflash, an Atmel serial EEPROM, a Davicom DM9161A PHY, a SD/MMC/DataFlash socket, a DAC, external connections for three serial channels (one debug, one full modem, one flow controlled), ethernet, USB host/device, and the various other peripherals supported by the AT91SAM9G20. eCos support for the many devices and peripherals on the boards and the AT91SAM9G20 is described below.
For typical eCos development, a RedBoot image is programmed into the dataflash memory, and the board will load this image from reset. RedBoot provides gdb stub functionality so it is then possible to download and debug stand-alone and eCos applications via the gdb debugger. This can happen over either a serial line or over ethernet.
This documentation is expected to be read in conjunction with the SAM9 processor HAL documentation and further device support and subsystems are described and documented there.
The Dataflash consists of 8192 blocks of 1056 bytes each. In a typical setup, the first 33792 bytes are reserved for the second-level bootstrap, AT91Bootstrap. The following 164736 bytes are reserved for the use of the ROM RedBoot image (The odd size aligns the end of the RedBoot area to a 1056 block boundary). The topmost block is used to manage the flash and the next block down holds RedBoot fconfig values. The remaining blocks can be used by application code.
There is a serial driver
which supports both the Debug Unit and USART serial devices. The
debug serial port at J17 and DTE port at J20 (connected to USART
channel 0) and flow controlled port at J18 (connected to USART channel
1) can be used by RedBoot for communication with the host. If
any of these devices is needed by the application, either directly
or via the serial driver, then it cannot also be used for RedBoot
communication. Another communication channel such as ethernet should
be used instead. The serial driver package is loaded automatically
when configuring for the AT91SAM9G20-EK target.
There is an ethernet driver
CYGPKG_DEVS_ETH_ARM_AT91 for the on-chip ethernet
device. The platform HAL package is responsible for configuring this
generic driver to the hardware. This driver is also loaded
automatically when configuring for the AT91SAM9G20-EK board.
There is a watchdog driver
CYGPKG_DEVICES_WATCHDOG_ARM_AT91WDTC. This driver is
also loaded automatically when configuring for the board.
There is a driver for the on-chip real-time timer controller (RTTC) at
CYGPKG_DEVICES_WALLCLOCK_ARM_AT91RTTC. This driver is
also loaded automatically when configuring for the target.
The SAM9 processor HAL contains a driver for the Two-Wire Interface (TWI) controller on the AT91SAM9G20. This type of bus is also known as I²C®. Further documentation may be found in the SAM9 processor HAL documentation.
The SAM9 processor HAL contains a driver for the MultiMedia Card Interface (MCI). This driver is loaded automatically when configuring for the AT91SAM9G20-EK target and allows use of MMC and Secure Digital (SD) flash storage cards within eCos, exported as block devices. Further documentation may be found in the SAM9 processor HAL documentation.
The platform HAL provides definitions
to allow access to devices on the SPI bus. The HAL provides
information to the more general AT91 SPI driver
CYGPKG_DEVS_SPI_ARM_AT91) which in turn provides
the underlying implementation for the SPI API layer in the
CYGPKG_IO_SPI package. All these packages are
automatically loaded when configuring for the board.
Furthermore, the platform HAL package contains support for SPI dataflash
cards. The HAL support integrates with the
CYGPKG_DEVS_FLASH_ATMEL_DATAFLASH package as well as
the above SPI packages. That package is automatically loaded when
configuring for the target. Dataflash media is then accessed
as a Flash device, using the Flash I/O API within the
CYGPKG_IO_FLASH package, if that package is loaded
in the configuration.
It is also possible to configure the HAL to access MMC cards in SPI mode, instead of using the MCI interface.
In general, devices (Caches, PIO, UARTs, EMAC) are initialized only as far as is necessary for eCos to run. Other devices (RTC, I2C, SPI, MCI etc.) are not touched unless the appropriate driver is loaded, although in some cases, the HAL boot sequence will set up the appropriate PIO configuration.
The AT91SAM9G20-EK support is intended to work with GNU tools configured for an arm-eabi target. The original port was undertaken using arm-elf-gcc version 3.4.4, arm-elf-gdb version 6.3, and binutils version 2.15.