Merge branch 'feat/support_allocate_memory_from_psram_for_ot_v5.4' into 'release/v5.4'

feat(openthread): support openthread heap allocation from PSRAM (v5.4)

See merge request espressif/esp-idf!45598
This commit is contained in:
Jiang Jiang Jian
2026-03-03 10:48:58 +08:00
2 changed files with 15 additions and 4 deletions
@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -99,6 +99,16 @@
#define OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE 0 #define OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE 0
#endif // CONFIG_OPENTHREAD_RADIO_TREL #endif // CONFIG_OPENTHREAD_RADIO_TREL
#if CONFIG_OPENTHREAD_RADIO_TREL
/**
* @def OPENTHREAD_CONFIG_TREL_USE_HEAP_ENABLE
*
* Set to 1 to allow TREL modules to use heap allocated objects (e.g. for the TREL peer table).
*
*/
#define OPENTHREAD_CONFIG_TREL_USE_HEAP_ENABLE 1
#endif // CONFIG_OPENTHREAD_RADIO_TREL
/** /**
* @def OPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE * @def OPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE
* *
@@ -1,10 +1,11 @@
/* /*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2021-2026 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
#include "esp_openthread.h" #include "esp_openthread.h"
#include "esp_openthread_platform.h"
#include "openthread/platform/memory.h" #include "openthread/platform/memory.h"
@@ -12,10 +13,10 @@
void *otPlatCAlloc(size_t num, size_t size) void *otPlatCAlloc(size_t num, size_t size)
{ {
return calloc(num, size); return heap_caps_calloc(num, size, esp_openthread_get_alloc_caps());
} }
void otPlatFree(void *ptr) void otPlatFree(void *ptr)
{ {
free(ptr); heap_caps_free(ptr);
} }