tinygo/src/runtime/runtime_fe310_qemu.go
Ayke van Laethem ed9b2dbc03 runtime/hifive1: use CLINT peripheral for timekeeping
The CLINT is implemented both on the fe310-g002 chip and in the sifive_e
QEMU machine type. Therefore, use that peripheral for consistency.

The only difference is the clock speed, which runs at 10MHz in QEMU for
some reason instead of 32.768kHz as on the physical HiFive1 boards.
2020-01-10 08:04:13 +01:00

20 строки
376 Б
Go

// +build fe310,qemu
package runtime
import (
"runtime/volatile"
"unsafe"
)
const tickMicros = 100 // CLINT.MTIME increments every 100ns
// 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)
}