Go to file
Andrea Barisani 36729d8ffc bump release 2023-10-16 09:10:39 +02:00
_dev allow GOARCH override 2022-08-03 10:08:49 +02:00
arm support symbol override of reserved memory area 2023-09-22 17:11:20 +02:00
bits improve driver abstraction 2022-07-27 12:42:37 +02:00
board remove U-Booot operation 2023-10-05 13:37:32 +02:00
dma tidying 2023-06-29 17:55:34 +02:00
example rename organization 2022-03-17 14:15:09 +01:00
internal favor channel closing as completion signal 2023-08-28 15:35:05 +02:00
riscv halt in low-power state on runtime exit 2023-07-11 10:46:03 +02:00
soc tidying 2023-10-02 19:40:55 +02:00
LICENSE rename organization 2022-03-28 10:56:59 +02:00
README.md bump release 2023-10-16 09:10:39 +02:00
go.mod gofmt 2023-03-17 09:30:11 +01:00
go.sum move example application to github.com/f-secure-foundry/tamago-example 2020-01-13 17:08:06 +01:00


TamaGo - bare metal Go for ARM/RISC-V SoCs

tamago | https://github.com/usbarmory/tamago

Copyright (c) WithSecure Corporation

TamaGo gopher


TamaGo is a framework that enables compilation and execution of unencumbered Go applications on bare metal ARM/RISC-V System-on-Chip (SoC) components.

The projects spawns from the desire of reducing the attack surface of embedded systems firmware by removing any runtime dependency on C code and Operating Systems.

The TamaGo framework consists of the following components:

  • A modified Go distribution which extends GOOS support to the tamago target, allowing bare metal execution.

  • Go packages for SoC driver support.

  • Go packages for board support.

The modifications are meant to be minimal for both the Go distribution (< ~4000 LOC changed) and the target application (one import required), with a clean separation from other architectures.

Strong emphasis is placed on code re-use from existing architectures already included within the standard Go runtime, see Internals.

Both aspects are motivated by the desire of providing a framework that allows secure Go firmware development on embedded systems.

Current release level

GitHub release Build Status

The current release for the TamaGo modified Go distribution is tamago1.21.3, which adds GOOS=tamago support to go1.21.3.

Binary releases for amd64 and armv7l Linux hosts are available.


The main documentation can be found on the project wiki.

The package API documentation can be found on pkg.go.dev.

Supported ARM hardware

The following table summarizes currently supported ARM SoCs and boards (GOOS=tamago GOARCH=arm).

SoC Board SoC package Board package
NXP i.MX6ULZ/i.MX6UL USB armory Mk II imx6ul usbarmory/mk2
NXP i.MX6ULL/i.MX6UL USB armory Mk II LAN imx6ul usbarmory/mk2
NXP i.MX6ULL MCIMX6ULL-EVK imx6ul mx6ullevk
Broadcom BCM2835 Raspberry Pi Zero bcm2835 pi/pizero
Broadcom BCM2835 Raspberry Pi 1 Model A+ bcm2835 pi/pi1
Broadcom BCM2835 Raspberry Pi 1 Model B+ bcm2835 pi/pi1
Broadcom BCM2836 Raspberry Pi 2 Model B bcm2835 pi/pi2

Supported RISC-V hardware

The following table summarizes currently supported RISC-V SoCs and boards (GOOS=tamago GOARCH=riscv64).

SoC Board SoC package Board package
SiFive FU540 QEMU sifive_u fu540 qemu/sifive_u


Go applications are simply required to import, the relevant board package to ensure that hardware initialization and runtime support takes place:

import (
	// Example for USB armory Mk II
	_ "github.com/usbarmory/tamago/board/usbarmory/mk2"

Build the TamaGo compiler (or use the latest binary release):

wget https://github.com/usbarmory/tamago-go/archive/refs/tags/latest.zip
unzip latest.zip
cd tamago-go-latest/src && ./all.bash
cd ../bin && export TAMAGO=`pwd`/go

Go applications can be compiled with the compiler built in the previous step, with the addition of a few flags/variables:

# Example for USB armory Mk II
  ${TAMAGO} build -ldflags "-T 0x80010000 -E _rt0_arm_tamago -R 0x1000"

# Example for QEMU RISC-V sifive_u
  ${TAMAGO} build -ldflags "-T 0x80010000 -E _rt0_riscv64_tamago -R 0x1000"

See the respective board package README file for compilation information for each specific target.

Executing and debugging

See the respective board package README file for execution and debugging information for each specific target (real or emulated).

The example application provides sample driver usage and instructions for native as well as emulated execution.

An emulated run of the example application can be launched as follows:

git clone https://github.com/usbarmory/tamago-example
cd tamago-example && make qemu

Applications using TamaGo

External drivers using TamaGo

Additional resources


Andrea Barisani
andrea.barisani@withsecure.com | andrea@inversepath.com

Andrej Rosano
andrej.rosano@withsecure.com | andrej@inversepath.com


tamago | https://github.com/usbarmory/tamago
Copyright (c) WithSecure Corporation

This project is distributed under the BSD-style license found in the LICENSE file.

The TamaGo logo is adapted from the Go gopher designed by Renee French and licensed under the Creative Commons 3.0 Attributions license. Go Gopher vector illustration by Hugo Arganda.