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