소스 검색

看门狗测试完成

CHENJIE-PC\QiXiang_CHENJIE 3 년 전
부모
커밋
3ab8917938
2개의 변경된 파일24개의 추가작업 그리고 7개의 파일을 삭제
  1. 1 6
      ARMCC/Makefile
  2. 23 1
      src/bsp_custom.c

+ 1 - 6
ARMCC/Makefile

@@ -10,7 +10,6 @@ THIRDPARTY_WAKAAMA_ENABLE   = n
 THIRDPARTY_ERCOAP_ENABLE    = y
 THIRDPARTY_TINYDTLS_ENABLE  = y
 THIRDPARTY_MBEDTLS_ENABLE   = y
-FLASH_MONITOR_ENABLE = y
 CFLAGS_INC        +=  -I ../inc
 
 
@@ -31,9 +30,5 @@ obj-y             += PLAT/project/$(TARGET)/apps/qx_app/src/app.o \
 
 include $(TOP)/PLAT/tools/scripts/Makefile.rules
 
-ifeq ($(FLASH_MONITOR_ENABLE), y)
 #enable wdt
-CFLAGS += -DWDT_FEATURE_ENABLE=1  -DFS_FILE_OPERATION_STATISTIC
-else
-CFLAGS += -DWDT_FEATURE_ENABLE=1
-endif
+CFLAGS += -DWDT_FEATURE_ENABLE=1

+ 23 - 1
src/bsp_custom.c

@@ -13,6 +13,7 @@
 #include "slpman_ec616.h"
 #include "plat_config.h"
 #include "debug_log.h"
+#include "os_exception.h"
 #if (WDT_FEATURE_ENABLE==1)
 #include "wdt_ec616.h"
 #define WDT_TIMEOUT_VALUE     (20)            // in unit of second, shall be less than 256s
@@ -152,7 +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