Releases: tinygo-org/tinygo
0.34.0
This release adds support for //go:wasmexport
that is a standardized way to export WebAssembly functions to the host, improves garbage collection performance (especially on wasm), adds big-endian MIPS support (GOOS=mips
), and adds two new boards! It also contains a number of smaller improvements and bug fixes.
- general
- fix
GOOS=wasip1
fortinygo test
- add
-C DIR
flag - add initial documentation for project governance
- add
-ldflags='-extldflags=...'
support - improve usage message with
tinygo help
and when passing invalid parameters
- fix
- compiler
builder
: remove environment variables when invoking Clang, to avoid the environment changing the behaviorbuilder
: check for the Go toolchain version used to compile TinyGocgo
: addC.CBytes
implementationcompiler
: fix passing weirdly-padded structs as parameters to new goroutinescompiler
: support pragmas on generic functionscompiler
: do not let the slice buffer escape when casting a[]byte
or[]rune
to a string, to help escape analysiscompiler
: conform to the latest iteration of the wasm types proposalloader
: don't panic when main package is not named 'main'loader
: make sure we always return type checker errors even without type errorstransform
: optimize range over[]byte(string)
- standard library
crypto/x509
: add package stub to build crypto/x509 on macOSmachine/usb/adc/midi
: fixPitchBend
os
: addTruncate
stub for baremetalos
: add stubs foros.File
deadlinesos
: add internalnet.newUnixFile
for the net packageruntime
: stub runtime_{Before,After}Exec for linkageruntime
: randomize map accessesruntime
: supportmaps.Clone
runtime
: add more fields toMemStats
runtime
: implement newcoro, coroswitch to support package iterruntime
: disallow defer in interruptsruntime
: add support for os/signal on Linux and MacOSruntime
: add gc layout info for some basic types to help the precise GCruntime
: bump GC mark stack size to avoid excessive heap rescans
- targets
darwin
: use Go standard library syscall package instead of a custom onefe310
: support GPIOPinInput
mips
: fix compiler crash with GOMIPS=softfloat and defermips
: add big-endian (GOARCH=mips) supportmips
: use MIPS32 (instead of MIPS32R2) as the instruction set for wider compatibilitywasi
: add relative and absolute --dir options to wasmtime argswasip2
: add wasmtime -S args to support network interfaceswasm
: add//go:wasmexport
support (for all WebAssembly targets)wasm
: use precise instead of conservative GC for WebAssembly (including WASI)wasm-unknown
: add bulk memory flags since basically every runtime has it now
- boards
0.33.0
This is an important release. No new boards, but we make up for that by adding a bunch of other big stuff!
Some of the highlights:
- Go 1.23 support (including the new range-over-func language feature)
- WASI preview 2 support
- MIPS little endian support (big endian support is still experimental), so you can use
GOARCH=mipsle
- softfloat support for ARM and MIPS
- improved error messages
For a full list of changes, see the list below.
- general
- use latest version of x/tools
- add chromeos 9p support for flashing
- sort compiler error messages by source position in a package
- don't include prebuilt libraries in the release to simplify packaging and reduce the release tarball size
- show runtime panic addresses for
tinygo run
- support Go 1.23 (including all new language features)
test
: support GOOS/GOARCH pairs in the-target
flagtest
: remove message after test binary built
- compiler
- remove unused registers for x86_64 linux syscalls
- remove old atomics workaround for AVR (not necessary in modern LLVM versions)
- support
golang.org/x/sys/unix
syscalls builder
: remove workaround for generics race conditionbuilder
: add package ID to compiler and optimization error messagesbuilder
: show better error messages for some common linker errorscgo
: support preprocessor macros passed on the command linecgo
: use absolute paths for error messagescgo
: add support for printfloader
: handlego list
errors inside TinyGo (for better error messages)transform
: fix incorrect alignment of heap-to-stack transformtransform
: use thinlto-pre-link passes (instead of the full pipeline) to speed up compilation speed slightly
- standard library
crypto/tls
: add CipherSuiteName and some extra fields to ConnectionStateinternal/abi
: implement initial version of this packagemachine
: use newinternal/binary
packagemachine
: rewrite Reply() to fix sending long replies in I2C Target Modemachine/usb/descriptor
: Reset joystick physicalmachine/usb/descriptor
: Drop second joystick hatmachine/usb/descriptor
: Add more HID... functionsmachine/usb/descriptor
: Fix encoding of valuesmachine/usb/hid/joystick
: Allow more hat switchesos
: addChown
,Truncate
os/user
: use stdlib version of this packagereflect
: return correct name for theunsafe.Pointer
typereflect
: implementType.Overflow*
functionsruntime
: implement dummygetAuxv
to satisfy golang.org/x/sys/runtime
: don't zero out new allocations for-gc=leaking
when they are already zeroedruntime
: simplify slice growing/appending coderuntime
: print a message when a fatal signal like SIGSEGV happensruntime/debug
: addGoVersion
todebug.BuildInfo
sync
: addMap.Clear()
sync/atomic
: add And* and Or* compiler intrinsics needed for Go 1.23syscall
: addFork
andExecve
syscall
: add all MacOS errno valuestesting
: stub outT.Deadline
unique
: implement custom (naive) version of the unique package
- targets
arm
: supportGOARM=*,softfloat
(softfloat support for ARM v5, v6, and v7)mips
: add linux/mipsle (and experimental linux/mips) supportmips
: addGOMIPS=softfloat
supportwasip2
: add WASI preview 2 supportwasm/js
: addnode:
prefix inrequire()
call of wasm_exec.jswasm-unknown
: make sure theos
package can be importedwasm-unknown
: remove import-memory flag
0.32.0
This release has lots of features and fixes that you need. From support for the new LLVM 18, to a patched version of the go/ssa
package with a fix for the race condition that annoys anyone who maintains a CI build using TinyGo. Of course, no TinyGo release would be complete without new hardware supported, such as the Pimoroni Badger2040-W. And more WASM features too!
-
general
- fix wasi-libc include headers on Nix
- apply OpenOCD commands after target configuration
- fix a minor race condition when determining the build tags
- support UF2 drives with a space in their name on Linux
- add LLVM 18 support
- drop support for Go 1.18 to be able to stay up to date
-
compiler
- move
-panic=trap
support to the compiler/runtime - fix symbol table index for WebAssembly archives
- fix ed25519 build errors by adjusting the alias names
- add aliases to generic AES functions
- fix race condition by temporarily applying a proposed patch
builder
: keep un-wasm-opt'd .wasm if -work was passedbuilder
: make sure wasm-opt command line is printed if askedcgo
: implement shift operations in preprocessor macrosinterp
: checking for methodset existance
- move
-
standard library
machine
: add__tinygo_spi_tx
function to simulatormachine
: fix simulator I2C supportmachine
: add GetRNG support to simulatormachine
: addTxFifoFreeLevel
for CANos
: addLink
os
: addFindProcess
for posixos
: addProcess.Release
for unixos
: addSetReadDeadline
stubos
,os/signal
: add signal stubsos/user
: add stubs forLookup{,Group}
andGroup
reflect
: use int inStringHeader
andSliceHeader
on non-AVR platformsreflect
: fixNumMethods
for Interface typeruntime
: skip negative sleep durations in sleepTicks
-
targets
esp32
: add I2C supportrp2040
: move UART0 and UART1 to common filerp2040
: make all RP2040 boards available for simulationrp2040
: fix timeUnit typestm32
: add i2cFrequency
andSetBaudRate
function for chips that were missing implementationwasm-unknown
: add math and memory builtins that LLVM needswasip1
: replace existing-target=wasi
support with wasip1 as supported in Go 1.21+
-
boards
adafruit-esp32-feather-v2
: add the Adafruit ESP32 Feather V2badger2040-w
: add support for the Badger2040 Wfeather-nrf52840-sense
: fix lack of LXFOm5paper
: add support for the M5 Papermksnanov3
: limit programming speed to 1800 kHznucleol476rg
: add stm32 nucleol476rg supportpico-w
: add the Pico W (which is near-idential to the pico target)thingplus-rp2040
,waveshare-rp2040-zero
: add WS2812 definitionpca10059-s140v7
: add this variant to the PCA10059 board
0.31.2
This is a patch release to address a few important items that were needed quickly by the community, and that have been addressed since the last full release.
-
general
- update the
net
submodule to updated version withBuffers
implementation
- update the
-
compiler
syscall
: add wasm_unknown tag to some additional files so it can compile more code
-
standard library
runtime
: add Frame.Entry field
0.31.1
This is a quick patch release to fix some critical issues that were noticed right after v0.31.0
. Thank you to our team for the fast response!
-
general
- fix Binaryen build in make task
- update final build stage of Docker
dev
image to go1.22 - only use GHA cache for building Docker
dev
image - update the
net
submodule to latest version
-
compiler
interp
: make getelementptr offsets signedinterp
: return a proper error message when indexing out of range
0.31.0
This is the highly anticipated first release of 2024! Some of the most requested features:
- Go 1.22 support
- macOS arm64 native binary release build
- Nix flake support
- LLVM 17
There are many improvements and fixes to the compiler and runtime. We also have a new net
package for greatly improved network support on bare metal devices. We have a new wasm-unknown
target for WebAssembly early adopters. And of course several new boards supported, such as the Adafruit QT Py ESP32-C, and the Thumby.
- general
- remove LLVM 14 support
- add LLVM 17 support, and use it by default
- add Nix flake support
- update bundled Binaryen to version 116
- add
ports
subcommand that lists available serial ports for-port
and-monitor
- support wasmtime version 14
- add
-serial=rtt
for serial output over SWD - add Go 1.22 support and use it by default
- change minimum Node.js version from 16 to 18
- compiler
- use the new LLVM pass manager
- allow systems with more stack space to allocate larger values on the stack
build
: fix a crash due to sharing GlobalValues between build instancescgo
: addC._Bool
typecgo
: fix calling CGo callback inside generic functioncompileopts
: setpurego
build tag by default so that more packages can be builtcompileopts
: force-enable CGo to avoid build issuescompiler
: fix crash on type assert on interfaces with no methodsinterp
: print LLVM instruction in tracebackinterp
: support runtime times by running them at runtimeloader
: enforce Go language version in the type checker (this may break existing programs with an incorrect Go version in go.mod)transform
: fix bug in StringToBytes optimization pass
- standard library
crypto/tls
: stub out a lot of functionsinternal/task
,machine
: make TinyGo code usable with "big Go" CGomachine
: implementI2C.SetBaudRate
consistently across chipsmachine
: implementSPI.Configure
consistently across chipsmachine
: addDeviceID
for nrf, rp2040, sam, stm32machine
: use smaller UART buffer size on atmega chipsmachine/usb
: allow setting a serial number using a linker flagmath
: support more math functions on baremetal (picolibc) systemsnet
: replace entire net package with a new one based on the netdev driveros/user
: add bare-bones implementation of this packagereflect
: stubCallSlice
andFuncOf
reflect
: addTypeFor[T]
reflect
: updateIsZero
to Go 1.22 semanticsreflect
: move indirect values into interface when setting interfacesruntime
: stubBreakpoint
sync
: implement trylock
- targets
atmega
: use UART double speed mode for fewer errors and higher throughputatmega328pb
: refactor to enable extra uartavr
: don't compile large parts of picolibc (math, stdio) for LLVM 17 supportesp32
: switch over to the official SVD fileesp32c3
: implement USB_SERIAL for USBCDC communicationesp32c3
: implement I2Cesp32c3
: implement RNGesp32c3
: add more ROM functions and update linker script for the in-progress wifi supportesp32c3
: update to newer SVD filesrp2040
: add support for UART hardware flow controlrp2040
: add definition formachine.PinToggle
rp2040
: set XOSC startup delay multipliersamd21
: add support for UART hardware flow controlsamd51
: add support for UART hardware flow controlwasm
: increase default stack size to 64k for wasi/wasm targetswasm
: bump wasi-libc version to SDK 20wasm
: remove line of dead code in wasm_exec.js
- new targets/boards
qtpy-esp32c3
: add Adafruit QT Py ESP32-C3 boardmksnanov3
: add support for the MKS Robin Nano V3.xnrf52840-generic
: add generic nrf52840 chip supportthumby
: add support for Thumbywasm
: add newwasm-unknown
target that doesn't depend on WASI or a browser
- boards
arduino-mkrwifi1010
,arduino-nano33
,nano-rp2040
,matrixportal-m4
,metro-m4-airlift
,pybadge
,pyportal
: addninafw
build tag and some constants for BLE supportgopher-badge
: fix typo in USB product namenano-rp2040
: add UART1 and correct mappings for NINA via UARTpico
: bump default stack size from 2kB to 8kBwioterminal
: expose UART4
0.30.0
This is a smaller but important release just in time for GopherCon US.
Some of the bigger changes of this release are switching to LLVM 16, fixes for two separate hard-to-reproduce compiler crashes, improvements to USB-MIDI, and added support for the Adafruit Gemma M0.
Here is the full list:
- general
- add LLVM 16 support, use it by default
- compiler
build
: work around a race condition by building Go SSA seriallycompiler
: fix a crash by not using the LLVM global context typesinterp
: don't copy unknown values inruntime.sliceCopy
to fix miscompileinterp
: fix crash in error report by not returning raw LLVM values
- standard library
machine/usb/adc/midi
: various improvements and API changesreflect
: add support for[...]T
→[]T
in reflect
- targets
atsamd21
,atsamd51
: add support for USB INTERRUPT OUTrp2040
: always use the USB device enumeration fix, even in chips that supposedly have the HW fixwasm
: increase default stack size to 32k for wasi/wasm
- boards
gobadge
: add GoBadge target as alias for PyBadge :)gemma-m0
: add support for the Adafruit Gemma M0
0.29.0
This release adds support for Go 1.21
It also adds compatibility with the new GOOS=wasip1
using the Go built-in WASI support.
There are a number of compiler and standard library improvements, such as even better reflection, and improved map/slice implementations.
We also have a bunch of useful fixes and improvements to various microcontrollers, including new support for hardware based watchdog timers (WDT) so your embedded devices can be more reliable than ever.
Here is the full changelog:
- general
- Go 1.21 support
- use https for renesas submodule #3856
- ci: rename release-double-zipped to something more useful
- ci: update Node.js from version 14 to version 16
- ci: switch GH actions builds to use Go 1.21 final release
- docker: update clang to version 15
- docker: use Go 1.21 for Docker dev container build
main
: add target JSON file intinygo info
outputmain
: improve detection of filesystemsmain
: usego env
instead of doing all detection manually- make: add make task to generate Renesas device wrappers
- make: add task to check NodeJS version before running tests
- add submodule for Renesas SVD file mirror repo
- update to go-serial package v1.6.0
testing
: add Testing functiontools/gen-device-svd
: small changes needed for Renesas MCUs
- compiler
builder
: update message for max supported Go versioncompiler,reflect
: NumMethods reports exported methods onlycompiler
: add compiler-rt and wasm symbols to tablecompiler
: add compiler-rt to wasm.jsoncompiler
: add min and max builtin supportcompiler
: implement clear builtin for mapscompiler
: implement clear builtin for slicescompiler
: improve panic message when a runtime call is unavailablecompiler
: update .ll test outputloader
: merge go.env file which is now required starting in Go 1.21 to correctly get required packages
- standard library
os
: define ErrNoDeadlinereflect
: Add FieldByNameFuncreflect
: add SetZeroreflect
: fix iterating over maps with interface{} keysreflect
: implement Value.Growreflect
: remove unecessary heap allocationsreflect
: use .key() instead of a type assertsync
: add implementation from upstream Go for OnceFunc, OnceValue, and OnceValues
- targets
machine
: UART refactor (#3832)machine/avr
: pin change interruptmachine/macropad_rp2040
: add machine.BUTTONmachine/nrf
: add I2C timeoutmachine/nrf
: wait for stop condition after reading from the I2C busmachine/nRF52
: set SPI TX/RX lengths even data is empty. Fixes #3868 (#3877)machine/rp2040
: add missing suffix to CMD_READ_STATUSmachine/rp2040
: add NoPin supportmachine/rp2040
: move flash related functions into separate file from C imports for correct - LSP. Fixes #3852machine/rp2040
: wait for 1000 us after flash reset to avoid issues with busy USB busmachine/samd51,rp2040,nrf528xx,stm32
: implement watchdogmachine/samd51
: fix i2cTimeout was decreasing due to cache activationmachine/usb
: Add support for HID Keyboard LEDsmachine/usb
: allow USB Endpoint settings to be changed externallymachine/usb
: refactor endpoint configurationmachine/usb
: remove usbDescriptorConfigmachine/usb/hid,joystick
: fix hidreport (3) (#3802)machine/usb/hid
: add RxHandler interfacemachine/usb/hid
: rename Handler() to TxHandler()wasi
: allow zero inodes when reading directorieswasm
: add support for GOOS=wasip1wasm
: fix functions exported through //exportwasm
: remove i64 workaround, use BigInt insteadexample
: adjust time offsetexample
: simplify pininterrupt
- boards
targets
: add AKIZUKI DENSHI AE-RP2040targets
: adding new uf2 target for PCA10056 (#3765)
0.28.1
0.28.0
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