Browse Source

[Add][rootfs][check_reset_reason]

2021.07.12 / Folus Wen

Actions:
1. Add check_reset_reason.sh to /usr/bin for check SOC reset reason.

Files:
1. As follow commit history

Image version: D0.00.XX.XXXX.XX
Image checksum: XXXXXXXX

Hardware PWB P/N : XXXXXXX
Hardware Version : XXXXXXX
FolusWen 3 years ago
parent
commit
b9f37eca58
1 changed files with 29 additions and 0 deletions
  1. 29 0
      EVSE/rootfs/usr/bin/check_reset_reason.sh

+ 29 - 0
EVSE/rootfs/usr/bin/check_reset_reason.sh

@@ -0,0 +1,29 @@
+#!/bin/sh
+
+if [ $# -lt 1 ]; then
+        echo "Usage sample:  check_reset_reason.sh [Action]"
+        echo " Action: read / clear"
+        exit 0;
+else
+        case $1 in
+                read)
+                        reason=`devmem 0x44e00f08`
+                        echo "CPU reset reason register:" $reason
+			echo "Bit[0]: Power-on (cold) reset event"
+			echo "Bit[1]: Global warm software reset event"
+			echo "Bit[2]: Reserved"
+			echo "Bit[3]: Reserved"
+			echo "Bit[4]: Watchdog1 timer reset event"
+			echo "Bit[5]: External warm reset event"
+			echo "Bit[6]: Reserved"
+			echo "Bit[7]: Reserved"
+			echo "Bit[8]: Reserved"
+			echo "Bit[9]: IcePick reset event"
+                ;;
+                clear)
+			`devmem 0x44e00f08 w 0xffffffff`
+                        echo "CPU reset reason register cleared."
+                ;;
+        esac
+fi
+