From 62319616830607966b6c4278f3d034f91c397a15 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 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/esp32/esp_adapter.c b/components/esp32/esp_adapter.c index 70f1bb5c4..2de293acd 100644 --- a/components/esp32/esp_adapter.c +++ b/components/esp32/esp_adapter.c @@ -404,22 +404,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 876ac4e963a7e80d1775f97aae8bcbfe8bd0f1a6 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/bt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/bt.c b/components/bt/bt.c index 898e77b64..9415f8c6e 100644 --- a/components/bt/bt.c +++ b/components/bt/bt.c @@ -753,7 +753,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])