X-Git-Url: https://robinkrens.nl/gitweb/?a=blobdiff_plain;ds=sidebyside;f=main.c;h=221d7d60f67756bfb8daadc668e2e1292671f50a;hb=43b1749173f70bdf67884d920b93f6a5b1f19a1d;hp=ccf6015023243c27560eaf6d6f7d5a1ec6487ff8;hpb=6e00544afe1ae83fcf51f262cfa744953dc8d023;p=cortex-from-scratch diff --git a/main.c b/main.c index ccf6015..221d7d6 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 * * */ @@ -19,71 +19,55 @@ #include #include +#include #include #include #include - -//void sleep() { -// -// __asm__ __volatile__("wfe"); -// -//} +//#include +#include 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"); + + /* Cortex M* integrated systick, can be replaced + * by the more accurate RTC. systick_init(); - led_init(); - rtc_init(); + */ - // SPEED_TEST -/* cputs("START TEST (8MHz) \n"); - int a; - for (int i = 0; i < 20000000; i++) { - a + 2; - } - a = 0; - cputs("END TEST\n"); - - //! - clock_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"); */ + /* Display some basic info at startup */ sysinfo(); + /* On board LEDs*/ + led_init(); + + /* Real time clock */ + rtc_init(); + + /* Eeprom Driver + eeprom_at24c_init(); + eeprom_test(); + */ + + /* LED Segment Driver */ + tm1637_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(); - } */ + /* Start up terminal */ terminal(); + /* Should not be here, endless loop */ for(;;) { }