Skip to content

Commit 2a0b5ec

Browse files
committed
armv8-r: Add Arm Cortex-R82 non-MPU port
The goal of this commit is to add the GCC/ARMClang non-MPU port variant for ARM Cortex-R82 processor which is ARMv8-R AArch64 based. The work done is inspired by the GCC ARM_AARCH64 FreeRTOS port. This port has the following features: * Uses single security state (non TrustZone). * Supports SMP (Symmetric multi-processing). * Doesn't support Hypervisor (EL2). * Doesn't support neither PMSA (MPU) nor VMSA (MMU). Signed-off-by: Ahmed Ismail <Ahmed.Ismail@arm.com> Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
1 parent 3d44975 commit 2a0b5ec

File tree

8 files changed

+1889
-0
lines changed

8 files changed

+1889
-0
lines changed

.github/.cSpellWords.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ ldrbs
430430
LDRBS
431431
LDRNE
432432
ldsr
433+
ldxr
433434
lidt
434435
LINKR
435436
LJMP
@@ -505,6 +506,7 @@ movs
505506
movw
506507
MOVWF
507508
movx
509+
MPIDR
508510
MPLAB
509511
MPUCTRL
510512
MQTT
@@ -779,6 +781,7 @@ SETINTENA
779781
SETPSW
780782
SETR
781783
setvect
784+
sevl
782785
SFRC
783786
SHLL
784787
SHLR
@@ -809,6 +812,7 @@ STTBRK
809812
STTDLY
810813
STTOUT
811814
STTTO
815+
stxr
812816
SVACC
813817
svcne
814818
SVDIS

.github/scripts/kernel_checker.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
r'.*portable/.*/ARM_CM3_MPU*',
119119
r'.*portable/.*/ARM_CM4_MPU*',
120120
r'.*portable/.*/ARM_CM4F_MPU*',
121+
r'.*portable/.*/ARM_CR82*',
121122
]
122123

123124
KERNEL_HEADER = [

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ if(NOT FREERTOS_PORT)
8787
" GCC_ARM_CR5 - Compiler: GCC Target: ARM Cortex-R5\n"
8888
" GCC_ARM_CRX_MPU - Compiler: GCC Target: ARM Cortex-Rx with MPU\n"
8989
" GCC_ARM_CRX_NOGIC - Compiler: GCC Target: ARM Cortex-Rx no GIC\n"
90+
" GCC_ARM_CR82 - Compiler: GCC Target: ARM Cortex-R82\n"
9091
" GCC_ARM7_AT91FR40008 - Compiler: GCC Target: ARM7 Atmel AT91R40008\n"
9192
" GCC_ARM7_AT91SAM7S - Compiler: GCC Target: ARM7 Atmel AT91SAM7S\n"
9293
" GCC_ARM7_LPC2000 - Compiler: GCC Target: ARM7 LPC2000\n"

portable/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,11 @@ add_library(freertos_kernel_port OBJECT
218218
GCC/ARM_CRx_No_GIC/port.c
219219
GCC/ARM_CRx_No_GIC/portASM.S>
220220

221+
# ARMv8-R ports for GCC
222+
$<$<STREQUAL:${FREERTOS_PORT},GCC_ARM_CR82>:
223+
GCC/ARM_CR82/port.c
224+
GCC/ARM_CR82/portASM.S>
225+
221226
# ARMv4T ARM7TDMI ports for GCC
222227
$<$<STREQUAL:${FREERTOS_PORT},GCC_ARM7_AT91FR40008>:
223228
GCC/ARM7_AT91FR40008/port.c
@@ -964,6 +969,9 @@ target_include_directories(freertos_kernel_port_headers INTERFACE
964969
$<$<STREQUAL:${FREERTOS_PORT},GCC_ARM_CRX_MPU>:${CMAKE_CURRENT_LIST_DIR}/GCC/ARM_CRx_MPU>
965970
$<$<STREQUAL:${FREERTOS_PORT},GCC_ARM_CRX_NOGIC>:${CMAKE_CURRENT_LIST_DIR}/GCC/ARM_CRx_No_GIC>
966971

972+
# ARMv8-R ports for GCC
973+
$<$<STREQUAL:${FREERTOS_PORT},GCC_ARM_CR82>:${CMAKE_CURRENT_LIST_DIR}/GCC/ARM_CR82>
974+
967975
# ARMv4T ARM7TDMI ports for GCC
968976
$<$<STREQUAL:${FREERTOS_PORT},GCC_ARM7_AT91FR40008>:${CMAKE_CURRENT_LIST_DIR}/GCC/ARM7_AT91FR40008>
969977
$<$<STREQUAL:${FREERTOS_PORT},GCC_ARM7_AT91SAM7S>:${CMAKE_CURRENT_LIST_DIR}/GCC/ARM7_AT91SAM7S>

portable/GCC/ARM_CR82/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Arm Cortex-R82 FreeRTOS Kernel Port
2+
3+
# Overview
4+
5+
- This directory contains the FreeRTOS Kernel port for Arm Cortex-R82 based on Armv8-R AArch64 architecture.
6+
- It provides the portable layer required by the kernel to run on this architecture.
7+
8+
# Supported toolchains
9+
10+
The port is supported and tested on the following toolchains:
11+
12+
* Arm Compiler for Embedded v6.23 (armclang).
13+
* Arm GNU toolchain v14.2.
14+
15+
# Cache Coherency
16+
17+
- This port assumes the hardware or model is fully cache coherent.
18+
- The port does not perform cache maintenance for shared buffers.
19+
- If your hardware or model doesn't support full cache coherency, you must handle cache clean/invalidate operations, memory attributes, and any additional barriers in your BSP/application (especially around shared-memory regions).
20+
21+
# SMP Multicore Bring-up
22+
23+
For SMP systems using this port, the application only needs to start the scheduler on the primary core and issue an SVC from each secondary core once they are online. The kernel coordinates the rest and ensures all cores are properly managed.
24+
25+
- Developer-facing summary: call `vTaskStartScheduler()` on the primary core; each secondary core, in its **reset handler**, performs its local init and then issues an SVC (immediate value `106`) to hand off to the kernel. The port will bring all cores under the scheduler.
26+
27+
Primary core flow:
28+
29+
1. Perform core-specific and shared initialization (e.g., set EL1 stack pointer, zero-initialize `.bss`).
30+
2. Jump to `main()`, create user tasks, optionally pin tasks to specific cores.
31+
3. Call `vTaskStartScheduler()` which invokes `xPortStartScheduler()`.
32+
4. `xPortStartScheduler()` configures the primary core tick timer and signals secondary cores that shared init is complete using the `ucPrimaryCoreInitDoneFlag` variable.
33+
5. Wait until all secondary cores report as brought up.
34+
6. Once all cores are up, call `vPortRestoreContext()` to schedule the first task on the primary core.
35+
36+
Secondary core flow (to be done in each core’s reset handler):
37+
38+
1. Perform core-specific initialization (e.g., set EL1 stack pointer).
39+
2. Wait for the primary core's signal that shared initialization is complete (i.e., `ucPrimaryCoreInitDoneFlag` set to 1).
40+
3. Update `VBAR_EL1` from the boot vector table to the FreeRTOS vector table.
41+
4. Initialize the GIC redistributor and enable SGIs so interrupts from the primary core are receivable; signal the primary that this secondary is online and ready by setting the its flag in the `ucSecondaryCoresReadyFlags` array.
42+
5. Issue an SVC with immediate value `106` to enter `FreeRTOS_SWI_Handler`, which will call `vPortRestoreContext()` based on the SVC number to start scheduling on this core.

0 commit comments

Comments
 (0)