Skip to content

Writing your own tests

erling edited this page Oct 1, 2019 · 2 revisions

Assembly:

Boilerplate assembly file for runnning on Spike or Software emulator without the Proxy Kernel

# helloworld.s

.text
.globl _start 
_start:
# Your program here:
li a2, 696969

# Write the value 1 to tohost, telling Spike to quit with an exit code of 0.
li t0, 1
la t1, tohost
sw t0, 0(t1)

# Wait for Spike to terminate
1: j 1b

# Expose tohost and fromhost to Spike so we can communicate with it.
.data
.align 6; .global tohost;   tohost:   .dword 0
.align 6; .global fromhost; fromhost: .dword 0

linker script

SECTIONS
{
  . = 0x80000000;
} 

Compile:

$RISCV/bin/riscv64-unknown-elf-gcc -nostdlib -nostartfiles -static -T link.kd helloworld.s -o helloworld.elf

Clone this wiki locally