zephyr/arch/arm/core/cortex_m
Andy Gross ecb0f3e159 arm: mpu: Account for stack guard size correctly
This patch fixes a couple of issues with the stack guard size and
properly constructs the STACK_ALIGN and STACK_ALIGN_SIZE definitions.

The ARM AAPCS requires that the stack pointers be 8 byte aligned.  The
STACK_ALIGN_SIZE definition is meant to contain the stack pointer
alignment requirements.  This is the required alignment at public API
boundaries (ie stack frames).

The STACK_ALIGN definition is the required alignment for the start
address for stack buffer storage.  STACK_ALIGN is used to validate
the allocation sizes for stack buffers.

The MPU_GUARD_ALIGN_AND_SIZE definition is the minimum alignment and
size for the MPU.  The minimum size and alignment just so happen to be
32 bytes for vanilla ARM MPU implementations.

When defining stack buffers, the stack guard alignment requirements
must be taken into consideration when allocating the stack memory.
The __align() must be filled in with either STACK_ALIGN_SIZE or the
align/size of the MPU stack guard.  The align/size for the guard region
will be 0 when CONFIG_MPU_STACK_GUARD is not set, and 32 bytes when it
is.

The _ARCH_THREAD_STACK_XXXXXX APIs need to know the minimum alignment
requirements for the stack buffer memory and the stack guard size to
correctly allocate and reference the stack memory.  This is reflected
in the macros with the use of the STACK_ALIGN definition and the
MPU_GUARD_ALIGN_AND_SIZE definition.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
2017-08-31 11:20:26 -05:00
..
mpu arm: mpu: Account for stack guard size correctly 2017-08-31 11:20:26 -05:00
Kconfig arm: dts: Cleanup HAS_DTS 2017-05-15 13:22:54 -04:00
Makefile
exc_manage.c
nmi.c linker: move all linker headers to include/linker 2017-06-18 09:24:04 -05:00
nmi_on_reset.S linker: move all linker headers to include/linker 2017-06-18 09:24:04 -05:00
prep_c.c arm: armv6-m: Support relocating vector table 2017-08-09 18:13:29 -04:00
reset.S linker: move all linker headers to include/linker 2017-06-18 09:24:04 -05:00
scb.c
vector_table.S linker: move all linker headers to include/linker 2017-06-18 09:24:04 -05:00
vector_table.h linker: move all linker headers to include/linker 2017-06-18 09:24:04 -05:00