From: Angus Gratton Date: Mon, 20 Aug 2018 06:11:35 +0000 (+1000) Subject: freertos: Expose TCB & Stack memory capabilities as macro, fix task delete test X-Git-Tag: v3.2-beta1~290^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c5d6845c5add9d9fde38cba2f6c1011eb59e744e;p=esp-idf freertos: Expose TCB & Stack memory capabilities as macro, fix task delete test Test was failing if task was allocating TCB & Stack memory from DMA only pool which is not MALLOC_CAP_DEFAULT. --- diff --git a/components/freertos/include/freertos/portmacro.h b/components/freertos/include/freertos/portmacro.h index 6b98b82690..48b8993957 100644 --- a/components/freertos/include/freertos/portmacro.h +++ b/components/freertos/include/freertos/portmacro.h @@ -258,8 +258,11 @@ static inline unsigned portENTER_CRITICAL_NESTED() { //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) heap_caps_malloc(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT) -#define pvPortMallocStackMem(size) heap_caps_malloc(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT) +#define portTcbMemoryCaps (MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT) +#define portStackMemoryCaps (MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT) + +#define pvPortMallocTcbMem(size) heap_caps_malloc(size, portTcbMemoryCaps) +#define pvPortMallocStackMem(size) heap_caps_malloc(size, portStackMemoryCaps) //xTaskCreateStatic uses these functions to check incoming memory. #define portVALID_TCB_MEM(ptr) (esp_ptr_internal(ptr) && esp_ptr_byte_accessible(ptr)) diff --git a/components/freertos/test/test_freertos_task_delete.c b/components/freertos/test/test_freertos_task_delete.c index 7c3394cbe6..348e788eed 100644 --- a/components/freertos/test/test_freertos_task_delete.c +++ b/components/freertos/test/test_freertos_task_delete.c @@ -23,7 +23,8 @@ #define NO_OF_TSKS 3 #define DELAY_TICKS 2 -#define HEAP_CAPS (MALLOC_CAP_INTERNAL|MALLOC_CAP_DEFAULT) +/* Caps of all memory which is allocated from when a task is created */ +#define HEAP_CAPS (portTcbMemoryCaps | portStackMemoryCaps) #define DELAY_US_ITERATIONS 1000