Name
HAL Port — Implementation Details
Overview
This documentation explains how the eCos HAL specification has been mapped onto the SAMX70-EK board hardware, and should be read in conjunction with that specification. The SAMX70-EK platform HAL package complements the Cortex-M architectural HAL and the SAM variant HAL. It provides functionality which is specific to the target board.
Startup
For ROM and JTAG startup, the HAL will perform
initialization, programming the various internal registers
including the PLL, peripheral clocks and pin multiplexing.
The details of the early hardware startup may be found in
the src/samx70_ek_misc.c
in both
hal_system_init()
and
hal_platform_init()
.
Memory Map
The platform HAL package provides the memory layout information needed to generate the linker script. The key memory areas are as follows:
- Internal SRAM
-
This is located at address 0x20400000 of the memory
space, and is 384KiB in size. The eCos VSR table
occupies the bottom 256 bytes, with the virtual vector
table starting at 0x20000200 and extending to
0x20000300. The top of SRAM is reserved for the MCAN
message buffer memory, whose size depends on the MCAN
configuration, and below those
CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE
bytes are reserved for the interrupt stack. The remainder of internal RAM is available for use by applications. - Internal FLASH
- This is located at address 0x004000000 of the memory space. This region is 2048KiB in size. ROM applications are by default configured to run from this memory.
- On-Chip Peripherals
- These are accessible at locations 0x40000000 and 0xE0000000 upwards. Descriptions of the contents can be found in the SAMX70 User Manual.
Linker Scripts
The platform linker scripts define the following symbols:
- hal_vsr_table
- This defines the location of the VSR table. This is set to 0x20000000 for all startup types, and space for 128 entries is reserved.
- hal_virtual_vector_table
- This defines the location of the virtual vector table used to communicate between a ROM monitor and an eCos application. This is allocated right after the VSR table, at 0x20400200.
- hal_mcan_ram1
- This defines the location of the message RAM for MCAN1. It is allocated at the top of SRAM, and its size is specified by the MCAN package if present, or will be zero if it is not.
- hal_mcan_ram0
- This defines the location of the message RAM for MCAN0. It is allocated just before the RAM for MCAN1, and its size is specified by the MCAN package if present, or will be zero if it is not.
- hal_interrupt_stack
- This defines the location of the interrupt stack. For all startup types this is allocated to the top of internal SRAM just before the MCAN message RAM.
- hal_startup_stack
- This defines the location of the startup stack. For all startup types it is initially allocated at the half-way point of the interrupt stack.
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 for JTAG startup on a SAMV71-XULT board.
Example 299.1. samv71-XULT Real-time characterization
Configured Testing parameters: Clock samples: 32 Threads: 19 Thread switches: 128 Mutexes: 873 Mailboxes: 254 Semaphores: 1528 Scheduler operations: 128 Counters: 509 Flags: 1018 Alarms: 436 Stack Size: 1088 Startup, main thrd : stack used 108 size 1536 Startup : Idlethread stack used 76 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.03 microseconds (1 raw clock ticks) Testing parameters: Clock samples: 32 Threads: 19 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> 1.16 1.00 2.00 0.27 84% 84% Create thread 0.26 0.00 1.00 0.39 73% 73% Yield thread [all suspended] 0.21 0.00 1.00 0.33 78% 78% Suspend [suspended] thread 0.32 0.00 1.00 0.43 68% 68% Resume thread 0.42 0.00 1.00 0.49 57% 57% Set priority 0.11 0.00 1.00 0.19 89% 89% Get priority 0.68 0.00 1.00 0.43 68% 31% Kill [suspended] thread 0.32 0.00 1.00 0.43 68% 68% Yield [no other] thread 0.42 0.00 1.00 0.49 57% 57% Resume [suspended low prio] thread 0.32 0.00 1.00 0.43 68% 68% Resume [runnable low prio] thread 0.42 0.00 1.00 0.49 57% 57% Suspend [runnable] thread 0.32 0.00 1.00 0.43 68% 68% Yield [only low prio] thread 0.32 0.00 1.00 0.43 68% 68% Suspend [runnable->not runnable] 0.68 0.00 1.00 0.43 68% 31% Kill [runnable] thread 0.63 0.00 1.00 0.47 63% 36% Destroy [dead] thread 1.37 1.00 2.00 0.47 63% 63% Destroy [runnable] thread 1.53 1.00 2.00 0.50 52% 47% Resume [high priority] thread 0.52 0.00 1.00 0.50 51% 48% Thread switch 0.06 0.00 1.00 0.12 93% 93% Scheduler lock 0.20 0.00 1.00 0.32 79% 79% Scheduler unlock [0 threads] 0.21 0.00 1.00 0.33 78% 78% Scheduler unlock [1 suspended] 0.20 0.00 1.00 0.32 79% 79% Scheduler unlock [many suspended] 0.22 0.00 1.00 0.34 78% 78% Scheduler unlock [many low prio] 0.09 0.00 1.00 0.17 90% 90% Init mutex 0.28 0.00 1.00 0.40 71% 71% Lock [unlocked] mutex 0.34 0.00 1.00 0.45 65% 65% Unlock [locked] mutex 0.28 0.00 1.00 0.40 71% 71% Trylock [unlocked] mutex 0.28 0.00 1.00 0.40 71% 71% Trylock [locked] mutex 0.06 0.00 1.00 0.12 93% 93% Destroy mutex 3.00 3.00 3.00 0.00 100% 100% Unlock/Lock mutex 0.22 0.00 1.00 0.34 78% 78% Create mbox 0.06 0.00 1.00 0.12 93% 93% Peek [empty] mbox 0.25 0.00 1.00 0.38 75% 75% Put [first] mbox 0.09 0.00 1.00 0.17 90% 90% Peek [1 msg] mbox 0.38 0.00 1.00 0.47 62% 62% Put [second] mbox 0.06 0.00 1.00 0.12 93% 93% Peek [2 msgs] mbox 0.38 0.00 1.00 0.47 62% 62% Get [first] mbox 0.34 0.00 1.00 0.45 65% 65% Get [second] mbox 0.25 0.00 1.00 0.38 75% 75% Tryput [first] mbox 0.19 0.00 1.00 0.30 81% 81% Peek item [non-empty] mbox 0.31 0.00 1.00 0.43 68% 68% Tryget [non-empty] mbox 0.31 0.00 1.00 0.43 68% 68% Peek item [empty] mbox 0.25 0.00 1.00 0.38 75% 75% Tryget [empty] mbox 0.09 0.00 1.00 0.17 90% 90% Waiting to get mbox 0.00 0.00 0.00 0.00 100% 100% Waiting to put mbox 0.16 0.00 1.00 0.26 84% 84% Delete mbox 1.09 1.00 2.00 0.17 90% 90% Put/Get mbox 0.06 0.00 1.00 0.12 93% 93% Init semaphore 0.25 0.00 1.00 0.38 75% 75% Post [0] semaphore 0.25 0.00 1.00 0.38 75% 75% Wait [1] semaphore 0.22 0.00 1.00 0.34 78% 78% Trywait [0] semaphore 0.31 0.00 1.00 0.43 68% 68% Trywait [1] semaphore 0.03 0.00 1.00 0.06 96% 96% Peek semaphore 0.09 0.00 1.00 0.17 90% 90% Destroy semaphore 1.75 1.00 2.00 0.38 75% 25% Post/Wait semaphore 0.16 0.00 1.00 0.26 84% 84% 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.25 0.00 1.00 0.38 75% 75% Tick counter 0.13 0.00 1.00 0.22 87% 87% Delete counter 0.09 0.00 1.00 0.17 90% 90% Init flag 0.28 0.00 1.00 0.40 71% 71% Destroy flag 0.19 0.00 1.00 0.30 81% 81% Mask bits in flag 0.31 0.00 1.00 0.43 68% 68% Set bits in flag [no waiters] 0.41 0.00 1.00 0.48 59% 59% Wait for flag [AND] 0.38 0.00 1.00 0.47 62% 62% Wait for flag [OR] 0.41 0.00 1.00 0.48 59% 59% Wait for flag [AND/CLR] 0.47 0.00 1.00 0.50 53% 53% Wait for flag [OR/CLR] 0.09 0.00 1.00 0.17 90% 90% Peek on flag 0.31 0.00 1.00 0.43 68% 68% Create alarm 0.44 0.00 1.00 0.49 56% 56% Initialize alarm 0.25 0.00 1.00 0.38 75% 75% Disable alarm 0.47 0.00 1.00 0.50 53% 53% Enable alarm 0.28 0.00 1.00 0.40 71% 71% Delete alarm 0.50 0.00 1.00 0.50 100% 50% Tick counter [1 alarm] 1.38 1.00 2.00 0.47 62% 62% Tick counter [many alarms] 0.53 0.00 1.00 0.50 53% 46% Tick & fire counter [1 alarm] 7.81 7.00 8.00 0.31 81% 18% Tick & fire counters [>1 together] 1.59 1.00 2.00 0.48 59% 40% Tick & fire counters [>1 separately] 1.00 1.00 1.00 0.00 100% 100% Alarm latency [0 threads] 1.00 1.00 1.00 0.00 100% 100% Alarm latency [2 threads] 1.00 1.00 1.00 0.00 100% 100% Alarm latency [many threads] 2.00 2.00 2.00 0.00 100% 100% Alarm -> thread resume latency 192 168 212 Worker thread stack used (stack size 1088) All done, main thrd : stack used 796 size 1536 All done : Idlethread stack used 164 size 1280 Timing complete - 27860 ms total PASS:<Basic timing OK> EXIT:<done>
2024-12-10 | Open Publication License |