aboutsummaryrefslogtreecommitdiff
path: root/src/kern/main.c
blob: 1eedb5970bf1f096dd36d6ff1c89da692ca6b5ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "arch.h"
#include "arch/stm32l4xxx/peripherals/clock.h"
#include "arch/stm32l4xxx/peripherals/system.h"
#include "kern/log.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