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

WIP:riscv64-qemu target #3545

Open
wants to merge 1 commit into
base: release
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions builder/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func TestClangAttributes(t *testing.T) {
"k210",
"nintendoswitch",
"riscv-qemu",
"riscv64-qemu",
"wasi",
"wasm",
}
Expand Down
8 changes: 8 additions & 0 deletions targets/riscv64-qemu.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"inherits": ["riscv64"],
"features": "+a,+c,+m,-relax,-save-restore",
Copy link
Member

Choose a reason for hiding this comment

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

These don't seem quite right, the test is complaining about it:

    builder_test.go:145: target has LLVM features
        	"+a,+c,+m,-relax,-save-restore"
        but Clang makes it
        	"+64bit,+a,+c,+d,+f,+m,-relax,-save-restore"

"build-tags": ["virt", "qemu"],
"default-stack-size": 4096,
"linkerscript": "targets/riscv64-qemu.ld",
"emulator": "qemu-system-riscv32 -machine virt -nographic -bios none -kernel {}"
Copy link
Member

Choose a reason for hiding this comment

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

qemu-system-riscv32? That doesn't look right.

}
16 changes: 16 additions & 0 deletions targets/riscv64-qemu.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

/* Memory map:
* https://github.com/qemu/qemu/blob/master/hw/riscv/virt.c
* RAM and flash are set to 1MB each. That should be enough for the foreseeable
* future. QEMU does not seem to limit the flash/RAM size and in fact doesn't
* seem to differentiate between it.
*/
MEMORY
{
FLASH_TEXT (rw) : ORIGIN = 0x20000000, LENGTH = 0x100000
RAM (xrw) : ORIGIN = 0x80000000, LENGTH = 0x100000
}

_stack_size = 2K;

INCLUDE "targets/riscv.ld"