forked from M-Labs/artiq
1
0
Fork 0
artiq/soc/runtime/main.c

42 lines
865 B
C

#include <stdio.h>
#include <irq.h>
#include <uart.h>
#include <system.h>
#include "corecom.h"
#include "elf_loader.h"
#include "symbols.h"
#include "rtio.h"
#include "dds.h"
typedef void (*kernel_function)(void);
int main(void)
{
unsigned char kbuf[256*1024];
unsigned char kcode[256*1024];
kernel_function k = (kernel_function)kcode;
int length;
irq_setmask(0);
irq_setie(1);
uart_init();
puts("ARTIQ runtime built "__DATE__" "__TIME__"\n");
while(1) {
length = ident_and_download_kernel(kbuf, sizeof(kbuf));
if(length > 0) {
if(load_elf(resolve_symbol, kbuf, length, kcode, sizeof(kcode))) {
rtio_init();
dds_init();
flush_cpu_icache();
k();
kernel_finished();
}
}
}
return 0;
}