From 199261e8d614de518f980923da52dd18a1d1a673 Mon Sep 17 00:00:00 2001
From: Rahix <rahix@rahix.de>
Date: Sun, 29 Dec 2019 15:05:19 +0100
Subject: [PATCH] fix(core1-control): Fix SysTick not being reset

Commit dbeec980d99c ("fix(pycardium): Fix delay implementation") enables
the systick on core 1 but on loading a new app, it is not reset which
makes some l0dables crash.  Fix this by always resetting (disabling) the
SysTick in the core1_reset() stub.

Fixes: dbeec980d99c ("fix(pycardium): Fix delay implementation")
Reported-by: Beastie <fischervincent98@gmail.com>
Signed-off-by: Rahix <rahix@rahix.de>
---
 epicardium/api/control.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/epicardium/api/control.c b/epicardium/api/control.c
index e11037b4..99c99953 100644
--- a/epicardium/api/control.c
+++ b/epicardium/api/control.c
@@ -76,6 +76,11 @@ void __core1_init(void)
 	 */
 	TMR_IntClear(MXC_TMR5);
 
+	/*
+	 * Disable the SysTick
+	 */
+	SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk;
+
 	/*
 	 * Reset Interrupts
 	 *
-- 
GitLab