@typecad/framework-zephyr 1.0.0-alpha.16 → 1.0.0-alpha.19
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 -21
- package/README.md +49 -87
- package/dist/as-built.d.ts +2 -2
- package/dist/as-built.js +2 -2
- package/dist/audit.d.ts +111 -0
- package/dist/audit.js +416 -0
- package/dist/boardgen.d.ts +1 -9
- package/dist/boardgen.js +288 -47
- package/dist/chips/resolve.js +20 -0
- package/dist/chips/types.d.ts +22 -1
- package/dist/debug-codegen.js +1 -1
- package/dist/display/bindings.d.ts +55 -0
- package/dist/display/bindings.js +316 -0
- package/dist/display/gfx.d.ts +2 -3
- package/dist/display/gfx.js +166 -154
- package/dist/display/index.js +20 -1
- package/dist/display/mipi-dbi-host.d.ts +9 -0
- package/dist/display/mipi-dbi-host.js +174 -0
- package/dist/display/profiles.d.ts +109 -4
- package/dist/display/profiles.js +270 -7
- package/dist/display/touch-adapter.js +119 -49
- package/dist/display/ui-adapter-eink.d.ts +2 -0
- package/dist/display/ui-adapter-eink.js +4 -0
- package/dist/display/ui-adapter-gray.d.ts +8 -0
- package/dist/display/ui-adapter-gray.js +170 -0
- package/dist/display/ui-adapter-mono.d.ts +13 -0
- package/dist/display/ui-adapter-mono.js +230 -0
- package/dist/display/ui-adapter-native.d.ts +10 -0
- package/dist/display/ui-adapter-native.js +295 -0
- package/dist/display/ui-adapter-shared.d.ts +11 -0
- package/dist/display/ui-adapter-shared.js +122 -0
- package/dist/display/ui-adapter.js +510 -558
- package/dist/doctor.js +4 -4
- package/dist/dt-config/custom-board.js +2 -2
- package/dist/dt-config/kconfig.d.ts +62 -1
- package/dist/dt-config/kconfig.js +141 -38
- package/dist/dt-config/overlay.d.ts +15 -2
- package/dist/dt-config/overlay.js +433 -18
- package/dist/framework.manifest.d.ts +10 -4
- package/dist/framework.manifest.js +133 -17
- package/dist/index.d.ts +2 -0
- package/dist/index.js +14 -6
- package/dist/licenses.d.ts +2 -2
- package/dist/licenses.js +13 -92
- package/dist/lowering/can.d.ts +25 -0
- package/dist/lowering/can.js +97 -0
- package/dist/lowering/clock.d.ts +17 -0
- package/dist/lowering/clock.js +58 -0
- package/dist/lowering/fs.js +1 -1
- package/dist/lowering/gpio.js +0 -32
- package/dist/lowering/hid.d.ts +27 -0
- package/dist/lowering/hid.js +244 -0
- package/dist/lowering/http.js +264 -32
- package/dist/lowering/i2c.d.ts +8 -0
- package/dist/lowering/i2c.js +137 -5
- package/dist/lowering/i2s.d.ts +27 -0
- package/dist/lowering/i2s.js +98 -0
- package/dist/lowering/index.d.ts +9 -1
- package/dist/lowering/index.js +25 -1
- package/dist/lowering/interrupts.js +6 -0
- package/dist/lowering/matrix.d.ts +15 -0
- package/dist/lowering/matrix.js +63 -0
- package/dist/lowering/mqtt.js +110 -8
- package/dist/lowering/power.d.ts +3 -2
- package/dist/lowering/power.js +20 -45
- package/dist/lowering/pwm.js +25 -0
- package/dist/lowering/sensor.d.ts +2 -2
- package/dist/lowering/sensor.js +8 -4
- package/dist/lowering/strip.d.ts +16 -0
- package/dist/lowering/strip.js +70 -0
- package/dist/lowering/thread.js +5 -1
- package/dist/lowering/trace.d.ts +44 -0
- package/dist/lowering/trace.js +239 -0
- package/dist/lowering/uart.js +6 -1
- package/dist/lowering/usb.d.ts +3 -1
- package/dist/lowering/usb.js +16 -13
- package/dist/lowering/wdt.js +2 -29
- package/dist/sbom.d.ts +181 -0
- package/dist/sbom.js +901 -0
- package/dist/sdk/board-catalog-sync.d.ts +1 -3
- package/dist/sdk/board-catalog-sync.js +4 -10
- package/dist/strategy.d.ts +82 -46
- package/dist/strategy.js +639 -182
- package/dist/tmp-probe.d.ts +2 -0
- package/dist/tmp-probe.js +9 -0
- package/dist/toolchain/debug-config.d.ts +50 -90
- package/dist/toolchain/debug-config.js +239 -510
- package/dist/toolchain/env-check.d.ts +1 -3
- package/dist/toolchain/env-check.js +2 -7
- package/dist/toolchain/index.d.ts +28 -3
- package/dist/toolchain/index.js +498 -62
- package/dist/toolchain/runners.d.ts +16 -0
- package/dist/toolchain/runners.js +75 -0
- package/dist/toolchain/scaffold.d.ts +5 -2
- package/dist/toolchain/scaffold.js +79 -15
- package/dist/toolchain/west-discover.d.ts +6 -0
- package/dist/toolchain/west-discover.js +36 -13
- package/dist/toolchain/west-spawn.js +8 -2
- package/dist/west-inventory.d.ts +25 -0
- package/dist/west-inventory.js +97 -0
- package/installer/README.md +328 -328
- package/installer/install.sh +2 -2
- package/installer/templates/project/.typecad/activate-zephyr.ps1 +1 -1
- package/installer/templates/project/.typecad/activate-zephyr.sh +1 -1
- package/installer/templates/project/.vscode/settings.json +1 -1
- package/installer/templates/project/README.md +2 -2
- package/package.json +5 -5
- package/src/as-built.ts +206 -206
- package/src/audit.ts +529 -0
- package/src/boardgen.ts +265 -50
- package/src/chips/resolve.ts +21 -0
- package/src/chips/types.ts +10 -1
- package/src/display/bindings.ts +347 -0
- package/src/display/gfx.ts +318 -306
- package/src/display/index.ts +87 -70
- package/src/display/mipi-dbi-host.ts +183 -0
- package/src/display/profiles.ts +458 -139
- package/src/display/touch-adapter.ts +119 -49
- package/src/display/ui-adapter-eink.ts +13 -0
- package/src/display/ui-adapter-gray.ts +178 -0
- package/src/display/ui-adapter-mono.ts +238 -0
- package/src/display/ui-adapter-native.ts +304 -0
- package/src/display/ui-adapter-shared.ts +125 -0
- package/src/display/ui-adapter.ts +732 -781
- package/src/doctor.ts +4 -4
- package/src/dt-config/custom-board.ts +2 -2
- package/src/dt-config/kconfig.ts +647 -505
- package/src/dt-config/overlay.ts +1475 -1058
- package/src/framework.manifest.ts +659 -535
- package/src/index.ts +16 -6
- package/src/licenses.ts +346 -425
- package/src/lowering/can.ts +140 -0
- package/src/lowering/clock.ts +91 -0
- package/src/lowering/fs.ts +135 -135
- package/src/lowering/gpio.ts +0 -33
- package/src/lowering/hid.ts +261 -0
- package/src/lowering/http.ts +264 -32
- package/src/lowering/i2c.ts +142 -5
- package/src/lowering/i2s.ts +143 -0
- package/src/lowering/index.ts +18 -1
- package/src/lowering/interrupts.ts +6 -0
- package/src/lowering/matrix.ts +70 -0
- package/src/lowering/mqtt.ts +109 -8
- package/src/lowering/power.ts +41 -0
- package/src/lowering/pwm.ts +192 -167
- package/src/lowering/sensor.ts +159 -155
- package/src/lowering/strip.ts +81 -0
- package/src/lowering/thread.ts +5 -1
- package/src/lowering/trace.ts +270 -0
- package/src/lowering/uart.ts +6 -1
- package/src/lowering/usb.ts +16 -13
- package/src/lowering/wdt.ts +2 -25
- package/src/sbom.ts +1117 -0
- package/src/sdk/board-catalog-sync.ts +4 -25
- package/src/strategy.ts +2680 -2309
- package/src/toolchain/debug-config.ts +262 -522
- package/src/toolchain/env-check.ts +279 -285
- package/src/toolchain/index.ts +1792 -1359
- package/src/toolchain/runners.ts +80 -0
- package/src/toolchain/scaffold.ts +355 -296
- package/src/toolchain/west-discover.ts +35 -13
- package/src/toolchain/west-spawn.ts +174 -168
- package/src/west-inventory.ts +102 -0
- package/dist/async/timer-polyfill.d.ts +0 -10
- package/dist/async/timer-polyfill.js +0 -95
- package/dist/chips/board-overrides.d.ts +0 -7
- package/dist/chips/board-overrides.js +0 -11
- package/dist/chips/esp32.d.ts +0 -2
- package/dist/chips/esp32.js +0 -71
- package/dist/chips/esp32s3.d.ts +0 -2
- package/dist/chips/esp32s3.js +0 -103
- package/dist/chips/soc/.d.ts +0 -2
- package/dist/chips/soc/.js +0 -129
- package/dist/chips/soc/esp32.d.ts +0 -2
- package/dist/chips/soc/esp32.js +0 -120
- package/dist/chips/soc/esp32c3.d.ts +0 -2
- package/dist/chips/soc/esp32c3.js +0 -90
- package/dist/chips/soc/esp32c6.d.ts +0 -2
- package/dist/chips/soc/esp32c6.js +0 -109
- package/dist/chips/soc/esp32s3.d.ts +0 -2
- package/dist/chips/soc/esp32s3.js +0 -189
- package/dist/chips/soc/index.d.ts +0 -2
- package/dist/chips/soc/index.js +0 -23
- package/dist/chips/soc/nrf52840.d.ts +0 -2
- package/dist/chips/soc/nrf52840.js +0 -130
- package/dist/chips/soc/rp2040.d.ts +0 -2
- package/dist/chips/soc/rp2040.js +0 -141
- package/dist/chips/soc/rp2350a.d.ts +0 -2
- package/dist/chips/soc/rp2350a.js +0 -145
- package/dist/chips/soc/samd21g18a.d.ts +0 -2
- package/dist/chips/soc/samd21g18a.js +0 -143
- package/dist/chips/soc/stm32f411xe.d.ts +0 -2
- package/dist/chips/soc/stm32f411xe.js +0 -251
- package/dist/chips/xiao-ble.d.ts +0 -2
- package/dist/chips/xiao-ble.js +0 -100
- package/dist/lowering/pulse.d.ts +0 -7
- package/dist/lowering/pulse.js +0 -51
- package/dist/lowering/tone.d.ts +0 -10
- package/dist/lowering/tone.js +0 -63
- package/dist/lowering/worker-backing.d.ts +0 -14
- package/dist/lowering/worker-backing.js +0 -79
- package/dist/lowering/worker.d.ts +0 -6
- package/dist/lowering/worker.js +0 -14
- package/dist/sdk/board-data.generated.d.ts +0 -2
- package/dist/sdk/board-data.generated.js +0 -4
- package/dist/sdk/catalog-walker.d.ts +0 -90
- package/dist/sdk/catalog-walker.js +0 -682
- package/dist/sdk/dts-reader.d.ts +0 -83
- package/dist/sdk/dts-reader.js +0 -596
- package/src/debug-codegen.ts +0 -207
package/LICENSE
CHANGED
|
@@ -1,21 +1,202 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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/README.md
CHANGED
|
@@ -1,87 +1,49 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
Or in `cuttlefish.config.ts`:
|
|
51
|
-
|
|
52
|
-
```ts
|
|
53
|
-
export default {
|
|
54
|
-
entry: './src/main.ts',
|
|
55
|
-
board: 'xiao_ble/nrf52840',
|
|
56
|
-
framework: '@typecad/framework-zephyr',
|
|
57
|
-
};
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## HAL coverage
|
|
61
|
-
|
|
62
|
-
The manifest (`src/framework.manifest.ts`) is the honest, complete record of
|
|
63
|
-
what lowers. Fully lowered: **gpio, pwm, adc, dac** (pin-fact-gated),
|
|
64
|
-
**i2c, spi, uart, interrupts, timing, wdt, counter, thread, shift, board
|
|
65
|
-
constants**, **random** (xorshift32 PRNG seeded from the Zephyr entropy tap),
|
|
66
|
-
**preferences (Store)**, **fs (File)**, **sensor**, **ble**, **snprintf**, and
|
|
67
|
-
**wifi/http/mqtt** (ESP32-class radio targets only — nRF52840 has no WiFi).
|
|
68
|
-
**Display** lowers via the generic `<zephyr/drivers/display.h>` GFX runtime.
|
|
69
|
-
Declared unsupported on this target: **i2s, twai/CAN, ethernet, espnow,
|
|
70
|
-
hardware crypto, pcnt, mcpwm**. USB CDC is board-gated: it lowers only on
|
|
71
|
-
boards whose DTS enables the USB device controller.
|
|
72
|
-
|
|
73
|
-
Run `npm test` (the manifest validator) to confirm the declared coverage matches
|
|
74
|
-
the actual lowering behavior.
|
|
75
|
-
|
|
76
|
-
## Notes / limitations
|
|
77
|
-
|
|
78
|
-
- **Minimal C++ libc.** Zephyr's default C++ support (`lib/cpp/minimal`) has no
|
|
79
|
-
`<vector>`, `<string>`, `<iostream>`, `<functional>`, exceptions, or RTTI.
|
|
80
|
-
`prj.conf` enables `CONFIG_NEWLIB_LIBC` for `std::string`/`std::vector`; array
|
|
81
|
-
literals still promote to the StaticArray wrapper, not `std::vector`.
|
|
82
|
-
- **Debug mode.** `cuttlefish build --debug` routes through `printk` (always
|
|
83
|
-
available, no `CONFIG_CONSOLE` dependency) rather than `std::cout`, since the
|
|
84
|
-
minimal libc has no iostream. Breakpoints halt on console input (`ENTER`
|
|
85
|
-
continues, `s` skips).
|
|
86
|
-
- **AUTOSAR compliance.** All emitted C++ uses `static_cast`/`reinterpret_cast`
|
|
87
|
-
(no C-style casts) so the shim bytes pass `--autosar=strict`.
|
|
1
|
+
# `@typecad/framework-zephyr`
|
|
2
|
+
|
|
3
|
+
The Zephyr engine behind your [typeCAD/hal](https://typecad.dev) builds.
|
|
4
|
+
|
|
5
|
+
When you scaffold a firmware project with `npx @typecad/hal create` and pick
|
|
6
|
+
a board, this is the package that lands in your dependencies and does the
|
|
7
|
+
heavy lifting: your TypeScript compiles to **real Zephyr RTOS applications**,
|
|
8
|
+
built and flashed with Zephyr's own toolchain.
|
|
9
|
+
|
|
10
|
+
## Why
|
|
11
|
+
|
|
12
|
+
Zephyr is a production-grade RTOS — but its devicetree, Kconfig, and CMake
|
|
13
|
+
layers demand real effort before your first blink. This package moves that
|
|
14
|
+
effort into the toolchain: you write TypeScript against `@typecad/hal`, and
|
|
15
|
+
the generated firmware calls the native Zephyr driver APIs directly. No
|
|
16
|
+
boilerplate project, no devicetree hand-editing, no Arduino compatibility
|
|
17
|
+
shims — just the RTOS, driven by code you can read.
|
|
18
|
+
|
|
19
|
+
## What it does for you
|
|
20
|
+
|
|
21
|
+
- **Generates a complete Zephyr application** from your firmware — entry
|
|
22
|
+
point, devicetree overlays, and Kconfig — regenerated automatically
|
|
23
|
+
whenever your code changes.
|
|
24
|
+
- **Builds and flashes through Zephyr's `west` toolchain**, discovering
|
|
25
|
+
your environment without activation scripts (works from any terminal).
|
|
26
|
+
- **Knows your board.** Board definitions come from your Zephyr tree's
|
|
27
|
+
catalog — 1,300+ board variants, same workflow for every one.
|
|
28
|
+
- **Debugs on hardware.** Set breakpoints in your TypeScript in VS Code and
|
|
29
|
+
debug the running board (the TypeCAD Debug extension ships into every
|
|
30
|
+
project).
|
|
31
|
+
- **Installs the toolchain for you.** No Zephyr SDK yet? One command:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
npx --package @typecad/framework-zephyr zephyr-installer
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Start here
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npx @typecad/hal create my-firmware # pick a board — this framework is the default
|
|
41
|
+
cd my-firmware && npm run upload
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- [typeCAD](https://typecad.dev) — documentation and guides
|
|
45
|
+
- [`@typecad/hal`](https://www.npmjs.com/package/@typecad/hal) — the product
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
|
|
49
|
+
Apache-2.0
|
package/dist/as-built.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface AsBuiltFacts {
|
|
|
10
10
|
pwm: AsBuiltRoute[];
|
|
11
11
|
dac: AsBuiltRoute[];
|
|
12
12
|
}
|
|
13
|
-
/** The .
|
|
13
|
+
/** The .typecad-hal/as-built.json shape (machine-authored facts file). */
|
|
14
14
|
export interface AsBuiltFile {
|
|
15
15
|
version: 1;
|
|
16
16
|
board: string;
|
|
@@ -27,7 +27,7 @@ export interface AsBuiltFile {
|
|
|
27
27
|
* its labels inline before the node name.
|
|
28
28
|
*/
|
|
29
29
|
export declare function parseZephyrDts(text: string): AsBuiltFacts;
|
|
30
|
-
/** Parse + shape-validate .
|
|
30
|
+
/** Parse + shape-validate .typecad-hal/as-built.json; errors name the file. */
|
|
31
31
|
export declare function parseAsBuiltJson(text: string, source?: string): AsBuiltFile;
|
|
32
32
|
/** Serialize the as-built snapshot (deterministic field order). */
|
|
33
33
|
export declare function asBuiltJson(board: string, facts: AsBuiltFacts): string;
|
package/dist/as-built.js
CHANGED
|
@@ -156,8 +156,8 @@ export function parseZephyrDts(text) {
|
|
|
156
156
|
}
|
|
157
157
|
return facts;
|
|
158
158
|
}
|
|
159
|
-
/** Parse + shape-validate .
|
|
160
|
-
export function parseAsBuiltJson(text, source = '.
|
|
159
|
+
/** Parse + shape-validate .typecad-hal/as-built.json; errors name the file. */
|
|
160
|
+
export function parseAsBuiltJson(text, source = '.typecad-hal/as-built.json') {
|
|
161
161
|
let parsed;
|
|
162
162
|
try {
|
|
163
163
|
parsed = JSON.parse(text);
|
package/dist/audit.d.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { ReadFile } from '@typecad/cuttlefish/api/shared';
|
|
2
|
+
export type KconfigValue = string | number | boolean;
|
|
3
|
+
/** Parse a merged Kconfig file: `CONFIG_X=y` (true), `# CONFIG_X is not set`
|
|
4
|
+
* (explicit false), `CONFIG_X=123` / `CONFIG_X="s"` (value). Comment blocks
|
|
5
|
+
* and everything else are ignored. Absent symbols are simply not in the map
|
|
6
|
+
* (Kconfig default applies — treat as "not enabled" for y/n symbols). */
|
|
7
|
+
export declare function parseMergedConfig(text: string): Map<string, KconfigValue>;
|
|
8
|
+
/** Sweep a resolved devicetree for every `compatible` string — the enabled
|
|
9
|
+
* hardware the firmware actually wired (attack-surface inventory input).
|
|
10
|
+
* Multi-string compatibles ("a,b", "a,b-fallback") contribute EVERY entry
|
|
11
|
+
* (the fallback binds the same node); nodes marked status = "disabled"
|
|
12
|
+
* contribute nothing. Node scoping is a brace-depth walk: every block is a
|
|
13
|
+
* node, and only its OWN properties (nested child blocks stripped) decide
|
|
14
|
+
* its status/compatibles. */
|
|
15
|
+
export declare function sweepCompatibles(dtsText: string): string[];
|
|
16
|
+
export interface SecurityFacts {
|
|
17
|
+
config: Map<string, KconfigValue>;
|
|
18
|
+
compatibles: string[];
|
|
19
|
+
}
|
|
20
|
+
export type AuditSeverity = 'high' | 'medium' | 'low';
|
|
21
|
+
export interface AuditFinding {
|
|
22
|
+
rule: string;
|
|
23
|
+
title: string;
|
|
24
|
+
severity: AuditSeverity;
|
|
25
|
+
requirement: string;
|
|
26
|
+
remediation: string;
|
|
27
|
+
/** The as-built evidence line(s) that triggered the rule. */
|
|
28
|
+
evidence: string;
|
|
29
|
+
}
|
|
30
|
+
export interface AuditRule {
|
|
31
|
+
id: string;
|
|
32
|
+
title: string;
|
|
33
|
+
severity: AuditSeverity;
|
|
34
|
+
/** CRA essential-requirement paraphrase this rule maps to. */
|
|
35
|
+
requirement: string;
|
|
36
|
+
remediation: string;
|
|
37
|
+
/** Returns the evidence string when the rule fires, else null. */
|
|
38
|
+
evaluate: (facts: SecurityFacts) => string | null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The Zephyr security baseline. Rules read ONLY config/devicetree facts —
|
|
42
|
+
* never a board name or SoC family (all-boards-are-equal). Every rule must
|
|
43
|
+
* be waivable with a recorded justification: real products have real
|
|
44
|
+
* exceptions, and a conformity assessor wants to see them documented, not
|
|
45
|
+
* hidden.
|
|
46
|
+
*/
|
|
47
|
+
export declare const SECURITY_RULES: readonly AuditRule[];
|
|
48
|
+
/** Evaluate the baseline over the facts. Order follows rule severity. */
|
|
49
|
+
export declare function evaluateSecurityRules(facts: SecurityFacts): AuditFinding[];
|
|
50
|
+
export interface AuditWaiver {
|
|
51
|
+
rule: string;
|
|
52
|
+
justification: string;
|
|
53
|
+
date?: string;
|
|
54
|
+
}
|
|
55
|
+
export declare function parseWaiverFile(text: string | undefined): {
|
|
56
|
+
waivers: AuditWaiver[];
|
|
57
|
+
error?: string;
|
|
58
|
+
};
|
|
59
|
+
/** Find .typecad-hal/audit-waivers.json, walking up from `cwd` (bounded). */
|
|
60
|
+
export declare function findWaiverFile(readFile: ReadFile, cwd: string): string | undefined;
|
|
61
|
+
export interface AuditRunner {
|
|
62
|
+
cwd?: string;
|
|
63
|
+
/** The last build's compile_commands.json path, or undefined. */
|
|
64
|
+
compileCommandsPath?: () => string | undefined;
|
|
65
|
+
readFile: ReadFile;
|
|
66
|
+
}
|
|
67
|
+
export interface AuditReport {
|
|
68
|
+
schema: 'typecad-hal/security-audit@1';
|
|
69
|
+
generated: string;
|
|
70
|
+
buildDir: string;
|
|
71
|
+
summary: {
|
|
72
|
+
console: 'uart' | 'usb' | 'rtt' | 'none';
|
|
73
|
+
shell: boolean;
|
|
74
|
+
network: boolean;
|
|
75
|
+
bluetooth: boolean;
|
|
76
|
+
usbDevice: boolean;
|
|
77
|
+
entropy: boolean;
|
|
78
|
+
watchdog: boolean;
|
|
79
|
+
hardware: string[];
|
|
80
|
+
};
|
|
81
|
+
findings: AuditFinding[];
|
|
82
|
+
deviations: (AuditFinding & {
|
|
83
|
+
justification: string;
|
|
84
|
+
date?: string;
|
|
85
|
+
})[];
|
|
86
|
+
rulesEvaluated: number;
|
|
87
|
+
waiverFile?: string;
|
|
88
|
+
}
|
|
89
|
+
export declare function buildAuditReport(args: {
|
|
90
|
+
buildDir: string;
|
|
91
|
+
facts: SecurityFacts;
|
|
92
|
+
findings: AuditFinding[];
|
|
93
|
+
deviations: (AuditFinding & {
|
|
94
|
+
justification: string;
|
|
95
|
+
date?: string;
|
|
96
|
+
})[];
|
|
97
|
+
generated?: string;
|
|
98
|
+
waiverFile?: string;
|
|
99
|
+
}): AuditReport;
|
|
100
|
+
/** Options accepted by `runAuditPresenter` (structurally compatible with the
|
|
101
|
+
* parsed `typecad-hal audit` CLI options). */
|
|
102
|
+
export interface AuditPresenterOptions {
|
|
103
|
+
/** Exit 1 on any unwaived high/medium finding. */
|
|
104
|
+
strict?: boolean;
|
|
105
|
+
/** Print only the JSON report (clean CI pipe); the sidecar is still written. */
|
|
106
|
+
json?: boolean;
|
|
107
|
+
}
|
|
108
|
+
/** @internal Test-only override of the default runner. */
|
|
109
|
+
export declare function __setAuditRunnerForTest(runner: AuditRunner | undefined): void;
|
|
110
|
+
/** `typecad-hal audit` presenter. */
|
|
111
|
+
export declare function runAuditPresenter(options: AuditPresenterOptions): void;
|