Commit Graph

66 Commits

Author SHA1 Message Date
Nathaniel Brough
a1113be66c workspace: Adding bazel build formatter/linter
Adds in buildifier bazel targets that autoformat/lint the entire
WORKSPACE. This can be invoked by running;

'bazel run //:buildifier'

or

'bazel run //:buildifier_test'

Change-Id: Iaaf7f6241e29894eca94aa6b5d0ca3b33255b7f7
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/36160
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Keir Mierle <keir@google.com>
2021-04-18 18:56:15 +00:00
Wyatt Hepler
a77e5e7a1c Fixes for GCC 10 compatibility
- pw_kvs: Remove use of std::enable_if that wasn't working property.
- pw_result, pw_rpc: Disable spurious GCC 10 warnings.
- pw_string: Size report code that is never executed was using the same
  pointer for snprintf input and output, which is not legal. This caused
  -Wrestrict warnings. Update the size report code to avoid this.
- Add the -pthread flag in GCC host builds to support building
  pw_thread.
- pw_tokenizer: For host builds, insert the tokenizer sections after
  .debug_info instead of .strtab, since inserting after .strtab does not
  work for GCC.

Change-Id: Ib141a102ed50eb639c8d0bcb236572b3dc142ec1
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/40620
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Reviewed-by: Anthony DiGirolamo <tonymd@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
2021-04-12 18:53:38 +00:00
Ewout van Bekkum
cc9ef83673 pw_sync: add lock safety annotations for C++ clang usage
Adds clang thread safety annotations to the interrupt spin lock for
C++ usage. Note that this is only checked when compiling with clang.

C APIs explicitly escape the thread safety annotations.

Change-Id: Ic829afd41b3978c507ebe294d34e1e0dc03865b4
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/40241
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Pigweed-Auto-Submit: Ewout van Bekkum <ewout@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
2021-04-12 16:53:37 +00:00
Ewout van Bekkum
6f5b8fb1ff pw_sync: split out pw::sync::TimedMutex from pw::sync::Mutex
Change-Id: I6a52123759045658cc21aaa3254279d95c23ed6e
Requires: pigweed-internal:11280
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/40083
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Ewout van Bekkum <ewout@google.com>
2021-04-09 18:05:44 +00:00
Ewout van Bekkum
da2a62d890 pw_sync: Migrate upstream to use InterruptSpinLock
Migrates Pigweed off of SpinLock to use the new InterruptSpinLock
name.

Also updates some stale documentation regarding SystemClock backends
which use InterruptSpinLocks before C++ construction now that there
is a constexpr constructor, as it was already getting updated for
the rename.

Change-Id: Ie821b7c5c59f21a16bcc9bd9674c5df6a85e27b1
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/37561
Commit-Queue: Ewout van Bekkum <ewout@google.com>
Pigweed-Auto-Submit: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
2021-03-12 21:16:44 +00:00
Ewout van Bekkum
126e01176c pw_sync: rename SpinLock -> InterruptSpinLock
Renames the existing pw::sync::SpinLock to InterruptSpinLock to
make it obvious that this is not just a spin lock and that interrupt
masking is included.

This change leaves C++ & GN redirects in place in order to support
migrating Pigweed and customers in follow up changes.

Change-Id: If9fb5594e7d71778b15cd15a9cd7ec71ca0e403b
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/37560
Commit-Queue: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
2021-03-12 20:52:04 +00:00
Armando Montanez
8104e8fabc Silence unused argument warnings
moves pw_trace-related build args into imports so toolchains can import
them and silence unused build-arg warnings for downstream projects that
use Pigweed's default host toolchain but don't use pw_trace.

Change-Id: I25cd8b59e2b05e0345e9ed738c4b06beff9a5069
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/36080
Pigweed-Auto-Submit: Armando Montanez <amontanez@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
2021-03-06 23:48:43 +00:00
Jason Graffius
322d594f36 pw_stream: Add client-side SocketStream support
Adds the SocketStream::Connect member function, allowing a SocketStream
to be established from the client side of a socket rather than only the
serving side as before.

Additionally, this change renames the existing Init member function to
Serve instead to make it clear that it is not required before calling
Connect and is instead an alternative way of establishing a SocketStream
connection.

Change-Id: Ib3fdb9f5405eee92ae1a166c64e990cb9c05fca7
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/31261
Pigweed-Auto-Submit: Jason Graffius <jgraff@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
2021-02-24 19:16:52 +00:00
Ewout van Bekkum
0f3901eda4 pw_thread: adds thread creation
Adds a std::thread like API through a new pw_thread facade based
on the STL's std::thread API, however with more restricted function
entry routine format support and backend specific option support
to permit non-portable configuration of thread settings/parameters
including static context allocations.

In addition this provides an initial set of backends based on using
the STL's std::thread directly.

Change-Id: Ib8c3cbdc434044e204e67e58d861a40e4acec9b4
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/30920
Reviewed-by: Wyatt Hepler <hepler@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Ewout van Bekkum <ewout@google.com>
2021-02-19 21:37:16 +00:00
Ali Zhang
5876558bba pw_fuzzer: Add dedicated toolchain and target for fuzzing
Adds a "//targets/host:host_clang_fuzz" target so fuzzers get built
along with other build targets. This new target uses "address" as the
default sanitizer for fuzzing. Sanitizers are overridable via
pw_toolchain_SANITIZERS.

Adds a top-level "fuzzers" target so it could be used (e.g. by
OSS-Fuzz) to just fuzzers.

Test: build normally and run
      `//out/host_clang_fuzz/obj/pw_fuzzer/bin/toy_fuzzer`

Change-Id: I4f1df389289ae7a47b29738a3c245f7bac308a08
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/31301
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Pigweed-Auto-Submit: Ali Zhang <alizhang@google.com>
2021-02-02 22:55:17 +00:00
Ewout van Bekkum
e3b5603919 pw_thread: adds the initial pw_thread module
Adds a std::this_thread like API through the pw_thread facades, that
is:
1) this_thread::yield
2) this_thread::sleep_{for,until}
3) this_thread::get_id

This module is split into many different facades in order to let users
decide what functionality they want to use as they may not always
be available, for example when using opaque SDKs.

In addition this provides an initial set of backends based on using
the STL's std::this_thread directly and selects them for the host
target.

Change-Id: I0ee8e4390ba988b2b13e9ee59f976f2333715f1f
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/30040
Commit-Queue: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
2021-01-28 01:47:20 +00:00
Alexei Frolov
d3e5cb710d s/pw_hdlc_lite/pw_hdlc/g
This renames the hdlc_lite module to just HDLC to accommodate for future
development.

Change-Id: Ic96502a9f41d3a10179435347d4e8615bc3ae844
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/29042
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
2021-01-11 21:16:53 +00:00
Alexei Frolov
e39af8d8da pw_rpc: Add synchronized channel output
This adds an channel output wrapper which synchronizes a ChannelOutput's
operations with a sync::Mutex, and updates the host target's system RPC server
to use it.

Change-Id: I3d2407a8c81a8f0370fd714ded850293d7030209
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/28540
Commit-Queue: Alexei Frolov <frolv@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Ewout van Bekkum <ewout@google.com>
2021-01-06 18:08:28 +00:00
Alexei Frolov
eb94e96186 pw_rpc: Move system_server backends into targets
Backends for the pw_rpc/system_server facade were defined in the pw_rpc
module, preventing targets from customizing their server configurations
and channels. This change moves the backends into the respective target
directories. Additionally, pw_unit_test's RPC main is updated to use the
system server.

Change-Id: I670e13dd178ab8a7fc8dfa8fade3f82a46d5208c
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/28500
Reviewed-by: Wyatt Hepler <hepler@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Alexei Frolov <frolv@google.com>
2021-01-06 17:42:18 +00:00
Wyatt Hepler
cb9a892446 pw_sys_io: Move sys_io's build arg to a .gni file
Change-Id: I1a6e7aed6c5720c60d1c224558c2913fe4d648a5
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/27940
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
2020-12-17 01:32:38 +00:00
Wyatt Hepler
ae93f424e9 pw_presubmit: Help prevent undefined GN build args
- Add the --fail-on-unused-args option to gn gen by default in
  presubmit.
- Import .gni files for backend build args into the toolchains
  that set them.
- Skip the init_cipd and init_virtualenv steps in local presubmits.
  Instead, use the current environment. This is much faster and avoids
  confusion about which environment is in use.

Fixes: 294
Change-Id: Ib86da7c3d4560b6c92cbacced725ee54c485e3d6
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/27580
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Michael Spang <spang@google.com>
2020-12-15 00:43:24 +00:00
Jiaming Wang
35b4ea3c3b pw_rpc_system_server: Local pw_rpc support
Using socket or sys_io to connect to server and client on host.

Test: Manually tested

Requires: pigweed:25460
Change-Id: I174121b90cea69621a885202b0d4d2df78a9aba8
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/20040
Commit-Queue: Jiaming (Charlie) Wang <jiamingw@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
2020-12-04 20:05:39 +00:00
Ewout van Bekkum
9618d8a770 pw_sync: Adds semaphores & mutexes
Adds the BinarySemaphore, CountingSemaphore, and Mutex to the
pw_sync module along with an STL backend for each.

Change-Id: I54a3a64e702202a319ed2c9068bf37412d3fd240
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/24241
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Ewout van Bekkum <ewout@google.com>
2020-12-01 21:28:25 +00:00
Ewout van Bekkum
3c61ae90de pw_chrono: Adds initial SystemClock support to Pigweed
Adds the initial pw_chrono module to Pigweed with a facade for the
pw::chrono::SystemClock. In adition, the pw_chrono_stl module is
provided with the first STL based backend of said module by using
std::chrono::steady_clock.

Change-Id: Id29f4280aa399a81518f6d13183cf495b2ee72dc
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/23260
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Ewout van Bekkum <ewout@google.com>
2020-11-24 21:03:24 +00:00
Ewout van Bekkum
58901934cd pw_sync: Adds initial SpinLock primitive
Adds the first synchronization primitive to Pigweed: the
pw::sync::SpinLock with integrated local interrupt
masking.

This also provides the first backend for the SpinLock facade
backed by an STL implementation. Note that signals are considered
"NMIs" while spin locks are only supported up to IRQs, ergo no
local interrupt/signal masking is done in the STL implementation.

Change-Id: I34204835c55e54597077d40665f61715964803f9
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/25802
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Ewout van Bekkum <ewout@google.com>
2020-11-24 19:02:43 +00:00
Alexei Frolov
b499d3f28c pw_protobuf_compiler: Remove pw_protobuf_GENERATORS build arg
This updates pw_protobuf_compiler to always create a target for each
supported protobuf generator, instead of having a build arg to select
which ones to use, simplifying the use of pw_proto_library.

Change-Id: I2699c9c5045e8671a061f8c8bc11a94244d008f1
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22721
Reviewed-by: Armando Montanez <amontanez@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Alexei Frolov <frolv@google.com>
2020-10-29 01:08:02 +00:00
Ewout van Bekkum
fa1fc6683c targets: use pw_build:extra_strict_warnings upstream
Updates all Pigweed targets, except for arduino, to use the
extra_strict_warnings where relevant.

Also fixes up several places which wouldn't compile with "-Wshadow"
enabled.

Change-Id: Ieb2c7f4870e4609181825e2c894ccbac56135cad
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/21688
Reviewed-by: Armando Montanez <amontanez@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Ewout van Bekkum <ewout@google.com>
2020-10-19 19:25:19 +00:00
Wyatt Hepler
d49f8fe3f3 BUILD.gn files: Improve import formatting
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>
2020-10-15 18:12:55 +00:00
Wyatt Hepler
f9fb90f299 docs: Make labels consistent; remove boilerplate
- 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>
2020-10-01 21:47:35 +00:00
Michael Spang
6a8459589c pw_toolchain: Allow iOS to use the right -map flag
In general toolchains should set values for the builtin arguments
current_cpu and current_os; this configures both the toolchain itself
and everything it builds. Make it so in Pigweed.

If there's a toolchain with current_os = "ios", use the arguments for
Apple's linker.

Bug: 241
Change-Id: I2ce8c46eb48cbc70c5d14086934bdf59c2fc3f36
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/16006
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Michael Spang <spang@google.com>
2020-08-14 19:29:22 +00:00
Alexei Frolov
dd6fa5c7bd third_party: Add nanopb BUILD.gn file
This change creates a Pigweed third_party directory and defines a GN
build file for nanopb which exposes a pw_source_set for the nanopb
library from a build arg pointing to a local nanopb installation.

Change-Id: I6779203626abce7821dc3fcef6dcbc11c319b43c
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/15763
Reviewed-by: Keir Mierle <keir@google.com>
2020-08-14 16:58:59 +00:00
Robert Oliver
6d05de13e7 pw_trace: tokenizer basic example
Run the trace sample app and dump all trace data to a file.
- Use std::chrono::system_clock as the time source for host builds.
- Add trace_to_file.h which registers callbacks and saves all trace data
to a provided binary file.

Change-Id: I57fac75ed91fc98646e7aae920897687a39549ab
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/13802
Commit-Queue: Rob Oliver <rgoliver@google.com>
Reviewed-by: (☞゚∀゚)☞ Tennessee Carmel-Veilleux  <tennessee@google.com>
2020-07-31 20:57:23 +00:00
Robert Oliver
21dcf27113 pw_trace: Initial tokenized trace backend
Tokenized trace, implements trace events by tokenizing all compile time
information of the event into a 32bit number (using tokenizer module).

This CL just adds the encoding of trace events and callback hooks,
buffering which usies the callback will be added in a future CL.

Test: passes included test
Change-Id: Ibfcc34211c09965af8da030e28dba5e8f7c6ccdb
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/11428
Commit-Queue: Rob Oliver <rgoliver@google.com>
Reviewed-by: (☞゚∀゚)☞ Tennessee Carmel-Veilleux  <tennessee@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
2020-07-31 12:44:51 +00:00
Ewout van Bekkum
e072fabcf0 docs: some more minor updates
Fixes some errors and some stale references and formats.

Change-Id: I5a2f6d4a20591b61ae49eaab3310dc7abf51d83d
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/14122
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Ewout van Bekkum <ewout@google.com>
2020-07-18 02:38:39 +00:00
Armando Montanez
3f3546ebd5 pw_watch: Update syntax for pw_watch
Updates syntax for using pw_watch in a few other locations.

Change-Id: I599fc3cb552c75e9f546447556fb756633093391
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/13804
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Armando Montanez <amontanez@google.com>
2020-07-13 22:28:43 +00:00
Armando Montanez
86003203b7 pw_toolchain: Update toolchain options
Updates pigweed to depend directly on is_host_toolchain provided by the
toolchain. Also adds a toolchain option that controls the extension of
final linked binaries.

Change-Id: Ia9499fe5974997a5bbc0bb9cfb89b5569b987189
2020-06-16 18:00:06 -07:00
Armando Montanez
a761e32bf9 Update docs
First pass at docs to bring them up to date with The Great GN Refactor.
More to follow.

Change-Id: I02dc977fcdc7bf3efa8fc9080282dee9b1455cdd
2020-06-16 10:00:17 -07:00
Alexei Frolov
48d58a095f host: Don't add nanopb generator if it exists
This checks if the project has already set the nanopb protobuf generator
before adding it as part of the host target.

Change-Id: I1336d73bdcbcb786bf783909b32230bebf10bdba
2020-06-16 10:00:17 -07:00
Armando Montanez
ccc3ee14b9 Update Pigweed presubmit
Updates the upstream presubmit to play nicely with The Great GN
Refactor.

Change-Id: I2296db592b4c8e3c2d5592410b9846e7435ac1fc
2020-06-16 10:00:17 -07:00
Armando Montanez
d9a8a346bc Clean up host toolchains
Update the host toolchains to be prefixed with their target name and use
a slightly more compact style to define the toolchain scopes.

Change-Id: Ib0dae237299e74c6c48cd4c35869fd215563a7bf
2020-06-16 09:50:59 -07:00
Armando Montanez
82bbce4aeb Remove legacy_target.gni
Transition to args is done, so this import is no longer needed.

Change-Id: Id42e06ec9fcc16eace2cc7ef51a5dacaf012147a
2020-06-16 09:50:59 -07:00
Armando Montanez
164624f0b0 Set up all host toolchains
Sets up clang and gcc based toolchains for all host target builds.
Defaults to using Clang for linux/mac and GCC for windows.

Change-Id: I1a15d98581cbf886fbb86321f2d7dabb0dd43cf1
2020-06-16 09:50:59 -07:00
Alexei Frolov
258fc1b8bf Define docs target as a toolchain
This change creates a toolchain that configures the docs target and adds
it to the default build.

Change-Id: Ib2a8387253eef809f94411780174377e0d23e1a9
2020-06-16 09:50:59 -07:00
Alexei Frolov
4c0428a0d8 Define Linux clang target as toolchain
This change configures the Linux clang -Og target as a toolchain with
args. To support this, all Pigweed variables from pw_vars_default are
made into build args, defined within their respective modules.

The Linux clang target/toolchain is the only one that currently works.
Pigweed's other targets will be ported in later changes.

Change-Id: I051e29fde7577e41a3184c37031a4e04936404e1
2020-06-16 09:50:59 -07:00
Armando Montanez
fb3d3fba79 Don't declare pigweed variables as globals
Require targets to explicitly import pigweed variable definitions. This
moves out some necessary logic from the BUILDCONFIG.gn file.

Change-Id: If9c9fe5a680cc9d897a0e8a55889873be618ed84
2020-06-16 09:50:59 -07:00
Rob Mohr
a7758f949a host: make clang the default
Make clang the default compiler on Linux.

Change-Id: I4c5d8e0a4e361f4d5b57c184ec89b09a8d789c65
2020-04-15 15:25:16 -07:00
Alexei Frolov
f39cd8b5ba pw_protobuf_compiler: nanopb support
This change adds support for compiling nanopb protobufs using
pw_protobuf_compiler.

The pw_protobuf_langs build variable is renamed to
pw_protobuf_generators as there is no longer a 1:1 mapping of languages.

To compile nanopb, add the "nanopb" generator to pw_protobuf_generators.
The build variable $dir_third_party_nanopb must be set to point to a
local installation of nanopb with GN support:

  https://github.com/frolv/nanopb/tree/gn-build

The host build will run a test which compiles nanopb code if
$dir_third_party_nanopb is set.

Change-Id: I29bf8780644917f35203a538b0bd7e4f3ec40180
2020-04-15 18:19:44 +00:00
Armando Montanez
3d92e81f1c Docs: Add target docs
Adds target docs for the `docs` and `host` builds. Also includes a few
other documentation updates.

Change-Id: Icc973d6d51707c79b7c506d89c8975023e274ef2
2020-03-19 20:49:33 +00:00
Wyatt Hepler
77bd6d23ba bootstrap.sh: Abort if PW_ROOT has spaces
- The scripts in .python3-env/bin use a shebang line to point to
  Python. If the Python path has spaces, this line will not work
  correctly. Until this can be fixed, abort bootstrap.sh if Pigweed's
  path has spaces.
- Quote expansions in environment setup to prepare for eventually
  allowing paths with spaces.

Change-Id: I85333bd930e03731e5ae093c5f63b6a2a26c6316
2020-03-19 12:46:31 -07:00
Armando Montanez
e97f05936a host: Rename host.gni to target_config.gni
Renames host.gni to target_config.gni so all targets have a
target_config.gni, and it's clear which .gni file to use for target
configuration.

Change-Id: I1bd0442a9dc00201bff46eb776a4a59c1d339a4e
2020-03-19 17:42:26 +00:00
Alexei Frolov
b7e952b79f Disable host_tools by default in host build
This change disables building host tools by default as they are packaged
in CIPD.

Change-Id: Ie5129805affa748dbcbc93ade7c208f733a61c88
2020-03-18 00:32:07 +00:00
Armando Montanez
f7a5a742ab Rename pw_dumb_io to pw_sys_io
Rename pw_dumb_io facade and backends to use the more deliberate name
pw_sys_io moving forward.

Change-Id: I968480715967ab8de491856afa1b7692b973ed7e
2020-03-03 18:19:17 +00:00
Alexei Frolov
8e58e88665 Make pw_target_toolchain a build arg on Windows
This makes Windows consistent with the other host platforms and this
behavior is required by CI builds.

Change-Id: I35b3df2d82364d3d43f6c334e71e7bef8d8a0f4d
2020-02-08 01:15:00 +00:00
Keir Mierle
3cee879769 pw_assert: Initial assert module
This starts the assert and assert_basic modules, which are the beginning
of our assert foundation. Much more is needed; in particular the "tests"
don't really do much other than check for compilation.

Screenshot
==========

   ▄████▄      ██▀███      ▄▄▄           ██████     ██░ ██
  ▒██▀ ▀█     ▓██ ▒ ██▒   ▒████▄       ▒██    ▒    ▓██░ ██▒
  ▒▓█ 💥 ▄    ▓██ ░▄█ ▒   ▒██  ▀█▄     ░ ▓██▄      ▒██▀▀██░
  ▒▓▓▄ ▄██▒   ▒██▀▀█▄     ░██▄▄▄▄██      ▒   ██▒   ░▓█ ░██
  ▒ ▓███▀ ░   ░██▓ ▒██▒    ▓█   ▓██▒   ▒██████▒▒   ░▓█▒░██▓
  ░ ░▒ ▒  ░   ░ ▒▓ ░▒▓░    ▒▒   ▓▒█░   ▒ ▒▓▒ ▒ ░    ▒ ░░▒░▒
    ░  ▒        ░▒ ░ ▒░     ▒   ▒▒ ░   ░ ░▒  ░ ░    ▒ ░▒░ ░
  ░             ░░   ░      ░   ▒      ░  ░  ░      ░  ░░ ░
  ░ ░            ░              ░  ░         ░      ░  ░  ░
  ░

  Welp, that didn't go as planned. It seems we crashed. Terribly sorry!

  CRASH MESSAGE

     Check failed: x (=50) > y (=51300): You SHOULD see this message

  CRASH FILE & LINE

     ../../pw_assert/assert_test.cc:46

  CRASH FUNCTION

     PigweedTestBody

==========

Change-Id: I9dbb460b3b33040d8009749f44b9fc174e2c8138
2020-02-07 23:18:07 +00:00
Alexei Frolov
dddc4fd7ce Initial Windows GN build
This change configures the Windows host target for GN. It should allow
building unit tests for the host.

Change-Id: Ib92c9a83b9b858a9b7ed55487199c63896580af1
2020-01-22 13:54:15 -08:00