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