mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-01 08:54:14 -04:00
FreeRTOS source changes:
+ heap_1.c and heap_2.c now support configAPPLICATION_ALLOCATED_HEAP (heap_4.c already did) which allows the heap to be placed by the user rather than the linker. Demo app changes: + SAMD20 project has been updated to use Atmel Studio 7.
This commit is contained in:
parent
e9561c946c
commit
fa86d4eece
5 changed files with 52 additions and 81 deletions
|
@ -91,7 +91,15 @@ task.h is included from an application file. */
|
|||
#define configADJUSTED_HEAP_SIZE ( configTOTAL_HEAP_SIZE - portBYTE_ALIGNMENT )
|
||||
|
||||
/* Allocate the memory for the heap. */
|
||||
static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
|
||||
/* Allocate the memory for the heap. */
|
||||
#if( configAPPLICATION_ALLOCATED_HEAP == 1 )
|
||||
/* The application writer has already defined the array used for the RTOS
|
||||
heap - probably so it can be placed in a special segment or address. */
|
||||
extern uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
|
||||
#else
|
||||
static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
|
||||
#endif /* configAPPLICATION_ALLOCATED_HEAP */
|
||||
|
||||
static size_t xNextFreeByte = ( size_t ) 0;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
@ -102,12 +110,14 @@ void *pvReturn = NULL;
|
|||
static uint8_t *pucAlignedHeap = NULL;
|
||||
|
||||
/* Ensure that blocks are always aligned to the required number of bytes. */
|
||||
#if portBYTE_ALIGNMENT != 1
|
||||
#if( portBYTE_ALIGNMENT != 1 )
|
||||
{
|
||||
if( xWantedSize & portBYTE_ALIGNMENT_MASK )
|
||||
{
|
||||
/* Byte alignment required. */
|
||||
xWantedSize += ( portBYTE_ALIGNMENT - ( xWantedSize & portBYTE_ALIGNMENT_MASK ) );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
vTaskSuspendAll();
|
||||
|
|
|
@ -97,7 +97,14 @@ task.h is included from an application file. */
|
|||
static void prvHeapInit( void );
|
||||
|
||||
/* Allocate the memory for the heap. */
|
||||
static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
|
||||
#if( configAPPLICATION_ALLOCATED_HEAP == 1 )
|
||||
/* The application writer has already defined the array used for the RTOS
|
||||
heap - probably so it can be placed in a special segment or address. */
|
||||
extern uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
|
||||
#else
|
||||
static uint8_t ucHeap[ configTOTAL_HEAP_SIZE ];
|
||||
#endif /* configAPPLICATION_ALLOCATED_HEAP */
|
||||
|
||||
|
||||
/* Define the linked list structure. This is used to link free blocks in order
|
||||
of their size. */
|
||||
|
@ -127,7 +134,7 @@ static size_t xFreeBytesRemaining = configADJUSTED_HEAP_SIZE;
|
|||
*/
|
||||
#define prvInsertBlockIntoFreeList( pxBlockToInsert ) \
|
||||
{ \
|
||||
BlockLink_t *pxIterator; \
|
||||
BlockLink_t *pxIterator; \
|
||||
size_t xBlockSize; \
|
||||
\
|
||||
xBlockSize = pxBlockToInsert->xBlockSize; \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue