mirror of
https://github.com/espressif/esp-idf
synced 2025-03-09 17:19:09 -04:00
Merge branch 'bugfix/memory_issue_v5.0' into 'release/v5.0'
fix(nimble): Nimble Error logs in case of memory overflow/failure (v5.0) See merge request espressif/esp-idf!35001
This commit is contained in:
commit
4580874d30
@ -1 +1 @@
|
||||
Subproject commit ad2be1f884d6527db17718d4daca66b65eb281c6
|
||||
Subproject commit d00fee8248f22d433f531d74ebb29000def4f1d3
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -7,18 +7,26 @@
|
||||
#include "esp_attr.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_log.h"
|
||||
#include <assert.h>
|
||||
|
||||
IRAM_ATTR void *bt_osi_mem_malloc(size_t size)
|
||||
{
|
||||
void *mem = NULL;
|
||||
#ifdef CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL
|
||||
return heap_caps_malloc(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
|
||||
mem = heap_caps_malloc(size, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
|
||||
#elif CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL
|
||||
return heap_caps_malloc(size, MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT);
|
||||
mem = heap_caps_malloc(size, MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT);
|
||||
#elif CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_IRAM_8BIT
|
||||
return heap_caps_malloc_prefer(size, 2, MALLOC_CAP_INTERNAL|MALLOC_CAP_IRAM_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
|
||||
mem = heap_caps_malloc_prefer(size, 2, MALLOC_CAP_INTERNAL|MALLOC_CAP_IRAM_8BIT, MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT);
|
||||
#else
|
||||
return malloc(size);
|
||||
mem = malloc(size);
|
||||
#endif
|
||||
if(!mem){
|
||||
ESP_LOGI("ESP_LOG_INFO","malloc failed (size %zu)",size);
|
||||
assert(mem != NULL);
|
||||
}
|
||||
return mem;
|
||||
}
|
||||
|
||||
IRAM_ATTR void *bt_osi_mem_calloc(size_t n, size_t size)
|
||||
|
Loading…
x
Reference in New Issue
Block a user