Skip to content

Commit 7f26009

Browse files
ioannisgnashif
authored andcommitted
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 <[email protected]>
1 parent a8fffca commit 7f26009

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

arch/arm/include/cortex_m/stack.h

+2-8
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,8 @@ extern K_THREAD_STACK_DEFINE(_interrupt_stack, CONFIG_ISR_STACK_SIZE);
3939
*/
4040
static ALWAYS_INLINE void z_InterruptStackSetup(void)
4141
{
42-
#if defined(CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT) && \
43-
defined(CONFIG_USERSPACE)
44-
u32_t msp = (u32_t)(Z_THREAD_STACK_BUFFER(_interrupt_stack) +
45-
CONFIG_ISR_STACK_SIZE - MPU_GUARD_ALIGN_AND_SIZE);
46-
#else
47-
u32_t msp = (u32_t)(Z_THREAD_STACK_BUFFER(_interrupt_stack) +
48-
CONFIG_ISR_STACK_SIZE);
49-
#endif
42+
u32_t msp = (u32_t)(Z_THREAD_STACK_BUFFER(_interrupt_stack)) +
43+
K_THREAD_STACK_SIZEOF(_interrupt_stack);
5044

5145
__set_MSP(msp);
5246
#if defined(CONFIG_BUILTIN_STACK_GUARD)

0 commit comments

Comments
 (0)