16#ifndef ZEPHYR_INCLUDE_ARCH_ARM_ARCH_H_
17#define ZEPHYR_INCLUDE_ARCH_ARM_ARCH_H_
23#define sys_define_gpr_with_alias(name1, name2) union { uint32_t name1, name2; }
35#if defined(CONFIG_GDBSTUB)
39#ifdef CONFIG_CPU_CORTEX_M
43#elif defined(CONFIG_CPU_AARCH32_CORTEX_R) || defined(CONFIG_CPU_AARCH32_CORTEX_A)
46#if defined(CONFIG_AARCH32_ARMV8_R)
123#ifdef CONFIG_STACK_ALIGN_DOUBLE_WORD
124#define ARCH_STACK_PTR_ALIGN 8
126#define ARCH_STACK_PTR_ALIGN 4
138#if defined(CONFIG_USERSPACE)
139#define Z_THREAD_MIN_STACK_ALIGN CONFIG_ARM_MPU_REGION_MIN_ALIGN_AND_SIZE
140#elif defined(CONFIG_ARM_AARCH32_MMU)
141#define Z_THREAD_MIN_STACK_ALIGN CONFIG_ARM_MMU_REGION_MIN_ALIGN_AND_SIZE
143#define Z_THREAD_MIN_STACK_ALIGN ARCH_STACK_PTR_ALIGN
193#if defined(CONFIG_MPU_STACK_GUARD)
195#if CONFIG_ARM_MPU_REGION_MIN_ALIGN_AND_SIZE <= 0x20
196#define MPU_GUARD_ALIGN_AND_SIZE 0x40
198#define MPU_GUARD_ALIGN_AND_SIZE CONFIG_ARM_MPU_REGION_MIN_ALIGN_AND_SIZE
201#define MPU_GUARD_ALIGN_AND_SIZE 0
214#if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING) \
215 && defined(CONFIG_MPU_STACK_GUARD)
216#if CONFIG_MPU_STACK_GUARD_MIN_SIZE_FLOAT <= 0x20
217#define MPU_GUARD_ALIGN_AND_SIZE_FLOAT 0x40
219#define MPU_GUARD_ALIGN_AND_SIZE_FLOAT CONFIG_MPU_STACK_GUARD_MIN_SIZE_FLOAT
222#define MPU_GUARD_ALIGN_AND_SIZE_FLOAT 0
232#if defined(CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT)
233#define Z_MPU_GUARD_ALIGN (MAX(MPU_GUARD_ALIGN_AND_SIZE, \
234 MPU_GUARD_ALIGN_AND_SIZE_FLOAT))
236#define Z_MPU_GUARD_ALIGN MPU_GUARD_ALIGN_AND_SIZE
239#if defined(CONFIG_USERSPACE) && \
240 defined(CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT)
246#define ARCH_THREAD_STACK_OBJ_ALIGN(size) Z_POW2_CEIL(size)
247#define ARCH_THREAD_STACK_SIZE_ADJUST(size) Z_POW2_CEIL(size)
249#define ARCH_THREAD_STACK_OBJ_ALIGN(size) MAX(Z_THREAD_MIN_STACK_ALIGN, \
251#ifdef CONFIG_USERSPACE
252#define ARCH_THREAD_STACK_SIZE_ADJUST(size) \
253 ROUND_UP(size, CONFIG_ARM_MPU_REGION_MIN_ALIGN_AND_SIZE)
257#ifdef CONFIG_MPU_STACK_GUARD
261#define ARCH_KERNEL_STACK_RESERVED MPU_GUARD_ALIGN_AND_SIZE
262#define ARCH_KERNEL_STACK_OBJ_ALIGN Z_MPU_GUARD_ALIGN
266#define ARCH_THREAD_STACK_RESERVED 0
270#ifdef CONFIG_CPU_HAS_ARM_MPU
273#ifdef CONFIG_CPU_HAS_NXP_MPU
277#ifdef CONFIG_ARM_AARCH32_MMU
ARM AArch32 public interrupt handling.
Per-arch thread definition.
k_fatal_error_reason_arch
Definition: arch.h:62
@ K_ERR_ARM_BUS_FP_LAZY_STATE_PRESERVATION
Definition: arch.h:78
@ K_ERR_ARM_MEM_UNSTACKING
Definition: arch.h:66
@ K_ERR_ARM_BACKGROUND_FAULT
Definition: arch.h:103
@ K_ERR_ARM_UNSUPPORTED_EXCLUSIVE_ACCESS_FAULT
Definition: arch.h:111
@ K_ERR_ARM_SYNC_EXTERNAL_ABORT
Definition: arch.h:105
@ K_ERR_ARM_SECURE_LAZY_STATE_PRESERVATION
Definition: arch.h:97
@ K_ERR_ARM_SECURE_GENERIC
Definition: arch.h:91
@ K_ERR_ARM_MEM_STACKING
Definition: arch.h:65
@ K_ERR_ARM_SYNC_PARITY_ERROR
Definition: arch.h:107
@ K_ERR_ARM_SECURE_ENTRY_POINT
Definition: arch.h:92
@ K_ERR_ARM_USAGE_ILLEGAL_EXC_RETURN
Definition: arch.h:86
@ K_ERR_ARM_USAGE_NO_COPROCESSOR
Definition: arch.h:85
@ K_ERR_ARM_SECURE_INTEGRITY_SIGNATURE
Definition: arch.h:93
@ K_ERR_ARM_ASYNC_EXTERNAL_ABORT
Definition: arch.h:106
@ K_ERR_ARM_MEM_FP_LAZY_STATE_PRESERVATION
Definition: arch.h:69
@ K_ERR_ARM_ALIGNMENT_FAULT
Definition: arch.h:102
@ K_ERR_ARM_TRANSLATION_FAULT
Definition: arch.h:110
@ K_ERR_ARM_USAGE_UNALIGNED_ACCESS
Definition: arch.h:83
@ K_ERR_ARM_USAGE_ILLEGAL_EPSR
Definition: arch.h:87
@ K_ERR_ARM_MEM_INSTRUCTION_ACCESS
Definition: arch.h:68
@ K_ERR_ARM_SECURE_EXCEPTION_RETURN
Definition: arch.h:94
@ K_ERR_ARM_BUS_UNSTACKING
Definition: arch.h:74
@ K_ERR_ARM_MEM_GENERIC
Definition: arch.h:64
@ K_ERR_ARM_BUS_STACKING
Definition: arch.h:73
@ K_ERR_ARM_USAGE_DIV_0
Definition: arch.h:82
@ K_ERR_ARM_BUS_GENERIC
Definition: arch.h:72
@ K_ERR_ARM_BUS_IMPRECISE_DATA_BUS
Definition: arch.h:76
@ K_ERR_ARM_BUS_INSTRUCTION_BUS
Definition: arch.h:77
@ K_ERR_ARM_UNDEFINED_INSTRUCTION
Definition: arch.h:101
@ K_ERR_ARM_USAGE_UNDEFINED_INSTRUCTION
Definition: arch.h:88
@ K_ERR_ARM_ASYNC_PARITY_ERROR
Definition: arch.h:108
@ K_ERR_ARM_DEBUG_EVENT
Definition: arch.h:109
@ K_ERR_ARM_SECURE_ATTRIBUTION_UNIT
Definition: arch.h:95
@ K_ERR_ARM_SECURE_TRANSITION
Definition: arch.h:96
@ K_ERR_ARM_SECURE_LAZY_STATE_ERROR
Definition: arch.h:98
@ K_ERR_ARM_USAGE_STACK_OVERFLOW
Definition: arch.h:84
@ K_ERR_ARM_BUS_PRECISE_DATA_BUS
Definition: arch.h:75
@ K_ERR_ARM_MEM_DATA_ACCESS
Definition: arch.h:67
@ K_ERR_ARM_PERMISSION_FAULT
Definition: arch.h:104
@ K_ERR_ARM_USAGE_GENERIC
Definition: arch.h:81
ARM AArch32 public error handling.
ARM AArch32 public exception handling.
ARM AArch32 public kernel miscellaneous.
Fatal base type definitions.
@ K_ERR_ARCH_START
Arch specific fatal errors.
Definition: fatal_types.h:41
ARM AArch32 NMI routines.