Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
arch.h File Reference

ARM AArch32 specific kernel interface header. More...

Go to the source code of this file.

Macros

#define ARCH_STACK_PTR_ALIGN   4
 Declare the ARCH_STACK_PTR_ALIGN.
 
#define MPU_GUARD_ALIGN_AND_SIZE   0
 Declare a minimum MPU guard alignment and size.
 
#define MPU_GUARD_ALIGN_AND_SIZE_FLOAT   0
 Declare the MPU guard alignment and size for a thread stack that is using the Floating Point services.
 
#define ARCH_THREAD_STACK_OBJ_ALIGN(size)
 
#define ARCH_THREAD_STACK_SIZE_ADJUST(size)
 
#define ARCH_THREAD_STACK_RESERVED   0
 

Enumerations

enum  k_fatal_error_reason_arch {
  K_ERR_ARM_MEM_GENERIC = K_ERR_ARCH_START , K_ERR_ARM_MEM_STACKING , K_ERR_ARM_MEM_UNSTACKING , K_ERR_ARM_MEM_DATA_ACCESS ,
  K_ERR_ARM_MEM_INSTRUCTION_ACCESS , K_ERR_ARM_MEM_FP_LAZY_STATE_PRESERVATION , K_ERR_ARM_BUS_GENERIC , K_ERR_ARM_BUS_STACKING ,
  K_ERR_ARM_BUS_UNSTACKING , K_ERR_ARM_BUS_PRECISE_DATA_BUS , K_ERR_ARM_BUS_IMPRECISE_DATA_BUS , K_ERR_ARM_BUS_INSTRUCTION_BUS ,
  K_ERR_ARM_BUS_FP_LAZY_STATE_PRESERVATION , K_ERR_ARM_USAGE_GENERIC , K_ERR_ARM_USAGE_DIV_0 , K_ERR_ARM_USAGE_UNALIGNED_ACCESS ,
  K_ERR_ARM_USAGE_STACK_OVERFLOW , K_ERR_ARM_USAGE_NO_COPROCESSOR , K_ERR_ARM_USAGE_ILLEGAL_EXC_RETURN , K_ERR_ARM_USAGE_ILLEGAL_EPSR ,
  K_ERR_ARM_USAGE_UNDEFINED_INSTRUCTION , K_ERR_ARM_SECURE_GENERIC , K_ERR_ARM_SECURE_ENTRY_POINT , K_ERR_ARM_SECURE_INTEGRITY_SIGNATURE ,
  K_ERR_ARM_SECURE_EXCEPTION_RETURN , K_ERR_ARM_SECURE_ATTRIBUTION_UNIT , K_ERR_ARM_SECURE_TRANSITION , K_ERR_ARM_SECURE_LAZY_STATE_PRESERVATION ,
  K_ERR_ARM_SECURE_LAZY_STATE_ERROR , K_ERR_ARM_UNDEFINED_INSTRUCTION , K_ERR_ARM_ALIGNMENT_FAULT , K_ERR_ARM_BACKGROUND_FAULT ,
  K_ERR_ARM_PERMISSION_FAULT , K_ERR_ARM_SYNC_EXTERNAL_ABORT , K_ERR_ARM_ASYNC_EXTERNAL_ABORT , K_ERR_ARM_SYNC_PARITY_ERROR ,
  K_ERR_ARM_ASYNC_PARITY_ERROR , K_ERR_ARM_DEBUG_EVENT , K_ERR_ARM_TRANSLATION_FAULT , K_ERR_ARM_UNSUPPORTED_EXCLUSIVE_ACCESS_FAULT
}
 

Detailed Description

ARM AArch32 specific kernel interface header.

This header contains the ARM AArch32 specific kernel interface. It is included by the kernel interface architecture-abstraction header (include/arm/cpu.h)

Macro Definition Documentation

◆ ARCH_STACK_PTR_ALIGN

#define ARCH_STACK_PTR_ALIGN   4

Declare the ARCH_STACK_PTR_ALIGN.

Denotes the required alignment of the stack pointer on public API boundaries

◆ ARCH_THREAD_STACK_OBJ_ALIGN

#define ARCH_THREAD_STACK_OBJ_ALIGN ( size)
Value:
MAX(Z_THREAD_MIN_STACK_ALIGN, \
Z_MPU_GUARD_ALIGN)
#define MAX(a, b)
Obtain the maximum of two values.
Definition util.h:386

◆ ARCH_THREAD_STACK_RESERVED

#define ARCH_THREAD_STACK_RESERVED   0

◆ ARCH_THREAD_STACK_SIZE_ADJUST

#define ARCH_THREAD_STACK_SIZE_ADJUST ( size)
Value:
ROUND_UP(size, CONFIG_ARM_MPU_REGION_MIN_ALIGN_AND_SIZE)
#define ROUND_UP(x, align)
Value of x rounded up to the next multiple of align.
Definition util.h:322

◆ MPU_GUARD_ALIGN_AND_SIZE

#define MPU_GUARD_ALIGN_AND_SIZE   0

Declare a minimum MPU guard alignment and size.

This specifies the minimum MPU guard alignment/size for the MPU. This will be used to denote the guard section of the stack, if it exists.

One key note is that this guard results in extra bytes being added to the stack. APIs which give the stack ptr and stack size will take this guard size into account.

Stack is allocated, but initial stack pointer is at the end (highest address). Stack grows down to the actual allocation address (lowest address). Stack guard, if present, will comprise the lowest MPU_GUARD_ALIGN_AND_SIZE bytes of the stack.

The guard region must include enough space for an exception frame below the trapping region as a stack fault will end up storing the exception data (0x20 bytes) onto the stack below wherever the stack pointer refers, even if that is within the guard region, so we make sure the region is strictly larger than this size by setting it to 0x40 (to respect any power-of-two requirements).

As the stack grows down, it will reach the end of the stack when it encounters either the stack guard region, or the stack allocation address.

--------------------— <-— Stack allocation address + stack size + | | MPU_GUARD_ALIGN_AND_SIZE | Some thread data | <-— Defined when thread is created | ... | |------------------—| <-— Actual initial stack ptr | Initial Stack Ptr | aligned to ARCH_STACK_PTR_ALIGN | ... | | ... | | ... | | ... | | ... | | ... | | ... | | ... | | Stack Ends | |-------------------— <-— Stack Buffer Ptr from API | MPU Guard, | | if present | --------------------— <-— Stack Allocation address

◆ MPU_GUARD_ALIGN_AND_SIZE_FLOAT

#define MPU_GUARD_ALIGN_AND_SIZE_FLOAT   0

Declare the MPU guard alignment and size for a thread stack that is using the Floating Point services.

For threads that are using the Floating Point services under Shared Registers (CONFIG_FPU_SHARING=y) mode, the exception stack frame may contain both the basic stack frame and the FP caller-saved context, upon exception entry. Therefore, a wide guard region is required to guarantee that stack-overflow detection will always be successful.

Enumeration Type Documentation

◆ k_fatal_error_reason_arch

Enumerator
K_ERR_ARM_MEM_GENERIC 
K_ERR_ARM_MEM_STACKING 
K_ERR_ARM_MEM_UNSTACKING 
K_ERR_ARM_MEM_DATA_ACCESS 
K_ERR_ARM_MEM_INSTRUCTION_ACCESS 
K_ERR_ARM_MEM_FP_LAZY_STATE_PRESERVATION 
K_ERR_ARM_BUS_GENERIC 
K_ERR_ARM_BUS_STACKING 
K_ERR_ARM_BUS_UNSTACKING 
K_ERR_ARM_BUS_PRECISE_DATA_BUS 
K_ERR_ARM_BUS_IMPRECISE_DATA_BUS 
K_ERR_ARM_BUS_INSTRUCTION_BUS 
K_ERR_ARM_BUS_FP_LAZY_STATE_PRESERVATION 
K_ERR_ARM_USAGE_GENERIC 
K_ERR_ARM_USAGE_DIV_0 
K_ERR_ARM_USAGE_UNALIGNED_ACCESS 
K_ERR_ARM_USAGE_STACK_OVERFLOW 
K_ERR_ARM_USAGE_NO_COPROCESSOR 
K_ERR_ARM_USAGE_ILLEGAL_EXC_RETURN 
K_ERR_ARM_USAGE_ILLEGAL_EPSR 
K_ERR_ARM_USAGE_UNDEFINED_INSTRUCTION 
K_ERR_ARM_SECURE_GENERIC 
K_ERR_ARM_SECURE_ENTRY_POINT 
K_ERR_ARM_SECURE_INTEGRITY_SIGNATURE 
K_ERR_ARM_SECURE_EXCEPTION_RETURN 
K_ERR_ARM_SECURE_ATTRIBUTION_UNIT 
K_ERR_ARM_SECURE_TRANSITION 
K_ERR_ARM_SECURE_LAZY_STATE_PRESERVATION 
K_ERR_ARM_SECURE_LAZY_STATE_ERROR 
K_ERR_ARM_UNDEFINED_INSTRUCTION 
K_ERR_ARM_ALIGNMENT_FAULT 
K_ERR_ARM_BACKGROUND_FAULT 
K_ERR_ARM_PERMISSION_FAULT 
K_ERR_ARM_SYNC_EXTERNAL_ABORT 
K_ERR_ARM_ASYNC_EXTERNAL_ABORT 
K_ERR_ARM_SYNC_PARITY_ERROR 
K_ERR_ARM_ASYNC_PARITY_ERROR 
K_ERR_ARM_DEBUG_EVENT 
K_ERR_ARM_TRANSLATION_FAULT 
K_ERR_ARM_UNSUPPORTED_EXCLUSIVE_ACCESS_FAULT