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