Legacy page
This page describes legacy neuralSPOT. For current tools and documentation, see neuralSPOT-X reference, neuralSPOT-X module catalog.
File heap_4.c
FileList > neuralspot > neuralspot > ns-core > src > heap_4.c
Go to the source code of this file
#include <stdlib.h>#include "FreeRTOS.h"#include "task.h"
Classes
| Type | Name |
|---|---|
| struct | A_BLOCK_LINK |
Public Types
| Type | Name |
|---|---|
| typedef struct A_BLOCK_LINK | BlockLink_t |
Public Attributes
| Type | Name |
|---|---|
| size_t const | ucHeapSize = configTOTAL\_HEAP\_SIZE |
Public Static Attributes
| Type | Name |
|---|---|
| BlockLink_t * | pxEnd = NULL |
| size_t | xBlockAllocatedBit = 0 |
| size_t | xFreeBytesRemaining = 0U |
| const size_t | xHeapStructSize = /* multi line expression */ |
| size_t | xMinimumEverFreeBytesRemaining = 0U |
| BlockLink_t | xStart |
Public Functions
| Type | Name |
|---|---|
| void | prvPortFree (void * pv, uint8_t enableSuspendResume) |
| void * | prvPortMalloc (size_t xWantedSize, uint8_t enableSuspendResume) |
| void * | pvPortMalloc (size_t xWantedSize) |
| void * | pvTasklessPortMalloc (size_t xWantedSize) |
| void | vPortFree (void * pv) |
| void | vPortInitialiseBlocks (void) |
| void | vTasklessPortFree (void * pv) |
| size_t | xPortGetFreeHeapSize (void) |
| size_t | xPortGetMinimumEverFreeHeapSize (void) |
Public Static Functions
| Type | Name |
|---|---|
| uint8_t ucHeap[configTOTAL_HEAP_SIZE] | __attribute__ ((aligned(4))) |
| void | prvHeapInit (void) |
| void | prvInsertBlockIntoFreeList (BlockLink_t * pxBlockToInsert) |
Macros
| Type | Name |
|---|---|
| define | MPU_WRAPPERS_INCLUDED_FROM_API_FILE |
| define | configTOTAL_HEAP_SIZE NS\_MALLOC\_HEAP\_SIZE\_IN\_K \* 1024 |
| define | heapBITS_PER_BYTE ((size\_t)8) |
| define | heapMINIMUM_BLOCK_SIZE ((size\_t)(xHeapStructSize << 1)) |
Public Types Documentation
typedef BlockLink_t
typedef struct A_BLOCK_LINK BlockLink_t;
Public Attributes Documentation
variable ucHeapSize
size_t const ucHeapSize;
Public Static Attributes Documentation
variable pxEnd
BlockLink_t * pxEnd;
variable xBlockAllocatedBit
size_t xBlockAllocatedBit;
variable xFreeBytesRemaining
size_t xFreeBytesRemaining;
variable xHeapStructSize
const size_t xHeapStructSize;
variable xMinimumEverFreeBytesRemaining
size_t xMinimumEverFreeBytesRemaining;
variable xStart
BlockLink_t xStart;
Public Functions Documentation
function prvPortFree
void prvPortFree (
void * pv,
uint8_t enableSuspendResume
)
function prvPortMalloc
void * prvPortMalloc (
size_t xWantedSize,
uint8_t enableSuspendResume
)
pvPortMalloc has a bug where it assumes that the task scheduler is running: The culprit is ResumeAll, which calls enterCritical/exitCritical - these functions, in port.c, assume the task scheduler is running, and the exit is not enabling interrupts because of the nested critical assert.
neuralSPOT solution is to create a new version of malloc
function pvPortMalloc
void * pvPortMalloc (
size_t xWantedSize
)
function pvTasklessPortMalloc
void * pvTasklessPortMalloc (
size_t xWantedSize
)
function vPortFree
void vPortFree (
void * pv
)
function vPortInitialiseBlocks
void vPortInitialiseBlocks (
void
)
function vTasklessPortFree
void vTasklessPortFree (
void * pv
)
function xPortGetFreeHeapSize
size_t xPortGetFreeHeapSize (
void
)
function xPortGetMinimumEverFreeHeapSize
size_t xPortGetMinimumEverFreeHeapSize (
void
)
Public Static Functions Documentation
function __attribute__
static uint8_t ucHeap[configTOTAL_HEAP_SIZE] __attribute__ (
(aligned(4))
)
function prvHeapInit
static void prvHeapInit (
void
)
function prvInsertBlockIntoFreeList
static void prvInsertBlockIntoFreeList (
BlockLink_t * pxBlockToInsert
)
Macro Definition Documentation
define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
define configTOTAL_HEAP_SIZE
#define configTOTAL_HEAP_SIZE `NS_MALLOC_HEAP_SIZE_IN_K * 1024`
define heapBITS_PER_BYTE
#define heapBITS_PER_BYTE `((size_t)8)`
define heapMINIMUM_BLOCK_SIZE
#define heapMINIMUM_BLOCK_SIZE `((size_t)(xHeapStructSize << 1))`
The documentation for this class was generated from the following file neuralspot/neuralspot/ns-core/src/heap_4.c