From 5bb5c9e23d532cea40476fc0bd1d3008522792ba Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Tue, 26 Mar 2024 17:02:03 -0400 Subject: [PATCH] Fix OnSoftwareFaultDetect chiplock assert occuring on appError() (#32713) --- examples/platform/silabs/SoftwareFaultReports.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/examples/platform/silabs/SoftwareFaultReports.cpp b/examples/platform/silabs/SoftwareFaultReports.cpp index fd9be7f7b9f02b..eab4278e1246cb 100644 --- a/examples/platform/silabs/SoftwareFaultReports.cpp +++ b/examples/platform/silabs/SoftwareFaultReports.cpp @@ -70,7 +70,11 @@ void OnSoftwareFaultEventHandler(const char * faultRecordString) softwareFault.id = taskDetails.xTaskNumber; softwareFault.faultRecording.SetValue(ByteSpan(Uint8::from_const_char(faultRecordString), strlen(faultRecordString))); - SoftwareDiagnosticsServer::Instance().OnSoftwareFaultDetect(softwareFault); + SystemLayer().ScheduleLambda([&softwareFault] { SoftwareDiagnosticsServer::Instance().OnSoftwareFaultDetect(softwareFault); }); + // Allow some time for the Fault event to be sent as the next action after exiting this function + // is typically an assert or reboot. + // Depending on the task at fault, it is possible the event can't be transmitted. + vTaskDelay(pdMS_TO_TICKS(1000)); #endif // MATTER_DM_PLUGIN_SOFTWARE_DIAGNOSTICS_SERVER } @@ -145,9 +149,6 @@ extern "C" void vApplicationMallocFailedHook(void) #endif Silabs::OnSoftwareFaultEventHandler(faultMessage); - // Allow some time for the Fault event to be sent before the chipAbort action - // Depending of the task at fault, it is possible the event can't be transmitted. - vTaskDelay(pdMS_TO_TICKS(1000)); /* Force an assert. */ configASSERT((volatile void *) NULL); } @@ -167,9 +168,6 @@ extern "C" void vApplicationStackOverflowHook(TaskHandle_t pxTask, char * pcTask #endif Silabs::OnSoftwareFaultEventHandler(faultMessage); - // Allow some time for the Fault event to be sent before the chipAbort action - // Depending of the task at fault, it is possible the event can't be transmitted. - vTaskDelay(pdMS_TO_TICKS(1000)); /* Force an assert. */ configASSERT((volatile void *) NULL); } @@ -251,9 +249,6 @@ extern "C" void RAILCb_AssertFailed(RAIL_Handle_t railHandle, uint32_t errorCode #endif // SILABS_LOG_ENABLED Silabs::OnSoftwareFaultEventHandler(faultMessage); - // Allow some time for the Fault event to be sent before the chipAbort action - // Depending of the task at fault, it is possible the event can't be transmitted. - vTaskDelay(pdMS_TO_TICKS(1000)); chipAbort(); } #endif // BRD4325A