X-Git-Url: https://robinkrens.nl/gitweb/?a=blobdiff_plain;f=main.c;h=26a7305697dc06d2882e733502477bb0b5f93659;hb=9844c168a86cd64b8e698e82724de09eca344dae;hp=b4f26ab7b9951dc168018887a83d50248d7d46fa;hpb=09e66bc2ce34038a3e47e1ade5413c5464a783cd;p=cortex-from-scratch diff --git a/main.c b/main.c index b4f26ab..26a7305 100644 --- a/main.c +++ b/main.c @@ -5,7 +5,7 @@ * Initial version * * $DESCRIPTION$ - * Main intialize basic components of the boards + * Main initialize basic components of the board * and jumps to a terminal * * */ @@ -18,83 +18,82 @@ #include #include +#include #include +#include #include #include #include -#include -#include -#include +//#include +//#include +//#include +//#include +#include -//void sleep() { -// -// __asm__ __volatile__("wfe"); -// -//} void main() { + + /* Initialize the clock system, */ clock_init(); + + /* Setup the interrupt vector table */ ivt_init(); + + /* Initialze basic input and output over serial */ uart_init(); -// cputs("ROBSYS LOADING...\n"); - systick_init(); -// tsensor_output(0xFFFF, 0x7FFF); - init_printf(NULL, putc); - // SPEED_TEST -/* cputs("START TEST (8MHz) \n"); - int a; - for (int i = 0; i < 20000000; i++) { - a + 2; - } - a = 0; - cputs("END TEST\n"); + /* TFT screen */ + // tft_init(); - //! - clock_init(); + /* Cortex M* integrated systick, can be replaced + * by the more accurate RTC. + systick_init(); + */ + + /* Set up a very small libc library */ + init_printf(NULL, putc); - cputs("START TEST (??MHz) \n"); - for (int i = 0; i < 20000000; i++) { - a + 2; - } - cputs("END TEST\n"); */ + /* Heap init */ + kheap_init(); + //printf("%p\n", get_kheap()); + + /* Display some basic info at startup */ sysinfo(); + /* On board LEDs*/ + led_init(); -// tsensor_input(5000); -// run(); + /* Real time clock */ + rtc_init(); - led_init(); - at24c_init(); - at24c_run(); -// rtc_init(); - -// tm1637_init(); -// tm1637_start(); - - //uint32_t test = hextoreg("12345678"); - -// cputs(regtohex(test)); - - //extern void stub(); - //stub(); - //__asm__ __volatile__ ("ldc p1, cr1, r0"); - -/* while(1) { - int r; - for (int i = 0; i < 50000; i++) { - r = 0; - } - led_on(); - for (int i = 0; i < 50000; i++) { - r = 0; - } - led_off(); - } */ - terminal(); + /* Eeprom Driver + eeprom_at24c_init(); + eeprom_test(); + */ + + /* LED Segment Driver */ + //tm1637_init(); + + /* ASM Blocking routine */ + //for (int i = 0; i < 1000; i++) + // _block(10000); + + /* TEMP SENSOR + tsensor_printid(); + uint16_t temp = tsensor_get_temp(); + printf("Current temperature: %d °C\n", temp); */ + + /* ADC Joystick module */ + // mk450_init(); + + + /* Start up terminal */ + terminal(); + + /* Should not be here, endless loop */ for(;;) { }