Release of Tinygo 0.7.0, LLVM-based Go compiler

Available project release Tinygo 0.7.0, which is developing 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. Code spreads under the BSD license.

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. The compiled program can be directly run on microcontrollers, allowing Go to be used as a language for writing automation scripts.

The motivation for creating a new project was the desire to use the familiar Go language on compact devices - the developers reasoned that if there was a Python version for microcontrollers, then why not create a similar one for the Go language. Go 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”).

In its current form, 15 microcontroller models are supported, including various boards from Adafruit, Arduino, BBC micro:bit, ST Micro, Digispark, Nordic Semiconductor, Makerdiary and Phytec. Programs can also be compiled to run in a browser in WebAssembly format and as executable files for Linux. Supports ESP8266/ESP32 controllers not yet, but a separate project is being developed to add support for the Xtensa chip in LLVM, which is still marked as unstable and not ready for integration with TinyGo.

Key goals of the project:

  • Generation of very compact executable files;
  • Support for the most common models of microcontroller boards;
  • Possibility of application for the Web;
  • CGo support with minimal overhead when calling functions in C;
  • Support for most of the standard packages and the ability to compile generic existing code without changing it.

    Support for multi-core systems is not among the main goals,
    efficient launch of a huge number of coroutines (the launch of coroutines itself is fully supported), achievement of the performance level of the reference compiler gc (optimization is left to LLVM and in some applications Tinygo may be faster than gc) and complete compatibility with all Go applications.

    The main difference from a similar compiler emgo is an attempt to preserve Go's original memory management model using garbage collection and use LLVM to generate efficient code instead of compiling it to a C representation. Tinygo also offers a new runtime library that implements a scheduler, memory allocation system, and string handlers optimized for compact systems. Some packages, such as sync and reflect, have been recreated based on the new runtime.

    Among the changes in release 0.7 are the implementation of the β€œtinygo test” command, the provision of garbage collection support for most target boards (based on ARM Cortex-M) and WebAssembly, support for the HiFive1 rev B board based on the RISC-V architecture and the Arduino nano33 board,
    improved language support (support for bit fields using getters and setters, support for anonymous structures).

    Source: opennet.ru

  • Add a comment