Hazard3/test/sim/hellow/main.c

24 lines
549 B
C
Raw Normal View History

2025-03-30 18:36:35 +08:00
2021-05-21 09:34:16 +08:00
#include "tb_cxxrtl_io.h"
2025-03-30 18:36:35 +08:00
#include "uart.h"
#define CLK_FREQ_MHZ 12
// __attribute__((optimize("O0")))
int main() {
// Float stuff should all be compile-time. 115200 baud.
uart_init();
uart_clkdiv_baud(CLK_FREQ_MHZ, 9600);
uart_puts("Hello, UART!\n");
// Need to wait for completion, else we will terminate the simulation
// while characters still in FIFO.
uart_wait_done();
// tb_puts("Hello world from Hazard3 + CXXRTL!\n");
uint32_t addr = 0x40008000;
uint32_t *point = (uint32_t *)addr;
*point = 'C';
return 123;
2021-05-21 09:34:16 +08:00
}