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