For some reason this world may never know, I set up pw_linker_script
using process_file_template to iterate over defines. While this works
for most defines, it breaks when a define contains a file path. Switches
to use a foreach instead as it contains less internal magic.
Change-Id: I974a63fc6d769fa884b9c867944112d068453599
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/21500
Reviewed-by: Alexei Frolov <frolv@google.com>
Commit-Queue: Armando Montanez <amontanez@google.com>
- Add PW_KVS_LOG_LEVEL to the pw_kvs config file and update code to
use it.
- Define a pw_kvs:config facade that be used to override configuration
values.
- Set up the empty "$dir_pw_build:empty" target that all modules use as
their default configuration backend via the
pw_build_DEFAULT_MODULE_CONFIGURATION variable.
Change-Id: Idf54d93678ffbd65e9e02a10454df4479f73827a
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/21240
Reviewed-by: David Rogers <davidrogers@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
Enables "-Wimplicit-fallthrough" as part of the
"strict_warnings" config to ensure only explicit fallthrough is
permitted.
Change-Id: If72d56975f460ea70fa5275bcb592e593c26f986
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/21462
Commit-Queue: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Enables "-Wcast-qual" as part of the "extra_strict_warnings" config
to ensure const qualifiers are not dropped from pointer types. This
is planned to be moved to "strict_warnings" in the near future.
Change-Id: Ie0d88d8e8d7994ed6abb59b4aa31c6a8d47398f9
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/21461
Commit-Queue: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Relaxes the commit subject line length requirement from 50 to
match the body's line length requirement of 72.
Change-Id: I2af5ff693edea22b5893b31327b8117bf8b26074
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/21480
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Ewout van Bekkum <ewout@google.com>
Following the pw_protobuf change updating the encode function to return
a result, this change forwards that through the RPC packet encoder.
The Packet::FromBuffer decoder is also updated to match.
Change-Id: I402e6d5c81b69758ca334960d872ad9639868bc6
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/20840
Commit-Queue: Alexei Frolov <frolv@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
The "# gn-format disable" comments are no longer necessary. Delete these
comments and reformat with a Vim macro and gn format.
Change-Id: Ia62c40ad73eef91187d0d443d6e3b0fa723e5aa9
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/21380
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
Change how files are passed into pw_env_setup. In most cases they're
passed in with --use-pigweed-defaults, but downstream projects now have
the option to not include Pigweed's defaults.
Change-Id: I82383705e156be14276a8498648ca376e3340efb
Bug: 274
Requires: pigweed-internal:7120
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19380
Commit-Queue: Rob Mohr <mohrr@google.com>
Reviewed-by: Joe Ethier <jethier@google.com>
Reviewed-by: Michael Spang <spang@google.com>
- Add counting of sectors erased. This count is only since instance
construction.
- Add HeavyMaintenance to be heavy and aggressive about garbage
collecting sectors with valid data.
- Don't erase sectors when doing garbage collection of sectors that are
already erased.
Change-Id: I4fb1647c1920cdc64a7a1029078575068a9156ce
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/20960
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: David Rogers <davidrogers@google.com>
detokenize_test.py fails on Windows because Windows doesn't support
having two open file descriptors for the same file.
Change-Id: I218586311407f713b20d62229ace4a0ae75befb4
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/21100
Reviewed-by: Alexei Frolov <frolv@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
- Add --module option, which allows running a Python module instead of a
script.
- Add --directory option that changes the output directory before
running the command.
- Add pw_python_script_foreach, which is action_foreach with
pw_python_script's features.
Change-Id: Idaa208cf9032467a7e3206043935b223cbbff559
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/20640
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
This is so that we can safely use PW_DCHECK
Change-Id: Id29b7ebfbef012ee892255d9eac735044a49f311
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/21041
Commit-Queue: Paul Mathieu <paulmathieu@google.com>
Reviewed-by: David Rogers <davidrogers@google.com>
New `pw_command_launcher` build arg that uses the `command_launcher`
tool variable. GN docs:
https://gn.googlesource.com/gn/+/master/docs/reference.md#func_tool
This wraps each compile in the given command.
For example using ccache yields faster re-compiles:
~/pigweed $ rm -rf out \
&& gn gen out --args='pw_command_launcher="ccache"' \
&& time ninja -C out stm32f429i
Generating compile_commands took 46ms
Done. Made 4617 targets from 114 files in 261ms
ninja: Entering directory `out'
[380/380] stamp obj/stm32f429i.stamp
real 0m39.430s
user 4m12.004s
sys 0m30.478s
~/pigweed $ rm -rf out \
&& gn gen out --args='pw_command_launcher="ccache"' \
&& time ninja -C out stm32f429i
Generating compile_commands took 45ms
Done. Made 4617 targets from 114 files in 243ms
ninja: Entering directory `out'
[380/380] stamp obj/stm32f429i.stamp
real 0m2.527s
user 0m12.540s
sys 0m4.708s
Change-Id: I153bd5cae2fdcff73301b4a787fabee68e96af3d
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/20262
Commit-Queue: Anthony DiGirolamo <tonymd@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
- New unit test scripts
- arduino_unit_test_runner
- arduino_test_server
- arduino_test_client
- teensy_detector
- arduino_builder changes
- '--config-file' loading and '--save-config' options
- '--set-variable' option to set arduino recipe vars. This is used
for passing vars to the teensyloader flash recipe.
- GN changes
- exec_script(arduino_builder) calls will save config files to:
./out/arduino_debug/gen/arduino_builder_config.json
- 'pw_arduino_use_test_server' gn build arg
The test_runner and test_server both require a options to
run properly, see targets/arduino/target_docs.rst for usage.
Change-Id: I118498c291d2fbb034faa372b9250f6a0783a478
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19220
Commit-Queue: Anthony DiGirolamo <tonymd@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
This updates Encoder::Encode() to return a Result to make it less
awkward to use and to ensure that its status is checked by the caller.
Change-Id: Ie376ee07555199010e4363d013959bb24b0db79a
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19620
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Alexei Frolov <frolv@google.com>
Rename Base64EncodedSize to Base64EncodedBufferSize and have it include
the null terminator. This makes it easier to use directly to size
buffers for Base64 encoding.
Change-Id: Ied24eed67f8d3c5e42a405c98e0b20b30d543536
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/20300
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Add additional blob store tests.
Change the padding at blob close to be flash erased byte rather than
zero.
Change-Id: If66f62ac15fb3733befe94900e6b9c8fba4db4c6
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/20160
Commit-Queue: David Rogers <davidrogers@google.com>
Reviewed-by: Ewout van Bekkum <ewout@google.com>
The log protobuf format has been modified to accept signed integers for
the elapsed time, to account for negative deltas.
Change-Id: I3fbc4a1b1dd9cdd5402cd621d6dcf5ae3ec6ecc5
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19040
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Commit-Queue: Prashanth Swaminathan <prashanthsw@google.com>
- Have PW_TOKENIZER_CFG_ENCODING_BUFFER_SIZE represent the whole encoded
buffer, including the 4-byte token. This makes the value easier to use
directly since the token is already accounted for.
- Update the Base64 encoding functions to always add a null terminator
to the Base64 output.
- Provide a pw::tokenizer::PrefixedBase64Encode overload that allocates
the buffer using pw::Vector.
Change-Id: Id78ef06a7d2111e7dfe5604ee091975be40ceed4
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19720
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
- The return values of the Status member functions should not be
ignored, so add [[nodiscard]].
- Reorder Status values and update the comments to match Abseil's
status/status.h.
Change-Id: Ie91f4f5fbb98353caf1df905a6bf5ce5da4ecaf9
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19360
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
- Move code in arduinobuilder.py to their own modules:
- __main__.py
- builder.py
- core_installer.py
- file_operations.py
- New log.py module
- os.system -> subprocess.run
- Move --run-* args in the 'show' subcommand under the 'run' subcommand.
This allows running multiple steps in the same invocation. For
example, this will execute 3 steps:
arduino_builder run \
--run-objcopy \
--run-postbuild \
--run-upload-command teensyloader
Change-Id: Ibe5493689f39aa6e6aaeecf5bc7065929111499d
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19143
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Anthony DiGirolamo <tonymd@google.com>
In order to fit within the log.proto definition of log levels, the
existing level constants are now limited to three-bit-width values.
Change-Id: I9cc40e84761383406a1264ead65e0d298c309660
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19740
Commit-Queue: Prashanth Swaminathan <prashanthsw@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Create an empty object of the same type as arduino_build when the
arduiro core is not specified.
Change-Id: Ia4cf3d19622ad2297f5d3d4220cb8ca8e894a8c5
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19741
Commit-Queue: Carlos Chinchilla <cachinchilla@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
This updates the RPC client to send back a CLIENT_ERROR to the server if
it receives a packet it was not expecting. The server is updated to
handle client errors by ending the active RPC, if applicable.
Change-Id: Ia9a2f36571fd3f91e28a50393c531df66ba11f09
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19180
Commit-Queue: Alexei Frolov <frolv@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
- Create the --restart option for pw watch that restarts builds when a
file changes, but have it default off. Restarting automatically is
problematic if projects happen to generate files tracked by pw watch
during the build, as it results in an infinite loop. Better path
filtering is needed to prevent this.
- Fix mypy issue related to path_to_log that came up.
Change-Id: I73e16e707a2f65c705ff986c92018c3b3662852a
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19440
Reviewed-by: Murphy Stein <steinm@google.com>
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
- Update labels so they use consistent naming. Instead of the
copy-and-pasted `chapter` prefix, name labels with a prefix consistent
with what they point to:
- "module-" for module
- "target-" for targets
- "docs-" for general documentation
- Remove the unnecessary highlight and default-domain directives.
Neither is necessary since the Pigweed docs always specify the
language in code snippets and other directives.
Change-Id: I55c34e9ec919f6f4670e5d3d008e0edf5fecf05b
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19328
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Support a --replace argument for database.py that replaces text in
the tokenized string database. This can be used to scrub potentially
senstive terms (e.g. code names) from token databases, which may be
distributed.
Change-Id: Ie5530e09e9ea1c92894914426fddd1278ce93661
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19020
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
- Terminate interrupted builds immediately. This saves time since the
the watcher doesn't have to wait for the previous build to finish
before starting a new build.
- Remove some unused members of PigweedBuildWatcher.
Change-Id: I2218f711725ceb76a374c9e035a62f8c64224fdb
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19301
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
- Update Status::CODE style to Status::Code() using
pw_status/update_style.py.
- Make minor adjustments to the pw_assert tests to get them passing.
Change-Id: Ie54c3c605178fd1e42c7cedbcff324115f3ed279
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19165
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Rename encoder.py to encode.py, since there is no encoder -- just a
function that encodes information frames. Rename decoder.py for
consistency.
Change-Id: I6aec98b51e1298aa920cbe5d26ca4d6785607acc
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19300
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
This implements an RPC client class which is used to make RPC requests
to a server. Like the server, the client exists globally and processes
incoming RPC packets. The client keeps track of active RPC request
contexts through ClientCall objects, and dispatches packets to them when
an expected response is received.
A nanopb implementation of a ClientCall is added as well, supporting
unary and server-streaming RPC calls, with a codegen-ready API.
Change-Id: If9615877199e0d4bc468c33d3d9ecf85da32440a
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/15741
Commit-Queue: Alexei Frolov <frolv@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Separate encoder and decoder dependencies to allow projects to import
one without the other, but keep them as the core of `pw_hdlc_lite`.
This fixes a circular dependency when encoding tokenized logs for
HDLC-Lite RPCs, since `pw_hdlc_lite:decoder` depends on logging, and
tokenized logging only needs `pw_hdlc_lite:encoder`.
Change-Id: Id94821cb3e12c9b772b45ea17e640d833a6732ed
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/19145
Commit-Queue: Carlos Chinchilla <cachinchilla@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>