mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
FreeRTOS: Make the default stack alignment 16 for Xtensa
This commit is contained in:
parent
21629b7840
commit
8731d281f1
@ -44,6 +44,8 @@
|
||||
#include "esp_gdbstub.h"
|
||||
#endif // CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME
|
||||
|
||||
_Static_assert(portBYTE_ALIGNMENT == 16, "portBYTE_ALIGNMENT must be set to 16");
|
||||
|
||||
/* ---------------------------------------------------- Variables ------------------------------------------------------
|
||||
*
|
||||
* ------------------------------------------------------------------------------------------------------------------ */
|
||||
@ -609,6 +611,7 @@ StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, TaskFunction_t pxC
|
||||
frame->tp = (UBaseType_t)threadptr;
|
||||
|
||||
//TODO: IDF-2393
|
||||
configASSERT(((uint32_t) frame & portBYTE_ALIGNMENT_MASK) == 0);
|
||||
return (StackType_t *)frame;
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ typedef uint32_t TickType_t;
|
||||
#define portCRITICAL_NESTING_IN_TCB 1
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 4
|
||||
#define portBYTE_ALIGNMENT 16 // Xtensa Windowed ABI requires the stack pointer to always be 16-byte aligned. See "isa_rm.pdf 8.1.1 Windowed Register Usage and Stack Layout"
|
||||
#define portNOP() XT_NOP() //Todo: Check if XT_NOP exists
|
||||
|
||||
/* ---------------------------------------------- Forward Declarations -------------------------------------------------
|
||||
|
@ -49,6 +49,8 @@
|
||||
#include "hal/systimer_ll.h"
|
||||
#endif // CONFIG_FREERTOS_SYSTICK_USES_SYSTIMER
|
||||
|
||||
_Static_assert(portBYTE_ALIGNMENT == 16, "portBYTE_ALIGNMENT must be set to 16");
|
||||
|
||||
/*
|
||||
OS state variables
|
||||
*/
|
||||
@ -708,6 +710,7 @@ StackType_t * pxPortInitialiseStack( StackType_t * pxTopOfStack,
|
||||
p[2] = (((uint32_t) p) + 12 + XCHAL_TOTAL_SA_ALIGN - 1) & -XCHAL_TOTAL_SA_ALIGN;
|
||||
#endif /* XCHAL_CP_NUM */
|
||||
|
||||
configASSERT(((uint32_t) sp & portBYTE_ALIGNMENT_MASK) == 0);
|
||||
return sp;
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@
|
||||
#include "port_systick.h"
|
||||
#include "esp_memory_utils.h"
|
||||
|
||||
|
||||
_Static_assert(portBYTE_ALIGNMENT == 16, "portBYTE_ALIGNMENT must be set to 16");
|
||||
|
||||
/* ---------------------------------------------------- Variables ------------------------------------------------------
|
||||
*
|
||||
@ -210,6 +210,7 @@ StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, TaskFunction_t pxC
|
||||
frame->tp = (UBaseType_t)threadptr;
|
||||
|
||||
//TODO: IDF-2393
|
||||
configASSERT(((uint32_t) frame & portBYTE_ALIGNMENT_MASK) == 0);
|
||||
return (StackType_t *)frame;
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ typedef uint32_t TickType_t;
|
||||
#define portCRITICAL_NESTING_IN_TCB 0
|
||||
#define portSTACK_GROWTH ( -1 )
|
||||
#define portTICK_PERIOD_MS ( ( TickType_t ) 1000 / configTICK_RATE_HZ )
|
||||
#define portBYTE_ALIGNMENT 4
|
||||
#define portBYTE_ALIGNMENT 16 // Xtensa Windowed ABI requires the stack pointer to always be 16-byte aligned. See "isa_rm.pdf 8.1.1 Windowed Register Usage and Stack Layout"
|
||||
#define portNOP() XT_NOP()
|
||||
|
||||
|
||||
|
@ -77,6 +77,8 @@
|
||||
#include "esp_cpu.h"
|
||||
#include "esp_memory_utils.h"
|
||||
|
||||
_Static_assert(portBYTE_ALIGNMENT == 16, "portBYTE_ALIGNMENT must be set to 16");
|
||||
|
||||
_Static_assert(tskNO_AFFINITY == CONFIG_FREERTOS_NO_AFFINITY, "incorrect tskNO_AFFINITY value");
|
||||
|
||||
|
||||
@ -260,7 +262,7 @@ StackType_t *pxPortInitialiseStack( StackType_t *pxTopOfStack, TaskFunction_t px
|
||||
p[1] = 0;
|
||||
p[2] = (((uint32_t) p) + 12 + XCHAL_TOTAL_SA_ALIGN - 1) & -XCHAL_TOTAL_SA_ALIGN;
|
||||
#endif /* XCHAL_CP_NUM */
|
||||
|
||||
configASSERT(((uint32_t) sp & portBYTE_ALIGNMENT_MASK) == 0);
|
||||
return sp;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user