kalloc and kfree interface and abstraction
[cortex-from-scratch] / main.c
1 /* (CC-BY-NC-SA) ROBIN KRENS - ROBIN @ ROBINKRENS.NL
2  * 
3  * $LOG$
4  * 2019/7/20 - ROBIN KRENS      
5  * Initial version 
6  * 
7  * $DESCRIPTION$
8  * Main initialize basic components of the board
9  * and jumps to a terminal
10  *
11  * */
12
13 #include <stdbool.h>
14 #include <stddef.h>
15 #include <stdint.h>
16
17 #include <sys/robsys.h> 
18 #include <sys/mmap.h>
19
20 #include <lib/regfunc.h>
21 #include <lib/pool.h>
22 #include <lib/stdio.h>
23 #include <lib/string.h>
24 #include <lib/tinyprintf.h>
25
26 #include <drivers/uart.h>
27 #include <drivers/led.h>
28 //#include <drivers/tm1637.h>
29 //#include <drivers/at24c.h>
30 //#include <drivers/tsensor.h>
31 //#include <drivers/mk450_joystick.h>
32 #include <drivers/st7735s.h>
33
34
35 void main()
36 {
37
38         /* Initialize the clock system, */
39         clock_init();
40
41         /* Setup the interrupt vector table */
42         ivt_init();
43
44         /* Initialze basic input and output over serial */
45         uart_init();
46
47         /* TFT screen */
48         // tft_init();
49         
50         /* Cortex M* integrated systick, can be replaced
51          * by the more accurate RTC.
52         systick_init();
53         */
54         
55         /* Set up a very small libc library */
56         init_printf(NULL, putc);
57
58         /* Heap init */
59         kheap_init();
60         //printf("%p\n", get_kheap());
61         
62         /* Display some basic info at startup */
63         sysinfo();
64
65         /* On board LEDs*/
66         led_init();
67
68         /* Real time clock */
69         rtc_init();
70
71
72         /* Eeprom Driver
73         eeprom_at24c_init();
74         eeprom_test();
75         */
76         
77         /* LED Segment Driver */
78         //tm1637_init();
79
80         /* ASM Blocking routine */
81         //for (int i = 0; i < 1000; i++)
82         //      _block(10000);
83
84         /* TEMP SENSOR 
85         tsensor_printid();
86         uint16_t temp = tsensor_get_temp();
87         printf("Current temperature: %d °C\n", temp); */
88
89         /* ADC Joystick module */
90         // mk450_init();        
91
92
93         /* Start up terminal */
94         terminal();
95         
96         /* Should not be here, endless loop */
97         for(;;) {
98
99         }
100 }