Introduction
We at Raspberry Pi are excited about Google’s open-source Pigweed project. Pigweed helps programmers and teams of developers build great software for embedded devices like our new RP2350 microcontroller. We appreciate projects that lower the barriers to professional embedded development. I believe Pigweed and its Bazel build system can change the way a large team creates embedded software at scale.
In this commentary, I will provide an overview of the Pigweed project and discuss how it benefits Raspberry Pi and the developer community. I will also highlight some example applications that demonstrate Pigweed’s capabilities. I hope that this commentary helps readers understand why Pigweed is such an important project and what it enables for embedded software development.
Pigweed Overview
Pigweed is an open-source project launched by Google in 2020 to address challenges in embedded software development. Some of the key problems Pigweed aims to solve include:
- Lack of standardized tooling: Embedded software often relies on vendor-specific and non-portable toolchains. Pigweed provides fully open-source Clang/LLVM tooling that works across platforms.
- Difficulty scaling development teams: As projects grow, code organization, testing, and reproducibility become huge challenges without standard build systems. Pigweed utilizes Bazel to address these issues.
- Limited standards compliance: Embedded C/C++ libraries often have outdated functionality and poor standards adherence. Pigweed offers modern, compliant libraries.
- Hardware dependence: Code is typically written close to the metal which limits portability. Pigweed promotes hardware abstraction through its library approach.
- Debugging headaches: Tracing bugs across hardware, OS, and application layers is difficult without standardized interfaces. Pigweed includes tracing, logging, and introspection tools.
To solve these problems, Pigweed provides fully open-source toolchains, library-driven hardware abstraction, RPC interfaces, build system integration, and more. The goal is to modernize embedded software development and enable larger professional teams.
Benefits of Raspberry Pi
Pigweed brings several benefits for Raspberry Pi and its community of developers:
- Standardization: Pigweed’s tools and libraries work across all Raspberry Pi microcontrollers like RP2040 and RP2350, increasing code portability.
- Professionalization: Bazel integration helps transition hobbyists to professional embedded software careers by promoting best practices.
- Collaboration: The centralized open source model lowers barriers for companies and external contributors to participate in development.
- Maintainability: Well-structured code designed for scaling makes software easier to understand, modify, and maintain over its lifetime.
- Innovation: Freed from tooling constraints, developers can focus energy on new applications rather than the reinvention of wheels.
For Raspberry Pi, Pigweed aligns well with our mission of lowering costs and requiring barriers for education and professional embedded development. The growth of Pigweed directly supports the growth of the Raspberry Pi ecosystem.
Example Applications
To demonstrate Pigweed’s capabilities, its developers have created several example applications, some of which are highlighted here:
Enviro+ Demo
This demo application interfaces with the Pimoroni Enviro+ environmental sensor add-on for RP2040. It shows how to communicate with peripherals over RPC, log sensor readings, and command/control the device from a REPL interface. This demo leverages many Pigweed libraries and builds features.
Kudzu Game Boy Badge
Built as a fun tribute to retro handhelds, this Game Boy-like system runs basic games on a QVGA touchscreen. It demonstrates Pigweed’s portability by replicating an application across different MCUs like RP2040 and controlling hardware directly from C++. The open design inspires further experimentation.
Pigweed OS
A lightweight RTOS for embedded written entirely in C++ using Pigweed’s libraries. It provides multithreading, synchronization, timer management, and more via an object-oriented interface. Compared to a bare metal approach, this simplifies development for complex real-time systems.
AWS IoT Device SDK
An adaptation of the AWS IoT SDK for embedded use via Pigweed. It shows large existing codebases can integrate Pigweed libraries and build systems, extending their functionality to new microcontrollers and devices.
These diverse applications exemplify how Pigweed streamlines code reuse across hardware, facilitates complex functionality through its libraries, and accelerates prototyping – all improving productivity for hardware-oriented developers.
Conclusion
In conclusion, the Google Pigweed project is a promising step towards standardizing and modernizing embedded software development practices. By providing open tools, extensible libraries, and integration with scalable build systems, Pigweed lowers the barriers for large and small teams to deliver high-quality, maintainable software for microcontrollers and embedded appliances.
Raspberry Pi strongly supports Pigweed given its synergistic goals of expanding the community and capabilities around accessible technologies like the RP2040 and RP2350. Including Raspberry Pi in Pigweed real-world demos and the upstream maintenance of Bazel tooling shows the mutually beneficial collaboration between these projects. Going forward, Pigweed’s continued growth will help embedded software engineering to better realize its full potential.
FAQ
What is Bazel?
Bazel is an open-source build and test tool intended for Google. It manages dependencies and builds code in parallel to improve speed and reproducibility. Bazel is a core part of the Pigweed project as it enables building, flashing, and testing at the scale needed for large embedded teams.
Who maintains Pigweed?
Pigweed is an open governance project led by Google but maintained by an open community of contributors. Google engineers still play a leadership role in tooling, architecture, and roadmap, but external contributors are encouraged to get involved via GitHub.
Does Pigweed only work with Raspberry Pi?
No, Pigweed aims to be as portable as possible. While it has been implemented for RP2040 and RP2350, the goal is for code built with Pigweed to compile and run on any compatible MCU. The team is actively working on ports to other platforms like STM32, ESP32, and Nvidia Jetson.
Is Pigweed intended for professionals or hobbyists?
Both! Pigweed helps to bridge the gap between hobbyists and professionals. Its focus on standardization, tooling, and scale benefits larger commercial development but should not exclude individual developers. Hobbyists can benefit from library-driven development while also gaining skills applicable to the industry.
Do I need to rewrite my code to use Pigweed?
No, existing code can often integrate Pigweed incrementally. For example, a project may start by just integrating Bazel for easier building before adapting libraries and tooling. Pigweed is designed so that code can choose precisely which components to use based on the specific goals and constraints of each application.