Published release of the project Tinygo 0.40, developing a compiler for the Go language. The compiler is suitable for generating compact executable files for low-power systems such as microcontrollers and embedded devices, programs for which must consume minimal memory and computing resources. Compilation for supported targets is implemented using LLVM, and function libraries are borrowed from the Go project’s core toolkit. The code is distributed under the BSD license.
The compiled program can directly run on microcontrollers, which allows you to use the subset of the Go language to write automation scripts. More than one hundred microcontroller models are supported, including various boards from Adafruit, Arduino, BBC micro, ESP32, M5Stack, ST Micro, Digispark, Raspberry Pi Pico, Nordic Semiconductor, SiFive HiFive1, STM32, Makerdiary and Phytec. To interact with sensors and connected external devices, as well as to support interfaces such as I2C, GPIO and SPI, special drivers are provided.
Unlike the similar compiler emgo, which has not been updated recently four years old, tinygo retains the original Go memory management model using a garbage collector, and instead of compiling to a C representation, uses LLVM to directly generate machine code. Programs can use existing standard Go code without modification, as well as most standard packages. In addition to generating machine code, tinygo provides support for generating WebAssembly bytecode with the ability to create stand-alone WebAssembly applications using the WASI interface (WebAssembly System Interface).
In the new version:
- Added optimizations to the garbage collector. The performance increase was up to 10%.
- Implemented support for the LLVM 20 toolkit.
- Added support for the ESP32-S3 platform, as well as Xiao ESP32-S3, Gopher ARCADE and Pico2-Ice boards.
- Added the go-compatibility flag and the TINYGO_GOCOMPATIBILITY environment variable to disable compatibility checking with the declared version of the Go language.
- For global variables and functions enabled pragma “//go:linkname” in addition to “https://go:extern”.
- Added the ability to mark string parameters as read-only to the compiler.
- To identify loops with deferred calls (operator defer), the compiler uses an algorithm for searching for tightly coupled components Taryana