فهرست منبع

看门狗测试完成

CHENJIE-PC\QiXiang_CHENJIE 3 سال پیش
والد
کامیت
7b55ed239c
5فایلهای تغییر یافته به همراه26 افزوده شده و 4 حذف شده
  1. 1 0
      ARMCC/Makefile
  2. 0 3
      inc/bsp_custom.h
  3. 1 1
      inc/hal_module_adapter.h
  4. 1 0
      src/MainTask.c
  5. 23 0
      src/bsp_custom.c

+ 1 - 0
ARMCC/Makefile

@@ -31,3 +31,4 @@ obj-y             += PLAT/project/$(TARGET)/apps/qx_app/src/app.o \
 
 include $(TOP)/PLAT/tools/scripts/Makefile.rules
 
+CFLAGS += -DWDT_FEATURE_ENABLE=1

+ 0 - 3
inc/bsp_custom.h

@@ -7,9 +7,6 @@ extern "C" {
 
 #include "bsp.h"
 #include "hal_module_adapter.h"
-
-//enable wdt
-#define WDT_FEATURE_ENABLE 1
 void BSP_CustomInit(void);
 #ifdef __cplusplus
 }

+ 1 - 1
inc/hal_module_adapter.h

@@ -8,7 +8,7 @@ extern "C" {
 #include "sensor.h"
 #include "can.h"
 
-// #define USING_PRINTF
+#define USING_PRINTF
 #define DEBUGLOG
 
 #define GPS_DATA_RECV_BUFFER_SIZE     						(1024)

+ 1 - 0
src/MainTask.c

@@ -204,6 +204,7 @@ static void MainTask(void* arg)
                     osDelay(1000);
                     EC_SystemReset();
                 }
+                WDT_Kick();//喂狗
                 osDelay(1000);
                 if(Work_timer_end)
                 {

+ 23 - 0
src/bsp_custom.c

@@ -12,6 +12,7 @@
 #include "bsp_custom.h"
 #include "slpman_ec616.h"
 #include "plat_config.h"
+#include "os_exception.h"
 #include "debug_log.h"
 #if (WDT_FEATURE_ENABLE==1)
 #include "wdt_ec616.h"
@@ -152,6 +153,28 @@ void BSP_WdtInit(void)
     wdtConfig.timeoutValue = 32768U;
     WDT_Init(&wdtConfig);
 }
+void NMI_Handler()
+{
+    ECOMM_TRACE(UNILOG_PLA_APP, enter_NMI_handler, P_ERROR, 0, "WDT timeout!!! Enter NMI Handler!!!");
+    // If we have been in exception handler excecution, we shall resume it.
+    if(is_in_excep_handler())
+    {
+        WDT_Stop();
+    }
+    else
+    {
+        if(BSP_GetPlatConfigItemValue(PLAT_CONFIG_ITEM_FAULT_ACTION) == EXCEP_OPTION_SILENT_RESET)
+        {
+            ResetReasonWrite(RESET_REASON_WDT);
+            EC_SystemReset();
+            while(1);
+        }
+        else
+        {
+            EC_ASSERT(0, 0, 0, 0);
+        }
+    }
+}
 #endif
 /*
  *  custom board related init