mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 05:53:39 +00:00
runtime: refactor initialization code
Let each target handle its own initialization/finalization sequence instead of providing one in the runtime with hooks for memory initialization etc. This is much more flexible although it causes a little bit of code duplication.
This commit is contained in:
@@ -36,6 +36,15 @@ var _sbss unsafe.Pointer
|
||||
//go:extern _ebss
|
||||
var _ebss unsafe.Pointer
|
||||
|
||||
//go:export main
|
||||
func main() {
|
||||
preinit()
|
||||
initAll()
|
||||
postinit()
|
||||
mainWrapper()
|
||||
abort()
|
||||
}
|
||||
|
||||
func preinit() {
|
||||
// Initialize .bss: zero-initialized global variables.
|
||||
ptr := uintptr(unsafe.Pointer(&_sbss))
|
||||
@@ -107,7 +116,6 @@ func ticks() timeUnit {
|
||||
}
|
||||
|
||||
func abort() {
|
||||
avr.Asm("cli")
|
||||
for {
|
||||
sleepWDT(WDT_PERIOD_2S)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user