mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 03:53:42 +00:00
esp32: implement task based scheduler
This has been a *lot* of work, trying to understand the Xtensa windowed registers ABI. But in the end I managed to come up with a very simple implementation that so far seems to work very well. I tested this with both blinky examples (with blinky2 slightly edited) and ./testdata/coroutines.go to verify that it actually works. Most development happened on the ESP32 QEMU fork from Espressif (https://github.com/espressif/qemu/wiki) but I also verified that it works on a real ESP32.
This commit is contained in:
committed by
Ron Evans
parent
abb09e869e
commit
caf35cfc41
@@ -2,6 +2,8 @@
|
||||
|
||||
package runtime
|
||||
|
||||
import "device"
|
||||
|
||||
const GOARCH = "arm" // xtensa pretends to be arm
|
||||
|
||||
// The bitness of the CPU (e.g. 8, 32, 64).
|
||||
@@ -12,4 +14,7 @@ func align(ptr uintptr) uintptr {
|
||||
return (ptr + 3) &^ 3
|
||||
}
|
||||
|
||||
func getCurrentStackPointer() uintptr
|
||||
func getCurrentStackPointer() uintptr {
|
||||
// The stack pointer (sp) is a1.
|
||||
return device.AsmFull("mov {}, sp", nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user