arm: refactor clearing of exception faults to common code

A number of SoCs clear out the Mem/Bus/Usage and Hard Fault exceptions
during init.  Lets refactor that into a common function so we don't have
to keep duplicating it over and over.

Change-Id: Ida908a9092db37447abcf3c9872f36937982f729
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2017-01-25 09:12:00 -06:00
commit f16cefea9f
8 changed files with 36 additions and 43 deletions

View file

@ -15,6 +15,7 @@
#include <init.h>
#include <soc.h>
#include <arch/cpu.h>
#include <cortex_m/exc.h>
/**
* @brief Perform basic hardware initialization at boot.
@ -32,12 +33,7 @@ static int stm32l4_init(struct device *arg)
key = irq_lock();
/* Clear all faults */
_ScbMemFaultAllFaultsReset();
_ScbBusFaultAllFaultsReset();
_ScbUsageFaultAllFaultsReset();
_ScbHardFaultAllFaultsReset();
_ClearFaults();
/* Install default handler that simply resets the CPU
* if configured in the kernel, NOP otherwise