1 #include <stdint.h>
2 
3 #define LED (*(volatile uint32_t*)0x02000000)
4 
5 #define reg_uart_clkdiv (*(volatile uint32_t*)0x02000004)
6 #define reg_uart_data (*(volatile uint32_t*)0x02000008)
7 
putchar(char c)8 void putchar(char c)
9 {
10     if (c == '\n')
11         putchar('\r');
12     reg_uart_data = c;
13 }
14 
print(const char * p)15 void print(const char *p)
16 {
17     while (*p)
18         putchar(*(p++));
19 }
20 
delay()21 void delay() {
22     for (volatile int i = 0; i < 250000; i++)
23         ;
24 }
25 
main()26 int main() {
27     reg_uart_clkdiv = 416;
28     while (1) {
29         LED = 0xFF;
30         print("hello world\n");
31         delay();
32         LED = 0x00;
33         delay();
34     }
35 }
36