Rob Mohr | d477748 | 2024-05-22 17:25:24 -0700 | [diff] [blame] | 1 | # Contributing to Pigweed |
| 2 | |
Ted Pudlik | 554438e | 2024-08-30 23:32:44 +0000 | [diff] [blame] | 3 | Pigweed lets anyone contribute to the project, regardless of their employer. The |
| 4 | Pigweed project reviews and encourages well-tested, high-quality contributions |
| 5 | from anyone who wants to contribute to Pigweed. |
Rob Mohr | d477748 | 2024-05-22 17:25:24 -0700 | [diff] [blame] | 6 | |
| 7 | ## Contributor License Agreement |
| 8 | |
| 9 | Contributions to this project must be accompanied by a Contributor License |
| 10 | Agreement (CLA). |
| 11 | |
| 12 | To see any Contributor License Agreements on file or to sign a CLA, go to |
| 13 | <https://cla.developers.google.com/>. |
| 14 | |
| 15 | For more information about the Google CLA, see |
| 16 | [Contributor License Agreements](https://cla.developers.google.com/about). |
| 17 | |
| 18 | ## Contributing changes and submitting code reviews |
| 19 | |
| 20 | All changes require review, including changes by project members. |
| 21 | |
Ted Pudlik | 554438e | 2024-08-30 23:32:44 +0000 | [diff] [blame] | 22 | For detailed instructions on how to contribute changes, see |
| 23 | [the Gerrit docs](https://gerrit-review.googlesource.com/Documentation/intro-user.html). |
Rob Mohr | d477748 | 2024-05-22 17:25:24 -0700 | [diff] [blame] | 24 | |
| 25 | ## Community guidelines |
| 26 | |
| 27 | This project observes the following community guidelines: |
| 28 | |
Ted Pudlik | 554438e | 2024-08-30 23:32:44 +0000 | [diff] [blame] | 29 | * [Google's Open Source Community Guidelines](https://opensource.google/conduct/) |
| 30 | |
| 31 | ## Required presumit testing |
| 32 | |
| 33 | We don’t have hardware-in-the-loop testing yet, so the following manual testing |
| 34 | is needed before merging *any* change to this repo. |
| 35 | |
| 36 | ### Checklist for new code |
| 37 | |
| 38 | - [ ] New binaries or tests? |
| 39 | - [ ] Update `//BUILD.bazel` with updated deps on |
| 40 | `:refresh_compile_commands`. |
| 41 | - [ ] Update `//.bazelrc` presubmit section with the new binaries you want |
| 42 | built in CQ after the line `build:presubmit -- \ ` |
| 43 | - [ ] New protos? |
| 44 | - [ ] Update `//tools/airmaranth/device.py` with the proto imports under |
| 45 | `get_all_protos()`. |
| 46 | - [ ] Add the proto deps to `:airmaranth_lib` in `//tools/BUILD.bazel` |
| 47 | - [ ] Run the regression suite (below) manually |
| 48 | |
| 49 | ### Regression testing suite: manual testing steps |
| 50 | |
| 51 | For now, assumes you have |
| 52 | [a full setup](https://pigweed.dev/docs/showcases/sense/tutorial/flash.html#option-full-setup): |
| 53 | |
| 54 | * Pico RP2040 |
| 55 | * Enviro+ pack |
| 56 | * OmniBus extender |
| 57 | * Debug probe |
| 58 | |
| 59 | #### Host simulator |
| 60 | |
| 61 | ##### Steps |
| 62 | |
Ted Pudlik | 688596d | 2024-09-12 18:16:52 +0000 | [diff] [blame] | 63 | 1. In terminal 1: Run simulator `$ bazelisk run //apps/blinky:simulator_blinky` |
Ted Pudlik | 554438e | 2024-08-30 23:32:44 +0000 | [diff] [blame] | 64 | 1. In terminal 2: |
| 65 | |
| 66 | * Run console `$ bazelisk run //apps/blinky:simulator_console` |
| 67 | * In the console, run: `>>> |
| 68 | device.rpcs.pw.rpc.EchoService.Echo(msg='hello')` |
| 69 | |
| 70 | ##### Expected result |
| 71 | |
| 72 | Return value shown in console is: `(Status.OK, pw.rpc.EchoMessage(msg=’hello’))` |
| 73 | |
| 74 | #### On-device RP2040 apps |
| 75 | |
| 76 | ##### Flashing test |
| 77 | |
| 78 | ###### Steps |
| 79 | |
| 80 | In a terminal (or in VSCode by “Run target”): |
| 81 | |
| 82 | * `$ bazelisk run //apps/blinky:flash` |
| 83 | * `$ bazelisk run //apps/blinky:rp2040_console` |
| 84 | |
| 85 | ###### Expected result |
| 86 | |
| 87 | 1. Successful build, flash, and console loads. |
| 88 | 1. RP2040 LED toggles @ 1Hz |
| 89 | 1. Log panel displays: `RpcDevice BLINKY Toggling Led` |
| 90 | |
| 91 | ##### RPC test |
| 92 | |
| 93 | ###### Steps |
| 94 | |
| 95 | In the console, run: `>>> device.rpcs.pw.rpc.EchoService.Echo(msg='hello')` |
| 96 | |
| 97 | ###### Expected result |
| 98 | |
| 99 | Return value shown in console is: `(Status.OK, pw.rpc.EchoMessage(msg=’hello’))` |
| 100 | |
| 101 | ##### Toggle blinky test |
| 102 | |
| 103 | 1. Close any active consoles. Run `$ bazelisk run |
| 104 | //apps/blinky:rp2040_toggle_blinky`. The Pico LED should *stop* blinking. |
| 105 | 1. Run `$ bazelisk run //apps/blinky:rp2040_toggle_blinky` again. The Pico LED |
| 106 | should *start* blinking. |
| 107 | |
| 108 | #### On-device RP2040 tests |
| 109 | |
| 110 | ##### Steps |
| 111 | |
| 112 | 1. In terminal 1: Start test runner: `$ bazelisk run \ |
| 113 | @pigweed//targets/rp2040/py:unit_test_server \ -- --debug-probe-only` |
| 114 | 1. In terminal 2: Run tests: `$ bazelisk test --config=rp2040 //...` |
| 115 | |
| 116 | ##### Expected result |
| 117 | |
| 118 | Test runner successfully connects to the device. Tests run and pass. |