Merge branch 'fix/fix_some_issues_found_in_ot_sdk_v5.3' into 'release/v5.3'

fix(openthread): fix configuration-related issues (v5.3)

See merge request espressif/esp-idf!51797
This commit is contained in:
Shu Chen
2026-08-18 02:49:19 +00:00
4 changed files with 14 additions and 8 deletions

View File

@@ -323,7 +323,7 @@ menu "OpenThread"
bool "Enable link metrics feature" bool "Enable link metrics feature"
default n default n
select IEEE802154_TIMING_OPTIMIZATION if IEEE802154_ENABLED select IEEE802154_TIMING_OPTIMIZATION if IEEE802154_ENABLED
select OPENTHREAD_TIMING_OPTIMIZATION select OPENTHREAD_TIMING_OPTIMIZATION if OPENTHREAD_RADIO_NATIVE
help help
Select this option to enable link metrics feature Select this option to enable link metrics feature
@@ -427,17 +427,16 @@ menu "OpenThread"
endmenu endmenu
menu "Thread Memory Allocation" menu "Thread Memory Allocation"
depends on (SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC)
config OPENTHREAD_PLATFORM_MALLOC_CAP_SPIRAM config OPENTHREAD_PLATFORM_MALLOC_CAP_SPIRAM
depends on (SPIRAM_USE_CAPS_ALLOC || SPIRAM_USE_MALLOC)
bool 'Allocate memory from PSRAM' bool 'Allocate memory from PSRAM'
default y default y
help help
Select this option to allocate buffer from PSRAM for Thread Select this option to allocate buffer from PSRAM for Thread
config OPENTHREAD_PLATFORM_MSGPOOL_MANAGEMENT config OPENTHREAD_PLATFORM_MSGPOOL_MANAGEMENT
bool 'Allocate message pool buffer from PSRAM' bool 'Allocate message pool buffer from platform'
depends on OPENTHREAD_PLATFORM_MALLOC_CAP_SPIRAM default n
default y
help help
If enabled, the message pool is managed by platform defined logic. If enabled, the message pool is managed by platform defined logic.
endmenu endmenu
@@ -471,8 +470,8 @@ menu "OpenThread"
config OPENTHREAD_NUM_MESSAGE_BUFFERS config OPENTHREAD_NUM_MESSAGE_BUFFERS
int "The number of openthread message buffers" int "The number of openthread message buffers"
default 65 if !OPENTHREAD_PLATFORM_MSGPOOL_MANAGEMENT default 65 if !OPENTHREAD_PLATFORM_MALLOC_CAP_SPIRAM
default 1024 if OPENTHREAD_PLATFORM_MSGPOOL_MANAGEMENT default 1024 if OPENTHREAD_PLATFORM_MALLOC_CAP_SPIRAM
config OPENTHREAD_XTAL_ACCURACY config OPENTHREAD_XTAL_ACCURACY
int "The accuracy of the XTAL" int "The accuracy of the XTAL"

View File

@@ -241,7 +241,9 @@ esp_err_t esp_openthread_launch_mainloop(void)
esp_err_t esp_openthread_deinit(void) esp_err_t esp_openthread_deinit(void)
{ {
esp_openthread_lock_acquire(portMAX_DELAY);
esp_openthread_instances_deinit(esp_openthread_get_instance()); esp_openthread_instances_deinit(esp_openthread_get_instance());
esp_openthread_lock_release();
return esp_openthread_platform_deinit(); return esp_openthread_platform_deinit();
} }

View File

@@ -30,7 +30,10 @@ bool esp_openthread_instances_init(void)
void esp_openthread_instances_deinit(otInstance *instance) void esp_openthread_instances_deinit(otInstance *instance)
{ {
otInstanceFinalize(instance); (void)instance;
for (int i = 0; i < OT_INSTANCE_COUNT; i++) {
otInstanceFinalize(s_instances[i]);
}
} }
bool esp_openthread_tasklets_are_pending(otInstance *instance) bool esp_openthread_tasklets_are_pending(otInstance *instance)

View File

@@ -28,11 +28,13 @@ void otPlatMessagePoolInit(otInstance *aInstance, uint16_t aMinNumFreeBuffers, s
uint16_t num_buffers = aMinNumFreeBuffers; uint16_t num_buffers = aMinNumFreeBuffers;
#if CONFIG_OPENTHREAD_PLATFORM_MALLOC_CAP_SPIRAM
if (!esp_psram_is_initialized() && num_buffers > OT_MSGPOOL_NUM_BUFFERS_NO_PSRAM) { if (!esp_psram_is_initialized() && num_buffers > OT_MSGPOOL_NUM_BUFFERS_NO_PSRAM) {
ESP_LOGW(OT_PLAT_LOG_TAG, "PSRAM not available, reducing message pool from %u to %u buffers", ESP_LOGW(OT_PLAT_LOG_TAG, "PSRAM not available, reducing message pool from %u to %u buffers",
num_buffers, OT_MSGPOOL_NUM_BUFFERS_NO_PSRAM); num_buffers, OT_MSGPOOL_NUM_BUFFERS_NO_PSRAM);
num_buffers = OT_MSGPOOL_NUM_BUFFERS_NO_PSRAM; num_buffers = OT_MSGPOOL_NUM_BUFFERS_NO_PSRAM;
} }
#endif
otMessageBuffer *buffer_pool = (otMessageBuffer *)heap_caps_calloc_prefer(num_buffers, aBufferSize, 3, esp_openthread_get_alloc_caps(), MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); otMessageBuffer *buffer_pool = (otMessageBuffer *)heap_caps_calloc_prefer(num_buffers, aBufferSize, 3, esp_openthread_get_alloc_caps(), MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
s_buffer_pool_pointer = (otMessageBuffer **)heap_caps_calloc_prefer(num_buffers, sizeof(otMessageBuffer **), 3, esp_openthread_get_alloc_caps(), MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); s_buffer_pool_pointer = (otMessageBuffer **)heap_caps_calloc_prefer(num_buffers, sizeof(otMessageBuffer **), 3, esp_openthread_get_alloc_caps(), MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);