mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-17 19:23:25 +00:00
generalize -scheduler=none to support most platforms
This commit is contained in:
@@ -30,20 +30,16 @@ var _sidata [0]byte
|
|||||||
//go:extern _edata
|
//go:extern _edata
|
||||||
var _edata [0]byte
|
var _edata [0]byte
|
||||||
|
|
||||||
|
func postinit() {}
|
||||||
|
|
||||||
// Entry point for Go. Initialize all packages and call main.main().
|
// Entry point for Go. Initialize all packages and call main.main().
|
||||||
//go:export main
|
//go:export main
|
||||||
func main() {
|
func main() {
|
||||||
// Initialize .data and .bss sections.
|
// Initialize .data and .bss sections.
|
||||||
preinit()
|
preinit()
|
||||||
|
|
||||||
// Run initializers of all packages.
|
// Run program.
|
||||||
initAll()
|
run()
|
||||||
|
|
||||||
// Compiler-generated call to main.main().
|
|
||||||
go callMain()
|
|
||||||
|
|
||||||
// Run the scheduler.
|
|
||||||
scheduler()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func preinit() {
|
func preinit() {
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ import (
|
|||||||
|
|
||||||
type timeUnit int64
|
type timeUnit int64
|
||||||
|
|
||||||
|
func postinit() {}
|
||||||
|
|
||||||
//go:export Reset_Handler
|
//go:export Reset_Handler
|
||||||
func main() {
|
func main() {
|
||||||
preinit()
|
preinit()
|
||||||
initAll()
|
run()
|
||||||
go callMain()
|
|
||||||
scheduler()
|
|
||||||
abort()
|
abort()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ import (
|
|||||||
|
|
||||||
type timeUnit int64
|
type timeUnit int64
|
||||||
|
|
||||||
|
func postinit() {}
|
||||||
|
|
||||||
//go:export Reset_Handler
|
//go:export Reset_Handler
|
||||||
func main() {
|
func main() {
|
||||||
preinit()
|
preinit()
|
||||||
initAll()
|
run()
|
||||||
go callMain()
|
|
||||||
scheduler()
|
|
||||||
abort()
|
abort()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,9 +39,7 @@ var _ebss [0]byte
|
|||||||
//go:export main
|
//go:export main
|
||||||
func main() {
|
func main() {
|
||||||
preinit()
|
preinit()
|
||||||
initAll()
|
run()
|
||||||
postinit()
|
|
||||||
callMain()
|
|
||||||
abort()
|
abort()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ const tickMicros = 1
|
|||||||
|
|
||||||
var timestamp timeUnit
|
var timestamp timeUnit
|
||||||
|
|
||||||
|
func postinit() {}
|
||||||
|
|
||||||
//go:export Reset_Handler
|
//go:export Reset_Handler
|
||||||
func main() {
|
func main() {
|
||||||
preinit()
|
preinit()
|
||||||
initAll()
|
run()
|
||||||
go callMain()
|
|
||||||
scheduler()
|
|
||||||
arm.SemihostingCall(arm.SemihostingReportException, arm.SemihostingApplicationExit)
|
arm.SemihostingCall(arm.SemihostingReportException, arm.SemihostingApplicationExit)
|
||||||
abort()
|
abort()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ var _sidata [0]byte
|
|||||||
//go:extern _edata
|
//go:extern _edata
|
||||||
var _edata [0]byte
|
var _edata [0]byte
|
||||||
|
|
||||||
|
func postinit() {}
|
||||||
|
|
||||||
//go:export main
|
//go:export main
|
||||||
func main() {
|
func main() {
|
||||||
// Zero the PLIC enable bits on startup: they are not zeroed at reset.
|
// Zero the PLIC enable bits on startup: they are not zeroed at reset.
|
||||||
@@ -51,9 +53,7 @@ func main() {
|
|||||||
|
|
||||||
preinit()
|
preinit()
|
||||||
initPeripherals()
|
initPeripherals()
|
||||||
initAll()
|
run()
|
||||||
go callMain()
|
|
||||||
scheduler()
|
|
||||||
abort()
|
abort()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,13 +17,13 @@ const tickMicros = 1024 * 32
|
|||||||
//go:linkname systemInit SystemInit
|
//go:linkname systemInit SystemInit
|
||||||
func systemInit()
|
func systemInit()
|
||||||
|
|
||||||
|
func postinit() {}
|
||||||
|
|
||||||
//go:export Reset_Handler
|
//go:export Reset_Handler
|
||||||
func main() {
|
func main() {
|
||||||
systemInit()
|
systemInit()
|
||||||
preinit()
|
preinit()
|
||||||
initAll()
|
run()
|
||||||
go callMain()
|
|
||||||
scheduler()
|
|
||||||
abort()
|
abort()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ package runtime
|
|||||||
|
|
||||||
type timeUnit int64
|
type timeUnit int64
|
||||||
|
|
||||||
|
func postinit() {}
|
||||||
|
|
||||||
//go:export Reset_Handler
|
//go:export Reset_Handler
|
||||||
func main() {
|
func main() {
|
||||||
preinit()
|
preinit()
|
||||||
initAll()
|
run()
|
||||||
go callMain()
|
|
||||||
scheduler()
|
|
||||||
abort()
|
abort()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,17 +45,12 @@ type timespec struct {
|
|||||||
|
|
||||||
const CLOCK_MONOTONIC_RAW = 4
|
const CLOCK_MONOTONIC_RAW = 4
|
||||||
|
|
||||||
|
func postinit() {}
|
||||||
|
|
||||||
// Entry point for Go. Initialize all packages and call main.main().
|
// Entry point for Go. Initialize all packages and call main.main().
|
||||||
//go:export main
|
//go:export main
|
||||||
func main() int {
|
func main() int {
|
||||||
// Run initializers of all packages.
|
run()
|
||||||
initAll()
|
|
||||||
|
|
||||||
// Compiler-generated call to main.main().
|
|
||||||
go callMain()
|
|
||||||
|
|
||||||
// Run scheduler.
|
|
||||||
scheduler()
|
|
||||||
|
|
||||||
// For libc compatibility.
|
// For libc compatibility.
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ type wasiIOVec struct {
|
|||||||
//export fd_write
|
//export fd_write
|
||||||
func fd_write(id uint32, iovs *wasiIOVec, iovs_len uint, nwritten *uint) (errno uint)
|
func fd_write(id uint32, iovs *wasiIOVec, iovs_len uint, nwritten *uint) (errno uint)
|
||||||
|
|
||||||
|
func postinit() {}
|
||||||
|
|
||||||
//export _start
|
//export _start
|
||||||
func _start() {
|
func _start() {
|
||||||
initAll()
|
run()
|
||||||
go callMain()
|
|
||||||
scheduler()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Using global variables to avoid heap allocation.
|
// Using global variables to avoid heap allocation.
|
||||||
|
|||||||
@@ -10,3 +10,14 @@ func sleep(duration int64) {
|
|||||||
addSleepTask(task.Current(), duration)
|
addSleepTask(task.Current(), duration)
|
||||||
task.Pause()
|
task.Pause()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// run is called by the program entry point to execute the go program.
|
||||||
|
// With a scheduler, init and the main function are invoked in a goroutine before starting the scheduler.
|
||||||
|
func run() {
|
||||||
|
initAll()
|
||||||
|
postinit()
|
||||||
|
go func() {
|
||||||
|
callMain()
|
||||||
|
}()
|
||||||
|
scheduler()
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,3 +12,11 @@ func sleep(duration int64) {
|
|||||||
func getSystemStackPointer() uintptr {
|
func getSystemStackPointer() uintptr {
|
||||||
return getCurrentStackPointer()
|
return getCurrentStackPointer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// run is called by the program entry point to execute the go program.
|
||||||
|
// With the "none" scheduler, init and the main function are invoked directly.
|
||||||
|
func run() {
|
||||||
|
initAll()
|
||||||
|
postinit()
|
||||||
|
callMain()
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user