Name
HAL Port — Implementation Details
Overview
This documentation explains how the eCos HAL specification has been mapped onto the KB920x hardware, and should be read in conjunction with that specification. The KB920x platform HAL package complements the ARM architectural HAL and the ARM9 variant 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 or ROMRAM startup, the HAL will perform additional
initialization, setting up the external RAM and programming the
various internal registers. 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:
- Flash
- This is located at address 0x10000000 of the physical memory space. The HAL uses the MMU to locate it at virtual address 0x60000000 after initialization. It remains accessible at address 0x1000000 but accesses to this address range are uncached.
- SDRAM
- This is located at address 0x20000000 of the physical memory space. However the HAL uses the MMU to relocate this to virtual address 0x00000000. The same memory is also accessible uncached and unbuffered at virtual location 0x20000000 for use by devices. The first 32 bytes are used for hardware exception vectors. The next 32 bytes are used for the VSR table and the next 256 bytes are normally used for the eCos virtual vectors, allowing RAM-based applications to use services provided by the ROM monitor. For ROM/ROMRAM startup, all remaining SDRAM is available. For RAM startup, available RAM starts at virtual location 0x00040000, with the bottom 256kB reserved for use by RedBoot.
- On-chip SRAM
- This is located at address 0x00200000 of the physical memory space. However the HAL uses the MMU to relocate this to virtual address 0x70000000. The same memory is also accessible uncached and unbuffered at virtual location 0x70100000 for use by devices. At present this memory is entirely reserved for use by the ethernet interface, since there are problems using external SDRAM for ethernet buffers.
- On-chip Peripheral Registers
- These are located at address 0xFF000000 in the physical memory space. When the MMU is enabled, it sets up a direct, uncached, unbuffered mapping so that these registers remain accessible at their physical locations.
- Off-chip Peripherals
- Apart from the SDRAM, flash and ethernet PHY, eCos does not currently make any use of the off-chip peripherals present on the KB920x boards.
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 Thumb mode, which provided better performance than ARM mode.
Example 258.1. kb9200 Real-time characterization
Startup, main stack : stack used 336 size 3920 Startup : Interrupt stack used 492 size 4096 Startup : Idlethread stack used 88 size 2048 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 15.40 microseconds (7 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 Confidence Ave Min Max Var Ave Min Function ====== ====== ====== ====== ========== ======== 16.70 10.67 23.47 3.01 51% 28% Create thread 2.50 2.13 8.53 0.63 85% 85% Yield thread [all suspended] 2.67 2.13 6.40 0.82 76% 76% Suspend [suspended] thread 3.00 2.13 6.40 1.06 60% 60% Resume thread 4.10 2.13 10.67 0.49 85% 12% Set priority 1.23 0.00 2.13 1.04 57% 42% Get priority 8.30 6.40 21.34 0.77 78% 20% Kill [suspended] thread 2.73 2.13 8.53 0.90 75% 75% Yield [no other] thread 4.50 4.27 8.53 0.42 90% 90% Resume [suspended low prio] thread 2.70 2.13 6.40 0.85 75% 75% Resume [runnable low prio] thread 4.33 2.13 8.53 0.32 89% 4% Suspend [runnable] thread 2.70 2.13 4.27 0.83 73% 73% Yield [only low prio] thread 2.77 2.13 4.27 0.89 70% 70% Suspend [runnable->not runnable] 8.20 6.40 21.34 0.90 73% 25% Kill [runnable] thread 7.40 6.40 14.93 1.15 98% 57% Destroy [dead] thread 11.73 10.67 25.60 1.27 98% 59% Destroy [runnable] thread 14.67 12.80 25.60 0.87 73% 23% Resume [high priority] thread 6.72 6.40 10.67 0.54 85% 85% Thread switch 0.55 0.00 2.13 0.82 74% 74% Scheduler lock 1.80 0.00 2.13 0.56 84% 15% Scheduler unlock [0 threads] 1.82 0.00 2.13 0.54 85% 14% Scheduler unlock [1 suspended] 1.82 0.00 4.27 0.57 83% 15% Scheduler unlock [many suspended] 1.82 0.00 4.27 0.57 83% 15% Scheduler unlock [many low prio] 0.87 0.00 2.13 1.03 59% 59% Init mutex 3.13 2.13 6.40 1.12 56% 56% Lock [unlocked] mutex 3.53 2.13 6.40 1.05 59% 37% Unlock [locked] mutex 3.13 2.13 6.40 1.12 56% 56% Trylock [unlocked] mutex 2.60 2.13 6.40 0.76 81% 81% Trylock [locked] mutex 0.87 0.00 2.13 1.03 59% 59% Destroy mutex 15.13 14.93 21.34 0.38 96% 96% Unlock/Lock mutex 1.27 0.00 4.27 1.11 53% 43% Create mbox 0.93 0.00 2.13 1.05 56% 56% Peek [empty] mbox 3.40 2.13 6.40 1.11 53% 43% Put [first] mbox 0.87 0.00 2.13 1.03 59% 59% Peek [1 msg] mbox 3.27 2.13 6.40 1.13 96% 50% Put [second] mbox 1.07 0.00 2.13 1.07 100% 50% Peek [2 msgs] mbox 3.40 2.13 6.40 1.11 53% 43% Get [first] mbox 3.73 2.13 6.40 0.90 68% 28% Get [second] mbox 3.53 2.13 6.40 1.05 59% 37% Tryput [first] mbox 3.53 2.13 8.53 1.14 56% 40% Peek item [non-empty] mbox 3.53 2.13 6.40 1.05 59% 37% Tryget [non-empty] mbox 3.33 2.13 6.40 1.12 50% 46% Peek item [empty] mbox 3.33 2.13 6.40 1.12 50% 46% Tryget [empty] mbox 1.20 0.00 2.13 1.05 56% 43% Waiting to get mbox 1.20 0.00 4.27 1.12 50% 46% Waiting to put mbox 3.53 2.13 8.53 1.14 56% 40% Delete mbox 7.60 6.40 17.07 1.42 93% 59% Put/Get mbox 0.87 0.00 2.13 1.03 59% 59% Init semaphore 2.33 2.13 4.27 0.36 90% 90% Post [0] semaphore 2.87 2.13 6.40 1.01 68% 68% Wait [1] semaphore 2.60 2.13 6.40 0.76 81% 81% Trywait [0] semaphore 2.27 2.13 4.27 0.25 93% 93% Trywait [1] semaphore 0.73 0.00 2.13 0.96 65% 65% Peek semaphore 1.00 0.00 4.27 1.12 56% 56% Destroy semaphore 9.07 8.53 17.07 0.90 84% 84% Post/Wait semaphore 1.20 0.00 4.27 1.12 50% 46% Create counter 0.87 0.00 2.13 1.03 59% 59% Get counter value 0.60 0.00 2.13 0.86 71% 71% Set counter value 3.33 2.13 6.40 1.12 50% 46% Tick counter 1.27 0.00 2.13 1.03 59% 40% Delete counter 0.73 0.00 2.13 0.96 65% 65% Init flag 2.60 2.13 6.40 0.76 81% 81% Destroy flag 2.47 2.13 4.27 0.56 84% 84% Mask bits in flag 2.80 2.13 6.40 0.96 71% 71% Set bits in flag [no waiters] 4.00 2.13 8.53 0.70 78% 18% Wait for flag [AND] 3.67 2.13 8.53 1.05 62% 34% Wait for flag [OR] 3.67 2.13 8.53 1.05 62% 34% Wait for flag [AND/CLR] 3.67 2.13 8.53 1.05 62% 34% Wait for flag [OR/CLR] 0.40 0.00 2.13 0.65 81% 81% Peek on flag 0.67 0.00 4.27 0.96 71% 71% Create alarm 4.67 4.27 10.67 0.70 87% 87% Initialize alarm 2.73 2.13 6.40 0.90 75% 75% Disable alarm 4.60 4.27 10.67 0.60 90% 90% Enable alarm 3.13 2.13 6.40 1.12 56% 56% Delete alarm 3.07 2.13 4.27 1.05 56% 56% Tick counter [1 alarm] 16.60 14.93 17.07 0.73 78% 21% Tick counter [many alarms] 5.07 4.27 8.53 1.05 65% 65% Tick & fire counter [1 alarm] 87.67 87.48 89.61 0.36 90% 90% Tick & fire counters [>1 together] 18.80 17.07 21.34 0.76 75% 21% Tick & fire counters [>1 separately] 12.97 12.80 32.00 0.33 98% 98% Alarm latency [0 threads] 15.03 12.80 36.27 0.97 65% 18% Alarm latency [2 threads] 15.28 12.80 40.54 1.64 39% 27% Alarm latency [many threads] 24.09 23.47 98.14 1.20 97% 97% Alarm -> thread resume latency 2.27 2.13 10.67 0.00 Clock/interrupt latency 5.40 4.27 12.80 0.00 Clock DSR latency 10 0 764 (main stack: 1328) Thread stack used (1360 total) All done, main stack : stack used 1328 size 3920 All done : Interrupt stack used 136 size 4096 All done : Idlethread stack used 212 size 2048 Timing complete - 29880 ms total PASS:<Basic timing OK> EXIT:<done>
Other Issues
The KB920x platform HAL does not affect the implementation of other parts of the eCos HAL specification. The ARM9 variant HAL, and the ARM architectural HAL documentation should be consulted for further details.
2024-12-10 | eCosPro Non-Commercial Public License |