1 /* (CC-BY-NC-SA) ROBIN KRENS - ROBIN @ ROBINKRENS.NL
4 * 2019/7/20 - ROBIN KRENS
8 * Main initialize basic components of the board
9 * and jumps to a terminal
17 #include <sys/robsys.h>
19 #include <sys/process.h>
21 #include <lib/regfunc.h>
23 #include <lib/stdio.h>
24 #include <lib/string.h>
25 #include <lib/tinyprintf.h>
26 #include <lib/syscall.h>
28 #include <drivers/uart.h>
29 #include <drivers/led.h>
30 //#include <drivers/tm1637.h>
31 //#include <drivers/at24c.h>
32 //#include <drivers/tsensor.h>
33 //#include <drivers/mk450_joystick.h>
34 #include <drivers/st7735s.h>
37 /* Example of multitasking */
41 uint32_t stackp1[500];
42 uint32_t stackp2[500];
52 /* Load .data segment into SRAM */
53 extern uint32_t * data_lma, data_vma, data_end;
54 int size = (&data_end - &data_vma) * 4;
55 memcpy(&data_vma, &data_lma, size);
57 /* Initialize the clock system, */
60 /* Setup the interrupt vector table */
63 /* Initialze basic input and output over serial */
69 /* Set up a very small libc library */
70 init_printf(NULL, putc);
74 //printf("%p\n", get_kheap());
76 /* Display some basic info at startup */
86 /* Initialize SVC handler for system calls*/
89 /* System call test */
90 int uptime = theos_uptime();
91 printf("UPTIME: %d\n", uptime);
93 /* Multi processes test */
94 // int size_stack = sizeof(stackp1);
95 // p1.stackptr = ((unsigned int) stackp1) + size_stack - 0x1C;
96 // p1.stackptr[6] = (uint32_t) process1;
97 // p1.stackptr[7] = 0x01000000;
98 // p2.stackptr = ((unsigned int) stackp2) + size_stack - 0x1C;
99 // p2.stackptr[6] = (uint32_t) process2;
100 // p2.stackptr[7] = 0x01000000;
103 /* Cortex M* integrated systick, can be replaced
104 * by the more accurate RTC. */
112 /* LED Segment Driver */
115 /* ASM Blocking routine */
116 //for (int i = 0; i < 1000; i++)
121 uint16_t temp = tsensor_get_temp();
122 printf("Current temperature: %d °C\n", temp); */
124 /* ADC Joystick module */
127 /* Start up terminal */
130 /* Should not be here, endless loop */
136 void process1(void) {
139 printf("process 1\n");
141 theos_switch(&p1, &p2);
145 void process2(void) {
147 printf("process 2\n");
149 theos_switch(&p2, &p1);