mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-15 00:13:43 +00:00
riscv: support sleeping in QEMU
QEMU doesn't support the RTC peripheral yet so work around it for now.
This makes the following command work:
tinygo run -target=hifive1-qemu ./testdata/coroutines.go
This commit is contained in:
committed by
Ron Evans
parent
14474e7099
commit
184827e4d8
@@ -10,7 +10,19 @@ import (
|
||||
// Special memory-mapped device to exit tests, created by SiFive.
|
||||
var testExit = (*volatile.Register32)(unsafe.Pointer(uintptr(0x100000)))
|
||||
|
||||
var timestamp timeUnit
|
||||
|
||||
func abort() {
|
||||
// Signal a successful exit.
|
||||
testExit.Set(0x5555)
|
||||
}
|
||||
|
||||
func ticks() timeUnit {
|
||||
return timestamp
|
||||
}
|
||||
|
||||
func sleepTicks(d timeUnit) {
|
||||
// Note: QEMU doesn't seem to support the RTC peripheral at the time of
|
||||
// writing so just simulate sleeping here.
|
||||
timestamp += d
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user