github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/runtime/runtime_arm7tdmi.go (about) 1 //go:build arm7tdmi 2 3 package runtime 4 5 import ( 6 _ "runtime/interrupt" // make sure the interrupt handler is defined 7 "unsafe" 8 ) 9 10 type timeUnit int64 11 12 func putchar(c byte) { 13 // dummy, TODO 14 } 15 16 func getchar() byte { 17 // dummy, TODO 18 return 0 19 } 20 21 func buffered() int { 22 // dummy, TODO 23 return 0 24 } 25 26 //go:extern _sbss 27 var _sbss [0]byte 28 29 //go:extern _ebss 30 var _ebss [0]byte 31 32 //go:extern _sdata 33 var _sdata [0]byte 34 35 //go:extern _sidata 36 var _sidata [0]byte 37 38 //go:extern _edata 39 var _edata [0]byte 40 41 // Entry point for Go. Initialize all packages and call main.main(). 42 // 43 //export main 44 func main() { 45 // Initialize .data and .bss sections. 46 preinit() 47 48 // Run program. 49 run() 50 } 51 52 func preinit() { 53 // Initialize .bss: zero-initialized global variables. 54 ptr := unsafe.Pointer(&_sbss) 55 for ptr != unsafe.Pointer(&_ebss) { 56 *(*uint32)(ptr) = 0 57 ptr = unsafe.Add(ptr, 4) 58 } 59 60 // Initialize .data: global variables initialized from flash. 61 src := unsafe.Pointer(&_sidata) 62 dst := unsafe.Pointer(&_sdata) 63 for dst != unsafe.Pointer(&_edata) { 64 *(*uint32)(dst) = *(*uint32)(src) 65 dst = unsafe.Add(dst, 4) 66 src = unsafe.Add(src, 4) 67 } 68 } 69 70 func ticksToNanoseconds(ticks timeUnit) int64 { 71 return int64(ticks) 72 } 73 74 func nanosecondsToTicks(ns int64) timeUnit { 75 return timeUnit(ns) 76 } 77 78 func ticks() timeUnit { 79 // TODO 80 return 0 81 } 82 83 func sleepTicks(d timeUnit) { 84 // TODO 85 } 86 87 func exit(code int) { 88 abort() 89 } 90 91 func abort() { 92 // TODO 93 for { 94 } 95 }