From f48285de10ef64042a679cc6d50cab17eba45064 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 30 Oct 2019 15:56:29 +1100 Subject: [PATCH 1/2] wifi: Include DMA reserved pool when allocating internal-only memory Fix for root cause of https://github.com/espressif/esp-idf/issues/3592 --- components/esp32/esp_adapter.c | 8 ++++---- components/esp32s2beta/esp_adapter.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/components/esp32/esp_adapter.c b/components/esp32/esp_adapter.c index 90c623bcd..406c42e4d 100644 --- a/components/esp32/esp_adapter.c +++ b/components/esp32/esp_adapter.c @@ -409,22 +409,22 @@ static int get_time_wrapper(void *t) static void * IRAM_ATTR malloc_internal_wrapper(size_t size) { - return heap_caps_malloc(size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); + return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); } static void * IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size) { - return heap_caps_realloc(ptr, size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); + return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); } static void * IRAM_ATTR calloc_internal_wrapper(size_t n, size_t size) { - return heap_caps_calloc(n, size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); + return heap_caps_calloc(n, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); } static void * IRAM_ATTR zalloc_internal_wrapper(size_t size) { - void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); + void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); if (ptr) { memset(ptr, 0, size); } diff --git a/components/esp32s2beta/esp_adapter.c b/components/esp32s2beta/esp_adapter.c index 069c7b074..3845e93a0 100644 --- a/components/esp32s2beta/esp_adapter.c +++ b/components/esp32s2beta/esp_adapter.c @@ -408,22 +408,22 @@ static int get_time_wrapper(void *t) static void * IRAM_ATTR malloc_internal_wrapper(size_t size) { - return heap_caps_malloc(size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); + return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); } static void * IRAM_ATTR realloc_internal_wrapper(void *ptr, size_t size) { - return heap_caps_realloc(ptr, size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); + return heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); } static void * IRAM_ATTR calloc_internal_wrapper(size_t n, size_t size) { - return heap_caps_calloc(n, size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); + return heap_caps_calloc(n, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); } static void * IRAM_ATTR zalloc_internal_wrapper(size_t size) { - void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); + void *ptr = heap_caps_calloc(1, size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); if (ptr) { memset(ptr, 0, size); } From 1768473eb8a1685d362f635a453cd37d66d9becf Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 31 Oct 2019 15:19:17 +1100 Subject: [PATCH 2/2] bt: Include DMA reserved pool when allocating internal-only memory Fix for root cause of https://github.com/espressif/esp-idf/issues/3592 --- components/bt/controller/bt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/controller/bt.c b/components/bt/controller/bt.c index c0155dd41..cd715493e 100644 --- a/components/bt/controller/bt.c +++ b/components/bt/controller/bt.c @@ -771,7 +771,7 @@ static int IRAM_ATTR cause_sw_intr_to_core_wrapper(int core_id, int intr_no) static void *malloc_internal_wrapper(size_t size) { - return heap_caps_malloc(size, MALLOC_CAP_DEFAULT|MALLOC_CAP_INTERNAL); + return heap_caps_malloc(size, MALLOC_CAP_8BIT|MALLOC_CAP_DMA|MALLOC_CAP_INTERNAL); } static int32_t IRAM_ATTR read_mac_wrapper(uint8_t mac[6])