project release , 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 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 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β).
Currently, 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 for browser execution in WebAssembly format and as executable files for LinuxSupport for ESP8266/ESP32 controllers , 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:
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 with all Go applications.
The main difference from a similar compiler 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
