From 7bdcf8a5d49838ce6e3e227e2780e4f12c461330 Mon Sep 17 00:00:00 2001 From: Zhanglong Xia Date: Tue, 28 Mar 2023 14:03:26 +0800 Subject: [PATCH] [spinel] abort host after receiving unexpected reset from RCP (#8909) Some platforms, such as Android and CastOS, can monitor program crash. And they can upload the crash dump to the crash server for developers to analyze the crash reason. This commit aborts the host after receiving a unexpected reset to trigger platforms to upload the crash dump. --- src/lib/spinel/openthread-spinel-config.h | 9 +++++++++ src/lib/spinel/radio_spinel_impl.hpp | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/lib/spinel/openthread-spinel-config.h b/src/lib/spinel/openthread-spinel-config.h index 3cd91f243..58ff993ba 100644 --- a/src/lib/spinel/openthread-spinel-config.h +++ b/src/lib/spinel/openthread-spinel-config.h @@ -55,4 +55,13 @@ #define OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT 0 #endif +/** + * @def OPENTHREAD_SPINEL_CONFIG_ABORT_ON_UNEXPECTED_RCP_RESET_ENABLE + * + * Define 1 to abort the host when receiving unexpected reset from RCP. + * + */ +#ifndef OPENTHREAD_SPINEL_CONFIG_ABORT_ON_UNEXPECTED_RCP_RESET_ENABLE +#define OPENTHREAD_SPINEL_CONFIG_ABORT_ON_UNEXPECTED_RCP_RESET_ENABLE 0 +#endif #endif // OPENTHREAD_SPINEL_CONFIG_H_ diff --git a/src/lib/spinel/radio_spinel_impl.hpp b/src/lib/spinel/radio_spinel_impl.hpp index d4d78f176..4bdc033ac 100644 --- a/src/lib/spinel/radio_spinel_impl.hpp +++ b/src/lib/spinel/radio_spinel_impl.hpp @@ -2259,6 +2259,8 @@ void RadioSpinel::HandleRcpUnexpectedReset(sp #if OPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT > 0 mRcpFailed = true; +#elif OPENTHREAD_SPINEL_CONFIG_ABORT_ON_UNEXPECTED_RCP_RESET_ENABLE + abort(); #else DieNow(OT_EXIT_RADIO_SPINEL_RESET); #endif