mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-02 18:10:57 +02:00
Merge branch 'feat/add_154_mac_logs_when_ot_assert' into 'master'
feat(openthread): add option to dump 802.15.4 MAC debug info on assert See merge request espressif/esp-idf!40936
This commit is contained in:
@@ -560,4 +560,22 @@ menu "OpenThread"
|
||||
failure.
|
||||
endmenu
|
||||
|
||||
menuconfig OPENTHREAD_DEBUG
|
||||
bool "Enable ESP OpenThread Debug"
|
||||
default n
|
||||
help
|
||||
Enable additional debugging support for ESP OpenThread integration.
|
||||
This includes various diagnostic tools and logs to help track down
|
||||
issues in OpenThread networking or system integration
|
||||
|
||||
config OPENTHREAD_DUMP_MAC_ON_ASSERT
|
||||
bool "Dump 802.15.4 MAC debug info on OpenThread assert"
|
||||
depends on OPENTHREAD_DEBUG && OPENTHREAD_RADIO_NATIVE && IEEE802154_DEBUG
|
||||
default n
|
||||
help
|
||||
When enabled, this option triggers the printing of 802.15.4 MAC layer debug
|
||||
information whenever an OpenThread assert occurs. This can help developers
|
||||
analyze unexpected failures by providing additional MAC layer context.
|
||||
|
||||
|
||||
endmenu
|
||||
|
@@ -1,11 +1,13 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#define OT_PLAT_LOG_TAG "OPENTHREAD"
|
||||
|
||||
#ifndef MS_PER_S
|
||||
@@ -21,3 +23,22 @@
|
||||
#endif
|
||||
|
||||
#define ESP_OPENTHREAD_UART_BUFFER_SIZE CONFIG_OPENTHREAD_UART_BUFFER_SIZE
|
||||
|
||||
#if CONFIG_OPENTHREAD_DEBUG
|
||||
|
||||
#if CONFIG_OPENTHREAD_DUMP_MAC_ON_ASSERT && CONFIG_IEEE802154_RECORD
|
||||
#include "esp_ieee802154.h"
|
||||
#define IEEE802154_RECORD_PRINT() esp_ieee802154_record_print()
|
||||
#else
|
||||
#define IEEE802154_RECORD_PRINT()
|
||||
#endif
|
||||
|
||||
#define ESP_OPENTHREAD_ASSERT(a) do { \
|
||||
if(unlikely(!(a))) { \
|
||||
IEEE802154_RECORD_PRINT(); \
|
||||
assert(a); \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
#define ESP_OPENTHREAD_ASSERT(a) assert(a)
|
||||
#endif
|
||||
|
@@ -76,5 +76,5 @@ otPlatMcuPowerState otPlatGetMcuPowerState(otInstance *instance)
|
||||
void otPlatAssertFail(const char *filename, int line)
|
||||
{
|
||||
ESP_LOGE(OT_PLAT_LOG_TAG, "Assert failed at %s:%d", filename, line);
|
||||
assert(false);
|
||||
ESP_OPENTHREAD_ASSERT(false);
|
||||
}
|
||||
|
Reference in New Issue
Block a user