Name

HAL Port — Implementation Details

Overview

This documentation explains how the eCos HAL specification has been mapped onto the Dream Chip A10 hardware, and should be read in conjunction with that specification. The platform HAL package complements the ARM architectural HAL, the Cortex-A variant HAL and the Altera HPS processor HAL. It provides functionality which is specific to the target board.

Startup

Following a hard or soft reset, the HAL will initialize or reinitialize most of the on-chip peripherals. There is an exception for RAM startup applications which depend on a ROM monitor for certain services.

For ROM startup, the HAL will perform additional initialization. This is all done in the PLATFORM_SETUP1 macro in the assembler header file hal_platform_setup.h.

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:

SDRAM
This is located at address 0x00000000 of the physical memory space. The SDRAM is 2GiB in size, although only the first 1GiB is used by eCos. The HAL configures the MMU to retain the SDRAM at virtual address 0x00000000 with caching enabled. The same memory is also accessible uncached and unbuffered at virtual location 0x40000000 for use by device drivers. Memory is required for the MMU tables, and must be aligned on a 16Kbyte boundary. These therefore occupy memory from 0x00010000 to 0x00014000. For ROM startup, all remaining SDRAM is available, although ROM applications actually load from 0x00100000. The virtual vector table is allocated as part of the RedBoot image and occupied 256 bytes from 0x00000050. RAM startup applications are loaded from location 0x00200000, reserving 1MiB for RedBoot.
SPI NOR Flash
SPI NOR flash media can only be accessed with the Flash API. For the purposes of this API a placeholder address range has been allocated as if the Flash is present at this address. The base of this address range is 0x80000000. This reserved range is not real memory and any attempt to access it directly by the processor other than via the Flash API will result in a memory address exception.
Peripheral Registers
These are located at various addresses in the physical memory space above 0xC0000000. When the MMU is enabled, it sets up a direct, uncached, unbuffered mapping so that these registers remain accessible at their physical locations.

SPI NOR Flash

eCos supports QSPI access to the NOR flash on the board. The device is typically used to contain RedBoot and flash configuration data.

Accesses to SPI flash are performed via the Flash API, using 0x80000000 or as the nominal address of the device, although it does not truly exist in the processor address space.

Since SPI flash is not directly addressable, access from RedBoot is only possible using fis command operations.

Real-time characterization

The tm_basic kernel test gives statistics gathered about the real-time characterization and performance of the kernel. The sample output is shown here for information. The test was built in ARM32 mode.

Example 276.1. dreamchip_a10 Real-time characterization

             Startup, main thrd : stack used   404 size  2304
             Startup :  Interrupt stack used  4096 size  4096
             Startup : Idlethread stack used    96 size  1280

eCos Kernel Timings
Notes: all times are in microseconds (.000001) unless otherwise stated

Reading the hardware clock takes 0 'ticks' overhead
... this value will be factored out of all other measurements
Clock interrupt took    1.00 microseconds (1 raw clock ticks)

Testing parameters:
   Clock samples:            32
   Threads:                  64
   Thread switches:         128
   Mutexes:                  32
   Mailboxes:                32
   Semaphores:               32
   Scheduler operations:    128
   Counters:                 32
   Flags:                    32
   Alarms:                   32
   Stack Size:             1088


                                 Confidence
     Ave     Min     Max     Var  Ave  Min  Function
  ======  ======  ======  ====== ========== ========
INFO:<Ctrl-C disabled until test completion>
    0.92    0.00    2.00    0.23   82%  12% Create thread
    0.17    0.00    1.00    0.28   82%  82% Yield thread [all suspended]
    0.20    0.00    1.00    0.32   79%  79% Suspend [suspended] thread
    0.16    0.00    1.00    0.26   84%  84% Resume thread
    0.23    0.00    1.00    0.36   76%  76% Set priority
    0.13    0.00    1.00    0.22   87%  87% Get priority
    0.30    0.00    1.00    0.42   70%  70% Kill [suspended] thread
    0.25    0.00    1.00    0.38   75%  75% Yield [no other] thread
    0.23    0.00    1.00    0.36   76%  76% Resume [suspended low prio] thread
    0.16    0.00    1.00    0.26   84%  84% Resume [runnable low prio] thread
    0.22    0.00    1.00    0.34   78%  78% Suspend [runnable] thread
    0.19    0.00    1.00    0.30   81%  81% Yield [only low prio] thread
    0.17    0.00    1.00    0.28   82%  82% Suspend [runnable->not runnable]
    0.33    0.00    1.00    0.44   67%  67% Kill [runnable] thread
    0.34    0.00    1.00    0.45   65%  65% Destroy [dead] thread
    0.50    0.00    1.00    0.50  100%  50% Destroy [runnable] thread
    0.63    0.00    1.00    0.47   62%  37% Resume [high priority] thread
    0.34    0.00    1.00    0.45   66%  66% Thread switch

    0.09    0.00    1.00    0.16   91%  91% Scheduler lock
    0.17    0.00    1.00    0.28   82%  82% Scheduler unlock [0 threads]
    0.17    0.00    1.00    0.28   82%  82% Scheduler unlock [1 suspended]
    0.17    0.00    1.00    0.28   82%  82% Scheduler unlock [many suspended]
    0.15    0.00    1.00    0.25   85%  85% Scheduler unlock [many low prio]

    0.06    0.00    1.00    0.12   93%  93% Init mutex
    0.16    0.00    1.00    0.26   84%  84% Lock [unlocked] mutex
    0.19    0.00    1.00    0.30   81%  81% Unlock [locked] mutex
    0.16    0.00    1.00    0.26   84%  84% Trylock [unlocked] mutex
    0.00    0.00    0.00    0.00  100% 100% Trylock [locked] mutex
    0.06    0.00    1.00    0.12   93%  93% Destroy mutex
    0.03    0.00    1.00    0.06   96%  96% Unlock/Lock mutex

    0.19    0.00    1.00    0.30   81%  81% Create mbox
    0.13    0.00    1.00    0.22   87%  87% Peek [empty] mbox
    0.19    0.00    1.00    0.30   81%  81% Put [first] mbox
    0.06    0.00    1.00    0.12   93%  93% Peek [1 msg] mbox
    0.22    0.00    1.00    0.34   78%  78% Put [second] mbox
    0.06    0.00    1.00    0.12   93%  93% Peek [2 msgs] mbox
    0.16    0.00    1.00    0.26   84%  84% Get [first] mbox
    0.06    0.00    1.00    0.12   93%  93% Get [second] mbox
    0.16    0.00    1.00    0.26   84%  84% Tryput [first] mbox
    0.19    0.00    1.00    0.30   81%  81% Peek item [non-empty] mbox
    0.16    0.00    1.00    0.26   84%  84% Tryget [non-empty] mbox
    0.22    0.00    1.00    0.34   78%  78% Peek item [empty] mbox
    0.16    0.00    1.00    0.26   84%  84% Tryget [empty] mbox
    0.09    0.00    1.00    0.17   90%  90% Waiting to get mbox
    0.09    0.00    1.00    0.17   90%  90% Waiting to put mbox
    0.06    0.00    1.00    0.12   93%  93% Delete mbox
    0.00    0.00    0.00    0.00  100% 100% Put/Get mbox

    0.09    0.00    1.00    0.17   90%  90% Init semaphore
    0.19    0.00    1.00    0.30   81%  81% Post [0] semaphore
    0.16    0.00    1.00    0.26   84%  84% Wait [1] semaphore
    0.06    0.00    1.00    0.12   93%  93% Trywait [0] semaphore
    0.16    0.00    1.00    0.26   84%  84% Trywait [1] semaphore
    0.13    0.00    1.00    0.22   87%  87% Peek semaphore
    0.13    0.00    1.00    0.22   87%  87% Destroy semaphore
    0.00    0.00    0.00    0.00  100% 100% Post/Wait semaphore

    0.13    0.00    1.00    0.22   87%  87% Create counter
    0.09    0.00    1.00    0.17   90%  90% Get counter value
    0.06    0.00    1.00    0.12   93%  93% Set counter value
    0.19    0.00    1.00    0.30   81%  81% Tick counter
    0.06    0.00    1.00    0.12   93%  93% Delete counter

    0.09    0.00    1.00    0.17   90%  90% Init flag
    0.19    0.00    1.00    0.30   81%  81% Destroy flag
    0.13    0.00    1.00    0.22   87%  87% Mask bits in flag
    0.19    0.00    1.00    0.30   81%  81% Set bits in flag [no waiters]
    0.22    0.00    1.00    0.34   78%  78% Wait for flag [AND]
    0.19    0.00    1.00    0.30   81%  81% Wait for flag [OR]
    0.16    0.00    1.00    0.26   84%  84% Wait for flag [AND/CLR]
    0.19    0.00    1.00    0.30   81%  81% Wait for flag [OR/CLR]
    0.06    0.00    1.00    0.12   93%  93% Peek on flag

    0.13    0.00    1.00    0.22   87%  87% Create alarm
    0.22    0.00    1.00    0.34   78%  78% Initialize alarm
    0.16    0.00    1.00    0.26   84%  84% Disable alarm
    0.19    0.00    1.00    0.30   81%  81% Enable alarm
    0.09    0.00    1.00    0.17   90%  90% Delete alarm
    0.16    0.00    1.00    0.26   84%  84% Tick counter [1 alarm]
    0.66    0.00    1.00    0.45   65%  34% Tick counter [many alarms]
    0.31    0.00    1.00    0.43   68%  68% Tick & fire counter [1 alarm]
    3.00    3.00    3.00    0.00  100% 100% Tick & fire counters [>1 together]
    0.78    0.00    1.00    0.34   78%  21% Tick & fire counters [>1 separately]
    0.00    0.00    0.00    0.00  100% 100% Alarm latency [0 threads]
    0.43    0.00    1.00    0.49   57%  57% Alarm latency [2 threads]
    0.63    0.00    1.00    0.47   62%  37% Alarm latency [many threads]
    1.00    1.00    1.00    0.00  100% 100% Alarm -> thread resume latency

    0.00    0.00    0.00    0.00            Clock/interrupt latency

    1.00    1.00    1.00    0.00            Clock DSR latency

     233     172     288                    Worker thread stack used (stack size 1088)
            All done, main thrd : stack used  1204 size  2304
            All done :  Interrupt stack used   420 size  4096
            All done : Idlethread stack used   248 size  1280

Timing complete - 29810 ms total

PASS:<Basic timing OK>
EXIT:<done>

Other Issues

The platform HAL does not affect the implementation of other parts of the eCos HAL specification. The HPS processor HAL and the ARM architectural HAL documentation should be consulted for further details.