Always allocate stack in internal memory
This commit is contained in:
parent
7153003aaf
commit
24690bb9cd
2 changed files with 11 additions and 5 deletions
|
@ -80,6 +80,8 @@ extern "C" {
|
||||||
#include <xtensa/config/system.h> /* required for XSHAL_CLIB */
|
#include <xtensa/config/system.h> /* required for XSHAL_CLIB */
|
||||||
#include <xtensa/xtruntime.h>
|
#include <xtensa/xtruntime.h>
|
||||||
|
|
||||||
|
#include <esp_heap_alloc_caps.h>
|
||||||
|
|
||||||
//#include "xtensa_context.h"
|
//#include "xtensa_context.h"
|
||||||
|
|
||||||
/*-----------------------------------------------------------
|
/*-----------------------------------------------------------
|
||||||
|
@ -223,6 +225,10 @@ static inline unsigned portENTER_CRITICAL_NESTED() { unsigned state = XTOS_SET_I
|
||||||
#define portSET_INTERRUPT_MASK_FROM_ISR() portENTER_CRITICAL_NESTED()
|
#define portSET_INTERRUPT_MASK_FROM_ISR() portENTER_CRITICAL_NESTED()
|
||||||
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(state) portEXIT_CRITICAL_NESTED(state)
|
#define portCLEAR_INTERRUPT_MASK_FROM_ISR(state) portEXIT_CRITICAL_NESTED(state)
|
||||||
|
|
||||||
|
//Because the ROM routines don't necessarily handle a stack in external RAM correctly, we force
|
||||||
|
//the stack memory to always be internal.
|
||||||
|
#define pvPortMallocTcbMem(size) pvPortMallocCaps(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT)
|
||||||
|
#define pvPortMallocStackMem(size) pvPortMallocCaps(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wrapper for the Xtensa compare-and-set instruction. This subroutine will atomically compare
|
* Wrapper for the Xtensa compare-and-set instruction. This subroutine will atomically compare
|
||||||
|
|
|
@ -714,7 +714,7 @@ void taskYIELD_OTHER_CORE( BaseType_t xCoreID, UBaseType_t uxPriority )
|
||||||
/* Allocate space for the TCB. Where the memory comes from depends
|
/* Allocate space for the TCB. Where the memory comes from depends
|
||||||
on the implementation of the port malloc function and whether or
|
on the implementation of the port malloc function and whether or
|
||||||
not static allocation is being used. */
|
not static allocation is being used. */
|
||||||
pxNewTCB = ( TCB_t * ) pvPortMalloc( sizeof( TCB_t ) );
|
pxNewTCB = ( TCB_t * ) pvPortMallocTcbMem( sizeof( TCB_t ) );
|
||||||
|
|
||||||
if( pxNewTCB != NULL )
|
if( pxNewTCB != NULL )
|
||||||
{
|
{
|
||||||
|
@ -767,14 +767,14 @@ void taskYIELD_OTHER_CORE( BaseType_t xCoreID, UBaseType_t uxPriority )
|
||||||
/* Allocate space for the TCB. Where the memory comes from depends on
|
/* Allocate space for the TCB. Where the memory comes from depends on
|
||||||
the implementation of the port malloc function and whether or not static
|
the implementation of the port malloc function and whether or not static
|
||||||
allocation is being used. */
|
allocation is being used. */
|
||||||
pxNewTCB = ( TCB_t * ) pvPortMalloc( sizeof( TCB_t ) );
|
pxNewTCB = ( TCB_t * ) pvPortMallocTcbMem( sizeof( TCB_t ) );
|
||||||
|
|
||||||
if( pxNewTCB != NULL )
|
if( pxNewTCB != NULL )
|
||||||
{
|
{
|
||||||
/* Allocate space for the stack used by the task being created.
|
/* Allocate space for the stack used by the task being created.
|
||||||
The base of the stack memory stored in the TCB so the task can
|
The base of the stack memory stored in the TCB so the task can
|
||||||
be deleted later if required. */
|
be deleted later if required. */
|
||||||
pxNewTCB->pxStack = ( StackType_t * ) pvPortMalloc( ( ( ( size_t ) usStackDepth ) * sizeof( StackType_t ) ) ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
|
pxNewTCB->pxStack = ( StackType_t * ) pvPortMallocStackMem( ( ( ( size_t ) usStackDepth ) * sizeof( StackType_t ) ) ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
|
||||||
|
|
||||||
if( pxNewTCB->pxStack == NULL )
|
if( pxNewTCB->pxStack == NULL )
|
||||||
{
|
{
|
||||||
|
@ -789,12 +789,12 @@ void taskYIELD_OTHER_CORE( BaseType_t xCoreID, UBaseType_t uxPriority )
|
||||||
StackType_t *pxStack;
|
StackType_t *pxStack;
|
||||||
|
|
||||||
/* Allocate space for the stack used by the task being created. */
|
/* Allocate space for the stack used by the task being created. */
|
||||||
pxStack = ( StackType_t * ) pvPortMalloc( ( ( ( size_t ) usStackDepth ) * sizeof( StackType_t ) ) ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
|
pxStack = ( StackType_t * ) pvPortMallocStackMem( ( ( ( size_t ) usStackDepth ) * sizeof( StackType_t ) ) ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
|
||||||
|
|
||||||
if( pxStack != NULL )
|
if( pxStack != NULL )
|
||||||
{
|
{
|
||||||
/* Allocate space for the TCB. */
|
/* Allocate space for the TCB. */
|
||||||
pxNewTCB = ( TCB_t * ) pvPortMalloc( sizeof( TCB_t ) ); /*lint !e961 MISRA exception as the casts are only redundant for some paths. */
|
pxNewTCB = ( TCB_t * ) pvPortMallocTcbMem( sizeof( TCB_t ) ); /*lint !e961 MISRA exception as the casts are only redundant for some paths. */
|
||||||
|
|
||||||
if( pxNewTCB != NULL )
|
if( pxNewTCB != NULL )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue