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>
20 #include <lib/regfunc.h>
22 #include <lib/stdio.h>
23 #include <lib/string.h>
24 #include <lib/tinyprintf.h>
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>
34 mem_pool_t kheap_pool;
39 /* Initialize the clock system, */
42 /* Setup the interrupt vector table */
45 /* Initialze basic input and output over serial */
51 /* Cortex M* integrated systick, can be replaced
52 * by the more accurate RTC.
56 /* Set up a very small libc library */
57 init_printf(NULL, putc);
59 /* Display some basic info at startup */
68 extern uint32_t * _beginofheap;
69 //printf("%p", &_beginofheap);
70 kpool_init(&kheap_pool, 0x10, 10, (uint32_t *) &_beginofheap);
72 // printf("%p\n", &kheap_pool);
74 char * string = (char *) kalloc(&kheap_pool);
75 char * string2 = (char *) kalloc(&kheap_pool);
76 char * string3 = (char *) kalloc(&kheap_pool);
79 memset(string, 0xFF, 0x10);
80 memset(string2, 0xEE, 0x10);
81 memset(string3, 0xDD, 0x10);
83 printf("%p\n", string);
84 printf("%p\n", string2);
85 printf("%p\n", string3);
87 kfree(&kheap_pool, string);
89 char * string6 = (char *) kalloc(&kheap_pool);
92 memset(string6, 0xCC, 0x10);
93 // char * string7 = (char *) kalloc(&kheap_pool);
94 printf("%p\n", string6);
95 // printf("%p\n", string7);
98 kfree(&kheap_pool, string2);
100 char * string7 = (char *) kalloc(&kheap_pool);
101 memset(string7, 0xBB, 0x10);
104 char * string8 = (char *) kalloc(&kheap_pool);
105 memset(string8, 0xAA, 0x10);
107 char * string9 = (char *) kalloc(&kheap_pool);
108 memset(string9, 0x99, 0x10);
111 kfree(&kheap_pool, string3);
113 //char * string2 = (char *) alloc();
122 /* LED Segment Driver */
125 /* ASM Blocking routine */
126 //for (int i = 0; i < 1000; i++)
131 uint16_t temp = tsensor_get_temp();
132 printf("Current temperature: %d °C\n", temp); */
134 /* ADC Joystick module */
138 /* Start up terminal */
141 /* Should not be here, endless loop */