-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Initial support for ARM Cortex-R #9316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
05433ac
d1a7cef
1b0cd18
6f81e76
7b1afc9
5f68cd3
8a9048e
df84594
00144f4
7c14465
5949236
8401923
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,96 @@ config CPU_CORTEX_M | |
help | ||
This option signifies the use of a CPU of the Cortex-M family. | ||
|
||
config CPU_CORTEX_R | ||
bool | ||
select CPU_CORTEX | ||
select HAS_FLASH_LOAD_OFFSET | ||
help | ||
This option signifies the use of a CPU of the Cortex-R family. | ||
|
||
config ISA_THUMB2 | ||
bool | ||
help | ||
From: http://www.arm.com/products/processors/technologies/instruction-set-architectures.php | ||
|
||
Thumb-2 technology is the instruction set underlying the ARM Cortex | ||
architecture which provides enhanced levels of performance, energy | ||
efficiency, and code density for a wide range of embedded | ||
applications. | ||
|
||
Thumb-2 technology builds on the success of Thumb, the innovative | ||
high code density instruction set for ARM microprocessor cores, to | ||
increase the power of the ARM microprocessor core available to | ||
developers of low cost, high performance systems. | ||
|
||
The technology is backwards compatible with existing ARM and Thumb | ||
solutions, while significantly extending the features available to | ||
the Thumb instructions set. This allows more of the application to | ||
benefit from the best in class code density of Thumb. | ||
|
||
For performance optimized code Thumb-2 technology uses 31 percent | ||
less memory to reduce system cost, while providing up to 38 percent | ||
higher performance than existing high density code, which can be used | ||
to prolong battery-life or to enrich the product feature set. Thumb-2 | ||
technology is featured in the processor, and in all ARMv7 | ||
architecture-based processors. | ||
|
||
config ISA_ARM | ||
bool | ||
help | ||
From: https://developer.arm.com/products/architecture/instruction-sets/a32-and-t32-instruction-sets | ||
|
||
A32 instructions, known as Arm instructions in pre-Armv8 architectures, | ||
are 32 bits wide, and are aligned on 4-byte boundaries. A32 instructions | ||
are supported by both A-profile and R-profile architectures. | ||
|
||
A32 was traditionally used in applications requiring the highest | ||
performance, or for handling hardware exceptions such as interrupts and | ||
processor start-up. Much of its functionality was subsumed into T32 with | ||
the introduction of Thumb-2 technology. | ||
|
||
config DATA_ENDIANNESS_LITTLE | ||
bool | ||
default y if CPU_CORTEX | ||
help | ||
This is driven by the processor implementation, since it is fixed in | ||
hardware. The board should set this value to 'n' if the data is | ||
implemented as big endian. | ||
|
||
config STACK_ALIGN_DOUBLE_WORD | ||
bool "Align stacks on double-words (8 octets)" | ||
default y | ||
help | ||
This is needed to conform to AAPCS, the procedure call standard for | ||
the ARM. It wastes stack space. The option also enforces alignment | ||
of stack upon exception entry on Cortex-M3 and Cortex-M4 (ARMv7-M). | ||
Note that for ARMv6-M, ARMv8-M, and Cortex-M7 MCUs stack alignment | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any particular comments needed for Cortex-R here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't need anything. The AAPCS comment covers the main reason and this config option isn't used on cortex-r to effect the exception stacks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK |
||
on exception entry is enabled by default and it is not configurable. | ||
|
||
config RUNTIME_NMI | ||
bool "Attach an NMI handler at runtime" | ||
select REBOOT | ||
help | ||
The kernel provides a simple NMI handler that simply hangs in a tight | ||
loop if triggered. This fills the requirement that there must be an | ||
NMI handler installed when the CPU boots. If a custom handler is | ||
needed, enable this option and attach it via _NmiHandlerSet(). | ||
|
||
config FAULT_DUMP | ||
int "Fault dump level" | ||
default 2 | ||
range 0 2 | ||
help | ||
Different levels for display information when a fault occurs. | ||
|
||
2: The default. Display specific and verbose information. Consumes | ||
the most memory (long strings). | ||
|
||
1: Display general and short information. Consumes less memory | ||
(short strings). | ||
|
||
0: Off. | ||
|
||
config BUILTIN_STACK_GUARD | ||
bool "Thread Stack Guards based on built-in ARM stack limit checking" | ||
depends on CPU_CORTEX_M_HAS_SPLIM | ||
|
@@ -185,6 +275,7 @@ endchoice | |
endmenu | ||
|
||
source "arch/arm/core/cortex_m/Kconfig" | ||
source "arch/arm/core/cortex_r/Kconfig" | ||
|
||
source "arch/arm/core/cortex_m/mpu/Kconfig" | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
zephyr_library() | ||
|
||
zephyr_library_sources( | ||
vector_table.S | ||
reset.S | ||
fault.c | ||
reboot.c | ||
stacks.c | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# Kconfig - ARM Cortex-R platform configuration options | ||
|
||
# | ||
# Copyright (c) 2018 Marvell | ||
# Copyright (c) 2018 Lexmark International, Inc. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
# NOTE: We have the specific core implementations first and outside of the | ||
# if CPU_CORTEX_R block so that SoCs can select which core they are using | ||
# without having to select all the options related to that core. Everything | ||
# else is captured inside the if CPU_CORTEX_R block so they are not exposed | ||
# if one selects a different ARM Cortex Family (Cortex-A or Cortex-M) | ||
|
||
|
||
config CPU_CORTEX_R4 | ||
bool | ||
select CPU_CORTEX_R | ||
select ARMV7_R | ||
select ARMV7_R_FP if CPU_HAS_FPU | ||
help | ||
This option signifies the use of a Cortex-R4 CPU | ||
|
||
config CPU_CORTEX_R5 | ||
bool | ||
select CPU_CORTEX_R | ||
select ARMV7_R | ||
select ARMV7_R_FP if CPU_HAS_FPU | ||
help | ||
This option signifies the use of a Cortex-R5 CPU | ||
|
||
if CPU_CORTEX_R | ||
|
||
config ARMV7_R | ||
bool | ||
select ATOMIC_OPERATIONS_BUILTIN | ||
select ISA_ARM | ||
help | ||
This option signifies the use of an ARMv7-R processor | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Coming back to this one: is this accurate for ARMv8-R? Are there Baseline and Mainline variations? |
||
implementation. | ||
|
||
From https://developer.arm.com/products/architecture/cpu-architecture/r-profile: | ||
The Armv7-R architecture implements a traditional Arm architecture with | ||
multiple modes and supports a Protected Memory System Architecture | ||
(PMSA) based on a Memory Protection Unit (MPU). It supports the Arm (32) | ||
and Thumb (T32) instruction sets. | ||
|
||
config ARMV7_R_FP | ||
bool | ||
depends on ARMV7_R | ||
help | ||
This option signifies the use of an ARMv7-R processor | ||
implementation supporting the Floating-Point Extension. | ||
|
||
config ARMV7_EXCEPTION_STACK_SIZE | ||
int "Undefined Instruction and Abort stack size (in bytes)" | ||
default 256 | ||
help | ||
This option specifies the size of the stack used by the undefined | ||
instruction and data abort exception handlers. | ||
|
||
config ARMV7_FIQ_STACK_SIZE | ||
int "FIQ stack size (in bytes)" | ||
default 256 | ||
help | ||
This option specifies the size of the stack used by the FIQ handler. | ||
|
||
config ARMV7_SVC_STACK_SIZE | ||
int "SVC stack size (in bytes)" | ||
default 512 | ||
help | ||
This option specifies the size of the stack used by the SVC handler. | ||
|
||
config ARMV7_SYS_STACK_SIZE | ||
int "SYS stack size (in bytes)" | ||
default 1024 | ||
help | ||
This option specifies the size of the stack used by the system mode. | ||
|
||
menu "ARM Cortex-R options" | ||
depends on CPU_CORTEX_R | ||
|
||
config RUNTIME_NMI | ||
default y | ||
|
||
config LDREX_STREX_AVAILABLE | ||
default y | ||
|
||
config GEN_ISR_TABLES | ||
default y | ||
|
||
config GEN_IRQ_VECTOR_TABLE | ||
default n | ||
|
||
endmenu | ||
ioannisg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
endif # CPU_CORTEX_R |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
ioannisg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* Copyright (c) 2018 Lexmark International, Inc. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <kernel.h> | ||
#include <kernel_structs.h> | ||
|
||
/** | ||
* | ||
* @brief Fault handler | ||
* | ||
* This routine is called when fatal error conditions are detected by hardware | ||
* and is responsible only for reporting the error. Once reported, it then | ||
* invokes the user provided routine _SysFatalErrorHandler() which is | ||
* responsible for implementing the error handling policy. | ||
* | ||
* This is a stub for more exception handling code to be added later. | ||
*/ | ||
void _Fault(z_arch_esf_t *esf, u32_t exc_return) | ||
{ | ||
z_arm_fatal_error(K_ERR_CPU_EXCEPTION, esf); | ||
} | ||
|
||
void z_FaultInit(void) | ||
{ | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, @bbolen would you like to add someone in the list of maintainers for the arch/arm/core/cortex-r ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added myself.