HAL Port — Implementation Details


This documentation explains how the eCos HAL specification has been mapped onto the STB220 hardware, and should be read in conjunction with that specification. The STB220 platform HAL package complements the MIPS architectural HAL, the PNX8330 variant HAL, and the PNX83xx support HAL. It provides functionality which is specific to the target board.


Following a hard or soft reset the HAL will set up some of the on-chip peripherals appropriately for eCos, but most peripherals are left to their default settings. Full details of this initialization can be found in the function hal_platform_init in stb220.c.

Linker Scripts and Memory Maps

The platform HAL package provides the memory layout information needed to generate the linker script. The key memory locations are as follows:

External SDRAM
This is mapped to location 0x80000000. The first four kilobytes are reserved for exception vectors and for some data which needs to be shared between RAM startup applications and the ROM monitor. For ROMRAM or JTAG startup, code will be loaded from 0x80001000 onwards. For ROM startup data will be loaded from 0x80001000 onwards. For RAM startup, code will start at 0x80100000, reserving the bottom 1MB for RedBoot's code and data.
On-chip Peripherals
These are accessible at location 0xB7000000 onwards.
External Flash
This is located at location 0x98000000 onwards. Different STB220 boards may come with different flash chips so CFI is used at run-time to query the flash chip and adapt. Typically the first 128K of flash at location 0x98000000 is used to hold RedBoot, and the last flash block at location 0x98DE0000 is used to hold flash management data and the RedBoot fconfig variables. The remaining blocks can be used by application code.

Clock Support

The platform HAL provides configuration options for the eCos system clock. This always uses the 4kEc COUNTER/COMPARE registers accessed via coprocessor 0. The actual HAL macros for managing the clock are provided by the MIPS architectural HAL. The specific numbers used are a characteristic of the platform because they depend on the processor speed. The CONFIG unit's timer 0 is used for profiling and its watchdog timer is supported by a watchdog driver.

MIPS16 Support

The STB220 platform HAL enables MIPS16 support in the architecture HAL. This allows application code to be compiled using MIPS16 options and linked against the 32 bit mode eCos library.

To compile for MIPS16 the standard flags that are used in eCos and exported to the ecos.mak file should be used except that the -mips32 flag should be replaced by -mips16 -fwritable-strings. The -mips16 option enables MIPS16 compilation and the -fwritable-strings option is a work-around for a bug in the compiler.

Other Issues

The STB220 platform HAL does not affect the implementation of other parts of the eCos HAL specification.