X-Git-Url: https://robinkrens.nl/gitweb/?a=blobdiff_plain;f=main.c;h=221d7d60f67756bfb8daadc668e2e1292671f50a;hb=c63924f7ae486235fdba9e307ceb722e6b8bc764;hp=5453cbd3a01b70e79dc30634c304b7fee0c42899;hpb=bc163529ee6f2aa8ba3ea60047a8471b6d81e1c9;p=cortex-from-scratch diff --git a/main.c b/main.c index 5453cbd..221d7d6 100644 --- a/main.c +++ b/main.c @@ -1,55 +1,73 @@ +/* (CC-BY-NC-SA) ROBIN KRENS - ROBIN @ ROBINKRENS.NL + * + * $LOG$ + * 2019/7/20 - ROBIN KRENS + * Initial version + * + * $DESCRIPTION$ + * Main initialize basic components of the board + * and jumps to a terminal + * + * */ + #include #include #include -#include // <-- your own header file located located in ./include +#include +#include -void *memcpy(void *dest, void *src, size_t count) -{ - const char *sp = (const char *)src; - char *dp = (char *)dest; - for(; count != 0; count--) *dp++ = *sp++; - return dest; -} +#include +#include +#include -/* fillout memory with 'val' (i.e. all zeroes) - */ -void *memset(void *dest, unsigned char val, size_t count) -{ - char *temp = (char *)dest; - for( ; count != 0; count--) *temp++ = val; - return dest; -} +#include +#include +#include +//#include +#include -/* same as above but shorter */ -unsigned short *memsetw(unsigned short *dest, unsigned short val, size_t count) +void main() { - unsigned short *temp = (unsigned short *)dest; - for( ; count != 0; count--) *temp++ = val; - return dest; -} -int strlen(const char *str) -{ - int retval; - for(retval = 0; *str != '\0'; str++) retval++; - return retval; -} + /* Initialize the clock system, */ + clock_init(); + + /* Setup the interrupt vector table */ + ivt_init(); + /* Initialze basic input and output over serial */ + uart_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); -void main() -{ - //uart_puts("LOADING SYSTEM...\n"); + /* Display some basic info at startup */ + sysinfo(); - ivt_init(); - uart_init(); - systick_init(); - uart_puts("WOGSYS LOADING..."); -// asm("cpsie i"); // enable irq , cpsied f (disable faukts( + /* On board LEDs*/ + led_init(); + + /* Real time clock */ + rtc_init(); + + /* Eeprom Driver + eeprom_at24c_init(); + eeprom_test(); + */ + + /* LED Segment Driver */ + tm1637_init(); + + /* Start up terminal */ + terminal(); - // loop + /* Should not be here, endless loop */ for(;;) { }