8000 Updated instructions on running HiFive under qemu by alevy · Pull Request #1783 · tock/tock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Updated instructions on running HiFive under qemu #1783

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

Merged
merged 1 commit into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions boards/hifive1/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ include ../Makefile.common
flash: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).elf
openocd \
-c "source [find board/sifive-hifive1.cfg]; flash protect 0 64 last off; program $<; resume 0x20400000; exit"

qemu: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).elf
qemu-system-riscv32 -M sifive_e -kernel $^ -nographic

qemu-app: $(TOCK_ROOT_DIRECTORY)target/$(TARGET)/release/$(PLATFORM).elf
qemu-system-riscv32 -M sifive_e -kernel $^ -device loader,file=$(APP),addr=0x20430000 -nographic
30 changes: 28 additions & 2 deletions boards/hifive1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,37 @@ Running in QEMU
The HiFive1 application can be run in the QEMU emulation platform, allowing quick and easy testing.

QEMU can be started with Tock using the following arguments (in Tock's top-level directory):

```bash
$ qemu-system-riscv32 -M sifive_e -kernel $TOCK_ROOT/target/riscv32imac-unknown-none-elf/release/hifive1.elf -nographic
```
qemu-system-riscv32 -M sifive_e -kernel target/riscv32imac-unknown-none-elf/release/hifive1.elf -nographic

Or with the `qemu` make target:

```bash
$ make qemu
Copy link
Member

Choose a reason for hiding this comment

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

In both cases, should the command invocation be duplicated, or should the documentation just direct folks to call make and let what make executes be self-documenting (worried the doc will fall out of sync / the command here provides relatively little value, unless it's changed often?)

```

QEMU can be started with Tock and a userspace app using the following arguments (in Tock's top-level directory):

```
qemu-system-riscv32 -M sifive_e -kernel $TOCK_ROOT/target/riscv32imac-unknown-none-elf/release/hifive1.elf -device loader,file=./examples/hello.tbf,addr=0x20430000 -nographic
```
qemu-system-riscv32 -M sifive_e -kernel target/riscv32imac-unknown-none-elf/release/hifive1.elf -device loader,file=./examples/hello.tbf,addr=0x20430000 -nographic
Or with the `qemu-app` make target:

```bash
$ make APP=/path/to/app.tbf qemu-app
```

The TBF must be compiled for the HiFive board which is, at the time of writing,
supported for Rust userland apps using libtock-rs. For example, you can build
the Hello World exmple app from the libtock-rs repository by running:

```
$ cd [LIBTOCK-RS-DIR]
$ make flash-hifive1
$ tar xf target/riscv32imac-unknown-none-elf/tab/hifive1/hello_world.tab
$ cd [TOCK_ROOT]/boards/hifive
$ make APP=[LIBTOCK-RS-DIR]/rv32imac.tbf qemu-app
```

1 change: 1 addition & 0 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ in
pythonPackages.tockloader
rust_build
llvm
qemu
];

LD_LIBRARY_PATH="${stdenv.cc.cc.lib}/lib64:$LD_LIBRARY_PATH";
Expand Down
0