ccf6015023243c27560eaf6d6f7d5a1ec6487ff8
[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 intialize basic components of the boards
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
23 #include <drivers/uart.h>
24 #include <drivers/led.h>
25 #include <drivers/tm1637.h>
26
27 //void sleep() {
28 //
29 //      __asm__ __volatile__("wfe");
30 //
31 //}
32
33 void main()
34 {
35         clock_init();
36         ivt_init();
37         uart_init();
38 //      cputs("ROBSYS LOADING...\n");
39         systick_init();
40         led_init();
41         rtc_init();
42
43         // SPEED_TEST
44 /*      cputs("START TEST (8MHz) \n");
45         int a;
46         for (int i = 0; i < 20000000; i++) {
47                 a + 2;  
48         }
49         a = 0;
50         cputs("END TEST\n");
51         
52         //! 
53         clock_init();
54
55         cputs("START TEST (??MHz) \n");
56         for (int i = 0; i < 20000000; i++) {
57                 a + 2;  
58         }
59         cputs("END TEST\n"); */
60         sysinfo();
61
62
63 //      tm1637_init();
64 //      tm1637_start();
65
66         //uint32_t test = hextoreg("12345678");
67                 
68 //      cputs(regtohex(test));
69
70         //extern void stub();
71         //stub();
72         //__asm__ __volatile__ ("ldc p1, cr1, r0");
73
74 /*      while(1) {
75                 int r;
76                 for (int i = 0; i < 50000; i++) {
77                         r = 0;  
78                 }
79                 led_on();
80                 for (int i = 0; i < 50000; i++) {
81                         r = 0;  
82                 }
83                 led_off();
84         } */
85         terminal();
86
87         for(;;) {
88
89         }
90 }