Armando Montanez | 4222532 | 2020-01-02 13:11:41 -0800 | [diff] [blame] | 1 | .. highlight:: sh |
| 2 | |
Alexei Frolov | 0efdb11 | 2019-11-14 17:22:08 -0800 | [diff] [blame] | 3 | .. toctree:: |
Wyatt Hepler | b82f995 | 2019-11-25 13:56:31 -0800 | [diff] [blame] | 4 | :maxdepth: 1 |
| 5 | :hidden: |
Alexei Frolov | 0efdb11 | 2019-11-14 17:22:08 -0800 | [diff] [blame] | 6 | |
Wyatt Hepler | ab4eb7a | 2020-01-08 18:04:31 -0800 | [diff] [blame] | 7 | Home <self> |
Keir Mierle | 72cae43 | 2021-04-10 02:03:40 -0700 | [diff] [blame] | 8 | docs/getting_started |
Wyatt Hepler | b847615 | 2021-04-06 15:28:32 -0700 | [diff] [blame] | 9 | Source Code <https://cs.opensource.google/pigweed/pigweed> |
Keir Mierle | bc6d475 | 2020-07-23 14:00:28 -0700 | [diff] [blame] | 10 | 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 Mohr | a10ebdb | 2021-03-10 19:50:13 -0800 | [diff] [blame] | 13 | Issue Tracker <https://bugs.pigweed.dev/> |
Keir Mierle | 72cae43 | 2021-04-10 02:03:40 -0700 | [diff] [blame] | 14 | docs/contributing |
| 15 | docs/code_of_conduct |
Wyatt Hepler | b82f995 | 2019-11-25 13:56:31 -0800 | [diff] [blame] | 16 | docs/embedded_cpp_guide |
Keir Mierle | bc6d475 | 2020-07-23 14:00:28 -0700 | [diff] [blame] | 17 | Code Style <docs/style_guide> |
Ewout van Bekkum | cc756c8 | 2021-05-12 07:57:43 -0700 | [diff] [blame] | 18 | docs/os_abstraction_layers |
Armando Montanez | 0874558 | 2019-12-12 10:51:50 -0800 | [diff] [blame] | 19 | targets |
Keir Mierle | bc6d475 | 2020-07-23 14:00:28 -0700 | [diff] [blame] | 20 | Build System <build_system> |
Keir Mierle | eaa7e92 | 2020-07-24 14:30:47 -0700 | [diff] [blame] | 21 | FAQ <docs/faq> |
Keir Mierle | 086ef1c | 2020-03-19 02:03:51 -0700 | [diff] [blame] | 22 | docs/module_structure |
| 23 | module_guides |
Keir Mierle | 72cae43 | 2021-04-10 02:03:40 -0700 | [diff] [blame] | 24 | |
| 25 | ======= |
| 26 | Pigweed |
| 27 | ======= |
| 28 | Pigweed is an open source collection of embedded-targeted libraries--or as we |
| 29 | like to call them, modules. These modules are building blocks and |
| 30 | infrastructure that enable faster and more reliable development on |
| 31 | small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics |
| 32 | STM32L452 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 | |
| 41 | Getting Started |
| 42 | --------------- |
| 43 | If you'd like to get set up with Pigweed, please visit the |
| 44 | :ref:`docs-getting-started` guide. |
| 45 | |
| 46 | What does Pigweed offer? |
| 47 | ------------------------ |
| 48 | There are many modules in Pigweed; this section showcases a selection that |
| 49 | produce visual output. For more information about the different Pigweed module |
| 50 | offerings, refer to :ref:`docs-module-guides` section. |
| 51 | |
| 52 | ``pw_watch`` - Build, flash, run, & test on save |
| 53 | ------------------------------------------------ |
| 54 | In the web development space, file system watchers are prevalent. These |
| 55 | watchers trigger a web server reload on source change, making development much |
| 56 | faster. In the embedded space, file system watchers are less prevalent; |
| 57 | however, they are no less useful! The Pigweed watcher module makes it easy to |
| 58 | instantly compile, flash, and run tests upon save. Combined with the GN-based |
| 59 | build which expresses the full dependency tree, only the exact tests affected |
| 60 | by a file change are run on saves. |
| 61 | |
| 62 | The demo below shows `pw_watch <module-pw_watch>`_ building for a |
| 63 | STMicroelectronics STM32F429I-DISC1 development board, flashing the board with |
| 64 | the affected test, and verifying the test runs as expected. Once this is set |
| 65 | up, you can attach multiple devices to run tests in a distributed manner to |
| 66 | reduce 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 | ---------------------------------------------- |
| 74 | Presubmit checks are essential tools, but they take work to set up, and |
| 75 | projects don’t always get around to it. The |
| 76 | `pw_presubmit <module-pw_presubmit>`_ module provides tools for setting up high |
| 77 | quality presubmit checks for any project. We use this framework to run |
| 78 | Pigweed’s presubmit on our workstations and in our automated building tools. |
| 79 | |
| 80 | The ``pw_presubmit`` module includes ``pw format``, a tool that provides a |
| 81 | unified interface for automatically formatting code in a variety of languages. |
| 82 | With ``pw format``, you can format C, C++, Python, GN, and Go code according to |
| 83 | configurations defined by your project. ``pw format`` leverages existing tools |
| 84 | like ``clang-format``, and it’s 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 | --------------------------------------------------------- |
| 92 | A classic problem in the embedded space is reducing the **time from git clone |
| 93 | to having a binary executing on a device**. An entire suite of tools is needed |
| 94 | for building non-trivial production embedded projects, and need to be |
| 95 | installed. 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 | |
| 105 | In the server space, container solutions like Docker or Podman solve this; |
| 106 | however, container solutions are a mixed bag for embedded systems development |
| 107 | where one frequently needs access to native system resources like USB devices, |
| 108 | or must operate on Windows. |
| 109 | |
| 110 | `pw_env_setup <module-pw_env_setup>`_ is our compromise solution for this |
| 111 | problem that works on Mac, Windows, and Linux. It leverages the Chrome |
| 112 | Infrastructure Packaging Deployment system (CIPD) to bootstrap a Python |
| 113 | installation, which in turn inflates a virtual environment. The tooling is |
| 114 | installed into your workspace, and makes no changes to your system. This |
| 115 | tooling 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 | -------------------------------------------- |
| 123 | Unit testing is important, and Pigweed offers a portable library that’s broadly |
| 124 | compatible with `Google Test <https://github.com/google/googletest>`_. Unlike |
| 125 | Google Test, `pw_unit_test <module-pw_unit_test>`_ is built on top of embedded |
| 126 | friendly primitives; for example, it does not use dynamic memory allocation. |
| 127 | Additionally, it is easy to port to new target platforms by implementing the |
Rob Mohr | 640c75c | 2021-05-26 07:22:54 -0700 | [diff] [blame] | 128 | `test event handler interface <https://cs.opensource.google/pigweed/pigweed/+/main:pw_unit_test/public/pw_unit_test/event_handler.h>`_. |
Keir Mierle | 72cae43 | 2021-04-10 02:03:40 -0700 | [diff] [blame] | 129 | |
| 130 | Like other modules in Pigweed, ``pw_unit_test`` is designed for use in |
| 131 | established codebases with their own build system, without the rest of Pigweed |
| 132 | or the Pigweed integrated GN build. However, when combined with Pigweed's |
| 133 | build, the result is a flexible and powerful setup that enables easily |
| 134 | developing code on your desktop (with tests), then running the same tests |
| 135 | on-device. |
| 136 | |
| 137 | .. image:: docs/images/pw_status_test.png |
| 138 | :width: 800 |
| 139 | :alt: pw_status test run natively on host |
| 140 | |
| 141 | And more! |
| 142 | --------- |
| 143 | Here 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 | |
| 166 | See the :ref:`docs-module-guides` for the complete list of modules and their |
| 167 | documentation. |