Olej писал(а): ↑16 фев 2024, 03:07
Завтра буду повторять...
Но, забегая вперёд... попробовал скомпилировать это под микроархитектуру Arduino AVR:
Код: Выделить всё
olej@nvidia:~/2024/Go$ time tinygo build -o gorutt -target arduino gorut.go
gorut.go:25:3: attempted to start a goroutine without a scheduler
real 0m4,582s
user 0m6,991s
sys 0m0,651s
Но у него ещё есть опция scheduler:
Код: Выделить всё
olej@nvidia:~/2024/Go$ time tinygo build -o gorutt -target arduino -scheduler tasks gorut.go
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 94 bytes
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 124 bytes
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 1176 bytes
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 1228 bytes
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 1290 bytes
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 1302 bytes
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 1322 bytes
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 1456 bytes
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 2046 bytes
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 8458 bytes
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 8470 bytes
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 8602 bytes
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 8724 bytes
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 8774 bytes
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 8802 bytes
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 9154 bytes
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 9676 bytes
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 10750 bytes
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 11274 bytes
tinygo:ld.lld: error: section '.text' will not fit in region 'FLASH_TEXT': overflowed by 11408 bytes
tinygo:ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
failed to run tool: ld.lld
error: failed to link /tmp/tinygo3977073725/main: exit status 1
real 0m8,583s
user 0m12,308s
sys 0m0,935s
Код: Выделить всё
olej@nvidia:~/2024/Go$ time tinygo build -o gorutt -target arduino -scheduler asyncify gorut.go
# runtime
/usr/local/lib/tinygo/src/runtime/gc_stack_raw.go:18:13: undefined: getSystemStackPointer
real 0m0,333s
user 0m0,444s
sys 0m0,077s
Код: Выделить всё
olej@nvidia:~/2024/Go$ ls -l /usr/local/lib/tinygo/src/runtime/ | head
итого 808
-rw-r--r-- 1 root root 1385 сен 21 10:35 algorithm.go
-rw-r--r-- 1 root root 350 сен 21 10:35 arch_386.go
-rw-r--r-- 1 root root 471 сен 21 10:35 arch_amd64.go
-rw-r--r-- 1 root root 350 сен 21 10:35 arch_arm64.go
-rw-r--r-- 1 root root 450 сен 21 10:35 arch_arm.go
-rw-r--r-- 1 root root 1786 сен 21 10:35 arch_avr.go
-rw-r--r-- 1 root root 863 сен 21 10:35 arch_cortexm.go
-rw-r--r-- 1 root root 172 сен 21 10:35 arch-has-returnaddr.go
-rw-r--r-- 1 root root 158 сен 21 10:35 arch-no-returnaddr.go
Смотрю getSystemStackPointer:
Код: Выделить всё
olej@nvidia:~/2024/Go$ grep getSystemStackPointer /usr/local/lib/tinygo/src/runtime/*.go
/usr/local/lib/tinygo/src/runtime/gc_stack_raw.go: markRoots(getSystemStackPointer(), stackTop)
/usr/local/lib/tinygo/src/runtime/scheduler_none.go:// getSystemStackPointer returns the current stack pointer of the system stack.
/usr/local/lib/tinygo/src/runtime/scheduler_none.go:func getSystemStackPointer() uintptr {
/usr/local/lib/tinygo/src/runtime/scheduler_tasks.go:// getSystemStackPointer returns the current stack pointer of the system stack.
/usr/local/lib/tinygo/src/runtime/scheduler_tasks.go:func getSystemStackPointer() uintptr {
... Пока из этого ничего не выходит ... но пищу для размышлений даёт.