From 8e0eb0d57473e85570dd99f4ebbcf5d6f290d455 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sun, 30 Dec 2018 11:43:46 -0500 Subject: [PATCH] sam3: Implement board reset via SAM RSTC hardware Use the RSTC hardware block to perform a full reset on a "reset" command. Signed-off-by: Kevin O'Connor --- src/sam3/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sam3/main.c b/src/sam3/main.c index 68949ce7..1b9375db 100644 --- a/src/sam3/main.c +++ b/src/sam3/main.c @@ -4,6 +4,7 @@ // // This file may be distributed under the terms of the GNU GPLv3 license. +#include "board/irq.h" // irq_disable #include "command.h" // DECL_CONSTANT #include "internal.h" // WDT #include "sched.h" // sched_main @@ -58,7 +59,11 @@ enable_pclock(uint32_t id) void command_reset(uint32_t *args) { - NVIC_SystemReset(); + irq_disable(); + RSTC->RSTC_CR = ((0xA5 << RSTC_CR_KEY_Pos) | RSTC_CR_PROCRST + | RSTC_CR_PERRST); + for (;;) + ; } DECL_COMMAND_FLAGS(command_reset, HF_IN_SHUTDOWN, "reset");