Commit Graph

42 Commits

Author SHA1 Message Date
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
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
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
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
Wyatt Hepler
8b8c34647b pw_cli: Make process.py faster
- For run_async, replace the silent option with the log_output option.
  With log_output, lines are read one-by-one and logged. Otherwise, the
  output is dumped to a temporary file.
- For tests, only log the output on failure. This substantially speeds
  up verbose tests. A pw_kvs test went from 38 s to 1.2 s when
  passing, or 26 s when failing and printing the output.

Change-Id: Iba18c555c07eeaa9eb5ba79bc8d36d3ef2435485
2020-03-13 19:36:59 +00:00
Armando Montanez
bcc194b750 docs: Extend readme, more docs
Adds/updates docs.

Bug: 125, 129

Change-Id: I96b8bc07c3817d6b629e546f74c06d7345b3227e
2020-03-12 18:00:44 +00:00
Rob Mohr
018f730df5 stm32f429i-disc1: fix mypy error
Fix mypy error that showed in
https://pigweed-review.git.corp.google.com/c/pigweed/pigweed/+/7605/4.

Change-Id: I92c28a3851bdd55e5eac636b524202416476ed33
2020-03-11 09:00:19 -07:00
Wyatt Hepler
e0aef0ab4e pw_presubmit: Enable mypy and get it passing
- Fix several typing issues.
- Disable type checking in several places where mypy wasn't working
  correctly.
- Enable mypy.
- Execute individual steps in the same order as they are provided with
  --step.

Change-Id: I229cf8ee39a4db5067c1923b4acfc5fcd164f733
2020-03-06 23:13:35 +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
Rob Mohr
a0ba54f648 Roll GN to 239533d
This caused gn format to flag many things which were also fixed.

Change-Id: Ie1d9081a1b08047bec52c60f54d2a94366be1ba6
2020-02-28 01:33:18 +00:00
Keir Mierle
41af9ed7b1 pw_assert: Add missing backend for disco boards
Change-Id: Ic2ec61226083c28b3750d6726995f6a3d12a85fd
2020-02-08 01:15:28 +00:00
Rob Mohr
2cc32ecdfb Move env_setup to pw_env_setup
Bug: 67
Change-Id: I285e917968b2e24e0851753ea4802cef1fbe2d67
2020-02-05 19:07:01 +00:00
Keir Mierle
da0bccb98f pw_unit_test: pw_log unit test event handler
This adds a pw_log based unit test event handler, and switches it to be
the default.

Change-Id: I83808e1e0ffcb0061644a45d4acc1d47f1161f57
2020-01-17 23:02:29 +00:00
Armando Montanez
9221213aca pw_boot_armv7m: rename INTERRUPT_VECTOR_TABLE
Renames occurrences of PW_BOOT_INTERRUPT_VECTOR_TABLE_* to
PW_BOOT_VECTOR_TABLE_* for consistency in naming and to match ARMv7-M
documentation.

Change-Id: Ic34c8b56ee6e87955fe5dd076344f4b648974767
2020-01-17 22:05:39 +00:00
Keir Mierle
af5e358b00 pw_log: Logging module first steps
This starts a logging module facade, with a frontend and a dumb IO based
backend. The initial version is lacking many features, like an API to
control enabling or disabling logs.

Change-Id: I3075aed33d9600a1190ca5237b5f7cfcfdc8f2ed
2020-01-17 12:42:05 -08:00
Armando Montanez
7009566653 pw_boot_armv7m: Initial commit
pw_boot_armv7m provides a generic linker script and startup script to
speed up device bringup on ARMv7-M based cores.

Change-Id: Ia4abe78ab1d6bde017608eeb46b2e780bf53dad1
2020-01-16 23:30:48 +00:00
Rob Mohr
2d5d25f5fc Add "PW_" prefix to env vars
Change-Id: Ie0cf5aee98fdc88643098ba2a2e90db72156f3b2
2020-01-15 15:32:15 +00:00
Alexei Frolov
44d5473453 Various small docs fixes
This fixes some typos in the docs.

Change-Id: I4dc2e3b8fa7685bc994123929513a58e8d0e9c79
2020-01-11 01:03:51 +00:00
Rob Mohr
5e844a9b67 Use cipd openocd on Linux
Change-Id: I1e5432223482f7102c0d6f36fe1034f63cc9bc51
2020-01-10 17:39:52 +00:00
Armando Montanez
c0ad978eac pw_target_runner: Update name change in docs
Updates pw_target_runner (and other) docs to reflect the name change
from pw_test_server to pw_target_runner.

Change-Id: Iffa81088b81a1b83c285949c73fbf93e23f478a3
2020-01-07 18:08:33 +00:00
Armando Montanez
975449b025 stm32f429i-disc1: Update docs
Update docs to reflect improvements to device detection and
pw_target_runner.

Change-Id: Iac29e2efcf976977e6b9bbbf710dcdacd4eae266
2020-01-06 18:19:14 +00:00
Armando Montanez
1644f12c0e stm32f429i-disc1: Fix unit test runner -v flag
The --verbose flag for stm32f429i_disc1_unit_test_runner wasn't properly
changing log level when run as a standalone utility. This change ensures
the -v/--verbose flag properly sets the logging level to debug.

Change-Id: Icf767b3b31834447b1b5d089b05585bc22061999
2020-01-03 23:21:05 +00:00
Armando Montanez
4ec8414d55 stm32f429i-disc1: Cross-platform board detection
Switch to using pyserial's list_ports tool to detect attached
STM32F429I-DISC1 boards. Theoretically, this allows autodetection to
work as expected on macOS/Windows as well.

Change-Id: I8fbde757bbd7a167103b07d6a073bbbbe3053e65
2020-01-03 01:21:26 +00:00
Alexei Frolov
fb27737cd6 Print an error if a host tool is running on copy
If a host tool is running when the pw_host_tool tries to copy a newer
version into the host_tools/ directory, the copy fails. This change
prints out a user-friendly error indicating the problem.

Change-Id: I7b25f709150f40e1ad9c8c7e63cbfa9f9f9a53e5
2020-01-02 20:49:48 +00:00
Alexei Frolov
59a83b41bb Update stm32f429i test server
This change updates the stm32f429i test server and client scripts to use
pw_target_runner instead of pw_test_server.

Change-Id: I82dd2b043c5517571cecff6c0e306056507fc950
2019-12-26 23:25:25 +00:00
Alexei Frolov
514de20e4a Fix stm32f429i test client
* Correctly specify the path to the client script from GN.
* Use subprocess instead of pw_cli.process to remove dependency on
  pw_cli and reduce output log clutter.
* Set test run target as Ninja default.

Change-Id: Iae01eae107a8eb52e26e772120d2f6ed8052ee37
2019-12-14 00:11:17 +00:00
Armando Montanez
8c235cec60
stm32f429i-disc1: Add unit test server
Adds a build argument to the stm32f429i-disc1 target that enables
running tests via the pw_test_server.

Change-Id: I76c98fa25d27c771251e41de8631f156572f7731
2019-12-13 11:33:17 -08:00
Armando Montanez
5104cd68bc pw_cpu_exception: Add CPU exception module
This change introduces pw_cpu_exception, a facade that provides a
high-level interface for handling CPU exceptions.

Change-Id: I1f98ac82dd54040448b2e2ac32a392c49cb6dfba
2019-12-13 11:26:08 -08:00
Armando Montanez
050eae89d2 stm32f429i-disc1: Enable hardware FPU
* Add Cortex-M4 toolchains with floating point hardware instructions.
 * Update stm32f429i-disc1 to use hardware fpu toolchain by default.
 * Add code to enable FPU in pw_dumb_io.

Verified tests that use floating point operations continue to pass.

Change-Id: I76bc7eeaf457eca1abacbc60992648d63dc85bf2
2019-12-13 00:33:46 +00:00
Armando Montanez
0874558cf3 docs: Add 'targets' section
Creates a new section in the docs for target documentation, and adds
some documentation for the stm32f429i-disc1 target.

Change-Id: I0ffbfa56a97458d850834fc0f670b32885b0d2b5
2019-12-12 21:15:16 +00:00
Armando Montanez
8f1139f5d7 stm32f429i-disc1: Automatic board detection
Introduce automatic STM32F429I-DISC1 board detection on linux, and
integrate it with the test target runer so the com port doesn't need to
be specified.

Change-Id: I2d8aa67bd03501934e9f2404f8afcef75e7d6aca
2019-12-06 23:22:18 +00:00
Wyatt Hepler
becb431e5f Apply pw format to the repository
Change-Id: I3c8e4f956dfe6c9e81d3069f72c30c5950852074
2019-12-05 09:31:11 -08:00
Rob Mohr
e11d715936 Add #! line to stm32f429i test runner.
Change-Id: Ida76b2683b6a24e9c60f2fa943672b9c5ed2f23d
2019-12-03 13:28:59 -08:00
Armando Montanez
47b0c5c1cd Use openocd provided by CIPD
Updates Pigweed tools to use OpenOCD provided by CIPD.

Change-Id: Iea80343373bc5d36d223dd327b854e89ee9e274a
2019-12-03 19:50:43 +00:00
Armando Montanez
7753c3edc5 stm32f429i-disc1: improve test runner integration
- Try to use pw_cli logger for test output format.
 - Log each line of captured subprocess output individually.
 - Minor tweaks to log statements.

Example:

...
20191202 14:38:19 OUT [26656] INF [       OK ] Format.ArgumentLargerThanBuffer_ReturnsResourceExhausted
20191202 14:38:19 OUT [26656] INF [ RUN      ] Format.CallFormatWithVaList_CallsCorrectFormatOverload
20191202 14:38:19 OUT [26656] INF [       OK ] Format.CallFormatWithVaList_CallsCorrectFormatOverload
20191202 14:38:19 OUT [26656] INF [==========] Done running all tests.
20191202 14:38:19 OUT [26656] INF [  PASSED  ] 6 test(s).
20191202 14:38:19 OUT [26656] INF [  FAILED  ] 1 test(s).
20191202 14:38:19 OUT [26656] ERR Test suite had one or more failures
20191202 14:38:19 ERR stm32f429i_disc1_unit_test_runner exited with status 1
20191202 14:38:19 INF Test  9/10: [FAIL] format_test
...

Change-Id: I99798f5c7d4770c4cf5def7ae621a374cad7f89b
2019-12-03 00:22:55 +00:00
Armando Montanez
89f02d77cd Simplify stm32f429i-disc1 test runner UI
- Change some info-level logs to be debug.
 - Include openocd config file in python module.
 - Provide default value for openocd_config command line argument.
 - Shorter log format.
 - Don't log backtrace for caught TestingFailure exceptions.

New example output (with test_runner.py):
~/pigweed/pigweed$ pw test --root out/stm32f429i-disc1/ --runner stm32f429i_disc1_unit_test_runner -- --port /dev/ttyACM0

 ▒█████▄   █▓  ▄███▒  ▒█    ▒█ ░▓████▒ ░▓████▒ ▒▓████▄
  ▒█░  █░ ░█▒ ██▒ ▀█▒ ▒█░ █ ▒█  ▒█   ▀  ▒█   ▀  ▒█  ▀█▌
  ▒█▄▄▄█░ ░█▒ █▓░ ▄▄░ ▒█░ █ ▒█  ▒███    ▒███    ░█   █▌
  ▒█▀     ░█░ ▓█   █▓ ░█░ █ ▒█  ▒█   ▄  ▒█   ▄  ░█  ▄█▌
  ▒█      ░█░ ░▓███▀   ▒█▓▀▓█░ ░▓████▒ ░▓████▒ ▒▓████▀

20191202 10:45:09 AM INF Scanning for tests...
20191202 10:45:09 AM INF Found 4 test groups (10 tests).
20191202 10:45:09 AM INF Running test groups //pw_status:tests, //pw_preprocessor:tests, //pw_string:tests, //pw_span:tests
20191202 10:45:09 AM INF Test  1/10: [RUN] format_test
2019-12-02 10:45:09 INFO | Flashing firmware to device...
2019-12-02 10:45:10 INFO | Successfully flashed firmware to device!
2019-12-02 10:45:10 INFO |
[==========] Running all tests.
[ RUN      ] Format.ValidFormatString_Succeeds
[       OK ] Format.ValidFormatString_Succeeds
[ RUN      ] Format.ValidFormatStringAndArguments_Succeeds
[       OK ] Format.ValidFormatStringAndArguments_Succeeds
[ RUN      ] Format.InvalidConversionSpecifier_ReturnsInvalidArgumentAndTerminates
../../pw_string/format_test.cc:51: Failure
      Expected: Status::INVALID_ARGUMENT == result.status()
        Actual: 3 == OK
../../pw_string/format_test.cc:52: Failure
      Expected: "" equals buffer
        Actual:  equals abc 12345
[  FAILED  ] Format.InvalidConversionSpecifier_ReturnsInvalidArgumentAndTerminates
[ RUN      ] Format.EmptyBuffer_ReturnsResourceExhausted
[       OK ] Format.EmptyBuffer_ReturnsResourceExhausted
[ RUN      ] Format.FormatLargerThanBuffer_ReturnsResourceExhausted
[       OK ] Format.FormatLargerThanBuffer_ReturnsResourceExhausted
[ RUN      ] Format.ArgumentLargerThanBuffer_ReturnsResourceExhausted
[       OK ] Format.ArgumentLargerThanBuffer_ReturnsResourceExhausted
[ RUN      ] Format.CallFormatWithVaList_CallsCorrectFormatOverload
[       OK ] Format.CallFormatWithVaList_CallsCorrectFormatOverload
[==========] Done running all tests.
[  PASSED  ] 6 test(s).
[  FAILED  ] 1 test(s).

2019-12-02 10:45:10 ERROR | Test suite had one or more failures.

Change-Id: I8ca4af75bb04ffb8f4a50d26e5ac0ef41e7d762a
2019-12-02 19:45:14 +00:00
Wyatt Hepler
1a96094ce6 Fix copyright notices
- Add missing copright header in conf.py.
- Fix inconsistent copyright notice line breaking.

Change-Id: Ib78f7768643069c49ff986a48a176df9fd06e891
2019-11-27 22:34:02 +00:00
Armando Montanez
3e1b5eb752 Reduce stm32f429i-disc1 test flake
The stm32f429i-disc1 test runner had some flakiness caused by a race
condition between the device and host. This change ensures all the
device test output is captured.

Change-Id: Ic1c68b2e680ab50536c747d31498ef46442afc41
2019-11-26 00:48:59 +00:00
Armando Montanez
2fe3b8de67 Add serial test runner for stm32f429i-disc1
Adds a script that flashes and runs a test on the stm32f429i-disc1
development board. Requires openocd and pyserial.

Example output:
~/pigweed/pigweed$ stm32f429i_disc1_unit_test_runner out/stm32f429i-disc1/obj/pw_unit_test/framework_test.elf --openocd-config targets/stm32f429i-disc1/openocd_stm32f4xx.cfg --port /dev/ttyACM0
TEST - 2019-11-25 13:50:43 - INFO - Launching test binary out/stm32f429i-disc1/obj/pw_unit_test/framework_test.elf
TEST - 2019-11-25 13:50:43 - INFO - Flashing firmware to device...
TEST - 2019-11-25 13:50:44 - INFO - Successfully flashed firmware to device!
TEST - 2019-11-25 13:50:44 - INFO - Test passed!

Change-Id: I111387bd967700e3eab6764a14b1890caedeb68d
2019-11-26 00:48:20 +00:00
Wyatt Hepler
8a823ceebb Size report for pw::string::Format
Add size report comparing pw::string::Format to std::snprintf.

Report with arm-none-eabi-gcc at -Os:

            Using pw::string::Format instead of snprintf
            ────────────────────────────────────────────
┌────────────────────────────┬───────────┬────────┬───────┬────────┐
│            Label           │  Segment  │ Before │ Delta │  After │
├════════════════════════════┼═══════════┼════════┼═══════┼════════┤
│    One string, return size │ SEG FLASH │  2,840 │   +80 │  2,920 │
├────────────────────────────┼───────────┼────────┼───────┼────────┤
│ Ten strings, handle errors │     (all) │ (same) │     0 │ (same) │
├────────────────────────────┼───────────┼────────┼───────┼────────┤
│   Fifty calls, same buffer │ SEG FLASH │  3,816 │   -72 │  3,744 │
└────────────────────────────┴───────────┴────────┴───────┴────────┘

Change-Id: Id484530320b0334cddf676a49ad79444fbbbde9b
2019-11-19 12:58:31 -08:00
Armando Montanez
a69244e4c1 Add stm32f429i-disc1 target and pw_dumb_io
Adds both the stm32f429i-disc1 target and a pw_dumb_io uart-based
backend.

Change-Id: If24379118fc2877485653d61ca66ceeb59ef920a
2019-11-16 00:14:52 +00:00