summaryrefslogtreecommitdiff
path: root/source/application/hal
diff options
context:
space:
mode:
authorKshitij Sisodia <kshitij.sisodia@arm.com>2021-05-24 16:12:40 +0100
committerKshitij Sisodia <kshitij.sisodia@arm.com>2021-05-24 16:41:51 +0000
commit3c8256df7de49a4fb64cdbcdea46ff471ff5f846 (patch)
treed080d1542d2ea85d4a7ae00f41d275878eda3706 /source/application/hal
parent55b818002cfdbf55ea3a9f2b509cde34f6a06302 (diff)
downloadml-embedded-evaluation-kit-3c8256df7de49a4fb64cdbcdea46ff471ff5f846.tar.gz
MLECO-1948: Fix for SysTick init and GNU's stdout
The counter val could have been 0 when read the first time quickly after the init function. The init function will now wait for the SysTick counter to start before returning. Also included are some minor changes to get around GNU's file stream implementation being line buffered. Change-Id: I8d51fef5d85f1261a6a5710608349d7ecc19ad62
Diffstat (limited to 'source/application/hal')
-rw-r--r--source/application/hal/platforms/bare-metal/bsp/bsp-packs/mps3/timer_mps3.c11
-rw-r--r--source/application/hal/platforms/bare-metal/bsp/cmsis-device/irqs.c8
2 files changed, 12 insertions, 7 deletions
diff --git a/source/application/hal/platforms/bare-metal/bsp/bsp-packs/mps3/timer_mps3.c b/source/application/hal/platforms/bare-metal/bsp/bsp-packs/mps3/timer_mps3.c
index a72103c..c0c3bdf 100644
--- a/source/application/hal/platforms/bare-metal/bsp/bsp-packs/mps3/timer_mps3.c
+++ b/source/application/hal/platforms/bare-metal/bsp/bsp-packs/mps3/timer_mps3.c
@@ -41,12 +41,11 @@ mps3_time_counter get_time_counter(void)
.counter_fpga = MPS3_FPGAIO->COUNTER,
.counter_systick = Get_SysTick_Cycle_Count()
};
- debug("Timestamp:"
- "\n\tCounter 1 Hz: %" PRIu32
- "\n\tCounter 100 Hz: %" PRIu32
- "\n\tCounter FPGA: %" PRIu32
- "\n\tCounter CPU: %" PRIu64 "\n",
- t.counter_1Hz, t.counter_100Hz, t.counter_fpga, t.counter_systick);
+ debug("Timestamp:\n");
+ debug("\tCounter 1 Hz: %" PRIu32 "\n", t.counter_1Hz);
+ debug("\tCounter 100 Hz: %" PRIu32 "\n", t.counter_100Hz);
+ debug("\tCounter FPGA: %" PRIu32 "\n", t.counter_fpga);
+ debug("\tCounter CPU: %" PRIu64 "\n", t.counter_systick);
return t;
}
diff --git a/source/application/hal/platforms/bare-metal/bsp/cmsis-device/irqs.c b/source/application/hal/platforms/bare-metal/bsp/cmsis-device/irqs.c
index 7c9f4b8..7d8aa06 100644
--- a/source/application/hal/platforms/bare-metal/bsp/cmsis-device/irqs.c
+++ b/source/application/hal/platforms/bare-metal/bsp/cmsis-device/irqs.c
@@ -71,7 +71,8 @@ __attribute__((noreturn)) static void DefaultHandler(void)
#define DEFAULT_HANDLER_CALL(type) \
do { \
- printf("\n%s caught by function %s\n", \
+ printf("\n"); \
+ printf("%s caught by function %s\n", \
type, __FUNCTION__); \
DefaultHandler(); \
} while (0)
@@ -238,6 +239,11 @@ int Init_SysTick(void)
/* Enable interrupt again. */
NVIC_EnableIRQ(SysTick_IRQn);
+ /* Wait for SysTick to kick off */
+ while (!err && !SysTick->VAL) {
+ __NOP();
+ }
+
return err;
}