@protoboardai/ext-zephyr 0.0.0-stage → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +13 -0
- package/README.md +161 -2
- package/evals/haptic-driver-mode/case.json +44 -0
- package/evals/haptic-driver-mode/seed-firmware.config.ts.txt +13 -0
- package/evals/haptic-driver-mode/solution-firmware.config.ts.txt +15 -0
- package/lib/design.ts +492 -0
- package/lib/drivers.ts +70 -0
- package/lib/dts.ts +166 -0
- package/lib/pins.ts +20 -0
- package/lib/soc.ts +89 -0
- package/ops/firmware.ts +36 -0
- package/package.json +42 -4
- package/protoboard-extension.json +68 -0
- package/skills/firmware-config-zephyr/SKILL.md +134 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Protoboard Stack: @protoboardai/ext-zephyr
|
|
2
|
+
Copyright 2026 Delta Robotics, Inc.
|
|
3
|
+
|
|
4
|
+
This product includes software developed at Delta Robotics, Inc.
|
|
5
|
+
(https://deltaroboticsinc.com).
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License").
|
|
8
|
+
See the LICENSE file in this package for full terms.
|
|
9
|
+
|
|
10
|
+
"Protoboard", the Protoboard logo and the "0" mark are trademarks of
|
|
11
|
+
Delta Robotics, Inc. The License grants no rights to them (section 6);
|
|
12
|
+
see TRADEMARKS.md in the Protoboard Stack repository
|
|
13
|
+
(https://github.com/Delta-Robotics-Inc/protoboard-stack).
|
package/README.md
CHANGED
|
@@ -1,3 +1,162 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @protoboardai/ext-zephyr
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A provider of the `firmware` capability
|
|
4
|
+
([tool integrations](../../docs/specs/tool-integrations.md)). It turns
|
|
5
|
+
a UHD board whose controller is an nRF52840 module into a
|
|
6
|
+
[Zephyr](https://zephyrproject.org) board definition: devicetree with pin
|
|
7
|
+
assignment, devices on their buses, buttons, display, regulators and Kconfig.
|
|
8
|
+
Every setting line cites the UHD facts it comes from, in a comment for people
|
|
9
|
+
and in `firmware.manifest.json` for tools. Checked against Zephyr **4.2.0**
|
|
10
|
+
(bindings, Kconfig symbols and the nRF52840 devicetree at the `v4.2.0` tag).
|
|
11
|
+
|
|
12
|
+
A project selects it for one board, in the config next to the board module:
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
// src/boards/mainboard/firmware.config.ts
|
|
16
|
+
import { defineCapabilityConfig } from "@protoboardai/core";
|
|
17
|
+
|
|
18
|
+
export default defineCapabilityConfig({
|
|
19
|
+
provider: "@protoboardai/ext-zephyr",
|
|
20
|
+
constraints: {
|
|
21
|
+
board_name: "watch_core",
|
|
22
|
+
wake: ["sw1", "u3"], // the side button and the fuel gauge's alert wake it from System OFF
|
|
23
|
+
properties: { u5: { "actuator-mode": "LRA" } }, // what a driver binding needs and the model does not say
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
protoboard run firmware:generate --module mainboard # src/boards/mainboard/zephyr/
|
|
30
|
+
protoboard run firmware:export --module mainboard # out/config/ + out/firmware.manifest.json
|
|
31
|
+
protoboard run firmware:extract --module mainboard # artifacts, and the pins the devicetree names
|
|
32
|
+
protoboard check # includes firmware:check for the board
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`test/fixtures/watch-core` is a complete example: a Raytac MDBT50Q-1MV2 with a
|
|
36
|
+
heart-rate sensor, fuel gauge and haptic driver on I2C, a round GC9A01
|
|
37
|
+
display on SPI with D/C and reset, a side button, the charger's status line,
|
|
38
|
+
a 32.768 kHz crystal, a GNSS on a UART and USB. Its generated files are the
|
|
39
|
+
golden files in `test/golden/`.
|
|
40
|
+
|
|
41
|
+
## What it writes
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
zephyr/
|
|
45
|
+
boards/<vendor>/<board>/board.yml board name and SoC (Zephyr hardware model v2)
|
|
46
|
+
boards/<vendor>/<board>/Kconfig.<board> selects SOC_NRF52840_QIAA
|
|
47
|
+
boards/<vendor>/<board>/<board>_defconfig MPU, GPIO, the 32 kHz clock source
|
|
48
|
+
boards/<vendor>/<board>/<board>.dts chosen, buttons, display, zephyr,user, buses and devices, regulators, GPIO ports, UICR, USB
|
|
49
|
+
boards/<vendor>/<board>/<board>-pinctrl.dtsi pin assignment of every bus (default and sleep states)
|
|
50
|
+
firmware.conf Kconfig fragment: the subsystems the board's drivers live in
|
|
51
|
+
protoboard.lines.json digest and cites of every file (what export turns into the manifest)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Build with the folder holding `boards/` as a board root:
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
west build -b watch_core app -- -DBOARD_ROOT=<path>/zephyr -DEXTRA_CONF_FILE=<path>/zephyr/firmware.conf
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Do not edit these files. Settings of your own go in the application's
|
|
61
|
+
`prj.conf` and an application overlay, which Zephyr merges after the board's.
|
|
62
|
+
Export refuses an edited file and check reports it.
|
|
63
|
+
|
|
64
|
+
## How the board maps to Zephyr
|
|
65
|
+
|
|
66
|
+
1. **Firmware map** (tool-neutral, in `@protoboardai/core`: `boardFirmware`).
|
|
67
|
+
The controller is the board's one `microcontroller`. Buses come from the
|
|
68
|
+
peripherals' I2C, SPI and UART composites: each slot's pin is followed
|
|
69
|
+
along its net to a controller pin. Single lines between a peripheral and
|
|
70
|
+
the controller become controls by the peripheral pin's capabilities
|
|
71
|
+
(interrupt output, `reset`, `enable`, `display_dc`, `charge_status`). A
|
|
72
|
+
switch between a controller net and ground is an active-low button; a
|
|
73
|
+
resistor from the net to a supply replaces the internal pull-up. Devices
|
|
74
|
+
that agree on the lines they share are one bus: the write-only display and
|
|
75
|
+
a flash on the same SCK/MOSI are one SPI instance, with the flash's MISO,
|
|
76
|
+
one `cs-gpios` entry per device and each device's `reg` its index there.
|
|
77
|
+
2. **SoC table** (`lib/soc.ts`). The controller's SoC fact
|
|
78
|
+
(`domains[electrical].metadata.soc`, "Nordic nRF52840 revision 2,
|
|
79
|
+
aQFN-73") selects the nRF52840: `nordic/nrf52840_qiaa.dtsi`, bus instances
|
|
80
|
+
(`i2c0`/`i2c1`, `spi3` first for its 32 MHz, then `spi2`; `i2c0`/`spi0`
|
|
81
|
+
and `i2c1`/`spi1` share hardware), and the pin naming: a module pin named
|
|
82
|
+
`P0.13` is `NRF_PSEL(…, 0, 13)` and `<&gpio0 13 …>`.
|
|
83
|
+
3. **Driver table** (`lib/drivers.ts`), keyed by part id, each entry checked
|
|
84
|
+
against its Zephyr 4.2.0 binding:
|
|
85
|
+
|
|
86
|
+
| Part | Compatible | Kconfig | Controls the binding takes |
|
|
87
|
+
| --- | --- | --- | --- |
|
|
88
|
+
| `adi-max17048g-t10` | `maxim,max17048` | `FUEL_GAUGE` | — (ALRT goes to `zephyr,user`) |
|
|
89
|
+
| `ti-drv2605ldgs` | `ti,drv2605` (requires `actuator-mode`) | `HAPTICS` | `en-gpios`, `in-trig-gpios` |
|
|
90
|
+
| `ti-lp5024rsm` | `ti,lp5024` | `LED` | `enable-gpios` (LED child nodes are yours) |
|
|
91
|
+
| `eastrising-er-tft128-1` | `galaxycore,gc9x01x` on `zephyr,mipi-dbi-spi` | `DISPLAY` | `dc-gpios`, `reset-gpios`; width and height from the part's resolution |
|
|
92
|
+
| `adafruit-381-ds18b20-probe` | `maxim,ds18b20` on `zephyr,w1-gpio` | `W1`, `SENSOR` | resolution from the part |
|
|
93
|
+
|
|
94
|
+
A part with no entry still gets a node on its bus with its address and no
|
|
95
|
+
compatible (the application finds it by label), and a warning says so. An
|
|
96
|
+
I2C part that states no address is an error: its node would have no `reg`.
|
|
97
|
+
A missing mapping is reported to this package; meanwhile the application
|
|
98
|
+
overlay binds the driver to the node's label. Buttons get `INPUT_KEY_0`…`9`
|
|
99
|
+
then `INPUT_KEY_A`…`Z`; beyond 36 they get no code and a warning.
|
|
100
|
+
Controls without a binding property go to `zephyr,user` as
|
|
101
|
+
`<instance>-<pin name>-gpios`.
|
|
102
|
+
4. **Board facts.** A 32.768 kHz crystal on XL1/XL2 selects
|
|
103
|
+
`CLOCK_CONTROL_NRF_K32SRC_XTAL`, else the RC oscillator with a warning; the
|
|
104
|
+
module's "REG1 DC/DC inductor inside" fact turns on `®1` DC/DC; NFC pads
|
|
105
|
+
used as GPIO set `nfct-pins-as-gpios`; USB pins wired to a connector enable
|
|
106
|
+
`zephyr_udc0: &usbd`. Wake sources (`constraints.wake`) are written as
|
|
107
|
+
`zephyr,user { wakeup-gpios = … }` for the application to arm before
|
|
108
|
+
`sys_poweroff()`; any nRF52840 GPIO can wake it from System OFF.
|
|
109
|
+
|
|
110
|
+
## Constraints
|
|
111
|
+
|
|
112
|
+
| Key | Meaning |
|
|
113
|
+
| --- | --- |
|
|
114
|
+
| `controller` | instance path of the controller, when the board has more than one microcontroller |
|
|
115
|
+
| `board_name` | Zephyr board name (default: the module id with `_` for `-`) |
|
|
116
|
+
| `vendor` | board vendor folder and compatible prefix (default `protoboard`) |
|
|
117
|
+
| `console` | UART bus id or UART device instance for `zephyr,console` |
|
|
118
|
+
| `i2c_frequency_hz` | 100000 or 400000 (default: 400 kHz when every device allows it) |
|
|
119
|
+
| `uart_baud` | `{ <instance>: baud }` for UART devices that state no `baud_rate` |
|
|
120
|
+
| `wake` | inputs that wake the chip from System OFF: button or device instances, or nets |
|
|
121
|
+
| `properties` | `{ <instance>: { <property>: value } }`: devicetree properties a binding requires that the model cannot state; strings, integers, integer arrays, or `true` for a boolean |
|
|
122
|
+
|
|
123
|
+
## Checks
|
|
124
|
+
|
|
125
|
+
`firmware:check` runs the shared rules from `@protoboardai/core` (codes in the
|
|
126
|
+
[provider guide](../../docs/guides/writing-a-capability-provider.md#diagnostic-codes))
|
|
127
|
+
and these:
|
|
128
|
+
|
|
129
|
+
| Code | Severity | Meaning |
|
|
130
|
+
| --- | --- | --- |
|
|
131
|
+
| `FW_SOC_UNSUPPORTED` | error | The controller's SoC fact names no SoC this provider knows. |
|
|
132
|
+
| `FW_BUS_INSTANCES` | error | More I2C, SPI or UART buses than free nRF52840 instances. |
|
|
133
|
+
| `FW_BUS_SPEED` | error | An I2C clock the TWIM cannot run (100 or 400 kHz). |
|
|
134
|
+
| `FW_PROPERTY_MISSING` | error | A binding's required property (`actuator-mode`, a display's size) that neither the part nor the config states. |
|
|
135
|
+
| `FW_DISPLAY_DC_MISSING` | error | A 4-wire SPI display without a D/C line to the controller. |
|
|
136
|
+
| `FW_UART_BAUD_UNKNOWN`, `FW_CONSOLE_UNKNOWN` | error | No baud rate for a UART device; a console that is no UART. |
|
|
137
|
+
| `FW_DTS_SYNTAX` | error | The generated devicetree is not well formed (a provider defect). |
|
|
138
|
+
|
|
139
|
+
The devicetree is checked by a structural parser (`lib/dts.ts`): nodes and
|
|
140
|
+
properties closed, values are cells, strings or references, labels defined
|
|
141
|
+
once, and every `&label` defined by the files or the nRF52840 devicetree.
|
|
142
|
+
The tests also compile it with `dtc` after the C preprocessor when `dtc` is
|
|
143
|
+
installed; it is not on every machine, so the structural check is what
|
|
144
|
+
always runs.
|
|
145
|
+
|
|
146
|
+
## What the output does not establish
|
|
147
|
+
|
|
148
|
+
A generated board definition agrees with the model and the checked Zephyr
|
|
149
|
+
release. It has not been built or flashed: the first `west build` is the
|
|
150
|
+
real compile check, and the bench (rails, programming, I2C scan at the
|
|
151
|
+
addresses above, each peripheral's smoke test) is where it is proven. The
|
|
152
|
+
release's test plan lists those steps.
|
|
153
|
+
|
|
154
|
+
## Tests
|
|
155
|
+
|
|
156
|
+
```sh
|
|
157
|
+
npx vitest run packages/ext-zephyr # contract, golden files, cites, devicetree, seeded faults
|
|
158
|
+
UPDATE_GOLDEN=1 npx vitest run packages/ext-zephyr # after a deliberate change to the output
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
The test parts in `test/fixtures/parts/` are copies of researched parts; the
|
|
162
|
+
README there says where they came from.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": "protoboard.eval-case/v0",
|
|
3
|
+
"title": "Generate the watch board's Zephyr configuration when a driver binding needs a property the model does not state",
|
|
4
|
+
"skills": ["firmware-config-zephyr"],
|
|
5
|
+
"tags": ["firmware", "zephyr", "judgement"],
|
|
6
|
+
"fixture": {
|
|
7
|
+
"from": "../../../../examples/wearable-watch",
|
|
8
|
+
"exclude": ["release"],
|
|
9
|
+
"steps": [
|
|
10
|
+
{ "note": "the config without the haptic driver's actuator-mode property", "write": { "file": "src/boards/watch-main/firmware.config.ts", "from": "seed-firmware.config.ts.txt" } },
|
|
11
|
+
{ "note": "the firmware configuration has not been generated in this copy", "remove": "src/boards/watch-main/zephyr" },
|
|
12
|
+
{ "remove": "src/boards/watch-main/out/config" },
|
|
13
|
+
{ "remove": "src/boards/watch-main/out/firmware.manifest.json" }
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"instruction": "The wearable watch's main board (module watch-main-board, src/boards/watch-main) needs its Zephyr board definition generated and exported; this copy has none yet. Produce fresh firmware outputs so that `npx protoboard check` reports no errors and no firmware finding left open. Do not change the board module, the parts or the circuit outputs, and do not edit generated files. Tell me what you generated and every value you had to decide that the model did not state, with where it came from.",
|
|
17
|
+
"tools": { "read": true, "edit": true, "commands": ["npx protoboard *"] },
|
|
18
|
+
"budget": { "turns": 30, "seconds": 900, "usd": 4 },
|
|
19
|
+
"graders": [
|
|
20
|
+
{ "id": "property-supplied-and-named", "kind": "fault", "code": "FW_PROPERTY_MISSING", "caught": "actuator.?mode[\\s\\S]*LRA|LRA[\\s\\S]*actuator.?mode", "description": "the binding's actuator-mode is set and the answer names it" },
|
|
21
|
+
{
|
|
22
|
+
"id": "check-clean",
|
|
23
|
+
"kind": "check",
|
|
24
|
+
"maxErrors": 0,
|
|
25
|
+
"absent": ["FW_NOT_GENERATED", "FW_NATIVE_STALE", "FW_NATIVE_EDITED", "FW_PIN_DRIFT", "PB_OUTPUT_NOT_EXPORTED"],
|
|
26
|
+
"ran": ["ext:@protoboardai/ext-zephyr/firmware:check", "protoboard/standard-outputs"]
|
|
27
|
+
},
|
|
28
|
+
{ "id": "outputs-valid", "kind": "outputs", "module": "watch-main-board" },
|
|
29
|
+
{ "id": "dts-lra", "kind": "text", "file": "src/boards/watch-main/out/config/boards/protoboard/wearable_watch/wearable_watch.dts", "matches": ["actuator-mode = \"LRA\""], "notMatches": ["actuator-mode = \"ERM\""], "description": "the DRV2605L drives the VG0832012, a linear resonant actuator" },
|
|
30
|
+
{ "id": "config-kept", "kind": "text", "file": "src/boards/watch-main/firmware.config.ts", "matches": ["wake: \\[\"sw1\", \"sw2\", \"u2\"\\]", "board_name: \"wearable_watch\""], "description": "the wake sources and board name are not changed to get past the check" },
|
|
31
|
+
{ "id": "manifest-cites", "kind": "facts", "file": "src/boards/watch-main/out/firmware.manifest.json", "facts": [{ "path": "provider", "equals": "@protoboardai/ext-zephyr" }, { "path": "controller.part", "equals": "raytac-mdbt50q-1mv2" }] },
|
|
32
|
+
{ "id": "board-untouched", "kind": "digest", "file": "src/boards/watch-main/watch-main.uhd.ts", "changed": false },
|
|
33
|
+
{ "id": "driver-part-untouched", "kind": "digest", "file": "parts/catalog/ti-drv2605ldgs.json", "changed": false },
|
|
34
|
+
{ "id": "circuit-outputs-untouched", "kind": "digest", "file": "src/boards/watch-main/out/netlist.json", "changed": false }
|
|
35
|
+
],
|
|
36
|
+
"solution": [
|
|
37
|
+
{ "protoboard": ["check"], "expect": { "exit": 1 } },
|
|
38
|
+
{ "write": { "file": "src/boards/watch-main/firmware.config.ts", "from": "solution-firmware.config.ts.txt" } },
|
|
39
|
+
{ "protoboard": ["run", "firmware:generate", "--module", "watch-main-board"], "expect": { "status": "succeeded" } },
|
|
40
|
+
{ "protoboard": ["run", "firmware:export", "--module", "watch-main-board"], "expect": { "status": "succeeded" } },
|
|
41
|
+
{ "protoboard": ["check"] },
|
|
42
|
+
{ "say": "firmware:check refused generate with FW_PROPERTY_MISSING: the ti,drv2605 binding requires actuator-mode, which no part states. The DRV2605L (u4) drives the VG0832012 on J4 through the LRA leads, a linear resonant actuator, so I set properties: { u4: { \"actuator-mode\": \"LRA\" } } in firmware.config.ts with a comment, then generated and exported the Zephyr board definition (wearable_watch: devicetree, pinctrl, Kconfig, firmware.conf) and out/firmware.manifest.json. check reports no errors." }
|
|
43
|
+
]
|
|
44
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineCapabilityConfig } from "@protoboardai/core";
|
|
2
|
+
|
|
3
|
+
// Zephyr 4.2 for the watch main board (@protoboardai/ext-zephyr): the board definition and Kconfig
|
|
4
|
+
// fragment, every line citing the board's nets and parts. Only what the model cannot state is here.
|
|
5
|
+
export default defineCapabilityConfig({
|
|
6
|
+
provider: "@protoboardai/ext-zephyr",
|
|
7
|
+
module: "watch-main-board",
|
|
8
|
+
constraints: {
|
|
9
|
+
board_name: "wearable_watch",
|
|
10
|
+
// System OFF wake sources (brief F2, F8): both buttons, and the IMU's wrist-raise interrupt
|
|
11
|
+
wake: ["sw1", "sw2", "u2"],
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineCapabilityConfig } from "@protoboardai/core";
|
|
2
|
+
|
|
3
|
+
// Zephyr 4.2 for the watch main board (@protoboardai/ext-zephyr): the board definition and Kconfig
|
|
4
|
+
// fragment, every line citing the board's nets and parts. Only what the model cannot state is here.
|
|
5
|
+
export default defineCapabilityConfig({
|
|
6
|
+
provider: "@protoboardai/ext-zephyr",
|
|
7
|
+
module: "watch-main-board",
|
|
8
|
+
constraints: {
|
|
9
|
+
board_name: "wearable_watch",
|
|
10
|
+
// System OFF wake sources (brief F2, F8): both buttons, and the IMU's wrist-raise interrupt
|
|
11
|
+
wake: ["sw1", "sw2", "u2"],
|
|
12
|
+
// the DRV2605L drives the Vybronics VG0832012 LRA (an LRA, not an ERM); its binding requires the mode
|
|
13
|
+
properties: { u4: { "actuator-mode": "LRA" } },
|
|
14
|
+
},
|
|
15
|
+
});
|