Product of the Week: Toit Software Platform
September 07, 2021
Why isn’t there a programming language yet that has been optimized for the IoT? Well, there is.
Toit is both a language and cloud platform that simplifies software development for connected microcontrollers as well as the orchestration and management of those targets once applications are deployed.
The object-oriented Toit language, which the company says is easier to learn and less risky than C but 20x faster than MicroPython, was designed for low-cost, low-power ESP32 microcontrollers with as little as 500 KB of RAM. It is declarative and statically analyzable, as well as safe and garbage collected, and easy to work with in part because Toit code runs in virtual machines.
The Toit VMs sandbox software into partitions, which minimizes the effects of application crashes and simplifies deploying over-the-air (OTA) updates from the Toit platform. A cloud orchestration component allows these capabilities to be delivered to fleets of devices.
Its emphasis on connectivity support, efficiency, and manageability make it one of the first languages, if not the first, developed specifically for the IoT.
The Toit Platform in Action
Toit software platform includes models that target different ESP32 core hardware, which allows the Toit stack to be used in various systems. Some models can even be customized to work with different core peripherals. For instance, the esp32-4mb model supports ESP32 microcontrollers with at least 4MB of flash, including the the ESP32-D0WDQ6 and ESP32-D0WD-V*classical devices that leverage a dual-core Xtensa LX6 architecture.
The Toit language integrates with the Visual Studio IDEs but can also be written in the Toit Console or command line interface (CLI) tool that allows users to run small programs on virtual hardware models stored in the Toit cloud. Cloud orchestration is handled using two APIs: a publicly available gRPC API and a data ingestion API. The gRPC allows public operations for client applications on the console and adds a layer of integrity by requiring that requests be authorized. After data is collected on endpoints and ready to be sent to the Toit cloud, the data ingestion API groups it into metric or log categories where it remains through the ingestion process.
All communication between a device and the Toit cloud, whether Wi-Fi or cellular, is encrypted. The platform also requires that software updates are cryptographically signed, rejecting any code or system updates that are not authorized.
These security features pair nicely with the ESP32 MPU, which offers secure boot with a chain of trust and crypto key.
Getting Started with the Toit Platform
To begin using Toit, you must first create an account to gain access to the Toit cloud. Next comes installing the CLI, which you'll need to setup whatever ESP32-based MCU you're working with in order to deploy apps to the target. Once the device is provisioned by plugging it into your host via a USB cable and connecting it to a local Wi-F network, Toit programs can be deployed a single time or as long-lived apps.
If you’re interested in the platform but don’t have an ESP32 yet, you can still practice through the Toit playground or a simulated device.
More detailed, step-by-step instructions can be found in a quick-start guide, which makes the assumption that Toit is already installed on your machine. Once all this is completed, you can use online documentation to start learning the Toit language and developing and deploying your own IoT apps through the Toit platform.
For more information, visit https://toit.io or check out the resources below.