github.com/aykevl/tinygo@v0.5.0/src/runtime/runtime_qemu.go (about) 1 // +build qemu 2 3 package runtime 4 5 // This file implements the Stellaris LM3S6965 Cortex-M3 chip as implemented by 6 // QEMU. 7 8 import ( 9 "device/arm" 10 "unsafe" 11 ) 12 13 type timeUnit int64 14 15 const tickMicros = 1 16 17 var timestamp timeUnit 18 19 //go:export Reset_Handler 20 func main() { 21 preinit() 22 initAll() 23 callMain() 24 arm.SemihostingCall(arm.SemihostingReportException, arm.SemihostingApplicationExit) 25 abort() 26 } 27 28 const asyncScheduler = false 29 30 func sleepTicks(d timeUnit) { 31 // TODO: actually sleep here for the given time. 32 timestamp += d 33 } 34 35 func ticks() timeUnit { 36 return timestamp 37 } 38 39 //go:volatile 40 type regValue uint32 41 42 // UART0 output register. 43 var stdoutWrite *regValue = (*regValue)(unsafe.Pointer(uintptr(0x4000c000))) 44 45 func putchar(c byte) { 46 *stdoutWrite = regValue(c) 47 }