mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-19 00:16:29 +08:00
Sebastien Bourdeauducq
3d8159ceb5
This allows multiple functions to be defined, with the main one not necessarily starting at 0.
43 lines
874 B
C
43 lines
874 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;
|
|
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) {
|
|
k = load_elf(resolve_symbol, "run", kbuf, length, kcode, sizeof(kcode));
|
|
if(k != NULL) {
|
|
rtio_init();
|
|
dds_init();
|
|
flush_cpu_icache();
|
|
k();
|
|
kernel_finished();
|
|
}
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|