forked from M-Labs/artiq
1
0
Fork 0

runtime: use UP/AMP terminology

This commit is contained in:
Sebastien Bourdeauducq 2015-04-05 17:55:05 +08:00
parent 71b7fe38bc
commit 1bca614d11
8 changed files with 23 additions and 21 deletions

View File

@ -3,17 +3,19 @@ include $(MSCDIR)/software/common.mak
OBJECTS_SERVICES=exception_jmp.o exceptions.o rtio.o dds.o OBJECTS_SERVICES=exception_jmp.o exceptions.o rtio.o dds.o
OBJECTS=isr.o elf_loader.o services.o comm_serial.o test_mode.o main.o OBJECTS=isr.o elf_loader.o services.o comm_serial.o test_mode.o main.o
# NOTE: this does not handle dependencies well. Run "make clean"
# when switching between UP and AMP.
UNIPROCESSOR := $(shell echo -e "\#include <generated/csr.h>\nCSR_KERNEL_CPU_BASE" | $(CC_normal) $(CFLAGS) -E - | tail -n 1 | grep -c CSR_KERNEL_CPU_BASE) UNIPROCESSOR := $(shell echo -e "\#include <generated/csr.h>\nCSR_KERNEL_CPU_BASE" | $(CC_normal) $(CFLAGS) -E - | tail -n 1 | grep -c CSR_KERNEL_CPU_BASE)
ifeq ($(UNIPROCESSOR),0) ifeq ($(UNIPROCESSOR),0)
OBJECTS += kernelcpu.o ksupport_data.o OBJECTS += kernelcpu.o ksupport_data.o
CFLAGS += -DARTIQ_BIPROCESSOR CFLAGS += -DARTIQ_AMP
SERVICE_TABLE_INPUT = ksupport.elf SERVICE_TABLE_INPUT = ksupport.elf
else else
ifeq ($(UNIPROCESSOR),1) ifeq ($(UNIPROCESSOR),1)
OBJECTS += $(OBJECTS_SERVICES) OBJECTS += $(OBJECTS_SERVICES)
else else
$(error failed to determine uniprocessor/biprocessor build) $(error failed to determine UP/AMP build)
endif endif
endif endif

View File

@ -151,7 +151,7 @@ static void receive_and_run_kernel(kernel_runner run_kernel)
send_char(MSGTYPE_KERNEL_EXCEPTION); send_char(MSGTYPE_KERNEL_EXCEPTION);
send_int(eid); send_int(eid);
for(i=0;i<3;i++) for(i=0;i<3;i++)
#ifdef ARTIQ_BIPROCESSOR #ifdef ARTIQ_AMP
#warning TODO #warning TODO
send_llint(0LL); send_llint(0LL);
#else #else
@ -177,7 +177,7 @@ void comm_serve(object_loader load_object, kernel_runner run_kernel)
if(msgtype == MSGTYPE_REQUEST_IDENT) { if(msgtype == MSGTYPE_REQUEST_IDENT) {
send_char(MSGTYPE_IDENT); send_char(MSGTYPE_IDENT);
send_int(0x41524f52); /* "AROR" - ARTIQ runtime on OpenRISC */ send_int(0x41524f52); /* "AROR" - ARTIQ runtime on OpenRISC */
#ifdef ARTIQ_BIPROCESSOR #ifdef ARTIQ_AMP
#warning TODO #warning TODO
send_int(125*1000*1000); send_int(125*1000*1000);
send_char(0); send_char(0);
@ -265,7 +265,7 @@ int comm_rpc(int rpc_num, ...)
eid = receive_int(); eid = receive_int();
retval = receive_int(); retval = receive_int();
#ifdef ARTIQ_BIPROCESSOR #ifdef ARTIQ_AMP
#warning TODO #warning TODO
#else #else
if(eid != EID_NONE) if(eid != EID_NONE)

View File

@ -1,7 +1,7 @@
#include <generated/csr.h> #include <generated/csr.h>
#include "exceptions.h" #include "exceptions.h"
#ifndef ARTIQ_BIPROCESSOR #ifndef ARTIQ_AMP
#include "comm.h" #include "comm.h"
#endif #endif
@ -49,7 +49,7 @@ void exception_raise_params(int id,
exception_params[2] = p2; exception_params[2] = p2;
exception_longjmp(exception_contexts[--ec_top].jb); exception_longjmp(exception_contexts[--ec_top].jb);
} else { } else {
#ifdef ARTIQ_BIPROCESSOR #ifdef ARTIQ_AMP
#warning TODO #warning TODO
#else #else
comm_log("ERROR: uncaught exception, ID=%d\n", id); comm_log("ERROR: uncaught exception, ID=%d\n", id);

View File

@ -24,7 +24,7 @@ services = [
] ]
def print_uniprocessor(): def print_up():
for name, contents in services: for name, contents in services:
print("static const struct symbol {}[] = {{".format(name)) print("static const struct symbol {}[] = {{".format(name))
for name, value in contents: for name, value in contents:
@ -33,7 +33,7 @@ def print_uniprocessor():
print("};") print("};")
def print_biprocessor(ksupport_elf_filename): def print_amp(ksupport_elf_filename):
from elftools.elf.elffile import ELFFile from elftools.elf.elffile import ELFFile
with open(ksupport_elf_filename, "rb") as f: with open(ksupport_elf_filename, "rb") as f:
elf = ELFFile(f) elf = ELFFile(f)
@ -51,9 +51,9 @@ def print_biprocessor(ksupport_elf_filename):
def main(): def main():
if len(sys.argv) == 1: if len(sys.argv) == 1:
print_uniprocessor() print_up()
elif len(sys.argv) == 2: elif len(sys.argv) == 2:
print_biprocessor(sys.argv[1]) print_amp(sys.argv[1])
else: else:
print("Incorrect number of command line arguments") print("Incorrect number of command line arguments")
sys.exit(1) sys.exit(1)

View File

@ -10,7 +10,7 @@ MEMORY {
ksupport : ORIGIN = 0x40020000, LENGTH = 0x4000 ksupport : ORIGIN = 0x40020000, LENGTH = 0x4000
} }
/* On biprocessor systems, kernel stack is at the end of main RAM, /* On AMP systems, kernel stack is at the end of main RAM,
* before the runtime stack. Leave 1M for runtime stack. * before the runtime stack. Leave 1M for runtime stack.
*/ */
PROVIDE(_fstack = 0x40000000 + LENGTH(main_ram) - 1024*1024 - 4); PROVIDE(_fstack = 0x40000000 + LENGTH(main_ram) - 1024*1024 - 4);

View File

@ -13,7 +13,7 @@ MEMORY {
/* Kernel memory space start right after the runtime, /* Kernel memory space start right after the runtime,
* and ends before the runtime stack. * and ends before the runtime stack.
* Runtime stack is always at the end of main_ram. * Runtime stack is always at the end of main_ram.
* This stack is shared with the kernel on uniprocessor systems. * This stack is shared with the kernel on UP systems.
*/ */
PROVIDE(_fstack = 0x40000000 + LENGTH(main_ram) - 4); PROVIDE(_fstack = 0x40000000 + LENGTH(main_ram) - 4);

View File

@ -68,7 +68,7 @@ typedef void (*kernel_function)(void);
static int run_kernel(const char *kernel_name, int *eid) static int run_kernel(const char *kernel_name, int *eid)
{ {
kernel_function k; kernel_function k;
#ifndef ARTIQ_BIPROCESSOR #ifndef ARTIQ_AMP
void *jb; void *jb;
#endif #endif
@ -78,7 +78,7 @@ static int run_kernel(const char *kernel_name, int *eid)
return KERNEL_RUN_STARTUP_FAILED; return KERNEL_RUN_STARTUP_FAILED;
} }
#ifdef ARTIQ_BIPROCESSOR #ifdef ARTIQ_AMP
kernelcpu_start(k); kernelcpu_start(k);
*eid = 0; *eid = 0;
while(1) { while(1) {
@ -146,10 +146,10 @@ int main(void)
irq_setie(1); irq_setie(1);
uart_init(); uart_init();
#ifdef ARTIQ_BIPROCESSOR #ifdef ARTIQ_AMP
puts("ARTIQ runtime built "__DATE__" "__TIME__" for biprocessor systems\n"); puts("ARTIQ runtime built "__DATE__" "__TIME__" for AMP systems\n");
#else #else
puts("ARTIQ runtime built "__DATE__" "__TIME__" for uniprocessor systems\n"); puts("ARTIQ runtime built "__DATE__" "__TIME__" for UP systems\n");
#endif #endif
blink_led(); blink_led();

View File

@ -11,13 +11,13 @@
#include "rtio.h" #include "rtio.h"
#include "dds.h" #include "dds.h"
#ifdef ARTIQ_BIPROCESSOR #ifdef ARTIQ_AMP
#warning TODO #warning TODO
void test_main(void) void test_main(void)
{ {
printf("Not implemented yet for biprocessor systems\n"); printf("Not implemented yet for AMP systems\n");
} }
#else #else
@ -353,4 +353,4 @@ void test_main(void)
} }
} }
#endif /* ARTIQ_BIPROCESSOR */ #endif /* ARTIQ_AMP */