This release is packed with features! Here are some highlights:
- Much improved reflect support, which means that many packages that previously didn't properly work are now mostly or entirely supported.
- Added
//go:wasmimport
following upstream Go. This is the supported way to import functions, other ways (//export
and the like) may stop working in the future.
This release also added support for several new boards, most notably our very own Gopher Badge developed by @conejoninja.
There are also two significant breaking changes for baremetal targets like microcontrollers: the runtime will now panic when an interrupt does a heap allocation inside an interrupt or when an interrupt does a blocking operation like a channel send. These were never correct, but might have accidentally worked in practice. If you hit one of these issues, TinyGo will usually print the source location where the problem originates when you use the -monitor
parameter on tinygo flash
. The fix for heap allocations is to restructure the code to not need them (for example, by using global variables) and the fix for blocking operations is to make them non-blocking, for example for a channel send:
select {
case someChan <- value:
default:
}
Of course, there is a very long list of smaller fixes and improvements, see the full list below:
- general
- fix parallelism in the compiler on Windows by building LLVM with thread support
- support qemu-user debugging
- make target JSON msd-volume-name an array
- print source location when a panic happens in -monitor
test
: don't printok
for a successful compile-only
- compiler
builder
: remove non-ThinLTO build modebuilder
: fail earlier if Go is not availablebuilder
: improve-size=full
in a number of waysbuilder
: implement Nordic DFU file writer in Gocgo
: allowLDFLAGS: --export=...
compiler
: support recursive slice typescompiler
: zero struct padding during map operationscompiler
: add llvm.ident metadatacompiler
: removeunsafe.Pointer(uintptr(v) + idx)
optimization (useunsafe.Add
instead)compiler
: add debug info to//go:embed
data structures for better-size
outputcompiler
: add debug info to string constantscompiler
: fix a minor race conditioncompiler
: emit correct alignment in debug info for global variablescompiler
: correctly generate reflect data for local named typescompiler
: add alloc attributes toruntime.alloc
, reducing flash usage slightlycompiler
: for interface maps, use the original named type if availablecompiler
: implement most math/bits functions as LLVM intrinsicscompiler
: ensure all defers have been seen before creating rundefers
- standard library
internal/task
: disallow blocking inside an interruptmachine
: addCPUReset
machine/usb/hid
: add MediaKey supportmachine/usb/hid/joystick
: move joystick under HIDmachine/usb/hid/joystick
: allow joystick settings overridemachine/usb/hid/joystick
: handle case where we cannot find the correct HID descriptormachine/usb/hid/mouse
: add support for mouse back and forwardmachine/usb
: add ability to override default VID, PID, manufacturer name, and product namenet
: added missingTCPAddr
andUDPAddr
implementationsos
: add IsTimeout functionos
: fix resource leak in(*File).Close
os
: add(*File).Sync
os
: implement(*File).ReadDir
for wasios
: implement(*File).WriteAt
reflect
: make sure null bytes are supported in tagsreflect
: refactor this package to enable many new featuresreflect
: add map type methods:Elem
andKey
reflect
: add map methods:MapIndex
,MapRange
/MapIter
,SetMapIndex
,MakeMap
,MapKeys
reflect
: add slice methods:Append
,MakeSlice
,Slice
,Slice3
,Copy
,Bytes
,SetLen
reflect
: add misc methods:Zero
,Addr
,UnsafeAddr
,OverflowFloat
,OverflowInt
,OverflowUint
,SetBytes
,Convert
,CanInt
,CanFloat
,CanComplex
,Comparable
reflect
: add type methods:String
,PkgPath
,FieldByName
,FieldByIndex
,NumMethod
reflect
: add stubs forType.Method
,CanConvert
,ArrayOf
,StructOf
,MapOf
reflect
: add stubs for channel select routines/typesreflect
: allow nil rawType to call Kind()reflect
: ensure all ValueError panics have Kind fieldsreflect
: add support for named typesreflect
: improveValue.String()
reflect
: setIndex
andPkgPath
field inType.Field
reflect
:Type.AssignableTo
: you can assign anything tointerface{}
reflect
: add type check toValue.Field
reflect
: letTypeOf(nil)
return nilreflect
: moveStructField.Anonymous
field to match upstream locationreflect
: addUnsafePointer
for Func typesreflect
:MapIter.Next
needs to allocate new keys/values every timereflect
: fixIsNil
for interfacesreflect
: fixType.Name
to return an empty string for non-named typesreflect
: addVisibleFields
reflect
: properly handle embedded structsreflect
: make surePointerTo
works for named typesreflect
:Set
: convert non-interface to interfacereflect
:Set
: fix direction of assignment checkreflect
: support channel directionsreflect
: print struct tags in Type.String()reflect
: properly handle read-only valuesruntime
: allow custom-gc SetFinalizer and clarify KeepAliveruntime
: implement KeepAlive using inline assemblyruntime
: check for heap allocations inside interruptsruntime
: properly turn pointer into empty interface when hashingruntime
: improve map size hint usageruntime
: zero map key/value on deletion to so GC doesn't see themruntime
: print the address where a panic happenedruntime/debug
: stubSetGCPercent
,BuildInfo.Settings
runtime/metrics
: add this package as a stubsyscall
:Stat_t
timespec fields are Atimespec on darwinsyscall
: addTimespec.Unix()
for wasisyscall
: add fsync using libctesting
: support -test.counttesting
: make test output unbuffered when verbosetesting
: add -test.skiptesting
: move runtime.GC() call to runN to match upstreamtesting
: add -test.shuffle to order randomize test and benchmark order
- targets
arm64
: fix register save/restore to include vector registersattiny1616
: add support for this chipcortexm
: refactor EnableInterrupts and DisableInterrupts to avoidarm.AsmFull
cortexm
: enable functions in RAM for go & cgocortexm
: convert SystemStack fromAsmFull
to C inline assemblycortexm
: fix crash due to wrong stack size offsetnrf, samd21, stm32
: add flash APInrf
: fix memory issue in ADC readnrf
: new peripheral type for nrf528xx chipsnrf, rp2040
: implement target modenrf
: improve ADC and add oversampling, longer sample time, and reference voltagerp2040
: change calling order for device enumeration fix to do firstrp2040
: rtc delayed interruptrp2040
: provide better errors for invalid pins on I2C and SPIrp2040
: change uart to allow for a single pinrp2040
: implement Flash interfacerp2040
: remove SPIDataBits
propertyrp2040
: unify all linker scripts using LDFLAGSrp2040
: remove SPI deadline for improved performancerp2040
: use 4MHz as default frequency for SPIrp2040
: implement target moderp2040
: use DMA for send-only SPI transferssamd21
: rearrange switch case for get pin cfgsamd21
: fix issue with WS2812 driver by making pin accesses fastersamd51
: enable CMCC cache for greatly improved performancesamd21
: remove extra BK0RDY clearsamd51
: implement Flash interfacesamd51
: use correct SPI frequencysamd51
: remove extra BK0RDY clearsamd51
: fix ADC multisamplingwasi
: allow users to set theruntime_memhash_tsip
orruntime_memhash_fnv
build tagswasi
: setWASMTIME_BACKTRACE_DETAILS
when running in wasmtime.wasm
: implement the//go:wasmimport
directive
- boards
gameboy-advance
: switch to use register definitions in device/gbagameboy-advance
: rename display and make pointer receiversgopher-badge
: Added Gopher Badge supportlorae5
: add needed definition for UART2lorae5
: correct mapping for I2C bus, add pin mapping to enable powerpinetime
: update the target file (rename from pinetime-devkit0)qtpy
: fix bad pin assignmentwioterminal
: fix pin definition of BCM13xiao
: Pins D4 & D5 are I2C1. Use pins D2 & D3 for I2C0.xiao
: add DefaultUART