fd762e4a868abe23ec7e0d183076e21b8e9947f0
[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/stdio.h>
22 #include <lib/tinyprintf.h>
23
24 #include <drivers/uart.h>
25 #include <drivers/led.h>
26 #include <drivers/tm1637.h>
27 //#include <drivers/at24c.h>
28 #include <drivers/tsensor.h>
29
30 void main()
31 {
32
33         /* Initialize the clock system, */
34         clock_init();
35
36         /* Setup the interrupt vector table */
37         ivt_init();
38
39         /* Initialze basic input and output over serial */
40         uart_init();
41
42         /* Cortex M* integrated systick, can be replaced
43          * by the more accurate RTC.
44         systick_init();
45         */
46
47         /* Set up a very small libc library */
48         init_printf(NULL, putc);
49
50         /* Display some basic info at startup */
51         sysinfo();
52
53         /* On board LEDs*/
54         led_init();
55
56         /* Real time clock */
57         rtc_init();
58
59         /* Eeprom Driver
60         eeprom_at24c_init();
61         eeprom_test();
62         */
63         
64         /* LED Segment Driver */
65         //tm1637_init();
66         
67         /* TEMP SENSOR */
68         run();
69
70         /* Start up terminal */
71         terminal();
72
73         /* Should not be here, endless loop */
74         for(;;) {
75
76         }
77 }