Fuchsia libraries#
Pigweed AI summary: This article discusses the use of Fuchsia libraries in Pigweed, an open source embedded development platform. While Pigweed does not use the Fuchsia operating system itself, it does use some low-level libraries developed for it, including FIT and stdcompat. Some Fuchsia source code is included in the Pigweed repository to avoid the need for an external repository, and files are synced between the Fuchsia and Pigweed repositories using the Copybara script. The article provides instructions for synchronizing with the Fuchsia
Fuchsia is a modern open source operating system developed by Google.
Pigweed does not use the Fuchsia operating system itself, but uses some low-level libraries developed for it.
Features#
Pigweed AI summary: The Pigweed software uses two libraries from Fuchsia, FIT and stdcompat, which provide low-level C++ features and implement newer C++ features for older standards, respectively.
Parts of two Fuchsia libraries are used in Pigweed:
Code synchronization#
Pigweed AI summary: This section explains how some Fuchsia source code is included in the Pigweed library to avoid the need for an external repository and because the Fuchsia repository is too large to require downstream projects to clone. The files are synced from the Fuchsia repository to the third_party/fuchsia/repo directory in Pigweed and are adapted for use in Pigweed using a Copybara script. The process for synchronizing with the Fuchsia repository is explained, including how to update the Copybara script or patch file if
Unlike other third party libraries used by Pigweed, some Fuchsia source code is included in tree. A few factors drove this decision:
Core Pigweed features like
pw::Function
depend on these Fuchsia libraries. Including the source in-tree avoids having Pigweed require an an external repository.The Fuchsia repository is too large to require downstream projects to clone.
If Fuchsia moves stdcompat
and fit
to separate repositories, the
decision to include Fuchsia code in tree may be reconsidered.
Files are synced from Fuchsia repository to the third_party/fuchsia/repo
directory in Pigweed. The files maintain their original paths under that
directory. The Copybara script applies patches to adapt the sources for use in
Pigweed. For example, __builtin_abort
is replaced with PW_ASSERT
.
Process#
Pigweed AI summary: This section explains the process of synchronizing code between the Fuchsia repository and the Pigweed repository using the Copybara script. The third_party/fuchsia/copy.bara.sky script is used for synchronization, and the copybara tool is run with this script to create a Gerrit change with updates from the Fuchsia repo. If the copybara command fails, the Copybara script or patch file may need to be updated by ensuring that the source files in copy.bara.sky are up-to-date and
Code is synchronized between the Fuchsia repository and the Pigweed repository using the third_party/fuchsia/copy.bara.sky Copybara script.
To synchronize with the Fuchsia repository, run the copybara
tool with the
script:
copybara third_party/fuchsia/copy.bara.sky
That creates a Gerrit change with updates from the Fuchsia repo, if any.
If the copybara
command fails, the Copybara script or patch file may need to
be updated. Try the following:
Ensure that the source files in
copy.bara.sky
are up-to-date. Fix the list if any files were renamed in Fuchsia.Update the patch file Copybara applies by running
python third_party/fuchsia/generate_fuchsia_patch.py
.