Tinygo 0.32 Released: A Go Compiler Utilizing LLVM

Available project release Tinygo 0.32, which develops a Go language compiler for areas that require compact representation of the resulting code and low resource consumption, such as microcontrollers and compact single-processor systems. Compilation for various target platforms is implemented using LLVM, and libraries used in the main toolkit from the Go project are used to support the language. Code distributed by under BSD license.

The compiled program can be directly run on microcontrollers, allowing Go to be used as a language for writing automation scripts. In current form supported more than a hundred microcontroller models, including various Adafruit, Arduino, BBC micro, ESP32, M5Stack, ST Micro, Digispark, Raspberry Pi Pico, Nordic Semiconductor, SiFive HiFive1, STM32, Makerdiary and Phytec boards. To interact with sensors and connected external devices, as well as to support interfaces such as I2C, GPIO and SPI, special drivers. Programs also can be collected in WebAssembly format (wasm/wasi) to run in the browser and as executable files for Linux.

Advertisement

Key project goals:

  • Possibility to use subset familiar Go language on compact devices. Go language selected instead of Rust because it is easier to learn, provides thread-independent support for coroutine-based parallelization, and offers an extensive standard library (“batteries included”).
  • Generating very compact executable files.
  • Support for the most common microcontroller board models.
  • Ability to use for the Web and create stand-alone WebAssembly applications, using WASI (WebAssembly System Interface) interface for working with files, sockets and other functions provided by the operating system.
  • CGo support with minimal overhead when calling C functions.
  • Support for most standard packages and the ability to compile standard existing code without changing it.
  • Unlike a similar compiler that is abandoned emgo Tinygo retains Go's original garbage-collector memory management model and instead of compiling to a C representation, uses LLVM to generate efficient machine code.

The new version adds support for Pico W, Adafruit ESP32 Feather V2, M5 Paper, PCA10059, stm32 nucleol476rg and Pimoroni Badger2040-W boards and chips. Compatibility with LLVM 18 has been ensured. It is now possible to use spaces in drive names in the format UF2. I2C bus support has been added for the esp32 platform. WebAssembly support has been expanded.

Thanks for reading:

Advertisement