arm: mpu: fix: align stack for mpu stack guard
The mimimum mpu size is 32 bytes, but requires mpu base address to be aligned on 32 bytes to work. Define architecture thread macro when MPU_STACK_GUARD config to allocate stack with 32 more bytes. Signed-off-by: Michel Jaouen <michel.jaouen@st.com>
This commit is contained in:
parent
505c45a7ad
commit
deeaa40e1e
3 changed files with 91 additions and 3 deletions
|
@ -24,7 +24,7 @@ void configure_mpu_stack_guard(struct k_thread *thread)
|
|||
{
|
||||
arm_core_mpu_disable();
|
||||
arm_core_mpu_configure(THREAD_STACK_GUARD_REGION,
|
||||
thread->stack_info.start,
|
||||
thread->stack_info.start - STACK_ALIGN,
|
||||
thread->stack_info.size);
|
||||
arm_core_mpu_enable();
|
||||
}
|
||||
|
|
|
@ -64,8 +64,8 @@ void _new_thread(struct k_thread *thread, k_thread_stack_t stack,
|
|||
|
||||
char *stackEnd = pStackMem + stackSize;
|
||||
struct __esf *pInitCtx;
|
||||
|
||||
_new_thread_init(thread, pStackMem, stackSize, priority, options);
|
||||
_new_thread_init(thread, K_THREAD_STACK_BUFFER(pStackMem), stackSize,
|
||||
priority, options);
|
||||
|
||||
/* carve the thread entry struct from the "base" of the stack */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue