Skip to content

Commit

Permalink
WIP:riscv64-qemu target
Browse files Browse the repository at this point in the history
tinygo build -target riscv64-qemu -monitor .
malloc(): corrupted top size
error: failed to link /tmp/tinygo3535057034/main: signal: aborted
rminnich@glenda:/usr/local/src/tinygo/src/examples/test$

Signed-off-by: Ronald G. Minnich <[email protected]>
  • Loading branch information
rminnichcodeu committed Mar 13, 2023
1 parent 0d56dee commit 7d0d7a1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
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",
"build-tags": ["virt", "qemu"],
"default-stack-size": 4096,
"linkerscript": "targets/riscv64-qemu.ld",
"emulator": "qemu-system-riscv32 -machine virt -nographic -bios none -kernel {}"
}
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 = 0x80000000, LENGTH = 0x100000
RAM (xrw) : ORIGIN = 0x80100000, LENGTH = 0x100000
}

_stack_size = 2K;

INCLUDE "targets/riscv.ld"

0 comments on commit 7d0d7a1

Please sign in to comment.