Commit Graph

17 Commits

Author SHA1 Message Date
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
a9ca999b09 pw_cpu_exception_cortex_m: Move armv7m->cortex_m
Moves the armv7m implementation of pw_cpu_exception to
pw_cpu_exception_cortex_m since much of the logic can be shared between
ARMv8-M and ARMv7-M. Symbol names are also updated to reflect current
naming style for extern "C" symbols. Old names will be removed in
pwrev/31060.

Warning, symbol renames are breaking!
pw_CpuExceptionEntry -> pw_cpu_exception_Entry
pw_CpuExceptionDefaultHandler -> pw_cpu_exception_DefaultHandler

Change-Id: I7ab99ac7637c436ba959d7546043090c66fe4215
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/30922
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Pigweed-Auto-Submit: Armando Montanez <amontanez@google.com>
2021-02-02 22:46:48 +00:00
Prashanth Swaminathan
acbd070e63 pw_sync_baremetal: Add scaffolding for baremetal
Adds a dummy spin lock backend implementation for baremetal
configuration.

The provided implementation makes a single attempt to acquire the
lock and asserts if it is unavailable. It does not perform interrupt
masking or disable global interrupts, so this implementation does
not support simultaneous multi-threaded environments including IRQs,
and is only meant to prevent data corruption.

Change-Id: I4d44b2dd5cc6f38be1188a9f480f61c6d042b855
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/30520
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Prashanth Swaminathan <prashanthsw@google.com>
2021-01-23 02:27:51 +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
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
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
Chenghan Zhou
ea0f7ad8cd pw_allocator: Add block sanity check
Add functions to check if a pw::allocator::Block object is valid in the
sense that it's aligned, the prev/next pointer matches with each other,
and poison bytes is not corrupted if enabled. Add functions to crash on
seeing an invalid Block.

Add a gn arg to enable heap poison, with sizeof(void*) before and after
the usable space with a fixed pattern.

Change-Id: I68a0194b4522ccadb21ecba96ce47a2265e8bf59
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/14500
Commit-Queue: Chenghan Zhou <chenghanzh@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
2020-07-31 14:32:49 +00:00
Chenghan Zhou
d4f44d2c50 pw_allocator: replacing malloc()
Add pw_malloc module to replace libc malloc with self defined methods.

Add pw_malloc_freelist backend to provide wrapper functions for freelist
malloc.

Change-Id: I7b645206655068d6c08063d7a520aca62d955052
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/12601
Commit-Queue: Chenghan Zhou <chenghanzh@google.com>
Reviewed-by: Chenghan Zhou <chenghanzh@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
2020-07-17 18:14:27 +00:00
Armando Montanez
356bf9786d pw_cpu_exception: Split facade
The pw_cpu_exception facade is comprised of three parts: the part
implemented by the architecture, and the part implemented by the
application, and some supporting libraries that make it easier to dump
CPU state. Since these are provided independently, the facade has been
split into three facades:

 1. entry
 2. handler
 3. support

Change-Id: I48c92f42b208f79596740f1bec59ed3d29e277a8
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/11646
Commit-Queue: Armando Montanez <amontanez@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
2020-07-16 21:03:29 +00:00
Armando Montanez
71b1fa3d2c pw_toolchain: Make arm float printf optional
Removes floating point printf support from the default ARM toolchain and
makes it into an optional config that isn't added by default (since it
adds ~14KB of flash usage).

Change-Id: I340630fa596ae131b56e75c7acb2536766cd11b8
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/12660
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
Commit-Queue: Armando Montanez <amontanez@google.com>
2020-06-19 19:30:30 +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
fd5de70b76 Add Pigweed GCC-ARM toolchains
Updates ARM toolchains and gets both the stm32f429i-disc1 and qemu
targets building again.

Change-Id: Ib0607bc498f8a331c3cde763da5ed3812ba595ba
2020-06-16 09:50:59 -07:00