TinyGo 0.45.0 Released
This is our biggest release so far, with more than 560 commits to our main repo since 0.44.0.
Important: TinyGo now requires Go 1.26 or newer.
The reflect package gets much more complete: you can now build new types at run time with StructOf, FuncOf, MapOf and similar functions, call functions and methods with Value.Call and MakeFunc, and use channels.
On Linux, os now starts processes with posix_spawn, which brings Process.Wait, Kill and Signal. The compiler builds faster, and better escape analysis keeps more values on the stack. The runtime adds Pinner, keeps timers in a min-heap, and grows the heap more smartly.
On the hardware side, there is initial support for the new ESP32-P4. The cores scheduler now runs on the original ESP32, and PSRAM works on ESP32 WROVER, ESP32-S3 Octal and Pimoroni Pico Plus 2. There is a new machine/watchdog package, capacitive touch on ESP32 and ESP32-S3, WiFi plus PWM, SPI and flash on ESP32-C6, and many I2C fixes for AVR and the ESP32 family. New boards include the Waveshare ESP32-P4-NANO, Elecrow CrowPanel ESP32-P4, Adafruit ESP32-S3 Feather TFT and Arduino Nano R4.
General
all: require Go 1.26 or newer (#6133, #6139)main: add-print-boundsflag (#6445)main: use the-oextension for the format oftinygo test -c(#6688)main: get the ESP flash offset from espflasher, and update espflasher to v0.10.0 (#6394, #6473, #6549)main: open the monitor at 9600 baud for ATmega targets (#6722)main: do not count a serial port twice when it matches more than one ID (#6127)main: create libc headers before loading packages intinygo fix(#6573)main: reject invalid packages even when no tests exist (#6046)compileopts,builder: add-libc=glibcfor linking system shared libraries (#5838)compileopts: add an arch target property for-march(#6436)compileopts: reject.binoutput for RP2040 and RP2350 (#6077)compileopts: forward-stack-sizetowasm-ldwhen-scheduler=none(#6103)compileopts: letlinux/386binaries run underqemu-i386(#6218)compileopts,loader: keep trimmed binaries reproducible (#6155, #6162)builder: allow-buildmode=wasi-legacywith any scheduler (#5994)builder: skip DWARF generation in the compiler with-no-debug(#6405)builder: build the embedded assembler with LLVM 23, and support LLVM 20 through 23 in the embedded Clang shims (#6086, #6327)builder,cgo: find the versioned Arch Linux LLVM packages (#6343)builder: keep concurrent builds within their shared limit, and release permits of jobs drained after a failure (#6156, #6149)builder: keep internal functions with clashing names (#6333)loader: reduce typechecking time for independent packages (#6110)loader: use upstreaminternal/pollon hosted targets (#6318)loader: preserve package diagnostics through error handling (#6109)loader: list only thePackageJSONfields (#6385)loader: strip the test suffix from mapped import paths (#6640)goenv: detect the TinyGo root withruntime.go(#6603)lib: upgrade wasi-libc (#5507)tools: addwasmprofto convert wasmtime guest profiles to pprof (#6513)tools: addupdate-binary-sizesandplot-binary-size(#6266, #6766)tools/gen-device-svd: generate device files faster, fix bitfield ranges and cluster sizes, and fix a duplicate ESP32-P4 register (#6183, #5821, #5811, #6360)release: prevent a nestedsrcdirectory in release archives (#6062)go.mod: updatego-llvmandx/tools(#6165, #6225, #6228)
Compiler
compiler: implementsyscall.Syscall*on darwin (#6557)compiler: return^uintptr(0)in r1 on Linux syscall error, and lowerunix.RawSyscallNoErroras a no-error syscall (#6682, #6684)compiler: keep frame pointers on linux amd64 and arm64 (#6088)compiler: give wasm modules the same triple as clang (#6309)compiler: avoid mixing LLVM contexts in WebAssembly exports (#6352)compiler: fix two Asyncify panic/recover bugs (#6332)compiler: fix the float to int saturation bound (#6558)compiler: reject nil assertions to empty interfaces (#6147)compiler: name promoted unexported methods by their package (#5901)compiler: don't evaluate the operand ofunsafe.SizeofandAlignof(#6382)compiler: report a redeclared function instead of panicking (#6089)compiler: emit volatile accesses at the call site (#6599)compiler: avoid large aggregate values in zero stores and debug info (#6176)compiler: lowers == ""to a length check, and slice-zeroing loops tomemset(#6415, #6511)compiler: skip zeroing new storage for zero constants, and a redundant bounds check inmake(#6179, #6449)compiler: tell LLVM the range of slice and string lengths, and thatlen <= capwhen reslicing (#6167, #6351)compiler: mark temporary map storage as non-capturing (#6235)compiler: compile faster by creating common types, constants and attributes once and by avoiding copies (#6240, #6245, #6247, #6220, #6261, #6456, #6274, #6243)compiler: internal cleanups and newer go-llvm APIs (#6203, #6208, #6209, #6212, #6213, #6219, #6221, #6251, #6264, #6330, #6353, #6354, #6355, #6356, #6373, #6375, #6376, #6412, #6451, #6459, #6516, #6563)cgo: accept array parameters with no size (#6275)transform: follow merged pointers in escape analysis, keep nonescaping recursive arguments on the stack, and stack allocate values that callees only check for nil (#6236, #6079, #6390, #6151, #6377)transform: avoid copying[]bytetostringfor read-only uses (#6152)transform: switch on a type ID in interface method calls and type asserts (#6545)transform: do not add unboxed types to interface method dispatch (#6169)transform: restore the linkage of functions kept for TinyGo passes (#6380)transform: remove the typed pointer bitcast case fromOptimizeAllocs, and centralize memory attribute lookup (#6248, #6379, #6099, #6625)interp: support atomic operations in global initializers (#5993)interp: skipllvm.assume(#6319)interp: preserve store order for exposed objects (#5908)interp: stop stale compile time reads after a run time call (#6204)interp: keep the alignment of loads and stores that run at runtime (#6242)interp: roll back calls that pause with the scheduler lock held (#6421)interp: stop panicking on integer constant expressions of addresses (#6043, #6044)interp: avoid runtime init for non-panicking recover calls (#6138)interp: name the function of a rollback from its instruction (#6014)interp: use less time and memory per call (#6136, #6137, #6143, #6386)
Core
reflect: implementSliceOf,MapOf,ArrayOf,ChanOf,StructOfandFuncOf(#6081, #6439)reflect: implementValue.Call,CallSlice,MakeFunc, method lookup and callable methods (#6255, #6257, #6444, #6458)reflect: implement channel operations (#6348, #6440)reflect: support composite and interface conversions (#6180)reflect: implementSliceAtandValue.InterfaceData(#6181, #6234)reflect: recognize iterator function signatures inCanSeq, and iterate over function values withSeqandSeq2(#6254, #6444)reflect: support deeply nested pointer types, and use the shared type cache for pointer types (#6250, #6366, #6367)reflect: avoid allocations inDeepEqual(#6079)reflect: expose function signature information, and enable more reflect tests (#6217, #6249, #6639)reflectlite: report pointer-to-pointer types as comparable (#6388, #6359, #6512)os: start processes withposix_spawnon linux, and implementProcess.Wait,Kill,Signal,ProcAttr.DirandProcAttr.Filesthere (#6301, #6306, #6341, #6323, #6320, #6342, #6346)os: implementHostnameandChtimeson linux, file seeking on 32-bit linux, and passO_CLOEXECwhen opening files (#6091, #6289, #6067, #6288)os: makeGlob,ReadDirandFile.Chdirwork on Windows (#6073, #6659)os: supportRemoveAllon WASI, and provide a null device on non-hosted targets (#6662, #6080)syscall: recognize missing files on Windows (#6065)syscall: reject empty paths in libcOpen(#6641)syscall: fix WASIp1 and WASIp2 working directories (#5874)crypto/rand: usegetrandomon Linux, and exclude stm32g0, which has no RNG driver (#6308, #6443)sync: drop pooled items after two collections (#6093)testing: print go test compatible benchmark output, and addB.Elapsed(#6381, #6532, #6600, #6717)testing: support the-test.timeoutflag and temporary artifact directories (#6653, #6642)testing: report synctest results through the parent test (#6654)internal/bytealg: count bytes a word at a time (#6661)internal/poll: wait on wasip1 without a scheduler (#6670)machine,os,runtime: useinternal/byteorderfor byte order conversions (#6311, #6313)
Runtime
- implement
Pinner(#6636) - fully implement
GOROOTandGODEBUG(#5885) - grow slices as Go does on hosted targets (#6123)
- grow the heap when less than half is free, and start native heaps at 1 MB (#6606)
- stop the GC freeing objects held only in registers (#5822)
- work on GC block states a state byte at a time, and put a split free range back without walking the list (#6687, #6738)
- correct Boehm heap statistics (#6423)
- keep timers in a binary min-heap and reuse timer nodes (#6035, #6269, #6092, #6282, #6389)
- fix periodic timer overflow, timer channel synchronization and unread channel timers (#6256)
- don't report an already-stopped firing timer as active (#6374)
- allow recovery from closed channel sends (#6216)
- hash NaN map keys randomly, use the Go panic message for unhashable map keys, and mix the hash seed with XOR (#6339, #6338, #6340, #6104, #6271)
- do not link reflect type methods to compare interfaces (#6262)
- use Speck CTR for
hardwareRandon linux and darwin, and seed the random state without allocating (#6588, #6310) - use monotonic clocks for wasm time (#6345)
- return from
_starton wasip1 when main returns (#6513) - make a finalizer panic fatal with
scheduler=none(#5987) - fix
sleepTickswith the threads scheduler (#5929) - allow compile-time synctest checks on bare metal (#5974)
- support 64-bit atomics on 32-bit MIPS, and atomic sub on MCUs without native atomics (#6369, #6331)
- add
crypto/subtleDIT stubs (#6658) - fix an overflow in UEFI
ticksToNanoseconds(#6153) - read console input on
cortex-m-qemuandriscv-qemu(#6671) cores: mask interrupts while holdingschedulerLockon esp32s3, rp2 and riscv-qemu (#6112, #6069)cores: fix a timer queue growth deadlock and scan the live goroutine stack during GC (#6211)cores: keep one saved interrupt state inschedulerSpinLock, and keep a GC pause that arrives during riscv-qemu core startup (#6272, #6239)cores: share the wait, wake, sleep, spinlock and GC code between targets (#6510, #6521, #6530, #6535, #6537, #6552, #6559, #6560, #6581, #6585, #6590)internal/task: fix a crash when a timer fires into a contended channel with-scheduler=cores(#6060)internal/task: reuse goroutine stacks with the leaking GC (#5981)internal/task: fix the task switch on RV64, and align the stack when exiting a goroutine on x86 (#6344, #6422)internal/task: find asyncify stacks through the GC, and stop channel contention from stalling multicore GC (#6041)esp32xx: fix stale timer reads, and set the TIMG update bit (#6395, #6702)esp32xx: share exit and abort, and makenumCPUthe chip core count (#6407, #6610)esp32c3: unlock the timer watchdog first (#6485)esp32s3: synchronize serial flushing with print output (#6244)fe310,k210: fix a lost timer wakeup insleepTicks(#6542, #6620)rp2: avoid heap allocation inresetSpinLocks(#6548)avr: scan byte-swapped words to find saved registers, and return from the GC stack scanner (#6358, #6216)atmega32u4: reset USB before enabling interrupts (#6714)interrupt: add a memory clobber on xtensa and avr, fix a lost INTENABLE update on xtensa, and reject out of range interrupts on esp32c3 (#6569, #6571, #6591, #6321)- drop
go:inlinefrom cold code, and tidy up runtime, interrupt and console files (#6135, #6408, #6411, #6518, #6534, #6539, #6544, #6550, #6567, #6570, #6582, #6584, #6592, #6593, #6594, #6596, #6597, #6601, #6604, #6605, #6608, #6614, #6616, #6622, #6628, #6629, #6630, #6657, #6774, #6615)
Machine
- add the
machine/watchdogpackage, with watchdog support for esp32, esp32c3, esp32c6 and esp32s3 (#6710, #6742, #6741, #6304, #6680) - add
CPUResetfor esp32xx andResetReason, and use the watchdog forCPUReseton rp2 (#6678, #6679) - add
machine/touchcapacitive touch sensor support for esp32 and esp32s3 (#6281, #6668) - gate
uart.go,spi.go,i2c.go,i2s.goandflash.goon machine target tags (#6406, #6434, #6442, #6465, #6743, #6759, #6761, #6775, #6779) esp32p4: add initial ESP32-P4 support, with USB serial, PSRAM, GDMA, clock control, I2C, SPI, FPU and the cores scheduler (#6314, #6396, #6447, #6468, #6432, #6474, #6497)esp32p4: run the CPU at 360 MHz, and fix time running at half speed (#6579, #6577)esp32: add PSRAM support for WROVER modules (#6188)esp32: add support for the cores scheduler (#6506)esp32: addGetRNG(#6430)esp32s3: add Octal PSRAM support, and share PSRAM support between drivers (#6431, #6472)esp32s3: addCPUFrequencyfor all ESP32-S3 boards (#6263)esp32s3: lock endpoint registers on USB reset, and do not rearm EP0 OUT while it is enabled (#6119, #6120)esp32c6: support the espradio WiFi driver (#6404)esp32c6: add PWM, SPI,machine.Flashand the true random number generator (#6633, #6660, #6677, #6464)esp32xx: fix I2C bus recovery, zero-length writes, NACK detection and bus timing, and implement I2CSetBaudRate(#6315, #6482, #6484, #6479, #6736)esp32xx: fix the UART baud rate overflow and the ESP32-C6 UART clock, and reject more than 8 data bits (#6475, #6490)esp32xx: link in only the UARTs that a program uses, and take UART0 default pins from the board (#6526, #6417)esp32xx: add a CS setup time in SPI modes 1 and 3 (#6492)esp32xx: make the USB serial ReadByte fail when emp
Comments
No comments yet. Start the discussion.