aboutsummaryrefslogtreecommitdiff
path: root/src/kern/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kern/main.c')
-rw-r--r--src/kern/main.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/kern/main.c b/src/kern/main.c
new file mode 100644
index 0000000..ebb2164
--- /dev/null
+++ b/src/kern/main.c
@@ -0,0 +1,29 @@
+#include "arch.h"
+#include "kern/log.h"
+
+#include "arch/stm32l4xxx/peripherals/system.h"
+#include "arch/stm32l4xxx/peripherals/clock.h"
+
+void on_systick() /* Overrides weak-symbol on_systick. */
+{
+ klogf("Systick\n");
+}
+
+#ifdef ARCH_STM32L4
+
+/* Main function. This gets executed from the interrupt vector defined above. */
+int main()
+{
+ klogf("Hello, World! Clock Mhz: %d\n", (uint32_t) get_clock_mhz());
+
+ /* Set the countdown to start from 10,000,0000. */
+ SCB.strv_r = 10000000;
+
+ /* Enable interrupts. */
+ regset(SCB.stcs_r, scb_tickint, 1);
+
+ /* Start the systick. */
+ regset(SCB.stcs_r, scb_enable, 1);
+}
+
+#endif