aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmando Montanez <amontanez@google.com>2020-03-13 13:06:24 -0700
committerCQ Bot Account <commit-bot@chromium.org>2020-03-17 00:13:35 +0000
commit0054a9be7053688b4001319ca7e9bce9340f9e9f (patch)
tree561dc2ca86f109859f4684bc2749fd5c9333c737
parent59bcd9003fad77105cacc4867ec62aa8e8ba0477 (diff)
downloadpigweed-0054a9be7053688b4001319ca7e9bce9340f9e9f.tar.gz
Docs: Add missing RST docs
Adds dcos.rst files for all modules lacking documentation. Change-Id: Ief5594831d31fcb876381a4a3886382fab7d595e
-rw-r--r--docs/BUILD.gn5
-rw-r--r--modules.gni1
-rw-r--r--pw_base64/BUILD.gn5
-rw-r--r--pw_base64/docs.rst15
-rw-r--r--pw_boot_armv7m/docs.rst26
-rw-r--r--pw_build/docs.rst4
-rw-r--r--pw_checksum/docs.rst4
-rw-r--r--pw_cli/BUILD.gn19
-rw-r--r--pw_cli/README.md5
-rw-r--r--pw_cli/docs.rst31
-rw-r--r--pw_containers/docs.rst4
-rw-r--r--pw_cpu_exception/docs.rst4
-rw-r--r--pw_env_setup/docs.rst4
-rw-r--r--pw_kvs/docs.rst15
-rw-r--r--pw_log_basic/BUILD.gn6
-rw-r--r--pw_log_basic/docs.rst21
-rw-r--r--pw_minimal_cpp_stdlib/docs.rst10
-rw-r--r--pw_polyfill/docs.rst6
-rw-r--r--pw_presubmit/docs.rst2
-rw-r--r--pw_protobuf/docs.rst22
-rw-r--r--pw_span/docs.rst2
-rw-r--r--pw_string/docs.rst32
-rw-r--r--pw_sys_io_baremetal_stm32f429/docs.rst4
-rw-r--r--pw_sys_io_stdio/docs.rst2
-rw-r--r--pw_target_runner/docs.rst2
-rw-r--r--pw_tokenizer/docs.rst25
-rw-r--r--pw_toolchain/BUILD.gn5
-rw-r--r--pw_toolchain/docs.rst31
-rw-r--r--pw_unit_test/docs.rst15
-rw-r--r--pw_varint/docs.rst4
-rw-r--r--pw_watch/docs.rst20
31 files changed, 259 insertions, 92 deletions
diff --git a/docs/BUILD.gn b/docs/BUILD.gn
index 04310a981..e32f4b82f 100644
--- a/docs/BUILD.gn
+++ b/docs/BUILD.gn
@@ -51,17 +51,21 @@ pw_doc_gen("docs") {
":target_docs",
"$dir_pw_assert:docs",
"$dir_pw_assert_basic:docs",
+ "$dir_pw_base64:docs",
"$dir_pw_bloat:docs",
"$dir_pw_boot_armv7m:docs",
"$dir_pw_build:docs",
"$dir_pw_checksum:docs",
+ "$dir_pw_cli:docs",
"$dir_pw_containers:docs",
"$dir_pw_cpu_exception:docs",
"$dir_pw_cpu_exception_armv7m:docs",
"$dir_pw_docgen:docs",
"$dir_pw_doctor:docs",
"$dir_pw_env_setup:docs",
+ "$dir_pw_kvs:docs",
"$dir_pw_log:docs",
+ "$dir_pw_log_basic:docs",
"$dir_pw_minimal_cpp_stdlib:docs",
"$dir_pw_module:docs",
"$dir_pw_polyfill:docs",
@@ -77,6 +81,7 @@ pw_doc_gen("docs") {
"$dir_pw_sys_io_stdio:docs",
"$dir_pw_target_runner:docs",
"$dir_pw_tokenizer:docs",
+ "$dir_pw_toolchain:docs",
"$dir_pw_unit_test:docs",
"$dir_pw_varint:docs",
"$dir_pw_watch:docs",
diff --git a/modules.gni b/modules.gni
index e758521df..6fd85fe63 100644
--- a/modules.gni
+++ b/modules.gni
@@ -23,6 +23,7 @@ dir_pw_bloat = "$dir_pigweed/pw_bloat"
dir_pw_boot_armv7m = "$dir_pigweed/pw_boot_armv7m"
dir_pw_build = "$dir_pigweed/pw_build"
dir_pw_checksum = "$dir_pigweed/pw_checksum"
+dir_pw_cli = "$dir_pigweed/pw_cli"
dir_pw_containers = "$dir_pigweed/pw_containers"
dir_pw_cpu_exception = "$dir_pigweed/pw_cpu_exception"
dir_pw_cpu_exception_armv7m = "$dir_pigweed/pw_cpu_exception_armv7m"
diff --git a/pw_base64/BUILD.gn b/pw_base64/BUILD.gn
index eec8d3176..00830cc50 100644
--- a/pw_base64/BUILD.gn
+++ b/pw_base64/BUILD.gn
@@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations under
# the License.
+import("$dir_pw_docgen/docs.gni")
import("$dir_pw_unit_test/test.gni")
config("default_config") {
@@ -38,3 +39,7 @@ pw_test("base64_test") {
"base64_test.cc",
]
}
+
+pw_doc_group("docs") {
+ sources = [ "docs.rst" ]
+}
diff --git a/pw_base64/docs.rst b/pw_base64/docs.rst
new file mode 100644
index 000000000..3872e3eb4
--- /dev/null
+++ b/pw_base64/docs.rst
@@ -0,0 +1,15 @@
+.. _chapter-pw-base64:
+
+.. default-domain:: cpp
+
+.. highlight:: sh
+
+---------
+pw_base64
+---------
+This module provides functions for encoding, decoding, and validating Base64
+data as specified by `RFC 3548 <https://tools.ietf.org/html/rfc3548>`_ and
+`RFC 4648 <https://tools.ietf.org/html/rfc4648>`_.
+
+.. note::
+ The documentation for this module is currently incomplete.
diff --git a/pw_boot_armv7m/docs.rst b/pw_boot_armv7m/docs.rst
index 94289349d..74132897e 100644
--- a/pw_boot_armv7m/docs.rst
+++ b/pw_boot_armv7m/docs.rst
@@ -52,10 +52,10 @@ regarding which configuration options are required.
Vector Table
------------
-Targets using pw_boot_armv7m will need to provide an ARMv7-M interrupt vector
-table (ARMv7-M Architecture Reference Manual DDI 0403E.b section B1.5.2 and
-B1.5.3). This is done by storing an array into the ``.vector_table`` section,
-and properly configuring ``PW_BOOT_VECTOR_TABLE_*`` preprocessor
+Targets using ``pw_boot_armv7m`` will need to provide an ARMv7-M interrupt
+vector table (ARMv7-M Architecture Reference Manual DDI 0403E.b section B1.5.2
+and B1.5.3). This is done by storing an array into the ``.vector_table``
+section, and properly configuring ``PW_BOOT_VECTOR_TABLE_*`` preprocessor
defines to cover the address region your SoC expects the vector table to be
located at (often the beginning of the flash region). If using a bootloader,
ensure VTOR (Vector Table Offset Register) is configured to point to the vector
@@ -113,36 +113,36 @@ Configuration
These configuration options can be controlled by appending to
``pw_boot_armv7m_config.defines`` as part of a Pigweed target config file.
-**PW_BOOT_HEAP_SIZE** (required):
+``PW_BOOT_HEAP_SIZE`` (required):
How much memory (in bytes) to reserve for the heap. This can be zero.
-**PW_BOOT_MIN_STACK_SIZE** (required):
+``PW_BOOT_MIN_STACK_SIZE`` (required):
The minimum size reserved for the main stack. If statically allocated memory
begins to cut into the minimum, a link error will be emitted.
-**PW_BOOT_FLASH_BEGIN** (required):
+``PW_BOOT_FLASH_BEGIN`` (required):
The start address of the MCU's flash region. This region must NOT include the
vector table. (i.e. if the VECTOR_TABLE is in flash, the flash region
should begin *after* the vtable)
-**PW_BOOT_FLASH_SIZE** (required):
+``PW_BOOT_FLASH_SIZE`` (required):
Size of the flash region in bytes.
-**PW_BOOT_RAM_BEGIN** (required):
+``PW_BOOT_RAM_BEGIN`` (required):
The start address of the MCU's RAM region.
-**PW_BOOT_RAM_SIZE** (required):
+``PW_BOOT_RAM_SIZE`` (required):
Size of the RAM region in bytes.
-**PW_BOOT_VECTOR_TABLE_BEGIN** (required):
+``PW_BOOT_VECTOR_TABLE_BEGIN`` (required):
Address the target MCU expects the link-time vector table to be located at. This
is typically the beginning of the flash region. While the vector table may be
changed later in the boot process, a minimal vector table MUST be present for
the MCU to operate as expected.
-**PW_BOOT_VECTOR_TABLE_SIZE** (required):
+``PW_BOOT_VECTOR_TABLE_SIZE`` (required):
Number of bytes to reserve for the ARMv7-M vector table.
Dependencies
============
- * pw_preprocessor module
+ * ``pw_preprocessor`` module
diff --git a/pw_build/docs.rst b/pw_build/docs.rst
index ce8d5e598..147c6917c 100644
--- a/pw_build/docs.rst
+++ b/pw_build/docs.rst
@@ -22,7 +22,7 @@ project with minimal effort.
Beyond just compiling code, Pigweed’s GN build system can also:
* Generate HTML documentation, via our Sphinx integration (with ``pw_docgen``)
-* Display memory usage report cards (with pw_bloat)
+* Display memory usage report cards (with ``pw_bloat``)
* Incrementally run unit tests after code changes (with ``pw_target_runner``)
* And more!
@@ -38,7 +38,7 @@ This module's ``build.gn`` file contains a number of C/C++ ``config``
declarations that are used by upstream Pigweed to set some architecture-agnostic
compiler defaults. (See Pigweed's ``//BUILDCONFIG.gn``)
-pw_build also provides several useful GN templates that are used throughout
+``pw_build`` also provides several useful GN templates that are used throughout
Pigweed.
Templates
diff --git a/pw_checksum/docs.rst b/pw_checksum/docs.rst
index 5ae1a8807..793dcdc24 100644
--- a/pw_checksum/docs.rst
+++ b/pw_checksum/docs.rst
@@ -5,7 +5,7 @@
-----------
pw_checksum
-----------
-The pw_checksum module provides functions for calculating checksums.
+The ``pw_checksum`` module provides functions for calculating checksums.
pw_checksum/ccitt_crc16.h
=========================
@@ -37,4 +37,4 @@ Compatibility
Dependencies
============
-* pw_span
+* ``pw_span``
diff --git a/pw_cli/BUILD.gn b/pw_cli/BUILD.gn
new file mode 100644
index 000000000..31d536d5d
--- /dev/null
+++ b/pw_cli/BUILD.gn
@@ -0,0 +1,19 @@
+# Copyright 2020 The Pigweed Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+import("$dir_pw_docgen/docs.gni")
+
+pw_doc_group("docs") {
+ sources = [ "docs.rst" ]
+}
diff --git a/pw_cli/README.md b/pw_cli/README.md
index 8d0e36316..e2287f94e 100644
--- a/pw_cli/README.md
+++ b/pw_cli/README.md
@@ -1,4 +1,5 @@
-This directory contains the `pw` tool that facilitates working with
-Pigweed. Example starting functionality is the ability to watch the Pigweed source for changes and re-run tests.
+This directory contains the `pw` command line interface (CLI) that facilitates
+working with Pigweed. One example tool exposed by pw_cli is pw_watch, a file
+system watcher that triggers builds on source file changes.
This code is experimental and unfinished.
diff --git a/pw_cli/docs.rst b/pw_cli/docs.rst
new file mode 100644
index 000000000..92f839bfd
--- /dev/null
+++ b/pw_cli/docs.rst
@@ -0,0 +1,31 @@
+.. _chapter-pw-cli:
+
+.. default-domain:: python
+
+.. highlight:: sh
+
+------
+pw_cli
+------
+This directory contains the `pw` command line interface (CLI) that facilitates
+working with Pigweed. The CLI module adds several subcommands prefixed with
+`pw`, and provides a mechanism for other Pigweed modules to behave as "plugins"
+and register themselves as `pw` commands as well. After activating the Pigweed
+environment, these commands will be available for use.
+
+Some examples:
+
+.. code:: sh
+
+ $ pw doctor
+ $ pw format
+ $ pw logdemo
+ $ pw module-check
+ $ pw presubmit
+ $ pw test
+ $ pw watch
+
+To see an up-to-date list of `pw` subcommands, run ``pw --help``.
+
+.. note::
+ The documentation for this module is currently incomplete.
diff --git a/pw_containers/docs.rst b/pw_containers/docs.rst
index 377ac9280..27b005b62 100644
--- a/pw_containers/docs.rst
+++ b/pw_containers/docs.rst
@@ -5,7 +5,7 @@
-------------
pw_containers
-------------
-The pw_containers module provides embedded-friendly container classes.
+The ``pw_containers`` module provides embedded-friendly container classes.
pw_vector
=========
@@ -27,4 +27,4 @@ Compatibility
Dependencies
============
-* pw_span
+* ``pw_span``
diff --git a/pw_cpu_exception/docs.rst b/pw_cpu_exception/docs.rst
index 7f14c57d8..ec5a27526 100644
--- a/pw_cpu_exception/docs.rst
+++ b/pw_cpu_exception/docs.rst
@@ -55,8 +55,8 @@ handler will be tied to the backend implementation of the CPU exception module.
Dependencies
============
- * pw_span
- * pw_preprocessor
+ * ``pw_span``
+ * ``pw_preprocessor``
Backend Expectations
====================
diff --git a/pw_env_setup/docs.rst b/pw_env_setup/docs.rst
index f02930c90..f67edf3cf 100644
--- a/pw_env_setup/docs.rst
+++ b/pw_env_setup/docs.rst
@@ -21,7 +21,7 @@ however, in our experience container solutions are a mixed bag for embedded
systems development where one frequently needs access to native system
resources like USB devices, or must operate on Windows.
-pw_env_setup is our compromise solution for this problem that works on Mac,
+``pw_env_setup`` is our compromise solution for this problem that works on Mac,
Windows, and Linux. It leverages the Chrome packaging system `CIPD`_ to
bootstrap a Python installation, which in turn inflates a virtual
environment. The tooling is installed into your workspace, and makes no
@@ -31,7 +31,7 @@ project.
.. _CIPD: https://github.com/luci/luci-go/tree/master/cipd
.. warning::
- At this time pw_env_setup works for us, but isn’t well tested. We don’t
+ At this time ``pw_env_setup`` works for us, but isn’t well tested. We don’t
suggest relying on it just yet. However, we are interested in experience
reports; if you give it a try, please `send us a note`_ about your
experience.
diff --git a/pw_kvs/docs.rst b/pw_kvs/docs.rst
new file mode 100644
index 000000000..eea107343
--- /dev/null
+++ b/pw_kvs/docs.rst
@@ -0,0 +1,15 @@
+.. _chapter-pw-kvs:
+
+.. default-domain:: cpp
+
+.. highlight:: cpp
+
+------
+pw_kvs
+------
+``pw_kvs`` is Pigweed's Key Value Store (KVS) library. KVS is a flash-backed
+persistent storage system with integrated wear-leveling that serves as a
+relatively lightweight alternative to a file system.
+
+.. note::
+ The documentation for this module is currently incomplete.
diff --git a/pw_log_basic/BUILD.gn b/pw_log_basic/BUILD.gn
index 0efa82dd1..9e780585d 100644
--- a/pw_log_basic/BUILD.gn
+++ b/pw_log_basic/BUILD.gn
@@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations under
# the License.
+import("$dir_pw_docgen/docs.gni")
+
config("default_config") {
include_dirs = [ "public" ]
}
@@ -43,3 +45,7 @@ source_set("pw_log_basic_core") {
public = [ "public/pw_log_basic/log_basic.h" ]
sources = public + [ "log_basic.cc" ]
}
+
+pw_doc_group("docs") {
+ sources = [ "docs.rst" ]
+}
diff --git a/pw_log_basic/docs.rst b/pw_log_basic/docs.rst
new file mode 100644
index 000000000..2b8ca4108
--- /dev/null
+++ b/pw_log_basic/docs.rst
@@ -0,0 +1,21 @@
+.. _chapter-pw-log-basic:
+
+.. default-domain:: cpp
+
+.. highlight:: sh
+
+------------
+pw_log_basic
+------------
+``pw_log_basic`` is a ``pw_log backend`` that sends logs over ``pw_sys_io``. The
+destination of ``pw_sys_io`` depends on the ``pw_sys_io`` backend in use. This
+is controlled by the ``dir_pw_sys_io_backend`` variable in a target's
+``target_config.gni``.
+information.
+
+This module employs an internal buffer for formatting log strings, and currently
+has a fixed size of 150 bytes. Any final log statements that are larger than
+149 bytes (one byte used for a null terminator) will be truncated.
+
+.. note::
+ The documentation for this module is currently incomplete.
diff --git a/pw_minimal_cpp_stdlib/docs.rst b/pw_minimal_cpp_stdlib/docs.rst
index 904f3697d..c9e100621 100644
--- a/pw_minimal_cpp_stdlib/docs.rst
+++ b/pw_minimal_cpp_stdlib/docs.rst
@@ -5,11 +5,11 @@
---------------------
pw_minimal_cpp_stdlib
---------------------
-The pw_minimal_cpp_stdlib module provides an extremely limited implementation of
-the C++ Standard Library. This module falls far, far short of providing a
-complete C++ Standard Library and should only be used in dire situations where
-you happen to be compiling with C++17 but don't have a C++ Standard Library
-available to you.
+The ``pw_minimal_cpp_stdlib`` module provides an extremely limited
+implementation of the C++ Standard Library. This module falls far, far short of
+providing a complete C++ Standard Library and should only be used in dire
+situations where you happen to be compiling with C++17 but don't have a C++
+Standard Library available to you.
The C++ Standard Library headers (e.g. ``<cstdint>`` and ``<type_traits>``) are
defined in ``public/``. These files are symlinks to their implementations in
diff --git a/pw_polyfill/docs.rst b/pw_polyfill/docs.rst
index 4af066fba..48ef25f96 100644
--- a/pw_polyfill/docs.rst
+++ b/pw_polyfill/docs.rst
@@ -7,7 +7,7 @@
-----------
pw_polyfill
-----------
-The pw_polyfill module backports C++17 features to C++11 and C++14.
+The ``pw_polyfill`` module backports C++17 features to C++11 and C++14.
Compatibility
=============
@@ -18,8 +18,8 @@ Features
Adapt code to compile with older versions of C++
------------------------------------------------
-The pw_polyfill module provides features for adapting C++17 code to work when
-compiled with older C++ standards.
+The ``pw_polyfill`` module provides features for adapting C++17 code to work
+when compiled with older C++ standards.
- ``pw_polyfill/standard.h`` -- provides a macro for checking the C++ standard
- ``pw_polyfill/language_features.h`` -- provides macros for adapting code to
diff --git a/pw_presubmit/docs.rst b/pw_presubmit/docs.rst
index 01389b382..a8d1ff173 100644
--- a/pw_presubmit/docs.rst
+++ b/pw_presubmit/docs.rst
@@ -64,7 +64,7 @@ Members
Presubmit checks
----------------
-The pw_presubmit package includes presubmit checks that can be used with any
+The ``pw_presubmit`` package includes presubmit checks that can be used with any
project. These checks include:
* Check code format of several languages including C, C++, and Python
diff --git a/pw_protobuf/docs.rst b/pw_protobuf/docs.rst
index 11dd4e7bc..6395ef98c 100644
--- a/pw_protobuf/docs.rst
+++ b/pw_protobuf/docs.rst
@@ -13,25 +13,25 @@ the Protocol Buffer wire format.
Design
======
Unlike other protobuf libraries, which typically provide in-memory data
-structures to represent protobuf messages, pw_protobuf operates directly on the
-wire format and leaves data storage to the user. This has a few benefits. The
-primary one is that it allows the library to be incredibly small, with the
+structures to represent protobuf messages, ``pw_protobuf`` operates directly on
+the wire format and leaves data storage to the user. This has a few benefits.
+The primary one is that it allows the library to be incredibly small, with the
encoder and decoder each having a code size of around 1.5K and negligible RAM
usage. Users can choose the tradeoffs most suitable for their product on top of
this core implementation.
-pw_protobuf also provides zero-overhead C++ code generation which wraps its
+``pw_protobuf`` also provides zero-overhead C++ code generation which wraps its
low-level wire format operations with a user-friendly API for processing
specific protobuf messages. The code generation integrates with Pigweed's GN
build system.
Usage
=====
-pw_protobuf splits wire format encoding and decoding operations. Links to the
-design and APIs of each are listed in below.
+``pw_protobuf`` splits wire format encoding and decoding operations. Links to
+the design and APIs of each are listed in below.
-See also :ref:`chapter-pw-protobuf-compiler` for details on pw_protobuf's build
-system integration.
+See also :ref:`chapter-pw-protobuf-compiler` for details on ``pw_protobuf``'s
+build system integration.
**pw_protobuf functionality**
@@ -63,12 +63,12 @@ to the necessity of defining a struct capable of storing all configurations of
the message, which can grow incredibly large. In one project, Pigweed developers
encountered an 11K struct statically allocated for a single message---over twice
the size of the final encoded output! (This was what prompted the development of
-pw_protobuf.)
+``pw_protobuf``.)
To avoid this issue, it is possible to use nanopb's low-level encode/decode
functions to process individual message fields directly, but this loses all of
-the useful semantics of code generation. pw_protobuf is designed to optimize for
-this use case; it allows for efficient operations on the wire format with an
+the useful semantics of code generation. ``pw_protobuf`` is designed to optimize
+for this use case; it allows for efficient operations on the wire format with an
intuitive user interface.
Depending on the requirements of a project, either of these libraries could be
diff --git a/pw_span/docs.rst b/pw_span/docs.rst
index dbfc05364..9fff2f36c 100644
--- a/pw_span/docs.rst
+++ b/pw_span/docs.rst
@@ -7,7 +7,7 @@
-------
pw_span
-------
-The pw_span module provides an implementation of C++20's
+The ``pw_span`` module provides an implementation of C++20's
`std::span <https://en.cppreference.com/w/cpp/container/span>`_, which is a
non-owning view of an array of values. The intent is for ``pw::span``'s
interface to exactly match ``std::span``.
diff --git a/pw_string/docs.rst b/pw_string/docs.rst
index 25cf59c87..6f1c791bc 100644
--- a/pw_string/docs.rst
+++ b/pw_string/docs.rst
@@ -13,10 +13,11 @@ but require too much flash and memory for many embedded projects. The C string
functions are lighter weight, but can be difficult to use correctly. Mishandling
of null terminators or buffer sizes can result in serious bugs.
-The pw_string module provides the flexibility, ease-of-use, and safety of
+The ``pw_string`` module provides the flexibility, ease-of-use, and safety of
C++-style string manipulation, but with no dynamic memory allocation and a much
-smaller binary size impact. Using pw_string in place of the standard C functions
-eliminates issues related to buffer overflow or missing null terminators.
+smaller binary size impact. Using ``pw_string`` in place of the standard C
+functions eliminates issues related to buffer overflow or missing null
+terminators.
Compatibility
=============
@@ -24,9 +25,9 @@ C++17
Dependencies
============
-* pw_preprocessor
-* pw_status
-* pw_span
+* ``pw_preprocessor``
+* ``pw_status``
+* ``pw_span``
Features
========
@@ -48,21 +49,22 @@ using ``Format``.
pw::StringBuilder
-----------------
-StringBuilder facilitates building formatted strings in a fixed-size buffer.
-It is designed to give the flexibility of std::string and std::ostringstream,
-but with a small footprint. However, applications sensitive to code size should
-use StringBuilder with care.
+StringBuilder facilitates building formatted strings in a fixed-size buffer. It
+is designed to give the flexibility of ``std::string`` and
+``std::ostringstream``, but with a small footprint. However, applications
+sensitive to code size should use StringBuilder with care.
Size report: replacing snprintf with pw::StringBuilder
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The fixed code size cost of StringBuilder is significant, though smaller than
-std::snprintf. Using StringBuilder's << and append methods exclusively in
-place of snprintf reduces code size, but snprintf may be difficult to avoid.
+``std::snprintf``. Using StringBuilder's << and append methods exclusively in
+place of ``snprintf`` reduces code size, but ``snprintf`` may be difficult to
+avoid.
-The incremental code size cost of StringBuilder is comparable to snprintf if
+The incremental code size cost of StringBuilder is comparable to ``snprintf`` if
errors are handled. Each argument to StringBuilder's << expands to a function
-call, but one or two StringBuilder appends may have a smaller code size
-impact than a single snprintf call.
+call, but one or two StringBuilder appends may have a smaller code size impact
+than a single ``snprintf`` call.
.. include:: string_builder_size_report.rst
diff --git a/pw_sys_io_baremetal_stm32f429/docs.rst b/pw_sys_io_baremetal_stm32f429/docs.rst
index 934deca7f..44c68e360 100644
--- a/pw_sys_io_baremetal_stm32f429/docs.rst
+++ b/pw_sys_io_baremetal_stm32f429/docs.rst
@@ -61,5 +61,5 @@ Sample connection diagram
Dependencies
============
- * pw_sys_io facade
- * pw_preprocessor module
+ * ``pw_sys_io`` facade
+ * ``pw_preprocessor`` module
diff --git a/pw_sys_io_stdio/docs.rst b/pw_sys_io_stdio/docs.rst
index 553efbfa3..d4c195448 100644
--- a/pw_sys_io_stdio/docs.rst
+++ b/pw_sys_io_stdio/docs.rst
@@ -36,4 +36,4 @@ to an application built directly against stdio.
Dependencies
============
- * pw_sys_io facade
+ * ``pw_sys_io`` facade
diff --git a/pw_target_runner/docs.rst b/pw_target_runner/docs.rst
index 2fc87d628..2b8b8ca45 100644
--- a/pw_target_runner/docs.rst
+++ b/pw_target_runner/docs.rst
@@ -28,7 +28,7 @@ This library provides the core gRPC server and a mechanism through which worker
routines can be registered. Code using the library instantiates a server with
some custom workers for the desired target to run passed executables.
-The pw_target_runner module also provides a standalone
+The ``pw_target_runner`` module also provides a standalone
``pw_target_runner_server`` program which runs the server with configurable
workers that launch external processes to execute passed binaries. This
program should be sufficient to quickly get unit tests running in a simple
diff --git a/pw_tokenizer/docs.rst b/pw_tokenizer/docs.rst
index cb1ea913b..09f742d85 100644
--- a/pw_tokenizer/docs.rst
+++ b/pw_tokenizer/docs.rst
@@ -9,14 +9,14 @@ pw_tokenizer
------------
Logging is critical, but developers are often forced to choose between
-additional logging or saving crucial flash space. pw_tokenizer helps ameliorate
-this issue by providing facilities to convert strings to integer tokens that can
-be decoded off-device, enabling extensive logging and debugging with
-significantly less memory usage. Printf-style format strings such as ``"My name
-is %s"`` are also supported; pw_tokenizer encodes the arguments into compact
-binary form at runtime. We’ve seen over 50% optimization in log contents and
-substantial savings in flash size, with additional benefits such as minimizing
-communication bandwidth and reducing CPU usage.
+additional logging or saving crucial flash space. ``pw_tokenizer`` helps
+ameliorate this issue by providing facilities to convert strings to integer
+tokens that can be decoded off-device, enabling extensive logging and debugging
+with significantly less memory usage. Printf-style format strings such as ``"My
+name is %s"`` are also supported; ``pw_tokenizer`` encodes the arguments into
+compact binary form at runtime. We’ve seen over 50% optimization in log contents
+and substantial savings in flash size, with additional benefits such as
+minimizing communication bandwidth and reducing CPU usage.
.. note::
This usage of the term "tokenizer" is not related to parsing! The
@@ -86,8 +86,7 @@ After: With tokenized logging
+------------------+-------------------------------------------------+---------+
In the above logging example, we achieve a savings of ~90% in binary size (41 →
-4 bytes) and 70% in bandwidth (49 → 15 bytes). pw_bloat - Generate "bloat
-reports"
+4 bytes) and 70% in bandwidth (49 → 15 bytes).
Basic operation
===============
@@ -756,6 +755,6 @@ Compatibility
Dependencies
============
- * pw_varint module
- * pw_preprocessor module
- * pw_span module
+ * ``pw_varint`` module
+ * ``pw_preprocessor`` module
+ * ``pw_span`` module
diff --git a/pw_toolchain/BUILD.gn b/pw_toolchain/BUILD.gn
index f7f9962c9..d4837be88 100644
--- a/pw_toolchain/BUILD.gn
+++ b/pw_toolchain/BUILD.gn
@@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations under
# the License.
+import("$dir_pw_docgen/docs.gni")
import("arm_gcc.gni")
import("host_clang.gni")
import("host_gcc.gni")
@@ -183,3 +184,7 @@ generate_toolchains("host_clang_suite") {
},
]
}
+
+pw_doc_group("docs") {
+ sources = [ "docs.rst" ]
+}
diff --git a/pw_toolchain/docs.rst b/pw_toolchain/docs.rst
new file mode 100644
index 000000000..68706a503
--- /dev/null
+++ b/pw_toolchain/docs.rst
@@ -0,0 +1,31 @@
+.. _chapter-pw-toolchain:
+
+.. default-domain:: cpp
+
+.. highlight:: cpp
+
+------------
+pw_toolchain
+------------
+The ``pw_toolchain`` module enumerates GN toolchain definitions that may be used
+to build pigweed.
+
+``pw_toolchain`` defines the following toolchains:
+
+ - arm_gcc_cortex_m4_og
+ - arm_gcc_cortex_m4_o1
+ - arm_gcc_cortex_m4_o2
+ - arm_gcc_cortex_m4_os
+ - arm_gcc_cortex_m4f_og
+ - arm_gcc_cortex_m4f_o1
+ - arm_gcc_cortex_m4f_o2
+ - arm_gcc_cortex_m4f_os
+ - host_clang_og
+ - host_clang_o2
+ - host_clang_os
+ - host_gcc_og
+ - host_gcc_o2
+ - host_gcc_os
+
+.. note::
+ The documentation for this module is currently incomplete.
diff --git a/pw_unit_test/docs.rst b/pw_unit_test/docs.rst
index 435c4f2a5..9294fda89 100644
--- a/pw_unit_test/docs.rst
+++ b/pw_unit_test/docs.rst
@@ -1,9 +1,8 @@
+.. _chapter-pw-unit-test:
.. default-domain:: cpp
.. highlight:: sh
-.. _chapter-pw-unit-test:
-
------------
pw_unit_test
------------
@@ -126,4 +125,16 @@ section, and use the ``pw_test`` template to register your test code.
sources = [ "foo_test.cc" ]
}
+``pw_unit_test`` module provides a few optional libraries to simplify setup:
+
+ - ``simple_printing_event_handler```: When running tests, output test results
+ as plain text over ``pw_sys_io``.
+ - ``simple_printing_main``: Implements a ``main()`` function that simply runs
+ tests using the ``simple_printing_event_handler``.
+ - ``logging_event_handler``: When running tests, log test results as
+ plain text using pw_log (ensure your target has set a ``pw_log`` backend).
+ - ``logging_main``: Implements a ``main()`` function that simply runs tests
+ using the ``logging_event_handler``.
+
+
.. _Google Test: https://github.com/google/googletest/blob/master/googletest/docs/primer.md
diff --git a/pw_varint/docs.rst b/pw_varint/docs.rst
index e4cb746c0..16c465b5d 100644
--- a/pw_varint/docs.rst
+++ b/pw_varint/docs.rst
@@ -5,7 +5,7 @@
---------
pw_varint
---------
-The pw_varint module provides functions for encoding and decoding variable
+The ``pw_varint`` module provides functions for encoding and decoding variable
length integers, or varints. For smaller values, varints require less memory
than a fixed-size encoding. For example, a 32-bit (4-byte) integer requires 1--5
bytes when varint-encoded.
@@ -20,4 +20,4 @@ Compatibility
Dependencies
============
-* pw_span
+* ``pw_span``
diff --git a/pw_watch/docs.rst b/pw_watch/docs.rst
index 3d18938c9..0cb8de152 100644
--- a/pw_watch/docs.rst
+++ b/pw_watch/docs.rst
@@ -8,8 +8,8 @@
pw_watch
--------
-pw_watch is similar to file system watchers found in the web development space.
-These watchers trigger a web server reload on source change, increasing
+``pw_watch`` is similar to file system watchers found in the web development
+space. These watchers trigger a web server reload on source change, increasing
iteration. In the embedded space, file system watchers are less prevalent but no
less useful! The Pigweed watcher module makes it easy to instantly compile,
flash, and run tests upon save.
@@ -18,21 +18,21 @@ flash, and run tests upon save.
.. note::
- pw_watch currently only works with Pigweed's GN build.
+ ``pw_watch`` currently only works with Pigweed's GN build.
Module Usage
============
-The simplest way to get started with pw_watch is to launch it from a shell using
-the Pigweed environment.
+The simplest way to get started with ``pw_watch`` is to launch it from a shell
+using the Pigweed environment.
.. code:: sh
$ pw watch
-By default, pw_watch will watch for repository changes and then trigger Ninja
-builds sequentially for each subdirectory in ``${PIGWEED_ROOT}/out``. To
+By default, ``pw_watch`` will watch for repository changes and then trigger
+Ninja builds sequentially for each subdirectory in ``${PIGWEED_ROOT}/out``. To
override this behavior, follow ``pw watch`` with paths to Ninja build
directories like so:
@@ -47,7 +47,7 @@ Unit Test Integration
=====================
Thanks to GN's understanding of the full dependency tree, only the tests
-affected by a file change are run when pw_watch triggers a build. By default,
-host builds using pw_watch will run unit tests. To run unit tests on a device as
-part of pw_watch, refer to your device's
+affected by a file change are run when ``pw_watch`` triggers a build. By
+default, host builds using ``pw_watch`` will run unit tests. To run unit tests
+on a device as part of ``pw_watch``, refer to your device's
:ref:`target documentation<chapter-targets>`.