1
0
mirror of https://github.com/antonblanchard/microwatt.git synced 2026-02-02 14:51:09 +00:00
Files
antonblanchard.microwatt/rust_lib_demo/hello_world.c
Anton Blanchard 90ed7adf58 rust_lib_demo: Use common console code
Use a symlink to share the console code in hello_world. Not ideal,
but we can improve on it later.

Signed-off-by: Anton Blanchard <anton@linux.ibm.com>
2020-04-16 17:26:21 +10:00

38 lines
438 B
C

#include <stdint.h>
#include <stdbool.h>
#include "console.h"
void rust_main();
void crash()
{
void (*fun_ptr)() = (void(*)()) 0xdeadbeef;
(*fun_ptr)();
}
void init_bss()
{
extern int _bss, _ebss;
int *p = &_bss;
while (p < &_ebss) {
*p++ = 0;
}
}
#define HELLO_WORLD "Hello World\r\n"
int main(void)
{
init_bss();
potato_uart_init();
putstr(HELLO_WORLD, strlen(HELLO_WORLD));
rust_main();
crash();
while (1)
;
}