diff --git a/lib/cm3/vector.c b/lib/cm3/vector.c
index c2041f33..2da43016 100644
--- a/lib/cm3/vector.c
+++ b/lib/cm3/vector.c
@@ -18,6 +18,7 @@
* along with this library. If not, see .
*/
+#include
#include
/* load optional platform dependent initialization routines */
@@ -74,6 +75,10 @@ void WEAK __attribute__ ((naked)) reset_handler(void)
*dest++ = 0;
}
+ /* Ensure 8-byte alignment of stack pointer on interrupts */
+ /* Enabled by default on most Cortex-M parts, but not M3 r1 */
+ SCB_CCR |= SCB_CCR_STKALIGN;
+
/* might be provided by platform specific vector.c */
pre_main();