Skip to content

Commit

Permalink
runtime: Add rtl runtime that does not depend on fesvr
Browse files Browse the repository at this point in the history
  • Loading branch information
fischeti committed Feb 16, 2024
1 parent 98ac9f1 commit 6b0f8bd
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 2 deletions.
6 changes: 4 additions & 2 deletions target/snitch_cluster/sw/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)
2 changes: 2 additions & 0 deletions target/snitch_cluster/sw/apps/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions target/snitch_cluster/sw/runtime/rtl-no-fesvr/Makefile
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>

SRCS = snitch_cluster_start.S
SRCS += snrt.c

include ../common/common.mk
8 changes: 8 additions & 0 deletions target/snitch_cluster/sw/runtime/rtl-no-fesvr/memory.ld
Original file line number Diff line number Diff line change
@@ -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
}
8 changes: 8 additions & 0 deletions target/snitch_cluster/sw/runtime/rtl-no-fesvr/src/putchar.c
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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"
19 changes: 19 additions & 0 deletions target/snitch_cluster/sw/runtime/rtl-no-fesvr/src/snrt.c
Original file line number Diff line number Diff line change
@@ -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"
38 changes: 38 additions & 0 deletions target/snitch_cluster/sw/runtime/rtl-no-fesvr/src/snrt.h
Original file line number Diff line number Diff line change
@@ -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 <stddef.h>
#include <stdint.h>

// 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"
2 changes: 2 additions & 0 deletions target/snitch_cluster/sw/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6b0f8bd

Please sign in to comment.