#include "CH32V00xxx.h" typedef __SIZE_TYPE__ size_t; extern "C" { extern void handle_reset () __attribute__((naked,nothrow,used)); extern void user_prog () __attribute__((used,noreturn)); extern int main () __attribute__((used)); extern void SystemInit() __attribute__((used)); // This is required to allow pure virtual functions to be defined. void __cxa_pure_virtual() { while (1); } void * memset(void * s, int c, size_t n) { char * p = (char *) s; for (unsigned i=0u; i 10 ".option arch, +zicsr\n" #endif // Setup the interrupt vector, processor status and INTSYSCR. R"---( li a0, 0x80 csrw mstatus, a0 li a3, 0x3 la a0, InterruptVector or a0, a0, a3 csrw mtvec, a0 /* Takhle RISC-V přejde do uživatelského programu. */ csrw mepc, %[user] mret )---" : : [user]"r"(user_prog) : "a0", "a3", "memory" ); } void user_prog () { SystemInit (); __init_array(); main(); for (;;); }