[roll third_party/pigweed] docker: Roll tag to cbde3eee441ac6c

From: us.gcr.io/google.com/pigweed/environment:fb09d03a6b3d7df408f88feb8392a63a4b9b74f9
To: us.gcr.io/google.com/pigweed/environment:cbde3eee441ac6c8cf128dca0acbbf63afcb2165

Original-Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/18560

Rolled-Commits: cbde3eee441ac6c..5f13f4a892ff2f2
CQ-Do-Not-Cancel-Tryjobs: true
Change-Id: I5f3e634c83ce09c6dfdca24cf5b95fb319b26eb0
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/sample_project/+/18561
Reviewed-by: Pigweed Integration Roller <pigweed-integration-roller@pigweed.google.com.iam.gserviceaccount.com>
Commit-Queue: Pigweed Integration Roller <pigweed-integration-roller@pigweed.google.com.iam.gserviceaccount.com>
1 file changed
tree: bf06ca3ee36ddbe0f860d8c5c9093358a065e24a
  1. .gitignore
  2. .gitmodules
  3. .gn
  4. BUILD.gn
  6. README.md
  7. activate.bat
  8. banner.txt
  9. bootstrap.bat
  10. bootstrap.sh
  11. build_overrides/
  12. source/
  13. targets/
  14. third_party/

Pigweed Sample Project

This repository outlines the recommended way of using Pigweed in a new or existing project. Feel free to fork this repository, or read it as a reference.

For more information see the Pigweed Getting started guide

Check back for more complex examples and features coming soon!

Repository setup

The preferred method to add the Pigweed source is to use git submodules and place the Pigweed source repository in third_party/pigweed. If you forked this repository, don't forget to run git submodule init and git submodule update.

Environment Setup

The scripts bootstrap.bat for Windows, and bootstrap.sh for Unix systems call the respective Pigweed bootstrap scripts. Feel free to modify them to set up your development environment for the first time.

After the initial setup, use the activate.bat in Windows or activate.sh in Unix to enter the environment in a shell.


Make the project yours with your own banner. Create your own banner and place it in banner.txt.


Generate the build files with gn gen out once, unless the build configuration has changed. Then, use ninja to build everything with ninja -C out.

Sample Application

The sample application in source/main.cc uses the sample module simple_counter. Look at source/BUILD.gn and source/simple_counter/BUILD.gn to see how these are built respectively. The key part is in the root BUILD.gn, which creates the host target using the host toolchain. A toolchain is required for each target.

Build the project and run the application. ./out/host_clang_debug/obj/source/bin/hello_world

Sample Test

The simple_counter module has tests defined in source/simple_counter_tests.cc. Look at source/simple_counter/BUILD.gn for an example of how a test is defined. The root BUILD.gn groups all the host tests together.

Build the project and run the tests. ./out/host_clang_debug_tests/obj/source/simple_counter/test/simple_counter_test

Tokenized Logging

Log entries in the sample app are tokenized to save binary space. The included tokens database, source/tokenizer_database.csv, is updated on each build. See the Pigweed pw_tokenizer for more information.

Optionally, the database can be created manually using the binary or the .elf file. python -m pw_tokenizer.database create --database source/tokenizer_database.csv out/host_clang_debug/obj/source/bin/hello_world

Running the app shows log entries similiar to $kgjLdg==. These can be saved to a file and then detokenized.

python -m pw_tokenizer.detokenize base64 source/tokenizer_database.csv -i log.txt

Or can be detokenized in realtime. ./out/host_clang_debug/obj/source/bin/hello_world | python -m pw_tokenizer.detokenize base64 source/tokenizer_database.csv