Skip to content

Commit

Permalink
[spinel] abort host after receiving unexpected reset from RCP (#8909)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zhanglongxia authored Mar 28, 2023
1 parent 4b97fd7 commit 7bdcf8a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib/spinel/openthread-spinel-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_
2 changes: 2 additions & 0 deletions src/lib/spinel/radio_spinel_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2259,6 +2259,8 @@ void RadioSpinel<InterfaceType, ProcessContextType>::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
Expand Down

0 comments on commit 7bdcf8a

Please sign in to comment.