fix: improve boot fault visibility and defer watchdog start
This commit is contained in:
+23
-3
@@ -142,7 +142,6 @@ int main(void)
|
||||
/* Initialize all configured peripherals */
|
||||
MX_GPIO_Init();
|
||||
MX_DMA_Init();
|
||||
MX_IWDG_Init();
|
||||
MX_USART1_UART_Init();
|
||||
MX_USART2_UART_Init();
|
||||
MX_USART3_UART_Init();
|
||||
@@ -231,7 +230,28 @@ void SystemClock_Config(void)
|
||||
*/
|
||||
void Debug_TrapWithRttHint(const char *tag)
|
||||
{
|
||||
debug_log_fault(tag);
|
||||
debug_log_fault_context(tag, __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
void vApplicationMallocFailedHook(void)
|
||||
{
|
||||
debug_log_fault_context("malloc-failed", __FILE__, __LINE__);
|
||||
__disable_irq();
|
||||
for (;;)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void vApplicationStackOverflowHook(TaskHandle_t xTask, char *pcTaskName)
|
||||
{
|
||||
debug_log_printf("[FAULT] stack-overflow task=%s\r\n",
|
||||
(pcTaskName != NULL) ? pcTaskName : "(null)");
|
||||
debug_log_fault_context("stack-overflow", __FILE__, __LINE__);
|
||||
(void)xTask;
|
||||
__disable_irq();
|
||||
for (;;)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/* USER CODE END 4 */
|
||||
@@ -244,7 +264,7 @@ void Error_Handler(void)
|
||||
{
|
||||
/* USER CODE BEGIN Error_Handler_Debug */
|
||||
/* User can add his own implementation to report the HAL error return state */
|
||||
debug_log_fault("error-handler");
|
||||
debug_log_fault_context("error-handler", __FILE__, __LINE__);
|
||||
__disable_irq();
|
||||
while (1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user