liveBook · Manning

TinyGo

As explained in Learn Go with Pocket-Sized Projects

TinyGo is a Go compiler designed to produce small binaries for resource-constrained systems and environments.

TinyGo is a Go compiler for producing small executables on microcontrollers and other resource-constrained devices. It is source compatible with Go, but its smaller standard library means that networking, cryptography, runtime, reflect, and other features may require changes or may behave differently. section 12.3 section 12.4

Use TinyGo to:

  • Compile Go programs for microcontrollers with very limited CPU and memory. section 12.0 section 12.3
  • Target WebAssembly as well as embedded and IoT hardware. section 12.3
  • Map hardware pins through TinyGo’s machine library and connect LEDs, sensors, and other components. section 12.4
  • Debug through USB print statements, Delve, the GDB-based TinyGo debugger, or a connected debug probe. section 12.3.3

Flashing an Arduino Nano 33 IoT

After compiling a TinyGo program for the target board, flash it through the board’s serial port with: tinygo flash -target=arduino-nano33 -port=/dev/ttyUSB0. Without a physical board, the TinyGo playground emulates a microcontroller with virtual LEDs. section 12.3.3 section 12.3

> tinygo flash -target=arduino-nano33 -port=/dev/ttyUSB0

Use the deployment command as a starting point for flashing TinyGo programs to an Arduino Nano 33 IoT. section 12.3.3

How Learn Go with Pocket-Sized Projects covers it

How deep it goes
Explains compiler purpose, compatibility limits, hardware access, flashing, and debugging options without detailing compiler internals.
Examples
Uses virtual LEDs, an Arduino Nano 33 IoT, USB output, debugger choices, and a TinyGo flashing command.
What it assumes
Assumes Go familiarity, requires a separate TinyGo installation, and offers a playground for experimentation without physical hardware.
What you can do after
Build and deploy Go programs to supported microcontrollers, then diagnose failures through serial output, debuggers, or probes.
How it connects
Connects Go with WebAssembly, microcontrollers, IoT, hardware pins, Delve, GDB, and build tags.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Go with Pocket-Sized Projects. The section links point to the parts of the book it draws on.