Add Tercel PHY reset synchronization
[microwatt.git] / rust_lib_demo / hello_world.c
1 #include <stdint.h>
2 #include <stdbool.h>
3
4 #include "console.h"
5
6 void rust_main();
7
8 void crash()
9 {
10 void (*fun_ptr)() = (void(*)()) 0xdeadbeef;
11 (*fun_ptr)();
12 }
13
14 void init_bss()
15 {
16 extern int _bss, _ebss;
17 int *p = &_bss;
18 while (p < &_ebss) {
19 *p++ = 0;
20 }
21 }
22
23 #define HELLO_WORLD "Hello World\n"
24
25 int main(void)
26 {
27 init_bss();
28 console_init();
29
30 puts(HELLO_WORLD);
31
32 rust_main();
33 crash();
34
35 while (1)
36 ;
37 }