Google Launches Pigweed SDK for Embedded Development on Pi Picos and Other Microcontrollers
MMS • Sergio De Simone
Article originally posted on InfoQ. Visit InfoQ
Recently launched by Google in developer preview, the Pigweed SDK aims to make it easier to develop, debug, test, and deploy embedded C++ applications. At the heart of the SDK lies Bazel, Google’s own build system, which has been extended to better support workflows and requirements typical of embedded development.
The Pigweed SDK leverages the Pigweed collection of embedded programming libraries that Google launched a few years ago and enhances it through a tool ecosystem that includes a Clang/LLVM toolchain, an interactive REPL, IDE integration, and more.
Pigweed’s modern and modular approach makes it easy to design applications with significantly reduced debugging and maintenance overhead, thus making it a perfect choice for medium to large product teams.
Used in Google Pixel, Nest thermostats, DeepMind robots, as well as satellites and autonomous aerial drones, Pigweed is composed of many independent modules developers can adopt separately. For example, pw_presubmit provides an integrated suite of linters that are pre-configured for microcontroller developers; pw_target_runner runs tests in parallel across multiple devices; pw_watch is a watcher that automatically creates an image when a file is modified, flashes it to the device, and verifies it by running the specific tests affected by the code changes.
The SDK helps embedded developers handle complex workflows such as hermetic building, flashing, and testing; structuring their codebases around hardware-agnostic C++; communicating with embedded hardware over RPC; and simulating Pico devices on a host computer. Cross-platform builds are supported on both macOS and Linux, with Windows support forthcoming.
One of the main contributions coming with the SDK is Sense, a complete showcase project. According to Google, Sense is a medium-sized project showing how a lot of Pigweed components work together. Sense is a simplistic air quality monitor that captures realistic flows such as integrating multiple inputs (sensors, buttons) and outputs (RGB LED), state machine management, and more. The Sense project is accompanied by a tutorial that provides a hands-on walkthrough of the codebase.
Also included is integration with Visual Studio Code with C++, Starlark code intelligence and out-of-the-box support for Bazel commands. Thanks to this module, Visual Studio Code provides code navigation, code completion, tooltips, errors and warnings, code formatting, and more, making it easier to use Pigweed modules.
Additionally, the SDK brings support for GitHub Actions, showing how to run a pre-submit action when a PR is sent and a post-submit action when the PR is finally merged. The actions involve checking out the code, installing Bazel, and building and testing the project, with an optional linter step.
Raspberry Pi has been working for almost a year with Google to add support for their Pico 1 and 2 devices to the Pigweed SDK.
Bazel is an important part of the Pigweed project, and the team believes it’s going to be the future of embedded software development, making it easier for large, professional embedded development teams to build prototypes and products on top of RP2350.
Pigweed SDK, in Google’s words, aims to become the best way to develop for the Pico family of devices, which are readily available today. This approach makes it possible to start prototyping quickly and easily and then target the Pigweed SDK to custom hardware without any major rewrite at a later stage.