aboutsummaryrefslogtreecommitdiff
path: root/docs/platform/spike.md
blob: bde9e13ed52f93b5dfcd9bd44b36a2df71073eea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
Spike Simulator Platform
========================

The **Spike** is a RISC-V ISA simulator which implements a functional model
of one or more RISC-V harts. The **Spike** compatible virtual platform is
also available on QEMU. In fact, we can use same OpenSBI firmware binaries
on **Spike** simulator and QEMU Spike machine.

For more details, refer [Spike on GitHub](https://github.com/riscv/riscv-isa-sim)

To build the platform-specific library and firmware images, provide the
*PLATFORM=generic* parameter to the top level `make` command.

Platform Options
----------------

The *Spike* platform does not have any platform-specific options.

Execution on Spike Simulator
----------------------------

**No Payload Case**

Build:
```
make PLATFORM=generic
```

Run:
```
spike build/platform/generic/firmware/fw_payload.elf
```

**Linux Kernel Payload**

Note: We assume that the Linux kernel is compiled using
*arch/riscv/configs/defconfig*.

Build:
```
make PLATFORM=generic FW_PAYLOAD_PATH=<linux_build_directory>/arch/riscv/boot/Image
```

Run:
```
spike -m256 \
	--initrd <path_to_cpio_ramdisk> \
	--bootargs 'root=/dev/ram rw console=hvc0 earlycon=sbi' \
	build/platform/generic/firmware/fw_payload.elf
```
or
```
spike -m256 \
	--kernel <linux_build_directory>/arch/riscv/boot/Image \
	--initrd <path_to_cpio_ramdisk> \
	--bootargs 'root=/dev/ram rw console=hvc0 earlycon=sbi' \
	build/platform/generic/firmware/fw_jump.elf
```

Execution on QEMU RISC-V 64-bit
-------------------------------

**No Payload Case**

Build:
```
make PLATFORM=generic
```

Run:
```
qemu-system-riscv64 -M spike -m 256M -nographic \
	-bios build/platform/generic/firmware/fw_payload.elf
```

**Linux Kernel Payload**

Note: We assume that the Linux kernel is compiled using
*arch/riscv/configs/defconfig*.

Build:
```
make PLATFORM=generic FW_PAYLOAD_PATH=<linux_build_directory>/arch/riscv/boot/Image
```

Run:
```
qemu-system-riscv64 -M spike -m 256M -nographic \
	-bios build/platform/generic/firmware/fw_payload.elf \
	-initrd <path_to_cpio_ramdisk> \
	-append "root=/dev/ram rw console=hvc0 earlycon=sbi"
```
or
```
qemu-system-riscv64 -M spike -m 256M -nographic \
	-bios build/platform/generic/firmware/fw_jump.elf \
	-kernel <linux_build_directory>/arch/riscv/boot/Image \
	-initrd <path_to_cpio_ramdisk> \
	-append "root=/dev/ram rw console=hvc0 earlycon=sbi"
```