Skip to content

Releases: tinygo-org/tinygo

0.28.0

11 Jun 09:02
Compare
Choose a tag to compare

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 print ok for a successful compile-only
  • compiler
    • builder: remove non-ThinLTO build mode
    • builder: fail earlier if Go is not available
    • builder: improve -size=full in a number of ways
    • builder: implement Nordic DFU file writer in Go
    • cgo: allow LDFLAGS: --export=...
    • compiler: support recursive slice types
    • compiler: zero struct padding during map operations
    • compiler: add llvm.ident metadata
    • compiler: remove unsafe.Pointer(uintptr(v) + idx) optimization (use unsafe.Add instead)
    • compiler: add debug info to //go:embed data structures for better -size output
    • compiler: add debug info to string constants
    • compiler: fix a minor race condition
    • compiler: emit correct alignment in debug info for global variables
    • compiler: correctly generate reflect data for local named types
    • compiler: add alloc attributes to runtime.alloc, reducing flash usage slightly
    • compiler: for interface maps, use the original named type if available
    • compiler: implement most math/bits functions as LLVM intrinsics
    • compiler: ensure all defers have been seen before creating rundefers
  • standard library
    • internal/task: disallow blocking inside an interrupt
    • machine: add CPUReset
    • machine/usb/hid: add MediaKey support
    • machine/usb/hid/joystick: move joystick under HID
    • machine/usb/hid/joystick: allow joystick settings override
    • machine/usb/hid/joystick: handle case where we cannot find the correct HID descriptor
    • machine/usb/hid/mouse: add support for mouse back and forward
    • machine/usb: add ability to override default VID, PID, manufacturer name, and product name
    • net: added missing TCPAddr and UDPAddr implementations
    • os: add IsTimeout function
    • os: fix resource leak in (*File).Close
    • os: add (*File).Sync
    • os: implement (*File).ReadDir for wasi
    • os: implement (*File).WriteAt
    • reflect: make sure null bytes are supported in tags
    • reflect: refactor this package to enable many new features
    • reflect: add map type methods: Elem and Key
    • 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 for Type.Method, CanConvert, ArrayOf, StructOf, MapOf
    • reflect: add stubs for channel select routines/types
    • reflect: allow nil rawType to call Kind()
    • reflect: ensure all ValueError panics have Kind fields
    • reflect: add support for named types
    • reflect: improve Value.String()
    • reflect: set Index and PkgPath field in Type.Field
    • reflect: Type.AssignableTo: you can assign anything to interface{}
    • reflect: add type check to Value.Field
    • reflect: let TypeOf(nil) return nil
    • reflect: move StructField.Anonymous field to match upstream location
    • reflect: add UnsafePointer for Func types
    • reflect: MapIter.Next needs to allocate new keys/values every time
    • reflect: fix IsNil for interfaces
    • reflect: fix Type.Name to return an empty string for non-named types
    • reflect: add VisibleFields
    • reflect: properly handle embedded structs
    • reflect: make sure PointerTo works for named types
    • reflect: Set: convert non-interface to interface
    • reflect: Set: fix direction of assignment check
    • reflect: support channel directions
    • reflect: print struct tags in Type.String()
    • reflect: properly handle read-only values
    • runtime: allow custom-gc SetFinalizer and clarify KeepAlive
    • runtime: implement KeepAlive using inline assembly
    • runtime: check for heap allocations inside interrupts
    • runtime: properly turn pointer into empty interface when hashing
    • runtime: improve map size hint usage
    • runtime: zero map key/value on deletion to so GC doesn't see them
    • runtime: print the address where a panic happened
    • runtime/debug: stub SetGCPercent, BuildInfo.Settings
    • runtime/metrics: add this package as a stub
    • syscall: Stat_t timespec fields are Atimespec on darwin
    • syscall: add Timespec.Unix() for wasi
    • syscall: add fsync using libc
    • testing: support -test.count
    • testing: make test output unbuffered when verbose
    • testing: add -test.skip
    • testing: move runtime.GC() call to runN to match upstream
    • testing: add -test.shuffle to order randomize test and benchmark order
  • targets
    • arm64: fix register save/restore to include vector registers
    • attiny1616: add support for this chip
    • cortexm: refactor EnableInterrupts and DisableInterrupts to avoid arm.AsmFull
    • cortexm: enable functions in RAM for go & cgo
    • cortexm: convert SystemStack from AsmFull to C inline assembly
    • cortexm: fix crash due to wrong stack size offset
    • nrf, samd21, stm32: add flash API
    • nrf: fix memory issue in ADC read
    • nrf: new peripheral type for nrf528xx chips
    • nrf, rp2040: implement target mode
    • nrf: improve ADC and add oversampling, longer sample time, and reference voltage
    • rp2040: change calling order for device enumeration fix to do first
    • rp2040: rtc delayed interrupt
    • rp2040: provide better errors for invalid pins on I2C and SPI
    • rp2040: change uart to allow for a single pin
    • rp2040: implement Flash interface
    • rp2040: remove SPI DataBits property
    • rp2040: unify all linker scripts using LDFLAGS
    • rp2040: remove SPI deadline for improved performance
    • rp2040: use 4MHz as default frequency for SPI
    • rp2040: implement target mode
    • rp2040: use DMA for send-only SPI transfers
    • samd21: rearrange switch case for get pin cfg
    • samd21: fix issue with WS2812 driver by making pin accesses faster
    • samd51: enable CMCC cache for greatly improved performance
    • samd21: remove extra BK0RDY clear
    • samd51: implement Flash interface
    • samd51: use correct SPI frequency
    • samd51: remove extra BK0RDY clear
    • samd51: fix ADC multisampling
    • wasi: allow users to set the runtime_memhash_tsip or runtime_memhash_fnv build tags
    • wasi: set WASMTIME_BACKTRACE_DETAILS when running in wasmtime.
    • wasm: implement the //go:wasmimport directive
  • boards
    • gameboy-advance: switch to use register definitions in device/gba
    • gameboy-advance: rename display and make pointer receivers
    • gopher-badge: Added Gopher Badge support
    • lorae5: add needed definition for UART2
    • lorae5: correct mapping for I2C bus, add pin mapping to enable power
    • pinetime: update the target file (rename from pinetime-devkit0)
    • qtpy: fix bad pin assignment
    • wioterminal: fix pin definition of BCM13
    • xiao: Pins D4 & D5 are I2C1. Use pins D2 & D3 for I2C0.
    • xiao: add DefaultUART

0.27.0

12 Feb 13:29
Compare
Choose a tag to compare

This release adds support for Go 1.20 and LLVM 15. In addition, it drops a dependency on the AVR and Xtensa toolchains, so you don't need to install avr-gcc or xtensa-esp32-elf-ld making TinyGo much easier to install. Instead, it uses the built-in LLVM linker instead.
Newly supported targets are windows/arm64 (or "Windows on ARM64"), Waveshare RP2040 Zero, Arduino Leonardo, Adafruit KB2040, Adafruit Feather M0 Express, Makerfabs ESP32C3SPI35, and Espressif ESP32-C3-DevKit-RUST-1. As usual, there are also a ton of smaller fixes and improvements.

Here is a detailed changelog for this release:

  • general
    • all: update musl
    • all: remove "acm:"` prefix for USB vid/pid pair
    • all: add support for LLVM 15
    • all: use DWARF version 4
    • all: add initial (incomplete) support for Go 1.20
    • all: add -gc=custom option
    • main: print ldflags including ThinLTO flags with -x
    • main: fix error message when a serial port can't be accessed
    • main: add -timeout flag to allow setting how long TinyGo will try looking for a MSD volume for flashing
    • test: print PASS on pass when running standalone test binaries
    • test: fix printing of benchmark output
    • test: print package name when compilation failed (not just when the test failed)
  • compiler
    • refactor to support LLVM 15
    • builder: print compiler commands while building a library
    • compiler: fix stack overflow when creating recursive pointer types (fix for LLVM 15+ only)
    • compiler: allow map keys and values of ≥256 bytes
    • cgo: add support for C.float and C.double
    • cgo: support anonymous enums included in multiple Go files
    • cgo: add support for bitwise operators
    • interp: add support for constant icmp instructions
    • transform: fix memory corruption issues
  • standard library
    • machine/usb: remove allocs in USB ISR
    • machine/usb: add Port() and deprecate New() to have the API better match the singleton that is actually being returned
    • machine/usb: change HID usage-maximum to 0xFF
    • machine/usb: add USB HID joystick support
    • machine/usb: change to not send before endpoint initialization
    • net: implement Pipe
    • os: add stub for os.Chtimes
    • reflect: stub out Type.FieldByIndex
    • reflect: add Value.IsZero method
    • reflect: fix bug in .Field method when the field fits in a pointer but the parent doesn't
    • runtime: switch some panic() calls in the gc to runtimePanic() for consistency
    • runtime: add xorshift-based fastrand64
    • runtime: fix alignment for arm64, arm, xtensa, riscv
    • runtime: implement precise GC
    • runtime/debug: stub PrintStack
    • sync: implement simple pooling in sync.Pool
    • syscall: stubbed Setuid, Exec and friends
    • syscall: add more stubs as needed for Go 1.20 support
    • testing: implement t.Setenv
    • unsafe: add support for Go 1.20 slice/string functions
  • targets
    • all: do not set stack size per board
    • all: update picolibc to v1.7.9
    • atsame5x: fix CAN extendedID handling
    • atsame5x: reduce heap allocation
    • avr: drop GNU toolchain dependency
    • avr: fix .data initialization for binaries over 64kB
    • avr: support ThinLTO
    • baremetal: implements calloc
    • darwin: fix syscall.Open on darwin/arm64
    • darwin: fix error with tinygo lldb
    • esp: use LLVM Xtensa linker instead of Espressif toolchain
    • esp: use ThinLTO for Xtensa
    • esp32c3: add SPI support
    • linux: include musl getpagesize function in release
    • nrf51: add ADC implementation
    • nrf52840: add PDM support
    • riscv: add "target-abi" metadata flag
    • rp2040: remove mem allocation in GPIO ISR
    • rp2040: avoid allocating clock on heap
    • rp2040: add basic GPIO support for PIO
    • rp2040: fix USB interrupt issue
    • rp2040: fix RP2040-E5 USB errata
    • stm32: always set ADC pins to pullups floating
    • stm32f1, stm32f4: fix ADC by clearing the correct bit for rank after each read
    • stm32wl: Fix incomplete RNG initialisation
    • stm32wlx: change order for init so clock speeds are set before peripheral start
    • wasi: makes wasmtime "run" explicit
    • wasm: fix GC scanning of allocas
    • wasm: allow custom malloc implementation
    • wasm: remove -wasm-abi= flag (use -target instead)
    • wasm: fix scanning of the stack
    • wasm: fix panic when allocating 0 bytes using malloc
    • wasm: always run wasm-opt even with -scheduler=none
    • wasm: avoid miscompile with ThinLTO
    • wasm: allow the emulator to expand {tmpDir}
    • wasm: support ThinLTO
    • windows: update mingw-w64 version to avoid linker warning
    • windows: add ARM64 support
  • boards
    • Add Waveshare RP2040 Zero
    • Add Arduino Leonardo support
    • Add Adafruit KB2040
    • Add Adafruit Feather M0 Express
    • Add Makerfabs ESP32C3SPI35 TFT Touchscreen board
    • Add Espressif ESP32-C3-DevKit-RUST-1 board
    • lgt92: fix OpenOCD configuration
    • xiao-rp2040: fix D9 and D10 constants
    • xiao-rp2040: add pin definitions

0.26.0

04 Oct 14:28
Compare
Choose a tag to compare

This is another TinyGo release with many small changes, including over 110 commits.

This release introduces two possible breaking changes:

  1. The machine package has had some changes in the public API, to remove some unintentionally exported constants. It is likely that very little real-world code is affected by this change.

  2. WebAssembly files could previously import functions by leaving a Go function unimplemented, like so:

    func add(a, b int) int

    This worked by accident. With this release, this is no longer possible. Instead, functions will need to be imported explicitly to avoid a compiler error:

    //export add
    func add(a, b int) int

    (The //export may be confusing, we intend to add a less-confusing //go:wasm-import directive in the future).

Here is a detailed changelog for this release:

  • general
    • remove support for LLVM 13
    • remove calls to deprecated ioutil package
    • move from os.IsFoo to errors.Is(err, ErrFoo)
    • fix for builds using an Android host
    • make interp timeout configurable from command line
    • ignore ports with VID/PID if there is no candidates
    • drop support for Go 1.16 and Go 1.17
    • update serial package to v1.3.5 for latest bugfixes
    • remove GOARM from tinygo info
    • add flag for setting the goroutine stack size
    • add serial port monitoring functionality
  • compiler
    • cgo: implement support for static functions
    • cgo: fix panic when FuncType.Results is nil
    • compiler: add aliases for edwards25519/field.feMul and field.feSquare
    • compiler: fix incorrect DWARF type in some generic parameters
    • compiler: use LLVM math builtins everywhere
    • compiler: replace some math operation bodies with LLVM intrinsics
    • compiler: replace math aliases with intrinsics
    • compiler: fix unsafe.Sizeof for chan and map values
    • compileopts: use tags parser from buildutil
    • compileopts: use backticks for regexp to avoid extra escapes
    • compileopts: fail fast on duplicate values in target field slices
    • compileopts: fix windows/arm target triple
    • compileopts: improve error handling when loading target/*.json
    • compileopts: add support for stlink-dap programmer
    • compileopts: do not complain about -no-debug on MacOS
    • goenv: support GOOS=android
    • interp: fix reading from external global
    • loader: fix link error for crypto/internal/boring/sig.StandardCrypto
  • standard library
    • rename assembly files to .S extension
    • machine: add PWM peripheral comments to pins
    • machine: improve UARTParity slightly
    • machine: do not export DFU_MAGIC_* constants on nrf52840
    • machine: rename PinInputPullUp/PinInputPullDown
    • machine: add KHz, MHz, GHz constants, deprecate TWI_FREQ_* constants
    • machine: remove level triggered pin interrupts
    • machine: do not expose RESET_MAGIC_VALUE
    • machine: use NoPin constant where appropriate (instead of 0 for example)
    • net: sync net.go with Go 1.18 stdlib
    • os: add SyscallError.Timeout
    • os: add ErrProcessDone error
    • reflect: implement CanInterface and fix string Index
    • runtime: make MemStats available to leaking collector
    • runtime: add MemStats.TotalAlloc
    • runtime: add MemStats.Mallocs and Frees
    • runtime: add support for time.NewTimer and time.NewTicker
    • runtime: implement resetTimer
    • runtime: ensure some headroom for the GC to run
    • runtime: make gc and scheduler asserts settable with build tags
    • runtime/pprof: add WriteHeapProfile
    • runtime/pprof: runtime/trace: stub some additional functions
    • sync: implement Map.LoadAndDelete
    • syscall: group WASI consts by purpose
    • syscall: add WASI {D,R}SYNC, NONBLOCK FD flags
    • syscall: add ENOTCONN on darwin
    • testing: add support for -benchmem
  • targets
    • remove USB vid/pid pair of bootloader
    • esp32c3: remove unused UARTStopBits constants
    • nrf: implement GetRNG function
    • nrf: rp2040: add machine.ReadTemperature
    • nrf52: cleanup s140v6 and s140v7 uf2 targets
    • rp2040: implement semi-random RNG based on ROSC based on pico-sdk
    • wasm: add summary of wasm examples and fix callback bug
    • wasm: do not allow undefined symbols (--allow-undefined)
    • wasm: make sure buffers returned by malloc are kept until free is called
    • windows: save and restore xmm registers when switching goroutines
  • boards
    • add Pimoroni's Tufty2040
    • add XIAO ESP32C3
    • add Adafruit QT2040
    • add Adafruit QT Py RP2040
    • esp32c3-12f: matrixportal-m4: p1am-100: remove duplicate build tags
    • hifive1-qemu: remove this emulated board
    • wioterminal: add UART3 for RTL8720DN
    • xiao-ble: fix usbpid

0.25.0

03 Aug 12:48
Compare
Choose a tag to compare

This release improves USB support with new support for the RP2040 and MIDI, improves support for generics, fixes some bugs on darwin/arm64, and adds 3 new boards: the Challenger RP2040 LoRa, the MCH2022 badge, and the XIAO RP2040

  • command line
    • change to ignore PortReset failures
  • compiler
    • compiler: darwin/arm64 is aarch64, not arm
    • compiler: don't clobber X18 and FP registers on darwin/arm64
    • compiler: fix issue with methods on generic structs
    • compiler: do not try to build generic functions
    • compiler: fix type names for generic named structs
    • compiler: fix multiple defined function issue for generic functions
    • compiler: implement unsafe.Alignof and unsafe.Sizeof for generic code
  • standard library
    • machine: add DTR and RTS to Serialer interface
    • machine: reorder pin definitions to improve pin list on tinygo.org
    • machine/usb: add support for MIDI
    • machine/usb: adjust buffer alignment (samd21, samd51, nrf52840)
    • machine/usb/midi: add NoteOn, NoteOff, and SendCC methods
    • machine/usb/midi: add definition of MIDI note number
    • runtime: add benchmarks for memhash
    • runtime: add support for printing slices via print/println
  • targets
    • avr: fix some apparent mistake in atmega1280/atmega2560 pin constants
    • esp32: provide hardware pin constants
    • esp32: fix WDT reset on the MCH2022 badge
    • esp32: optimize SPI transmit
    • esp32c3: provide hardware pin constants
    • esp8266: provide hardware pin constants like GPIO2
    • nrf51: define and use P0_xx constants
    • nrf52840, samd21, samd51: unify bootloader entry process
    • nrf52840, samd21, samd51: change usbSetup and sendZlp to public
    • nrf52840, samd21, samd51: refactor handleStandardSetup and initEndpoint
    • nrf52840, samd21, samd51: improve usb-device initialization
    • nrf52840, samd21, samd51: move usbcdc to machine/usb/cdc
    • rp2040: add usb serial vendor/product ID
    • rp2040: add support for usb
    • rp2040: change default for serial to usb
    • rp2040: add support for machine.EnterBootloader
    • rp2040: turn off pullup/down when input type is not specified
    • rp2040: make picoprobe default openocd interface
    • samd51: add support for DAC1
    • samd51: improve TRNG
    • wasm: stub runtime.buffered, runtime.getchar
    • wasi: make leveldb runtime hash the default
  • boards
    • add Challenger RP2040 LoRa
    • add MCH2022 badge
    • add XIAO RP2040
    • clue: remove pins D21..D28
    • feather-rp2040, macropad-rp2040: fix qspi-flash settings
    • xiao-ble: add support for flash-1200-bps-reset
    • gopherbot, gopherbot2: add these aliases to simplify for newer users

0.25.0-beta1

29 Jul 05:45
Compare
Choose a tag to compare
0.25.0-beta1 Pre-release
Pre-release

This is a pre-release of TinyGo v0.25.0

You will need to install manually by downloading files from here. The beta versions are not available on Homebrew for macOS, nor for Scoop on Windows.

0.24.0

01 Jul 10:48
Compare
Choose a tag to compare

This release adds a few pretty major features to TinyGo: the embed package, recover() (for most non-wasm architectures), and generics. It also adds initial (incomplete) support for Go 1.19, which is still in beta. Apart from that, we have the usual assortment of new features and bug fixes and we add the Badger 2040 board.

One possible breaking change is that we will now use a few newer WebAssembly features. If this is a problem, let us know and we can add a new target without these newer features. We use them because it lowers the binary size of the .wasm files.

Here is the complete changelog:

  • command line
    • remove support for go 1.15
    • remove support for LLVM 11 and LLVM 12
    • add initial Go 1.19 beta support
    • test: fix package/... syntax
  • compiler
    • add support for the embed package
    • builder: improve error message for "command not found"
    • builder: add support for ThinLTO on MacOS and Windows
    • builder: free LLVM objects after use, to reduce memory leaking
    • builder: improve -no-debug error messages
    • cgo: be more strict: CGo now requires every Go file to import the headers it needs
    • compiler: alignof(func) is 1 pointer, not 2
    • compiler: add support for type parameters (aka generics)
    • compiler: implement recover() built-in function
    • compiler: support atomic, volatile, and LLVM memcpy-like functions in defer
    • compiler: drop support for macos syscalls via inline assembly
    • interp: do not try to interpret past task.Pause()
    • interp: fix some buggy localValue handling
    • interp: do not unroll loops
    • transform: fix MakeGCStackSlots that caused a possible GC bug on WebAssembly
  • standard library
    • os: enable os.Stdin for baremetal target
    • reflect: add Value.UnsafePointer method
    • runtime: scan GC globals conservatively on Windows, MacOS, Linux and Nintendo Switch
    • runtime: add per-map hash seeds
    • runtime: handle nil map write panics
    • runtime: add stronger hash functions
    • syscall: implement Getpagesize
  • targets
    • atmega2560: support UART1-3 + example for uart
    • avr: use compiler-rt for improved float64 support
    • avr: simplify timer-based time
    • avr: fix race condition in stack write
    • darwin: add support for GOARCH=arm64 (aka Apple Silicon)
    • darwin: support -size=short and -size=full flag
    • rp2040: replace sleep 'busy loop' with timer alarm
    • rp2040: align api for PortMaskSet, PortMaskClear
    • rp2040: fix GPIO interrupts
    • samd21, samd51, nrf52840: add support for USBHID (keyboard / mouse)
    • wasm: update wasi-libc version
    • wasm: use newer WebAssembly features
  • boards
    • add Badger 2040
    • matrixportal-m4: attach USB DP to the correct pin
    • teensy40: add I2C support
    • wioterminal: fix I2C definition

0.23.0

29 Apr 09:11
Compare
Choose a tag to compare

This release adds support for the recently released Go 1.18, although not for all language features yet. We have also added support for LLVM 14 which is the latest release of the compiler framework. Lots of improvements to the runtime and standard library support, especially when running in WASM/WASI environments. Also a whole bunch of bugfixes and improvements to our hardware support, in particular for the RP2040 processor.

The following new boards have been added this release:

Here is the complete list of changes:

  • command line
    • add -work flag
    • add Go 1.18 support
    • add LLVM 14 support
    • run: add support for command-line parameters
    • build: calculate default output path if -o is not specified
    • build: add JSON output
    • test: support multiple test binaries with -c
    • test: support flags like -v on all targets (including emulated firmware)
  • compiler
    • add support for ThinLTO
    • use compiler-rt from LLVM
    • builder: prefer GNU build ID over Go build ID for caching
    • builder: add support for cross compiling to Darwin
    • builder: support machine outlining pass in stacksize calculation
    • builder: disable asynchronous unwind tables
    • compileopts: fix emulator configuration on non-amd64 Linux architectures
    • compiler: move allocations > 256 bytes to the heap
    • compiler: fix incorrect unsafe.Alignof on some 32-bit architectures
    • compiler: accept alias for slice cap builtin
    • compiler: allow slices of empty structs
    • compiler: fix difference in aliases in interface methods
    • compiler: make RawSyscall an alias for Syscall
    • compiler: remove support for memory references in AsmFull
    • loader: only add Clang header path for CGo
    • transform: fix poison value in heap-to-stack transform
  • standard library
    • internal/fuzz: add this package as a shim
    • os: implement readdir for darwin and linux
    • os: add DirFS, which is used by many programs to access readdir.
    • os: isWine: be compatible with older versions of wine, too
    • os: implement RemoveAll
    • os: Use a uintptr for NewFile
    • os: add stubs for exec.ExitError and ProcessState.ExitCode
    • os: export correct values for DevNull for each OS
    • os: improve support for Signal by fixing various bugs
    • os: implement File.Fd method
    • os: implement UserHomeDir
    • os: add exec.ProcessState stub
    • os: implement Pipe for darwin
    • os: define stub ErrDeadlineExceeded
    • reflect: add stubs for more missing methods
    • reflect: rename reflect.Ptr to reflect.Pointer
    • reflect: add Value.FieldByIndexErr stub
    • runtime: fix various small GC bugs
    • runtime: use memzero for leaking collector instead of manually zeroing objects
    • runtime: implement memhash
    • runtime: implement fastrand
    • runtime: add stub for debug.ReadBuildInfo
    • runtime: add stub for NumCPU
    • runtime: don't inline runtime.alloc with -gc=leaking
    • runtime: add Version
    • runtime: add stubs for NumCgoCall and NumGoroutine
    • runtime: stub {Lock,Unlock}OSThread on Windows
    • runtime: be able to deal with a very small heap
    • syscall: make Environ return a copy of the environment
    • syscall: implement getpagesize and munmap
    • syscall: wasi: define MAP_SHARED and PROT_READ
    • syscall: stub mmap(), munmap(), MAP_SHARED, PROT_READ, SIGBUS, etc. on nonhosted targets
    • syscall: darwin: more complete list of signals
    • syscall: wasi: more complete list of signals
    • syscall: stub WaitStatus
    • syscall/js: allow copyBytesTo(Go|JS) to use Uint8ClampedArray
    • testing: implement TempDir
    • testing: nudge type TB closer to upstream; should be a no-op change.
    • testing: on baremetal platforms, use simpler test matcher
  • targets
    • atsamd: fix usbcdc initialization when -serial=uart
    • atsamd51: allow higher frequency when using SPI
    • esp: support CGo
    • esp32c3: add support for input pin
    • esp32c3: add support for GPIO interrupts
    • esp32c3: add support to receive UART data
    • rp2040: fix PWM bug at high frequency
    • rp2040: fix some minor I2C bugs
    • rp2040: fix incorrect inline assembly
    • rp2040: fix spurious i2c STOP during write+read transaction
    • rp2040: improve ADC support
    • wasi: remove --export-dynamic linker flag
    • wasm: remove heap allocator from wasi-libc
  • boards
    • circuitplay-bluefruit: move pin mappings so board can be compiled for WASM use in Playground
    • esp32-c3-12f: add the ESP32-C3-12f Kit
    • m5stamp-c3: add pin setting of UART
    • macropad-rp2040: add the Adafruit MacroPad RP2040 board
    • nano-33-ble: typo in LPS22HB peripheral definition and documentation (#2579)
    • teensy41: add the Teensy 4.1 board
    • teensy40: add ADC support
    • teensy40: add SPI support
    • thingplus-rp2040: add the SparkFun Thing Plus RP2040 board
    • wioterminal: add DefaultUART
    • wioterminal: verify written data when flashing through OpenOCD
    • xiao-ble: add XIAO BLE nRF52840 support

0.22.0

26 Jan 14:12
Compare
Choose a tag to compare

This release contains significantly improved standard library support with many more packages passing all tests. Especially the os package was improved a lot with many functions added to match the standard Go os package. In addition, we upgraded LLVM to LLVM 13, improved the build cache (no tinygo clean anymore), and of course we've made various other improvements and bug fixes.

We've added the following boards this release:

Here are the changes in detail:

  • command line
    • add asyncify to scheduler flag help
    • support -run for tests
    • remove FreeBSD target support
    • add LLVM 12 and LLVM 13 support, use LLVM 13 by default
    • add support for ARM64 MacOS
    • improve help
    • check /run/media as well as /media on Linux for non-debian-based distros
    • test: set cmd.Dir even when running emulators
    • info: add JSON output using the -json flag
  • compiler
    • builder: fix off-by-one in size calculation
    • builder: handle concurrent library header rename
    • builder: use flock to avoid double-compiles
    • builder: use build ID as cache key
    • builder: add -fno-stack-protector to musl build
    • builder: update clang header search path to look in /usr/lib
    • builder: explicitly disable unwind tables for ARM
    • cgo: add support for C.CString and related functions
    • compiler: fix ranging over maps with particular map types
    • compiler: add correct debug location to init instructions
    • compiler: fix emission of large object layouts
    • compiler: work around AVR atomics bugs
    • compiler: predeclare runtime.trackPointer
    • interp: work around AVR function pointers in globals
    • interp: run goroutine starts and checks at runtime
    • interp: always run atomic and volatile loads/stores at runtime
    • interp: bump timeout to 180 seconds
    • interp: handle type assertions on nil interfaces
    • loader: elminate goroot cache inconsistency
    • loader: respect $GOROOT when running go list
    • transform: allocate the correct amount of bytes in an alloca
    • transform: remove switched func lowering
  • standard library
    • crypto/rand: show error if platform has no rng
    • device/*: add *_Msk field for each bit field and avoid duplicates
    • device/*: provide Set/Get for each register field described in the SVD files
    • internal/task: swap stack chain when switching goroutines
    • internal/task: remove -scheduler=coroutines
    • machine: add Device string constant
    • net: add bare Interface implementation
    • net: add net.Buffers
    • os: stub out support for some features
    • os: obey TMPDIR on unix, TMP on Windows, etc
    • os: implement ReadAt, Mkdir, Remove, Stat, Lstat, CreateTemp, MkdirAll, Chdir, Chmod, Clearenv, Unsetenv, Setenv, MkdirTemp, Rename, Seek, ExpandEnv, Symlink, Readlink
    • os: implement File.Stat
    • os: fix IsNotExist on nonexistent path
    • os: fix opening files on WASI in read-only mode
    • os: work around lack of syscall.seek on 386 and arm
    • reflect: make sure indirect pointers are handled correctly
    • runtime: allow comparing interfaces
    • runtime: use LLVM intrinsic to read the stack pointer
    • runtime: strengthen hashmap hash function for structs and arrays
    • runtime: fix float/complex hashing
    • runtime: fix nil map dereference
    • runtime: add realloc implementation to GCs
    • runtime: handle negative sleep times
    • runtime: correct GC scan bounds
    • runtime: remove extalloc GC
    • rumtime: implement __sync libcalls as critical sections for most microcontrollers
    • runtime: add stubs for Func.FileLine and Frame.PC
    • sync: fix concurrent read-lock on write-locked RWMutex
    • sync: add a package doc
    • sync: add tests
    • syscall: add support for Mmap and Mprotect
    • syscall: fix array size for mmap slice creation
    • syscall: enable Getwd in wasi
    • testing: add a stub for CoverMode
    • testing: support -bench option to run benchmarks matching the given pattern.
    • testing: support b.SetBytes(); implement sub-benchmarks.
    • testing: replace spaces with underscores in test/benchmark names, as upstream does
    • testing: implement testing.Cleanup
    • testing: allow filtering subbenchmarks with the -bench flag
    • testing: implement -benchtime flag
    • testing: print duration
    • testing: allow filtering of subtests using -run
  • targets
    • all: change LLVM features to match vanilla Clang
    • avr: use interrupt-based timer which is much more accurate
    • nrf: fix races in I2C
    • samd51: implement TRNG for randomness
    • stm32: pull-up on I2C lines
    • stm32: fix timeout for i2c comms
    • stm32f4, stm32f103: initial implementation for ADC
    • stm32f4, stm32f7, stm32l0x2, stm32l4, stm32l5, stm32wl: TRNG implementation in crypto/rand
    • stm32wl: add I2C support
    • windows: add support for the -size= flag
    • wasm: add support for tinygo test
    • wasi, wasm: raise default stack size to 16 KiB
  • boards
    • add M5Stack
    • add lorae5 (stm32wle) support
    • add Generic Node Sensor Edition
    • add STM32F469 Discovery
    • add M5Stamp C3
    • add Blues Wireless Swan
    • bluepill: add definitions for ADC pins
    • stm32f4disco: add definitions for ADC pins
    • stm32l552ze: use supported stlink interface
    • microbit-v2: add some pin definitions

0.21.0

18 Nov 14:30
Compare
Choose a tag to compare

This release brings many small changes to the TinyGo compiler toolchain. Some of the highlights are: support for building Windows binaries in TinyGo, improved goroutine support on WebAssembly using Asyncify, and many small fixes that together get 12 more standard library packages to pass the package tests. Of course, there is also a number of improvements for microcontrollers such as ESP32-C3 and the RP2040. And lastly, we've added support for the M5Stack Core2 board.

  • command line
    • drop support for LLVM 10
    • build: drop support for LLVM targets in the -target flag
    • build: fix paths in error messages on Windows
    • build: add -p flag to set parallelism
    • lldb: implement tinygo lldb subcommand
    • test: use emulator exit code instead of parsing test output
    • test: pass testing arguments to wasmtime
  • compiler
    • use -opt flag for optimization level in CFlags (-Os, etc)
    • builder: improve accuracy of the -size=full flag
    • builder: hardcode some more frame sizes for _aeabi* functions
    • builder: add support for -size= flag for WebAssembly
    • cgo: fix line/column reporting in syntax error messages
    • cgo: support function definitions in CGo headers
    • cgo: implement rudimentary C array decaying
    • cgo: add support for stdio in picolibc and wasi-libc
    • cgo: run CGo parser per file, not per CGo fragment
    • compiler: fix unintentionally exported math functions
    • compiler: properly implement div and rem operations
    • compiler: add support for recursive function types
    • compiler: add support for the go keyword on interface methods
    • compiler: add minsize attribute for -Oz
    • compiler: add "target-cpu" and "target-features" attributes
    • compiler: fix indices into strings and arrays
    • compiler: fix string compare functions
    • interp: simplify some code to avoid some errors
    • interp: support recursive globals (like linked lists) in globals
    • interp: support constant globals
    • interp: fix reverting of extractvalue/insertvalue with multiple indices
    • transform: work around renamed return type after merging LLVM modules
  • standard library
    • internal/bytealg: fix indexing error in Compare()
    • machine: support Pin.Get() function when the pin is configured as output
    • net, syscall: Reduce code duplication by switching to internal/itoa.
    • os: don't try to read executable path on baremetal
    • os: implement Getwd
    • os: add File.WriteString and File.WriteAt
    • reflect: fix type.Size() to account for struct padding
    • reflect: don't construct an interface-in-interface value
    • reflect: implement Value.Elem() for interface values
    • reflect: fix Value.Index() in a specific case
    • reflect: add support for DeepEqual
    • runtime: add another set of invalid unicode runes to encodeUTF8()
    • runtime: only initialize os.runtime_args when needed
    • runtime: only use CRLF on baremetal systems for println
    • runtime/debug: stub debug.SetMaxStack
    • runtime/debug: stub debug.Stack
    • testing: add a stub for t.Parallel()
    • testing: add support for -test.short flag
    • testing: stub B.ReportAllocs()
    • testing: add testing.Verbose
    • testing: stub testing.AllocsPerRun
  • targets
    • fix gen-device-svd to handle 64-bit values
    • add CPU and Features property to all targets
    • match LLVM triple to the one Clang uses
    • atsam: simplify definition of SERCOM UART, I2C and SPI peripherals
    • atsam: move I2S0 to machine file
    • esp32: fix SPI configuration
    • esp32c3: add support for GDB debugging
    • esp32c3: add support for CPU interrupts
    • esp32c3: use tasks scheduler by default
    • fe310: increase CPU frequency from 16MHz to 320MHz
    • fe310: add support for bit banging drivers
    • linux: build static binaries using musl
    • linux: reduce binary size by calling write instead of putchar
    • linux: add support for GOARM
    • riscv: implement 32-bit atomic operations
    • riscv: align the heap to 16 bytes
    • riscv: switch to tasks-based scheduler
    • rp2040: add CPUFrequency()
    • rp2040: improve I2C baud rate configuration
    • rp2040: add pin interrupt API
    • rp2040: refactor PWM code and fix Period calculation
    • stm32f103: fix SPI
    • stm32f103: make SPI frequency selection more flexible
    • qemu: signal correct exit code to QEMU
    • wasi: run C/C++ constructors at startup
    • wasm: ensure heapptr is aligned
    • wasm: update wasi-libc dependency
    • wasm: wasi: use asyncify
    • wasm: support -scheduler=none
    • windows: add support for Windows (amd64 only for now)
  • boards
    • feather-stm32f405, feather-rp2040: add I2C pin names
    • m5stack-core2: add M5Stack Core2
    • nano-33-ble: SoftDevice s140v7 support
    • nano-33-ble: add constants for more on-board pins

0.20.0

21 Sep 18:31
Compare
Choose a tag to compare

This release adds support for Go 1.17, fixes a bunch of compiler bugs (especially for WebAssembly), and adds support for a few new boards including boards based on the ESP32-C3 chip.

  • command line
    • add support for Go 1.17
    • improve Go version detection
    • add support for the Black Magic Probe (BMP)
    • add a flag for creating cpu profiles
  • compiler
    • builder: list libraries at the end of the linker command
    • builder: strip debug information at link time instead of at compile time
    • builder: add missing error check for ioutil.TempFile()
    • builder: simplify running of jobs
    • compiler: move LLVM math builtin support into the compiler
    • compiler: move math aliases from the runtime to the compiler
    • compiler: add aliases for many hashing packages
    • compiler: add *ssa.MakeSlice bounds tests
    • compiler: fix max possible slice
    • compiler: add support for new language features of Go 1.17
    • compiler: fix equally named structs in different scopes
    • compiler: avoid zero-sized alloca in channel operations
    • interp: don't ignore array indices for untyped objects
    • interp: keep reverted package initializers in order
    • interp: fix bug in compiler-time/run-time package initializers
    • loader: fix panic in CGo files with syntax errors
    • transform: improve GC stack slot pass to work around a bug
  • standard library
    • crypto/rand: switch to arc4random_buf
    • math: fix math.Max and math.Min
    • math/big: fix undefined symbols error
    • net: add MAC address implementation
    • os: implement os.Executable
    • os: add SEEK_SET, SEEK_CUR, and SEEK_END
    • reflect: add StructField.IsExported method
    • runtime: reset heapptr to heapStart after preinit()
    • runtime: add subsections_via_symbols to assembly files on darwin
    • testing: add subset implementation of Benchmark
    • testing: test testing package using tinygo test
    • testing: add support for the -test.v flag
  • targets
    • 386: bump minimum requirement to the Pentium 4
    • arm: switch to Thumb instruction set on ARM
    • atsamd: fix copy-paste error for atsamd21/51 calibTrim block
    • baremetal,wasm: support command line params and environment variables
    • cortexm: fix stack overflow because of unaligned stacks
    • esp32c3: add support for the ESP32-C3 from Espressif
    • nrf52840: fix ram size
    • nxpmk66f18: fix a suspicious bitwise operation
    • rp2040: add SPI support
    • rp2040: add I2C support
    • rp2040: add PWM implementation
    • rp2040: add openocd configuration
    • stm32: add support for PortMask* functions for WS2812 support
    • unix: fix time base for time.Now()
    • unix: check for mmap error and act accordingly
    • wasm: override dlmalloc heap implementation from wasi-libc
    • wasm: align heap to 16 bytes
    • wasm: add support for the crypto/rand package
  • boards
    • add DefaultUART to adafruit boards
    • arduino-mkrwifi1010: add board definition for Arduino MKR WiFi 1010
    • arduino-mkrwifi1010: fix pin definition of NINA_RESETN
    • feather-nrf52: fix pin definition of uart
    • feather-rp2040: add pin name definition
    • gameboy-advance: fix ROM header
    • mdbt50qrx-uf2: add Raytac MDBT50Q-RX Dongle with TinyUF2
    • nano-rp2040: define NINA_SPI and fix wifinina pins
    • teensy40: enable hardware UART reconfiguration, fix receive watermark interrupt