Learning Tock from the Ground Up

An interactive companion to the Tock Book

Learning Tock from the Ground Up

Microcontrollers and the Tock kernel from first principles, on a Raspberry Pi Pico 2 — a board the official book does not cover.

What this is

The book says what Tock does. These pages show it happening.

The Tock Book is the project's own documentation, and it is the right place for installing the toolchain, writing applications, and the reference specifications. This series does not repeat it. Each entry below names the book page it sits beside.

Two things are missing there, and they are what these pages are for. The first is this board: the book's guided material is built around an nRF52840DK, and its getting-started list names five boards, not one of them a Pico. Everything here runs on a Pico 2 or a Pico 2 W.

The second is mechanism. The book states how Tock is built; these pages take one instruction, one register, one refused write, and let you drive it until the reason is obvious. Two of the nine have no counterpart in the book at all.

The chapters

Reading order is dependency order

Chapter 1 defines the vocabulary; everything after inherits it.

Click a chapter to see what it stands on.

0 Running it 1 Memory 2 Registers 3 Boot 4 Drivers 5 Processes 6 The MPU 7 Syscalls 8 Grants optional

Nothing chosen. Click a chapter above, or start at 1 — it stands on nothing, which is why it is already outlined. Ready to read: everything it stands on is behind you. Not yet. It stands on chapters you have not marked read. You have marked this one read. Optional, and it stands on nothing either. It is the one chapter you can read at any point, and the only one that needs hardware.

0 of 9 marked read · kept in this browser only, and cleared by clearing site data.
0

Getting It Running

Tock on a chip you can hold: one command to build it, one to put it there, three wires to make it talk.

Book Getting Started — five boards, no Pico

Optional

1

Everything Is Memory

One str writes 3.3 V to a pin. The hardware determines which block answers the address, which register inside it does the work, and which of thirty pins that single bit picks.

Book nothing on this

Needs nothing

2

Registers Are Not Variables

A register is not a variable, and three things go wrong when you treat it as one: what a read gives back, what the compiler does to a loop that polls, and what the second processor does to your value while you are holding it.

Book nothing on this

Needs 1

3

How Code Starts Running

Power-on to main(): where the processor looks for its first instruction, what the boot ROM hunts for in the kilobyte ahead of the kernel, and what "initialize RAM" actually means.

Book doc/startup

Needs 1

4

What a Driver May Touch

Capsules and HILs: a driver that cannot reach hardware it was not handed, enforced by the type system rather than by the chip — and the three things it can still do to you anyway.

Book doc/design, development/hil

Needs 1 3

5

What a Process Is

Code the compiler never saw: sixteen trusted bytes at the start of an application, a traversal through flash that halts when the header parsing ends, and a reserved slice of RAM at the top where the kernel keeps its private record of the process.

Book doc/processes, doc/tock_binary_format

Needs 1

7

Asking the Kernel

One instruction out: eight classes of request encoded in four registers, the same eight registers returning the response, and a buffer that crosses a memory boundary designed to prevent exactly that.

Book doc/syscalls, TRD104

Needs 5 6

8

Grants

How a driver stores per-process state inside the process's own memory — bounded, with no allocator. Seventy-six bytes for a console, carved from the top of the process's memory downward, and not freed until the process exits.

Book doc/syscalls, development/syscall

Needs 4 5 7

Why the wall before the door

Problems first, mechanisms second

The memory protection unit comes before syscalls: meet the wall, then find the door.

Hardware

Groundable on a board you can hold

Every chapter cites boards/raspberry_pi_pico_2, a real port in this tree, so a reader with a Pico 2 and a debug probe can run what they have just read about.

If your board is a Pico 2 W

This branch has a raspberry_pi_pico_2_w crate, so use that one. Same chip, same chapters; what differs is a single pin.

GPIO 25 is the radio's chip select on a W rather than the LED. So that crate hands nothing to the LED driver, and prints on a panic where the plain one blinks.

Two crates over one chip, one pin apart, is a sharper look at what a board crate is for than either would be alone, and the chapters use it that way. The radio works too, over a state machine in the chip's PIO block, though nothing in these chapters needs it.

Verifying

Every citation names a commit, and is checked against it

Each chapter pins one commit of the Tock tree, so a citation is checked against the source as it stood there rather than against whatever master says today — and when the tree moves a line a chapter quoted, that is information rather than an inconvenience. The pages are interactive, so "it looks right" is not evidence. The chapters used to live in a branch of the kernel repository and now sit beside it, so the gate has to be told where that clone is:

TOCK_TREE=/path/to/tock python3 learning/tools/check.py

Without it every other check still runs, and the run says plainly that the citation checks were skipped rather than passing them in silence.

Begin

Chapter 0 — Getting It Running

Forty minutes with a board, a probe and six wires, ending on one line of text that proves the kernel is up. Optional — chapter 1 reads fine from an armchair — but everything after it means more with hardware in front of you.

Learning Tock from the Ground Up · Jon Hillesheim, 2026
Licensed CC BY-SA 4.0 · kernel source quoted under Tock's own terms
A chapter that quotes a line names the commit it is pinned to
Reading progress is stored in this browser only.