#include #include #include #define AHB_LED_BASE 0x50000000 #define AHB_UART_BASE 0x51000000 #define AHB_UART_STATUS 0x51000004 #pragma import(__use_no_semihosting) struct __FILE { unsigned char * ptr; }; FILE __stdout = {(unsigned char *) AHB_UART_BASE}; FILE __stdin = {(unsigned char *) AHB_UART_BASE}; int uart_out(int ch) { volatile unsigned char* UARTBase; volatile unsigned char* UARTStatus; UARTBase = (volatile unsigned char*)AHB_UART_BASE; UARTStatus = (volatile unsigned char*)AHB_UART_STATUS; *UARTBase = (char)ch; while((*UARTStatus & 0x2) == 0x1); // Wait until its sent return(ch); } int fputc(int ch, FILE *f) { return(uart_out(ch)); } int fgetc(FILE *f) { return 0; } int ferror(FILE *f) { return 0; } void _sys_exit(void) { printf("\nTEST DONE\n"); while(1); }