# Tock (operating system)

Tock is a free and open source embedded operating system for microcontrollers written in Rust. The operating system's goal is to isolate components so untrusted third-party applications can run on Cortex-M, RISC-V, and x86 processors in a protected environment.

## History

Amit Levy, a PhD student at Stanford University, began the Tock project to have a security-focused replacement for the TinyOS operating system. Amit became interested in researching IoT low-power computers when he decided to build a smart door lock after bicycles were stolen from him and his roommates due to not locking their front door.

## Features

The Tock kernel is written in the Rust language. The kernel relies on Rust's memory safety and type safety to isolate parts of the kernel from one another. This isolation makes it easier to write secure extensions to the operating system, as one component cannot modify the memory of another.
The system uses a process abstraction that provides complete isolation of memory and CPU resources between applications and the kernel. This allows Tock applications to be written in any language.
The Tock kernel does not have a shared heap and so does not support dynamic memory allocation within the kernel. All kernel memory is statically allocated. Application processes can dynamically allocate from their own memory.
When device memory is statically allocated, kernel software for managing shared abstraction like radio interfaces must make a static decision about the number of requests it will support. Tock allows kernel components to maintain state for dynamic process requests to kernel services using a mechanism called a grant. Each process has a region of its memory called the grant region, which only the Tock kernel can access. Using the grant region, the kernel can dynamically allocate memory from process memory.
Tock supports the following features, which can sometimes be found in embedded operating systems: concurrency, dependability from resource exhaustion, fault isolation, memory efficiency, and application updates at runtime.
The operating system is also customizable to run on different platforms and scheduling modules.

## Development and release

* On May 9, 2016, Tock was released at the OSDI conference. This was the first version of Tock.
* On February 13, 2018, Tock 1.0 was released. This was the first rolling release, which added support for nRF and TM4C series chips. Also included were some driver libraries that supported the 1.0 version system call interface.
* On April 25, 2018, version 1.1 was released. It included a new register interface and automatic deep sleep for most SAM4L peripherals.
* On November 30, 2018, Tock 1.3 was released. This version added support for Tock to run on non-Cortex-M platforms and an interface for the operating system to send and receive UDP packets.
* Tock version 1.4 was released on October 18, 2019 and included support for RISC-V architectures.
* On April 30, 2020, Tock version 1.5 was released. It included new features to remove unsafe from TBF parsing in the kernel and added generic components.
* Version 1.6 was released on October 23, 2020. This version added a scheduler trait, added support for four new boards, and included support for UART over USB.
* On August 27, 2021, rolling version 2.0 was released. It added two new system calls: AllowReadOnly and Exit. Tock 2.0 also required that apps be compiled for the new syscall interface.
* Tock 2.1 was released on September 7, 2022. Version 2.1 included support for new HILs and boards, bugfixes, and a new system call interface.
* On January 6, 2023, version 2.1.1 was released. It fixed an issue related to system call errors.

## Reception

Tock has been received well by the microcontroller community and has over 190 open source contributors as of October 2024. In 2022, the Ti50 firmware on the Google Security Chip (GSC) in Chromebooks started using Tock. Microsoft's Pluton root-of-trust chip also uses Tock. Google uses Tock for their OpenSK security key implementation.