blob: 3fd88d9ca907a8935d47e7ceb2b53023002fb316 [file] [log] [blame]
Armando Montanez42225322020-01-02 13:11:41 -08001.. highlight:: sh
2
Alexei Frolov0efdb112019-11-14 17:22:08 -08003.. toctree::
Wyatt Heplerb82f9952019-11-25 13:56:31 -08004 :maxdepth: 1
5 :hidden:
Alexei Frolov0efdb112019-11-14 17:22:08 -08006
Wyatt Heplerab4eb7a2020-01-08 18:04:31 -08007 Home <self>
Keir Mierle72cae432021-04-10 02:03:40 -07008 docs/getting_started
Wyatt Heplerb8476152021-04-06 15:28:32 -07009 Source Code <https://cs.opensource.google/pigweed/pigweed>
Keir Mierlebc6d4752020-07-23 14:00:28 -070010 Code Reviews <https://pigweed-review.googlesource.com>
11 Mailing List <https://groups.google.com/forum/#!forum/pigweed>
12 Chat Room <https://discord.gg/M9NSeTA>
Rob Mohra10ebdb2021-03-10 19:50:13 -080013 Issue Tracker <https://bugs.pigweed.dev/>
Keir Mierle72cae432021-04-10 02:03:40 -070014 docs/contributing
15 docs/code_of_conduct
Wyatt Heplerb82f9952019-11-25 13:56:31 -080016 docs/embedded_cpp_guide
Keir Mierlebc6d4752020-07-23 14:00:28 -070017 Code Style <docs/style_guide>
Ewout van Bekkumcc756c82021-05-12 07:57:43 -070018 docs/os_abstraction_layers
Armando Montanez08745582019-12-12 10:51:50 -080019 targets
Keir Mierlebc6d4752020-07-23 14:00:28 -070020 Build System <build_system>
Keir Mierleeaa7e922020-07-24 14:30:47 -070021 FAQ <docs/faq>
Keir Mierle086ef1c2020-03-19 02:03:51 -070022 docs/module_structure
23 module_guides
Keir Mierle72cae432021-04-10 02:03:40 -070024
25=======
26Pigweed
27=======
28Pigweed is an open source collection of embedded-targeted libraries--or as we
29like to call them, modules. These modules are building blocks and
30infrastructure that enable faster and more reliable development on
31small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics
32STM32L452 or the Nordic nRF52832.
33
34.. attention::
35
36 Pigweed is in **early access**; though many modules are shipping in
37 production already. If you're interested in using Pigweed, please reach out
38 in our `chat room <https://discord.gg/M9NSeTA>`_ or on the `mailing list
39 <https://groups.google.com/forum/#!forum/pigweed>`_.
40
41Getting Started
42---------------
43If you'd like to get set up with Pigweed, please visit the
44:ref:`docs-getting-started` guide.
45
46What does Pigweed offer?
47------------------------
48There are many modules in Pigweed; this section showcases a selection that
49produce visual output. For more information about the different Pigweed module
50offerings, refer to :ref:`docs-module-guides` section.
51
52``pw_watch`` - Build, flash, run, & test on save
53------------------------------------------------
54In the web development space, file system watchers are prevalent. These
55watchers trigger a web server reload on source change, making development much
56faster. In the embedded space, file system watchers are less prevalent;
57however, they are no less useful! The Pigweed watcher module makes it easy to
58instantly compile, flash, and run tests upon save. Combined with the GN-based
59build which expresses the full dependency tree, only the exact tests affected
60by a file change are run on saves.
61
62The demo below shows `pw_watch <module-pw_watch>`_ building for a
63STMicroelectronics STM32F429I-DISC1 development board, flashing the board with
64the affected test, and verifying the test runs as expected. Once this is set
65up, you can attach multiple devices to run tests in a distributed manner to
66reduce the time it takes to run tests.
67
68.. image:: docs/images/pw_watch_on_device_demo.gif
69 :width: 800
70 :alt: pw watch running on-device tests
71
72``pw_presubmit`` - Vacuum lint on every commit
73----------------------------------------------
74Presubmit checks are essential tools, but they take work to set up, and
75projects dont always get around to it. The
76`pw_presubmit <module-pw_presubmit>`_ module provides tools for setting up high
77quality presubmit checks for any project. We use this framework to run
78Pigweeds presubmit on our workstations and in our automated building tools.
79
80The ``pw_presubmit`` module includes ``pw format``, a tool that provides a
81unified interface for automatically formatting code in a variety of languages.
82With ``pw format``, you can format C, C++, Python, GN, and Go code according to
83configurations defined by your project. ``pw format`` leverages existing tools
84like ``clang-format``, and its simple to add support for new languages.
85
86.. image:: pw_presubmit/docs/pw_presubmit_demo.gif
87 :width: 800
88 :alt: pw presubmit demo
89
90``pw_env_setup`` - Cross platform embedded compiler setup
91---------------------------------------------------------
92A classic problem in the embedded space is reducing the **time from git clone
93to having a binary executing on a device**. An entire suite of tools is needed
94for building non-trivial production embedded projects, and need to be
95installed. For example:
96
97- A C++ compiler for your target device, and also for your host
98- A build system or three; for example, GN, Ninja, CMake, Bazel
99- A code formatting program like clang-format
100- A debugger like OpenOCD to flash and debug your embedded device
101- A known Python version with known modules installed for scripting
102- A Go compiler for the Go-based command line tools
103- ... and so on
104
105In the server space, container solutions like Docker or Podman solve this;
106however, container solutions are a mixed bag for embedded systems development
107where one frequently needs access to native system resources like USB devices,
108or must operate on Windows.
109
110`pw_env_setup <module-pw_env_setup>`_ is our compromise solution for this
111problem that works on Mac, Windows, and Linux. It leverages the Chrome
112Infrastructure Packaging Deployment system (CIPD) to bootstrap a Python
113installation, which in turn inflates a virtual environment. The tooling is
114installed into your workspace, and makes no changes to your system. This
115tooling is designed to be reused by any project.
116
117.. image:: docs/images/pw_env_setup_demo.gif
118 :width: 800
119 :alt: pw environment setup demo
120
121``pw_unit_test`` - Embedded testing for MCUs
122--------------------------------------------
123Unit testing is important, and Pigweed offers a portable library thats broadly
124compatible with `Google Test <https://github.com/google/googletest>`_. Unlike
125Google Test, `pw_unit_test <module-pw_unit_test>`_ is built on top of embedded
126friendly primitives; for example, it does not use dynamic memory allocation.
127Additionally, it is easy to port to new target platforms by implementing the
Rob Mohr640c75c2021-05-26 07:22:54 -0700128`test event handler interface <https://cs.opensource.google/pigweed/pigweed/+/main:pw_unit_test/public/pw_unit_test/event_handler.h>`_.
Keir Mierle72cae432021-04-10 02:03:40 -0700129
130Like other modules in Pigweed, ``pw_unit_test`` is designed for use in
131established codebases with their own build system, without the rest of Pigweed
132or the Pigweed integrated GN build. However, when combined with Pigweed's
133build, the result is a flexible and powerful setup that enables easily
134developing code on your desktop (with tests), then running the same tests
135on-device.
136
137.. image:: docs/images/pw_status_test.png
138 :width: 800
139 :alt: pw_status test run natively on host
140
141And more!
142---------
143Here is a selection of interesting modules:
144
145 - :ref:`module-pw_cpu_exception_cortex_m` - Robust low level hardware fault
146 handler for ARM Cortex-M; the handler even has unit tests written in
147 assembly to verify nested-hardware-fault handling!
148
149 - :ref:`module-pw_polyfill` - Similar to JavaScript “polyfill” libraries, this
150 module provides selected C++17 standard library components that are
151 compatible with C++11 and C++14.
152
153 - :ref:`module-pw_tokenizer` - Replace string literals from log statements
154 with 32-bit tokens, to reduce flash use, reduce logging bandwidth, and save
155 formatting cycles from log statements at runtime.
156
157 - :ref:`module-pw_kvs` - A key-value-store implementation for flash-backed
158 persistent storage with integrated wear levelling. This is a lightweight
159 alternative to a file system for embedded devices.
160
161 - :ref:`module-pw_protobuf` - An early preview of our wire-format-oriented
162 protocol buffer implementation. This protobuf compiler makes a different set
163 of implementation tradeoffs than the most popular protocol buffer library in
164 this space, nanopb.
165
166See the :ref:`docs-module-guides` for the complete list of modules and their
167documentation.