TinyGo is a compiler for the Go language, designed for use in areas such as microcontrollers, WASM, and the development of command-line utilities.
TinyGo utilizes tools and libraries written in the Go project while providing an alternative method for compiling programs based on the LLVM project.
Project Goals:
- Ensure minimal size of executable files.
- Support for the largest number of microcontrollers.
- Support for WebAssembly.
- Good support for CGo.
- Support for original Go code without changes.
Example of use for switching an LED on a microcontroller:
package main
import (
"machine"
"time"
)
func main() {
led := machine.LED
led.Configure(machine.PinConfig{Mode: machine.PinOutput})
for {
led.Low()
time.Sleep(time.Millisecond * 1000)
led.High()
time.Sleep(time.Millisecond * 1000)
}
}
Version 0.6.0 includes numerous changes, primarily related to improved support for CGo, js.FuncOF (Go 1.12+), as well as two new debugging boards: Adafruit Feather M0 and Adafruit Trinket M0.
The full changelog is available on project page on GitHub.
Source: linux.org.ru
