/**
 * @file
 * @brief
 *
 * @author  Anton Kozlov
 * @date    30.10.2014
 */

#include <assert.h>
#include <stdint.h>
#include <system_stm32f4xx.h>
#include <framework/mod/options.h>
#include <module/embox/arch/system.h>
#include <hal/arch.h>

#include <stm32f4xx_wwdg.h>

void arch_init(void) {
	static_assert(OPTION_MODULE_GET(embox__arch__system, NUMBER, core_freq) == 144000000);
	SystemInit();
}

void arch_idle(void) {

}

void arch_shutdown(arch_shutdown_mode_t mode) {
	switch (mode) {
	case ARCH_SHUTDOWN_MODE_HALT:
	case ARCH_SHUTDOWN_MODE_REBOOT:
	case ARCH_SHUTDOWN_MODE_ABORT:
	default:
		NVIC_SystemReset();
	}

	/* NOTREACHED */
	while(1) {

	}
}

/**
 * @file
 * @brief
 *
 * @author  Anton Kozlov
 * @date    30.10.2014
 */

#include <assert.h>
#include <stdint.h>
#include <system_stm32f4xx.h>
#include <framework/mod/options.h>
#include <module/embox/arch/system.h>
#include <hal/arch.h>

void arch_init(void) {
	static_assert(OPTION_MODULE_GET(embox__arch__system, NUMBER, core_freq) == 144000000);
	SystemInit();
}

void arch_idle(void) {

}

void arch_shutdown(arch_shutdown_mode_t mode) {
	while (1);
}

--- 
+++ 
@@ -13,6 +13,8 @@
 #include <module/embox/arch/system.h>
 #include <hal/arch.h>
 
+#include <stm32f4xx_wwdg.h>
+
 void arch_init(void) {
 	static_assert(OPTION_MODULE_GET(embox__arch__system, NUMBER, core_freq) == 144000000);
 	SystemInit();
@@ -23,5 +25,16 @@
 }
 
 void arch_shutdown(arch_shutdown_mode_t mode) {
-	while (1);
+	switch (mode) {
+	case ARCH_SHUTDOWN_MODE_HALT:
+	case ARCH_SHUTDOWN_MODE_REBOOT:
+	case ARCH_SHUTDOWN_MODE_ABORT:
+	default:
+		NVIC_SystemReset();
+	}
+
+	/* NOTREACHED */
+	while(1) {
+
+	}
 }
stm32: Change shutdown to reset the board
