blob: c85decbebb684935d799d01f023d7b0c684aece1 (
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
29
30
31
32
33
34
35
36
37
|
#include "arch.h"
#include "arch/stm32l4xxx/peripherals/clock.h"
#include "arch/stm32l4xxx/peripherals/system.h"
#include "kern/log.h"
#include "kern/panic.h"
#include "kern/init.h"
#include "kern/mem.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());
klogf("Heap Start: %p\n", &HEAP_START);
klogf("Heap End : %p\n", &HEAP_STOP);
/* Set the countdown to start from 10,000,0000. */
SCB.strv_r = 10000000 / 20;
/* Enable interrupts. */
regset(SCB.stcs_r, scb_tickint, 1);
/* Start the systick. */
regset(SCB.stcs_r, scb_enable, 1);
void* hunk = kalloc(25);
kfree(hunk);
kfree(hunk); /* Invalid free. */
}
#endif
|