16#ifndef ZEPHYR_INCLUDE_ARCH_ARM_ARCH_H_
17#define ZEPHYR_INCLUDE_ARCH_ARM_ARCH_H_
32#if defined(CONFIG_GDBSTUB)
36#ifdef CONFIG_CPU_CORTEX_M
40#elif defined(CONFIG_CPU_AARCH32_CORTEX_R) || defined(CONFIG_CPU_AARCH32_CORTEX_A)
43#if defined(CONFIG_AARCH32_ARMV8_R)
120#ifdef CONFIG_STACK_ALIGN_DOUBLE_WORD
121#define ARCH_STACK_PTR_ALIGN 8
123#define ARCH_STACK_PTR_ALIGN 4
135#if defined(CONFIG_USERSPACE)
136#define Z_THREAD_MIN_STACK_ALIGN CONFIG_ARM_MPU_REGION_MIN_ALIGN_AND_SIZE
137#elif defined(CONFIG_ARM_AARCH32_MMU)
138#define Z_THREAD_MIN_STACK_ALIGN CONFIG_ARM_MMU_REGION_MIN_ALIGN_AND_SIZE
140#define Z_THREAD_MIN_STACK_ALIGN ARCH_STACK_PTR_ALIGN
190#if defined(CONFIG_MPU_STACK_GUARD)
192#if CONFIG_ARM_MPU_REGION_MIN_ALIGN_AND_SIZE <= 0x20
193#define MPU_GUARD_ALIGN_AND_SIZE 0x40
195#define MPU_GUARD_ALIGN_AND_SIZE CONFIG_ARM_MPU_REGION_MIN_ALIGN_AND_SIZE
198#define MPU_GUARD_ALIGN_AND_SIZE 0
211#if defined(CONFIG_FPU) && defined(CONFIG_FPU_SHARING) \
212 && defined(CONFIG_MPU_STACK_GUARD)
213#if CONFIG_MPU_STACK_GUARD_MIN_SIZE_FLOAT <= 0x20
214#define MPU_GUARD_ALIGN_AND_SIZE_FLOAT 0x40
216#define MPU_GUARD_ALIGN_AND_SIZE_FLOAT CONFIG_MPU_STACK_GUARD_MIN_SIZE_FLOAT
219#define MPU_GUARD_ALIGN_AND_SIZE_FLOAT 0
229#if defined(CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT)
230#define Z_MPU_GUARD_ALIGN (MAX(MPU_GUARD_ALIGN_AND_SIZE, \
231 MPU_GUARD_ALIGN_AND_SIZE_FLOAT))
233#define Z_MPU_GUARD_ALIGN MPU_GUARD_ALIGN_AND_SIZE
236#if defined(CONFIG_USERSPACE) && \
237 defined(CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT)
243#define ARCH_THREAD_STACK_OBJ_ALIGN(size) Z_POW2_CEIL(size)
244#define ARCH_THREAD_STACK_SIZE_ADJUST(size) Z_POW2_CEIL(size)
246#define ARCH_THREAD_STACK_OBJ_ALIGN(size) MAX(Z_THREAD_MIN_STACK_ALIGN, \
248#ifdef CONFIG_USERSPACE
249#define ARCH_THREAD_STACK_SIZE_ADJUST(size) \
250 ROUND_UP(size, CONFIG_ARM_MPU_REGION_MIN_ALIGN_AND_SIZE)
254#ifdef CONFIG_MPU_STACK_GUARD
258#define ARCH_KERNEL_STACK_RESERVED MPU_GUARD_ALIGN_AND_SIZE
259#define ARCH_KERNEL_STACK_OBJ_ALIGN Z_MPU_GUARD_ALIGN
263#define ARCH_THREAD_STACK_RESERVED 0
267#ifdef CONFIG_CPU_HAS_ARM_MPU
270#ifdef CONFIG_CPU_HAS_NXP_MPU
274#ifdef CONFIG_ARM_AARCH32_MMU
ARM AArch32 public interrupt handling.
Per-arch thread definition.
k_fatal_error_reason_arch
Definition arch.h:59
@ K_ERR_ARM_BUS_FP_LAZY_STATE_PRESERVATION
Definition arch.h:75
@ K_ERR_ARM_MEM_UNSTACKING
Definition arch.h:63
@ K_ERR_ARM_BACKGROUND_FAULT
Definition arch.h:100
@ K_ERR_ARM_UNSUPPORTED_EXCLUSIVE_ACCESS_FAULT
Definition arch.h:108
@ K_ERR_ARM_SYNC_EXTERNAL_ABORT
Definition arch.h:102
@ K_ERR_ARM_SECURE_LAZY_STATE_PRESERVATION
Definition arch.h:94
@ K_ERR_ARM_SECURE_GENERIC
Definition arch.h:88
@ K_ERR_ARM_MEM_STACKING
Definition arch.h:62
@ K_ERR_ARM_SYNC_PARITY_ERROR
Definition arch.h:104
@ K_ERR_ARM_SECURE_ENTRY_POINT
Definition arch.h:89
@ K_ERR_ARM_USAGE_ILLEGAL_EXC_RETURN
Definition arch.h:83
@ K_ERR_ARM_USAGE_NO_COPROCESSOR
Definition arch.h:82
@ K_ERR_ARM_SECURE_INTEGRITY_SIGNATURE
Definition arch.h:90
@ K_ERR_ARM_ASYNC_EXTERNAL_ABORT
Definition arch.h:103
@ K_ERR_ARM_MEM_FP_LAZY_STATE_PRESERVATION
Definition arch.h:66
@ K_ERR_ARM_ALIGNMENT_FAULT
Definition arch.h:99
@ K_ERR_ARM_TRANSLATION_FAULT
Definition arch.h:107
@ K_ERR_ARM_USAGE_UNALIGNED_ACCESS
Definition arch.h:80
@ K_ERR_ARM_USAGE_ILLEGAL_EPSR
Definition arch.h:84
@ K_ERR_ARM_MEM_INSTRUCTION_ACCESS
Definition arch.h:65
@ K_ERR_ARM_SECURE_EXCEPTION_RETURN
Definition arch.h:91
@ K_ERR_ARM_BUS_UNSTACKING
Definition arch.h:71
@ K_ERR_ARM_MEM_GENERIC
Definition arch.h:61
@ K_ERR_ARM_BUS_STACKING
Definition arch.h:70
@ K_ERR_ARM_USAGE_DIV_0
Definition arch.h:79
@ K_ERR_ARM_BUS_GENERIC
Definition arch.h:69
@ K_ERR_ARM_BUS_IMPRECISE_DATA_BUS
Definition arch.h:73
@ K_ERR_ARM_BUS_INSTRUCTION_BUS
Definition arch.h:74
@ K_ERR_ARM_UNDEFINED_INSTRUCTION
Definition arch.h:98
@ K_ERR_ARM_USAGE_UNDEFINED_INSTRUCTION
Definition arch.h:85
@ K_ERR_ARM_ASYNC_PARITY_ERROR
Definition arch.h:105
@ K_ERR_ARM_DEBUG_EVENT
Definition arch.h:106
@ K_ERR_ARM_SECURE_ATTRIBUTION_UNIT
Definition arch.h:92
@ K_ERR_ARM_SECURE_TRANSITION
Definition arch.h:93
@ K_ERR_ARM_SECURE_LAZY_STATE_ERROR
Definition arch.h:95
@ K_ERR_ARM_USAGE_STACK_OVERFLOW
Definition arch.h:81
@ K_ERR_ARM_BUS_PRECISE_DATA_BUS
Definition arch.h:72
@ K_ERR_ARM_MEM_DATA_ACCESS
Definition arch.h:64
@ K_ERR_ARM_PERMISSION_FAULT
Definition arch.h:101
@ K_ERR_ARM_USAGE_GENERIC
Definition arch.h:78
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.