diff --git a/target/snitch_cluster/sw/Makefile b/target/snitch_cluster/sw/Makefile index a0115d00a..5553423f4 100644 --- a/target/snitch_cluster/sw/Makefile +++ b/target/snitch_cluster/sw/Makefile @@ -9,11 +9,13 @@ SELECT_RUNTIME ?= rtl ifeq ($(SELECT_RUNTIME), banshee) RUNTIME = runtime/banshee +else ifeq ($(SELECT_RUNTIME), rtl-no-fesvr) +RUNTIME = runtime/rtl-no-fesvr else RUNTIME = runtime/rtl endif -SUBDIRS = runtime/banshee runtime/rtl math apps tests +SUBDIRS = runtime/banshee runtime/rtl math runtime/rtl-no-fesvr apps tests .PHONY: all $(SUBDIRS) @@ -27,5 +29,5 @@ apps: $(RUNTIME) math tests: $(RUNTIME) math $(MAKE) -C $@ $(TARGET) -runtime/rtl runtime/banshee math: +runtime/rtl runtime/rtl-no-fesvr runtime/banshee math: $(MAKE) -C $@ $(TARGET) diff --git a/target/snitch_cluster/sw/apps/common.mk b/target/snitch_cluster/sw/apps/common.mk index f0e43cd7a..3f23ad93f 100644 --- a/target/snitch_cluster/sw/apps/common.mk +++ b/target/snitch_cluster/sw/apps/common.mk @@ -19,6 +19,8 @@ SNRT_DIR := $(ROOT)/sw/snRuntime ifeq ($(SELECT_RUNTIME), banshee) RUNTIME_DIR := $(ROOT)/target/snitch_cluster/sw/runtime/banshee RISCV_CFLAGS += -DBIST +else ifeq ($(SELECT_RUNTIME), rtl-no-fesvr) +RUNTIME_DIR := $(ROOT)/target/snitch_cluster/sw/runtime/rtl-no-fesvr else RUNTIME_DIR := $(ROOT)/target/snitch_cluster/sw/runtime/rtl endif diff --git a/target/snitch_cluster/sw/runtime/rtl-no-fesvr/Makefile b/target/snitch_cluster/sw/runtime/rtl-no-fesvr/Makefile new file mode 100644 index 000000000..ae9ff7f77 --- /dev/null +++ b/target/snitch_cluster/sw/runtime/rtl-no-fesvr/Makefile @@ -0,0 +1,10 @@ +# Copyright 2023 ETH Zurich and University of Bologna. +# Licensed under the Apache License, Version 2.0, see LICENSE for details. +# SPDX-License-Identifier: Apache-2.0 +# +# Luca Colagrande + +SRCS = snitch_cluster_start.S +SRCS += snrt.c + +include ../common/common.mk diff --git a/target/snitch_cluster/sw/runtime/rtl-no-fesvr/memory.ld b/target/snitch_cluster/sw/runtime/rtl-no-fesvr/memory.ld new file mode 100644 index 000000000..985c7cfd8 --- /dev/null +++ b/target/snitch_cluster/sw/runtime/rtl-no-fesvr/memory.ld @@ -0,0 +1,8 @@ +/* Copyright 2020 ETH Zurich and University of Bologna. */ +/* Solderpad Hardware License, Version 0.51, see LICENSE for details. */ +/* SPDX-License-Identifier: SHL-0.51 */ + +MEMORY +{ + L3 (rwxa) : ORIGIN = 0x80000000, LENGTH = 0x80000000 +} diff --git a/target/snitch_cluster/sw/runtime/rtl-no-fesvr/src/putchar.c b/target/snitch_cluster/sw/runtime/rtl-no-fesvr/src/putchar.c new file mode 100644 index 000000000..d8cb5986d --- /dev/null +++ b/target/snitch_cluster/sw/runtime/rtl-no-fesvr/src/putchar.c @@ -0,0 +1,8 @@ +// Copyright 2020 ETH Zurich and University of Bologna. +// Licensed under the Apache License, Version 2.0, see LICENSE for details. +// SPDX-License-Identifier: Apache-2.0 + +// Provide an implementation for putchar. +void snrt_putchar(char character) { + *(volatile uint32_t *)0x0d000008 = character; +} diff --git a/target/snitch_cluster/sw/runtime/rtl-no-fesvr/src/snitch_cluster_start.S b/target/snitch_cluster/sw/runtime/rtl-no-fesvr/src/snitch_cluster_start.S new file mode 100644 index 000000000..93259b880 --- /dev/null +++ b/target/snitch_cluster/sw/runtime/rtl-no-fesvr/src/snitch_cluster_start.S @@ -0,0 +1,15 @@ +# Copyright 2023 ETH Zurich and University of Bologna. +# Licensed under the Apache License, Version 2.0, see LICENSE for details. +# SPDX-License-Identifier: Apache-2.0 + +#define SNRT_INIT_INT_REGS +#define SNRT_INIT_FP_REGS +#define SNRT_INIT_GP +#define SNRT_INIT_CORE_INFO +#define SNRT_INIT_CLS +#define SNRT_INIT_STACK +#define SNRT_INIT_TLS +#define SNRT_CRT0_PARK + +#include "snitch_cluster_defs.h" +#include "start.S" diff --git a/target/snitch_cluster/sw/runtime/rtl-no-fesvr/src/snitch_cluster_start.c b/target/snitch_cluster/sw/runtime/rtl-no-fesvr/src/snitch_cluster_start.c new file mode 100644 index 000000000..eb2316229 --- /dev/null +++ b/target/snitch_cluster/sw/runtime/rtl-no-fesvr/src/snitch_cluster_start.c @@ -0,0 +1,18 @@ +// Copyright 2023 ETH Zurich and University of Bologna. +// Licensed under the Apache License, Version 2.0, see LICENSE for details. +// SPDX-License-Identifier: Apache-2.0 + +#define SNRT_INIT_TLS +#define SNRT_INIT_BSS +#define SNRT_INIT_CLS +#define SNRT_INIT_LIBS +#define SNRT_CRT0_PRE_BARRIER +#define SNRT_INVOKE_MAIN +#define SNRT_CRT0_POST_BARRIER +#define SNRT_CRT0_EXIT + +static inline volatile uint32_t* snrt_exit_code_destination() { + return (volatile uint32_t*)0x0d000000; +} + +#include "start.c" diff --git a/target/snitch_cluster/sw/runtime/rtl-no-fesvr/src/snrt.c b/target/snitch_cluster/sw/runtime/rtl-no-fesvr/src/snrt.c new file mode 100644 index 000000000..860c64188 --- /dev/null +++ b/target/snitch_cluster/sw/runtime/rtl-no-fesvr/src/snrt.c @@ -0,0 +1,19 @@ +// Copyright 2023 ETH Zurich and University of Bologna. +// Licensed under the Apache License, Version 2.0, see LICENSE for details. +// SPDX-License-Identifier: Apache-2.0 + +#include "snrt.h" + +#include "alloc.c" +#include "cls.c" +#include "cluster_interrupts.c" +#include "dm.c" +#include "dma.c" +#include "eu.c" +#include "kmp.c" +#include "omp.c" +#include "printf.c" +#include "putchar.c" +#include "snitch_cluster_start.c" +#include "sync.c" +#include "team.c" diff --git a/target/snitch_cluster/sw/runtime/rtl-no-fesvr/src/snrt.h b/target/snitch_cluster/sw/runtime/rtl-no-fesvr/src/snrt.h new file mode 100644 index 000000000..1902c0454 --- /dev/null +++ b/target/snitch_cluster/sw/runtime/rtl-no-fesvr/src/snrt.h @@ -0,0 +1,38 @@ +// Copyright 2023 ETH Zurich and University of Bologna. +// Licensed under the Apache License, Version 2.0, see LICENSE for details. +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include +#include + +// Snitch cluster specific +#include "snitch_cluster_defs.h" +#include "snitch_cluster_memory.h" + +// Forward declarations +#include "alloc_decls.h" +#include "cls_decls.h" +#include "riscv_decls.h" +#include "start_decls.h" +#include "sync_decls.h" +#include "team_decls.h" + +// Implementation +#include "alloc.h" +#include "cls.h" +#include "cluster_interrupts.h" +#include "dm.h" +#include "dma.h" +#include "dump.h" +#include "eu.h" +#include "kmp.h" +#include "omp.h" +#include "perf_cnt.h" +#include "printf.h" +#include "riscv.h" +#include "snitch_cluster_global_interrupts.h" +#include "ssr.h" +#include "sync.h" +#include "team.h" diff --git a/target/snitch_cluster/sw/tests/Makefile b/target/snitch_cluster/sw/tests/Makefile index 57b26d9a0..45ae67813 100644 --- a/target/snitch_cluster/sw/tests/Makefile +++ b/target/snitch_cluster/sw/tests/Makefile @@ -19,6 +19,8 @@ SRC_DIR = $(ROOT)/sw/tests BUILDDIR = $(ROOT)/target/snitch_cluster/sw/tests/build ifeq ($(SELECT_RUNTIME), banshee) RUNTIME_DIR = $(ROOT)/target/snitch_cluster/sw/runtime/banshee +else ifeq ($(SELECT_RUNTIME), rtl-no-fesvr) +RUNTIME_DIR = $(ROOT)/target/snitch_cluster/sw/runtime/rtl-no-fesvr else RUNTIME_DIR = $(ROOT)/target/snitch_cluster/sw/runtime/rtl endif