mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-09-12 09:07:46 -04:00
Kernel changes:
+ Do not attempt to free the stack of a deleted task if the stack was statically allocated. + Introduce configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES - which optionally writes known values into the list and list item data structures in order to assist with the detection of memory corruptions. Microblase port: +Change occurrences of #if XPAR_MICROBLAZE_0_USE_FPU == 1 to #if XPAR_MICROBLAZE_0_USE_FPU != 0 as the value can also be 2 or 3. Demo app modifications: + Update Zynq project to use the 2014.4 tools and add in tests for the new task notification feature. + Update SAM4S project to include tests for the new task notification feature.
This commit is contained in:
parent
f407b70dcc
commit
2de32c0141
18 changed files with 327 additions and 98 deletions
|
@ -133,6 +133,7 @@ typedef struct tskTaskControlBlock
|
|||
|
||||
#if ( portUSING_MPU_WRAPPERS == 1 )
|
||||
xMPU_SETTINGS xMPUSettings; /*< The MPU settings are defined as part of the port layer. THIS MUST BE THE SECOND MEMBER OF THE TCB STRUCT. */
|
||||
BaseType_t xUsingStaticallyAllocatedStack; /* Set to pdTRUE if the stack is a statically allocated array, and pdFALSE if the stack is dynamically allocated. */
|
||||
#endif
|
||||
|
||||
ListItem_t xGenericListItem; /*< The list that the state list item of a task is reference from denotes the state of that task (Ready, Blocked, Suspended ). */
|
||||
|
@ -543,6 +544,7 @@ BaseType_t xTaskGenericCreate( TaskFunction_t pxTaskCode, const char * const pcN
|
|||
{
|
||||
BaseType_t xReturn;
|
||||
TCB_t * pxNewTCB;
|
||||
StackType_t *pxTopOfStack;
|
||||
|
||||
configASSERT( pxTaskCode );
|
||||
configASSERT( ( ( uxPriority & ( ~portPRIVILEGE_BIT ) ) < configMAX_PRIORITIES ) );
|
||||
|
@ -553,8 +555,6 @@ TCB_t * pxNewTCB;
|
|||
|
||||
if( pxNewTCB != NULL )
|
||||
{
|
||||
StackType_t *pxTopOfStack;
|
||||
|
||||
#if( portUSING_MPU_WRAPPERS == 1 )
|
||||
/* Should the task be created in privileged mode? */
|
||||
BaseType_t xRunPrivileged;
|
||||
|
@ -567,6 +567,20 @@ TCB_t * pxNewTCB;
|
|||
xRunPrivileged = pdFALSE;
|
||||
}
|
||||
uxPriority &= ~portPRIVILEGE_BIT;
|
||||
|
||||
if( puxStackBuffer != NULL )
|
||||
{
|
||||
/* The application provided its own stack. Note this so no
|
||||
attempt is made to delete the stack should that task be
|
||||
deleted. */
|
||||
pxNewTCB->xUsingStaticallyAllocatedStack = pdTRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The stack was allocated dynamically. Note this so it can be
|
||||
deleted again if the task is deleted. */
|
||||
pxNewTCB->xUsingStaticallyAllocatedStack = pdFALSE;
|
||||
}
|
||||
#endif /* portUSING_MPU_WRAPPERS == 1 */
|
||||
|
||||
/* Calculate the top of stack address. This depends on whether the
|
||||
|
@ -3222,7 +3236,22 @@ TCB_t *pxNewTCB;
|
|||
_reclaim_reent( &( pxTCB->xNewLib_reent ) );
|
||||
}
|
||||
#endif /* configUSE_NEWLIB_REENTRANT */
|
||||
vPortFreeAligned( pxTCB->pxStack );
|
||||
|
||||
#if( portUSING_MPU_WRAPPERS == 1 )
|
||||
{
|
||||
/* Only free the stack if it was allocated dynamically in the first
|
||||
place. */
|
||||
if( pxTCB->xUsingStaticallyAllocatedStack == pdFALSE )
|
||||
{
|
||||
vPortFreeAligned( pxTCB->pxStack );
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
vPortFreeAligned( pxTCB->pxStack );
|
||||
}
|
||||
#endif
|
||||
|
||||
vPortFree( pxTCB );
|
||||
}
|
||||
|
||||
|
@ -3601,7 +3630,7 @@ TCB_t *pxTCB;
|
|||
pcWriteBuffer = prvWriteNameToBuffer( pcWriteBuffer, pxTaskStatusArray[ x ].pcTaskName );
|
||||
|
||||
/* Write the rest of the string. */
|
||||
sprintf( pcWriteBuffer, "\t\t%c\t%u\t%u\t%u\r\n", cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );
|
||||
sprintf( pcWriteBuffer, "\t%c\t%u\t%u\t%u\r\n", cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber );
|
||||
pcWriteBuffer += strlen( pcWriteBuffer );
|
||||
}
|
||||
|
||||
|
@ -3694,13 +3723,13 @@ TCB_t *pxTCB;
|
|||
{
|
||||
#ifdef portLU_PRINTF_SPECIFIER_REQUIRED
|
||||
{
|
||||
sprintf( pcWriteBuffer, "\t\t%lu\t\t%lu%%\r\n", pxTaskStatusArray[ x ].ulRunTimeCounter, ulStatsAsPercentage );
|
||||
sprintf( pcWriteBuffer, "\t%lu\t\t%lu%%\r\n", pxTaskStatusArray[ x ].ulRunTimeCounter, ulStatsAsPercentage );
|
||||
}
|
||||
#else
|
||||
{
|
||||
/* sizeof( int ) == sizeof( long ) so a smaller
|
||||
printf() library can be used. */
|
||||
sprintf( pcWriteBuffer, "\t\t%u\t\t%u%%\r\n", ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter, ( unsigned int ) ulStatsAsPercentage );
|
||||
sprintf( pcWriteBuffer, "\t%u\t\t%u%%\r\n", ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter, ( unsigned int ) ulStatsAsPercentage );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -3710,13 +3739,13 @@ TCB_t *pxTCB;
|
|||
consumed less than 1% of the total run time. */
|
||||
#ifdef portLU_PRINTF_SPECIFIER_REQUIRED
|
||||
{
|
||||
sprintf( pcWriteBuffer, "\t\t%lu\t\t<1%%\r\n", pxTaskStatusArray[ x ].pcTaskName, pxTaskStatusArray[ x ].ulRunTimeCounter );
|
||||
sprintf( pcWriteBuffer, "\t%lu\t\t<1%%\r\n", pxTaskStatusArray[ x ].ulRunTimeCounter );
|
||||
}
|
||||
#else
|
||||
{
|
||||
/* sizeof( int ) == sizeof( long ) so a smaller
|
||||
printf() library can be used. */
|
||||
sprintf( pcWriteBuffer, "\t\t%u\t\t<1%%\r\n", pxTaskStatusArray[ x ].pcTaskName, ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter );
|
||||
sprintf( pcWriteBuffer, "\t%u\t\t<1%%\r\n", ( unsigned int ) pxTaskStatusArray[ x ].ulRunTimeCounter );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue