From 53c63690da4a30bcd03f8342452a3cea997b9130 Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Tue, 8 Nov 2022 13:57:41 +0800 Subject: [PATCH] =?UTF-8?q?reset=5Ffc=20=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: a1012112796 <1012112796@qq.com> --- board/board.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/board/board.c b/board/board.c index 0e5d30a..025ae70 100644 --- a/board/board.c +++ b/board/board.c @@ -72,3 +72,23 @@ INIT_ENV_EXPORT(fal_init); extern int iap_main_entry(void); INIT_ENV_EXPORT(iap_main_entry); + +#include +static void reset_fc(int argc, char **argv) +{ + int second = 20; // default 20s + + if (argc > 1) + { + second = atoi(argv[1]); + } + + rt_kprintf("\n the system will be reset after %ds\n", second); + rt_enter_critical(); + rt_console_set_device(RT_NULL); + rt_exit_critical(); + rt_thread_delay(1000 * second); + + rt_hw_cpu_reset(); +} +MSH_CMD_EXPORT(reset_fc, resetfc cmd);