Tamago and tinygo: working with firmware and kernel written in Go!
10-10, 14:00–14:30 (US/Pacific), Main Track

Tamago and TinyGo are Go compilers for bare metal; both firmware and small kernels have been written using them. In this talk, I will describe what I have learned by working with these two compilers; discuss the benefits of having the Go runtime available in firmware; provide a demo of each in action; and close by describing how they have turned my preconceptions about firmware languages on their head.

It has been commonly believed that Go is not usable on bare metal, and that we must use languages such as Rust or C. As I have learned in the last three years, such is not the case.

In this talk, I will describe two bare metal Go toolchains, Tamago and TinyGo. Both allow users to compile standard Go programs to run on bare metal, i.e. with no underlying kernel: the Go programs become both firmware and kernel.

Tamago (https://github.com/usbarmory/tamago), a Go toolchain created by WithSecure, is based on the standard Google Go toolchain, with a few hundred lines of changes. Withsecure.com has released an open source USB device, the USB Armory, which can boot Linux or a small kernel written Go. This device has recently flown in space.

TinyGo (https://tinygo.org/) is combination of a Go front end and an LLVM backend. TinyGo is thus a completely new Go toolchain, able to benefit from LLVM's optimizations: tinygo binaries are about 20% or less the size of standard Go binaries. TinyGo has grown quickly: in just a few years, contributors have got about 100 boards working. This rate of adoption is faster than coreboot, and far faster than oreboot; there are lessons to be learned from their work.

The u-root project (u-root.org) now includes Tamago and TinyGo builds as part of continuous integration.

In this talk, I will describe my experiences with both these toolchains, give a demo with hardware, and speculate on where Go is the best bare metal language. There have been a lot of surprises for me in using these systems, and I have had to discard my preconceptions about what languages are best.

Ron Minnich has been working in Unix kernels since 1976. Along the way, he started the LinuxBIOS, a.k.a. coreboot; oreboot; u-root (u-root.org); LinuxBoot; and other projects. He is currently employed as a Senior Principle Engineer in the Systems Research Lab at Samsung Advanced Institute of Technolgy.