Skip to content
Permalink
Browse files

arch: arm: minor clean-up in interrupt stack size derivation

CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT is taken into
account when allocating the area for the interrupt stack
using the K_THREAD_STACK_DEFINE macro. Therefore, we can
simplify how the top of the stack is derived during the
initialization of the system, by removing one more
occurrence of CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT.

Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
  • Loading branch information...
ioannisg authored and nashif committed May 23, 2019
1 parent a8fffca commit 7f260091e52d325db8c4ef3a58326cb4f65acbd5
Showing with 2 additions and 8 deletions.
  1. +2 −8 arch/arm/include/cortex_m/stack.h
@@ -39,14 +39,8 @@ extern K_THREAD_STACK_DEFINE(_interrupt_stack, CONFIG_ISR_STACK_SIZE);
*/
static ALWAYS_INLINE void z_InterruptStackSetup(void)
{
#if defined(CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT) && \
defined(CONFIG_USERSPACE)
u32_t msp = (u32_t)(Z_THREAD_STACK_BUFFER(_interrupt_stack) +
CONFIG_ISR_STACK_SIZE - MPU_GUARD_ALIGN_AND_SIZE);
#else
u32_t msp = (u32_t)(Z_THREAD_STACK_BUFFER(_interrupt_stack) +
CONFIG_ISR_STACK_SIZE);
#endif
u32_t msp = (u32_t)(Z_THREAD_STACK_BUFFER(_interrupt_stack)) +
K_THREAD_STACK_SIZEOF(_interrupt_stack);

__set_MSP(msp);
#if defined(CONFIG_BUILTIN_STACK_GUARD)

0 comments on commit 7f26009

Please sign in to comment.
You can’t perform that action at this time.