Open xzj478 opened 1 year ago
It should just be --device=sifive_uart
.
I tried "spike -m1 --extlib=/tmp/riscvtoolchain/lib/libspikedevices.so --device=sifive_uart /tmp/spike-devices/plugin_test", but nothing happened, and if I press Ctrl+C right after, it will be in spike debugging mode (I guess).
It should just be
--device=sifive_uart
.
Okay, after I tried "spike --extlib=/home/zijianxie/riscvtoolchain/lib/libspikedevices.so --device=sifive_uart --isa=RV64GC --dtb /home/zijianxie/spike-devices/test.dtb /home/zijianxie/spike-devices/plugin_test"
it printed "Found uart at 10000000"; which means spike could recognize the mmio device?
Then how could I pass a string argument to the plugin device to test the store/load function? Since the original command of "--device=<P,B,A>; P -- Name of MMIO plugin, B -- Base memory addr. of the device, A -- String arguments to pass to the plugin" is no longer available in spike.cc.
All I want to ask is how to access the device with memory load/store? Should I write an assembly file like they did in repo: https://github.com/vexingcodes/spike-plugin?
Or I write a simple function C code to do that(after compilation)?
You should write a test program, whether in C or assembly, and execute it.
Any simple example (in C) for that would be appreciated.
Ping :-) I am really struggling to put together a working code, could you by any chance provide a c or asm example?
HI @jerryz123, can you please provide a sample test (C) example and a related LD script being used to compile it.
I somehow figured this thing out hence documenting for beginners like me:
dtc -I dts -O dtb test.dts > test.dtb
hello_world.c
program and compile it using riscv64-unknown-elf-gcc
spike --extlib libspikedevices.so --device sifive_uart --dtb=test.dtb pk hello
Found uart at 10000000
Hello World
.Hello World
which you compiled via printf
in step 2 is actually being shown via the syscall done by the uart device.--device sifive_uart
and rerun. You would not be able to see Hello World
.--dtb
command would override the pk
default compiled dtb and use the sifive_uart
as display output driver
@xzj478 you can try this if I am not very very very late 😅
I used the test drive which posted in this repo: "https://github.com/vexingcodes/spike-plugin" to test the output
With this command line: "spike -m1 --extlib=/tmp/riscvtoolchain/lib/libspikedevices.so --device=sifive_uart,0x10000000,argument /tmp/spike-devices/plugin_test"
but it reports: "terminate called after throwing an instance of 'std::runtime_error' what(): Plugin "sifive_uart,0x10000000,argument" not found in loaded extlibs. Aborted (core dumped)"
Could you please show me the right way of testing the output? Thanks.