Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support spike #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Support spike #17

wants to merge 2 commits into from

Conversation

xiwenx
Copy link

@xiwenx xiwenx commented Oct 9, 2022

arch: add support for spike

manual:

  1. make ARCH=riscv64-spike
  2. fix HAS_RVV to support v extension

finished:

  1. fix bug #include <pmp.h> in am/src/nemu/isa/riscv/cte64.c
  2. add tohost link rules in am/src/spike/ldscript/section.ld
  3. add tohost Symbol table in am/src/spike/isa/riscv/boot/start.S
  4. add _halt() for spike in am/src/spike/isa/riscv/trm.c

todo:

  1. add _putc() for spike
  2. add other sysytem calls for spike

@@ -14,7 +14,7 @@ extern void enable_timer();
extern void init_pmp();
extern void enable_pmp(uintptr_t pmp_reg, uintptr_t pmp_addr, uintptr_t pmp_size, uint8_t lock, uint8_t permission);
extern void enable_pmp_TOR(uintptr_t pmp_reg, uintptr_t pmp_addr, uintptr_t pmp_size, bool lock, uint8_t permission);
#include <pmp.h>
// #include <pmp.h>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for running nexus-am

@@ -0,0 +1,13 @@
include $(AM_HOME)/am/arch/isa/riscv64.mk
include $(AM_HOME)/am/arch/platform/spike.mk
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

support for spike

LDFLAGS += -L $(AM_HOME)/am/src/spike/ldscript

NEMU_ARGS += -l --isa=$(RV_MARCH)
ifeq ($(HAS_RVV),1)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

support for RVV

@echo + OBJCOPY "->" $(BINARY_REL).bin
@$(OBJCOPY) -S --set-section-flags .bss=alloc,contents -O binary $(BINARY).elf $(BINARY).bin

run:image
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

support for spike

csrwi fcsr, 0
jal _trm_init

.section ".tohost","aw",@progbits
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

support for spike

extern volatile uint64_t fromhost;

void _halt(int code) {
tohost = (code << 1) | 1;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

support for spike

_pmem_start = pmem_base;
_pmem_end = _pmem_start + LENGTH(ram);
. = ALIGN(0x1000);
.tohost : { *(.tohost) }
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

support for spike

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant