mirror of
https://github.com/espressif/openthread.git
synced 2026-09-09 02:30:11 +00:00
[simulation] enable the platform assert (#10952)
When the ot-rcp enters the assert state, the host crashes and exits. But the ot-rcp still runs in the dead loop and becomes an orphan process. This commit enables the platform assert so that the ot-rcp can automatically exit when entering the assert state.
This commit is contained in:
@@ -113,3 +113,12 @@ otPlatMcuPowerState otPlatGetMcuPowerState(otInstance *aInstance)
|
||||
#if OPENTHREAD_CONFIG_PLATFORM_LOG_CRASH_DUMP_ENABLE
|
||||
otError otPlatLogCrashDump(void) { return OT_ERROR_NONE; }
|
||||
#endif
|
||||
|
||||
void otPlatAssertFail(const char *aFilename, int aLineNumber)
|
||||
{
|
||||
otLogCritPlat("assert failed at %s:%d", aFilename, aLineNumber);
|
||||
|
||||
// For debug build, use assert to generate a core dump
|
||||
assert(false);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -147,4 +147,8 @@
|
||||
#define OPENTHREAD_CONFIG_RADIO_STATS_ENABLE 1
|
||||
#endif
|
||||
|
||||
#ifndef OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT
|
||||
#define OPENTHREAD_CONFIG_PLATFORM_ASSERT_MANAGEMENT 1
|
||||
#endif
|
||||
|
||||
#endif // OPENTHREAD_CORE_SIMULATION_CONFIG_H_
|
||||
|
||||
Reference in New Issue
Block a user