mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-03 20:17:34 +00:00
freertos(IDF): Refactor port heap functions
Vanilla FreeRTOS expects applications to use one of the heap implementations provided by FreeRTOS (i.e., heap_x.c), where functions such as pvPortMalloc() and vPortFree() are defined in the heap implementation. However, ESP-IDF already provides its own heap implementation (i.e., esp_heap_caps.h). Thus, the pvPortMallc()/vPortFree() functions were previously overriden by macro to call esp_heap functions directly. This commit refactors the FreeRTOS port's heap as such: - Added a heap_idf.c that implements all of the heap related functions required by FreeRTOS source - All dynamic memory allocated by FreeRTOS is from internal memory. Thus, the FreeRTOS heap is the internal memory subset of the ESP-IDF heap. - Removed some old macros to reduce diff from upstream source code.
This commit is contained in:
@@ -139,8 +139,6 @@
|
||||
#endif
|
||||
#endif /* if ( portUSING_MPU_WRAPPERS == 1 ) */
|
||||
|
||||
#ifdef configUSE_FREERTOS_PROVIDED_HEAP
|
||||
|
||||
/* Used by heap_5.c to define the start address and size of each memory region
|
||||
* that together comprise the total FreeRTOS heap space. */
|
||||
typedef struct HeapRegion
|
||||
@@ -189,29 +187,6 @@ void vPortInitialiseBlocks( void ) PRIVILEGED_FUNCTION;
|
||||
size_t xPortGetFreeHeapSize( void ) PRIVILEGED_FUNCTION;
|
||||
size_t xPortGetMinimumEverFreeHeapSize( void ) PRIVILEGED_FUNCTION;
|
||||
|
||||
#if( configSTACK_ALLOCATION_FROM_SEPARATE_HEAP == 1 )
|
||||
void *pvPortMallocStack( size_t xSize ) PRIVILEGED_FUNCTION;
|
||||
void vPortFreeStack( void *pv ) PRIVILEGED_FUNCTION;
|
||||
#else
|
||||
#define pvPortMallocStack pvPortMalloc
|
||||
#define vPortFreeStack vPortFree
|
||||
#endif
|
||||
#else // configUSE_FREERTOS_PROVIDED_HEAP
|
||||
|
||||
/*
|
||||
* Map to the memory management routines required for the port.
|
||||
*
|
||||
* Note that libc standard malloc/free are also available for
|
||||
* non-FreeRTOS-specific code, and behave the same as
|
||||
* pvPortMalloc()/vPortFree().
|
||||
*/
|
||||
#define pvPortMalloc malloc
|
||||
#define vPortFree free
|
||||
#define xPortGetFreeHeapSize esp_get_free_heap_size
|
||||
#define xPortGetMinimumEverFreeHeapSize esp_get_minimum_free_heap_size
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Setup the hardware ready for the scheduler to take control. This generally
|
||||
* sets up a tick interrupt and sets timers for the correct tick frequency.
|
||||
|
Reference in New Issue
Block a user