@typecad/framework-zephyr 1.0.0-alpha.13 → 1.0.0-alpha.15

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.
Files changed (191) hide show
  1. package/README.md +22 -35
  2. package/dist/as-built.d.ts +33 -0
  3. package/dist/as-built.js +188 -0
  4. package/dist/async/timer-polyfill.js +1 -1
  5. package/dist/boardgen.d.ts +128 -0
  6. package/dist/boardgen.js +1366 -0
  7. package/dist/chips/board-overrides.d.ts +7 -0
  8. package/dist/chips/board-overrides.js +11 -0
  9. package/dist/chips/controllers.d.ts +28 -8
  10. package/dist/chips/controllers.js +49 -12
  11. package/dist/chips/esp32s3.js +49 -0
  12. package/dist/chips/index.d.ts +6 -12
  13. package/dist/chips/index.js +18 -34
  14. package/dist/chips/resolve.d.ts +16 -2
  15. package/dist/chips/resolve.js +298 -15
  16. package/dist/chips/soc/.d.ts +2 -0
  17. package/dist/chips/soc/.js +129 -0
  18. package/dist/chips/soc/esp32.d.ts +2 -0
  19. package/dist/chips/soc/esp32.js +120 -0
  20. package/dist/chips/soc/esp32c3.d.ts +2 -0
  21. package/dist/chips/soc/esp32c3.js +90 -0
  22. package/dist/chips/soc/esp32c6.d.ts +2 -0
  23. package/dist/chips/soc/esp32c6.js +109 -0
  24. package/dist/chips/soc/esp32s3.d.ts +2 -0
  25. package/dist/chips/soc/esp32s3.js +189 -0
  26. package/dist/chips/soc/index.d.ts +2 -0
  27. package/dist/chips/soc/index.js +23 -0
  28. package/dist/chips/soc/nrf52840.d.ts +2 -0
  29. package/dist/chips/soc/nrf52840.js +130 -0
  30. package/dist/chips/soc/rp2040.d.ts +2 -0
  31. package/dist/chips/soc/rp2040.js +141 -0
  32. package/dist/chips/soc/rp2350a.d.ts +2 -0
  33. package/dist/chips/soc/rp2350a.js +145 -0
  34. package/dist/chips/soc/samd21g18a.d.ts +2 -0
  35. package/dist/chips/soc/samd21g18a.js +143 -0
  36. package/dist/chips/soc/stm32f411xe.d.ts +2 -0
  37. package/dist/chips/soc/stm32f411xe.js +251 -0
  38. package/dist/chips/types.d.ts +382 -12
  39. package/dist/chips/xiao-ble.js +33 -0
  40. package/dist/display/profiles.js +1 -1
  41. package/dist/doctor.js +38 -4
  42. package/dist/dt-config/custom-board.d.ts +23 -0
  43. package/dist/dt-config/custom-board.js +227 -0
  44. package/dist/dt-config/kconfig.d.ts +83 -1
  45. package/dist/dt-config/kconfig.js +116 -27
  46. package/dist/dt-config/overlay.js +623 -18
  47. package/dist/framework.manifest.d.ts +20 -30
  48. package/dist/framework.manifest.js +124 -178
  49. package/dist/index.d.ts +4 -1
  50. package/dist/index.js +8 -2
  51. package/dist/lowering/adc.d.ts +26 -5
  52. package/dist/lowering/adc.js +137 -31
  53. package/dist/lowering/ble.js +31 -28
  54. package/dist/lowering/dac.js +9 -9
  55. package/dist/lowering/fs.js +18 -10
  56. package/dist/lowering/gpio.d.ts +2 -0
  57. package/dist/lowering/gpio.js +90 -10
  58. package/dist/lowering/http.js +39 -14
  59. package/dist/lowering/hwtimer.d.ts +4 -0
  60. package/dist/lowering/hwtimer.js +35 -10
  61. package/dist/lowering/i2c.js +46 -54
  62. package/dist/lowering/index.d.ts +5 -5
  63. package/dist/lowering/index.js +15 -16
  64. package/dist/lowering/interrupts.d.ts +22 -5
  65. package/dist/lowering/interrupts.js +104 -22
  66. package/dist/lowering/mqtt.js +12 -6
  67. package/dist/lowering/power.js +0 -4
  68. package/dist/lowering/preferences.js +49 -77
  69. package/dist/lowering/pulse.js +5 -36
  70. package/dist/lowering/pwm.d.ts +32 -3
  71. package/dist/lowering/pwm.js +105 -17
  72. package/dist/lowering/random.js +3 -3
  73. package/dist/lowering/sensor.d.ts +37 -0
  74. package/dist/lowering/sensor.js +119 -0
  75. package/dist/lowering/spi.d.ts +12 -0
  76. package/dist/lowering/spi.js +65 -40
  77. package/dist/lowering/thread.d.ts +14 -0
  78. package/dist/lowering/thread.js +55 -0
  79. package/dist/lowering/timing.js +20 -46
  80. package/dist/lowering/tone.js +18 -5
  81. package/dist/lowering/uart.d.ts +13 -0
  82. package/dist/lowering/uart.js +72 -51
  83. package/dist/lowering/usb.d.ts +34 -0
  84. package/dist/lowering/usb.js +206 -0
  85. package/dist/lowering/wdt.d.ts +1 -1
  86. package/dist/lowering/wdt.js +17 -7
  87. package/dist/lowering/wifi.d.ts +3 -2
  88. package/dist/lowering/wifi.js +120 -111
  89. package/dist/sdk/board-catalog-sync.d.ts +16 -0
  90. package/dist/sdk/board-catalog-sync.js +41 -0
  91. package/dist/sdk/board-data.generated.d.ts +2 -0
  92. package/dist/sdk/board-data.generated.js +4 -0
  93. package/dist/sdk/catalog-walker.d.ts +90 -0
  94. package/dist/sdk/catalog-walker.js +682 -0
  95. package/dist/sdk/dts-reader.d.ts +83 -0
  96. package/dist/sdk/dts-reader.js +596 -0
  97. package/dist/strategy.d.ts +136 -17
  98. package/dist/strategy.js +881 -212
  99. package/dist/toolchain/bossac-touch.d.ts +18 -0
  100. package/dist/toolchain/bossac-touch.js +88 -0
  101. package/dist/toolchain/compat.d.ts +2 -2
  102. package/dist/toolchain/compat.js +8 -3
  103. package/dist/toolchain/debug-config.d.ts +21 -26
  104. package/dist/toolchain/debug-config.js +212 -72
  105. package/dist/toolchain/env-check.d.ts +4 -4
  106. package/dist/toolchain/env-check.js +5 -5
  107. package/dist/toolchain/index.d.ts +66 -1
  108. package/dist/toolchain/index.js +713 -58
  109. package/dist/toolchain/scaffold.d.ts +9 -0
  110. package/dist/toolchain/scaffold.js +84 -7
  111. package/dist/toolchain/west-discover.d.ts +8 -1
  112. package/dist/toolchain/west-discover.js +19 -6
  113. package/dist/toolchain/west-spawn.js +17 -5
  114. package/installer/CHANGELOG.md +473 -0
  115. package/installer/README.md +328 -0
  116. package/installer/environment.yml +46 -0
  117. package/installer/etc/conda/activate.d/zephyr.bat +7 -0
  118. package/installer/etc/conda/activate.d/zephyr.ps1 +12 -0
  119. package/installer/etc/conda/activate.d/zephyr.sh +20 -0
  120. package/installer/etc/conda/deactivate.d/zephyr.bat +6 -0
  121. package/installer/etc/conda/deactivate.d/zephyr.ps1 +6 -0
  122. package/installer/etc/conda/deactivate.d/zephyr.sh +4 -0
  123. package/installer/install.mjs +580 -0
  124. package/installer/install.ps1 +619 -0
  125. package/installer/install.sh +310 -0
  126. package/installer/lib/detect-platform.sh +62 -0
  127. package/installer/lib/fetch-sdk.sh +304 -0
  128. package/installer/lib/init-workspace.sh +153 -0
  129. package/installer/lib/write-activation.sh +76 -0
  130. package/installer/patches/tfm-c-include-separators.patch +19 -0
  131. package/installer/patches/zephyr-tfm-nordic-zephyr-include.patch +24 -0
  132. package/installer/templates/project/.typecad/activate-zephyr.ps1 +31 -0
  133. package/installer/templates/project/.typecad/activate-zephyr.sh +31 -0
  134. package/installer/templates/project/.vscode/settings.json +30 -0
  135. package/installer/templates/project/README.md +58 -0
  136. package/installer/versions.env +110 -0
  137. package/package.json +16 -16
  138. package/src/as-built.ts +206 -0
  139. package/src/boardgen.ts +1428 -0
  140. package/src/chips/controllers.ts +61 -12
  141. package/src/chips/index.ts +35 -54
  142. package/src/chips/resolve.ts +316 -14
  143. package/src/chips/types.ts +388 -13
  144. package/src/display/profiles.ts +1 -1
  145. package/src/doctor.ts +110 -77
  146. package/src/dt-config/custom-board.ts +325 -0
  147. package/src/dt-config/kconfig.ts +177 -19
  148. package/src/dt-config/overlay.ts +1058 -450
  149. package/src/framework.manifest.ts +125 -178
  150. package/src/index.ts +57 -41
  151. package/src/lowering/adc.ts +222 -102
  152. package/src/lowering/ble.ts +32 -28
  153. package/src/lowering/dac.ts +82 -82
  154. package/src/lowering/fs.ts +18 -10
  155. package/src/lowering/gpio.ts +242 -152
  156. package/src/lowering/http.ts +512 -488
  157. package/src/lowering/hwtimer.ts +139 -101
  158. package/src/lowering/i2c.ts +116 -126
  159. package/src/lowering/index.ts +91 -93
  160. package/src/lowering/interrupts.ts +113 -21
  161. package/src/lowering/mqtt.ts +12 -6
  162. package/src/lowering/preferences.ts +327 -354
  163. package/src/lowering/pwm.ts +167 -74
  164. package/src/lowering/random.ts +3 -3
  165. package/src/lowering/sensor.ts +155 -0
  166. package/src/lowering/spi.ts +164 -124
  167. package/src/lowering/thread.ts +63 -0
  168. package/src/lowering/timing.ts +46 -72
  169. package/src/lowering/uart.ts +73 -51
  170. package/src/lowering/usb.ts +221 -0
  171. package/src/lowering/wdt.ts +95 -84
  172. package/src/lowering/wifi.ts +120 -111
  173. package/src/sdk/board-catalog-sync.ts +62 -0
  174. package/src/strategy.ts +888 -229
  175. package/src/toolchain/bossac-touch.ts +112 -0
  176. package/src/toolchain/compat.ts +8 -3
  177. package/src/toolchain/debug-config.ts +666 -522
  178. package/src/toolchain/env-check.ts +9 -9
  179. package/src/toolchain/index.ts +765 -44
  180. package/src/toolchain/scaffold.ts +81 -7
  181. package/src/toolchain/west-discover.ts +334 -316
  182. package/src/toolchain/west-spawn.ts +17 -5
  183. package/src/async/timer-polyfill.ts +0 -107
  184. package/src/chips/esp32.ts +0 -74
  185. package/src/chips/esp32s3.ts +0 -57
  186. package/src/chips/xiao-ble.ts +0 -70
  187. package/src/lowering/power.ts +0 -70
  188. package/src/lowering/pulse.ts +0 -93
  189. package/src/lowering/tone.ts +0 -60
  190. package/src/lowering/worker-backing.ts +0 -94
  191. package/src/lowering/worker.ts +0 -17
@@ -2,7 +2,7 @@
2
2
  // Zephyr framework manifest
3
3
  //
4
4
  // Coverage reflects actual resolveHALOperation / lowerHalOp + resolveDisplayOp
5
- // behavior. GPIO, PWM, ADC, I2C, SPI, UART, interrupts, tone, power, pulse,
5
+ // behavior. GPIO, PWM, ADC, I2C, SPI, UART, interrupts, pulse,
6
6
  // shift, WDT, BLE, timing, WiFi, HTTP/S, MQTT, board constants, and random
7
7
  // are lowered; display is lowered via the generic <zephyr/drivers/display.h>
8
8
  // GFX runtime. WiFi/HTTP/MQTT require an ESP32 target (nRF52840 has no radio).
@@ -38,20 +38,23 @@ export default defineFrameworkManifest({
38
38
  implementationMode: 'from-scratch',
39
39
 
40
40
  entrypoint: {
41
- entrypointFunctionName: 'setup',
42
- requiresLoopFunction: true,
41
+ // Zephyr is a main()-based RTOS: top-level statements lower straight into
42
+ // main() (no setup()/loop() pair, no bridge shim). Event-driven programs
43
+ // get their scheduler loop appended inside main() by the driver machinery.
44
+ entrypointFunctionName: 'main',
45
+ requiresLoopFunction: false,
43
46
  sourceExtension: 'cpp',
44
47
  overrideBaseName: 'main',
45
48
  outputSubdirectory: 'src',
46
49
  generateHeaderFile: true,
47
- customBridgeShim: 'main',
48
50
  },
49
51
 
50
52
  profile: {
51
53
  // Informational list of supported board targets. The manifest validator
52
- // never iterates this; chipForTarget (src/chips/index.ts) is the real
53
- // resolver. ESP32-S3 + plain ESP32 added alongside the nRF52840 MVP target.
54
- targets: ['xiao_ble', 'esp32s3_devkitc', 'esp32_devkitc'],
54
+ // never iterates this. Every board in the catalog resolves the same way
55
+ // (resolveChipFromBoard over the generated manifest) there is no
56
+ // curated target list.
57
+ targets: [],
55
58
  forcedIncludes: ['<zephyr/kernel.h>', '<zephyr/drivers/gpio.h>', '<cstdint>'],
56
59
  symbolAliases: {},
57
60
  },
@@ -65,27 +68,29 @@ export default defineFrameworkManifest({
65
68
  'gpio.write': 'supported',
66
69
  'gpio.read': 'supported',
67
70
  'gpio.toggle': 'supported',
68
- 'gpio.set_mode': 'supported',
71
+ // Thin GPIO (hal/gpio-pin.ts): construction flags as tokens, applied
72
+ // once per pin ahead of first use.
73
+ 'gpio.configure': 'supported',
74
+ 'gpio.read_cfg': 'supported', // fused guarded configure + read
75
+ 'gpio.shift_out': 'supported',
76
+ 'gpio.shift_in': 'supported',
69
77
  },
70
78
  },
71
79
 
72
- // ── Supported: Timing (delay/millis/delay_us/micros/free_heap; timers via polyfill) ─
80
+ // ── Supported: Timing (delay/millis/delay_us/micros; timers via polyfill) ─
73
81
  timing: {
74
82
  supported: true,
75
83
  partialCoverage: false,
76
84
  ops: {
77
- 'timing.delay': 'supported', // → k_msleep(ms)
78
- 'timing.delay_microseconds': 'supported', // → k_busy_wait(us)
79
- 'timing.millis': 'supported', // → k_uptime_get_32()
80
- 'timing.micros': 'supported', // → k_cycle_get_32 + cycles/sec
81
- 'timing.free_heap': 'supported', // → 0 (no portable query; see lowering)
82
85
  // Timer ops are POLYFILL_BACKED_OPS → timer_methods. The validator skips
83
86
  // the resolver probe (these legitimately return polyfill-helper calls,
84
87
  // not direct lowering) and requires the polyfill be in polyfills.emitted.
85
- 'timing.set_interval': 'polyfill',
86
- 'timing.set_timeout': 'polyfill',
87
- 'timing.clear_interval': 'polyfill',
88
- 'timing.clear_timeout': 'polyfill',
88
+ // Time.* — the TS-flavored surface (hal/time.ts), preferred over the
89
+ // Arduino-named forms above for new code.
90
+ 'timing.sleep': 'supported', // → k_msleep(ms) — Time.sleep
91
+ 'timing.now': 'supported', // → k_uptime_get() — Time.now
92
+ 'timing.now_us': 'supported', // → k_cyc_to_us_floor64 — Time.nowUs
93
+ 'timing.busy_wait_us': 'supported', // → k_busy_wait(us) — Time.busyWaitUs
89
94
  },
90
95
  },
91
96
 
@@ -94,9 +99,11 @@ export default defineFrameworkManifest({
94
99
  supported: true,
95
100
  partialCoverage: false,
96
101
  ops: {
97
- 'pwm.write': 'supported',
98
- 'pwm.get_frequency': 'supported',
99
- 'pwm.get_resolution': 'supported',
102
+ // Thin PWM (hal/pwm-pin.ts): ns-true verbs; construction period
103
+ // applies once, setDuty is 0.0–1.0 sugar over one set_pulse call.
104
+ 'pwm.set_pulse': 'supported',
105
+ 'pwm.set_duty': 'supported',
106
+ 'pwm.set_period': 'supported',
100
107
  },
101
108
  },
102
109
 
@@ -105,11 +112,10 @@ export default defineFrameworkManifest({
105
112
  supported: true,
106
113
  partialCoverage: false,
107
114
  ops: {
108
- 'adc.read': 'supported',
109
- 'adc.get_resolution': 'supported',
110
- 'adc.set_reference': 'supported',
111
- 'adc.get_reference': 'supported',
112
- 'adc.read_voltage': 'supported',
115
+ // Thin ADC (hal/adc-pin.ts): construction gain/reference tokens,
116
+ // lazy inline channel setup.
117
+ 'adc.read_raw': 'supported',
118
+ 'adc.read_mv': 'supported',
113
119
  },
114
120
  },
115
121
  dac: {
@@ -119,77 +125,57 @@ export default defineFrameworkManifest({
119
125
  // (zephyr-dac-pin-unavailable).
120
126
  supported: true,
121
127
  partialCoverage: true,
122
- ops: { 'dac.write': 'supported' },
128
+ ops: {
129
+ // Thin DAC (hal/dac-pin.ts): raw code, construction resolution.
130
+ 'dac.write_value': 'supported',
131
+ },
123
132
  },
124
133
  interrupts: {
125
134
  supported: true,
126
135
  partialCoverage: true,
127
136
  unsupportedReason: undefined,
128
137
  ops: {
129
- 'interrupt.attach': 'supported',
130
138
  'interrupt.detach': 'supported',
131
- },
132
- },
133
- tone: {
134
- supported: true,
135
- partialCoverage: true,
136
- ops: {
137
- 'tone.play': 'supported', // PWM-based square wave (blocking for duration)
138
- 'tone.stop': 'supported',
139
- },
140
- },
141
- power: {
142
- supported: true,
143
- partialCoverage: true,
144
- ops: {
145
- 'power.deep_sleep': 'supported', // k_sleep (deepest allowed state)
146
- 'power.light_sleep': 'supported', // pm_state_force SUSPEND_TO_IDLE
147
- 'power.set_cpu_frequency': 'supported', // comment (nRF clock API deferred)
148
- 'power.deep_sleep_pin': 'supported', // GPIO-interrupt wake + k_sleep
139
+ // Thin GPIO interrupts (hal/gpio-pin.ts onInterrupt): INT_* tokens,
140
+ // covering the level modes the legacy mode strings could not express.
141
+ 'interrupt.attach_flags': 'supported',
149
142
  },
150
143
  },
151
144
  i2c: {
152
145
  supported: true,
153
146
  partialCoverage: false,
154
147
  ops: {
155
- 'i2c.begin': 'supported', 'i2c.end': 'supported', 'i2c.set_clock': 'supported',
156
- 'i2c.begin_transmission': 'supported', 'i2c.write': 'supported',
157
- 'i2c.write_bytes': 'supported', 'i2c.write_buffer': 'supported',
158
- 'i2c.read_buffer': 'supported', 'i2c.end_transmission': 'supported',
159
- 'i2c.request_from': 'supported', 'i2c.available': 'supported', 'i2c.read': 'supported',
160
- 'i2c.recover': 'supported',
148
+ // Thin I2C device (hal/i2c-target.ts): Zephyr register verbs.
149
+ 'i2c.reg_write': 'supported',
150
+ 'i2c.reg_read': 'supported',
151
+ 'i2c.reg_update': 'supported',
152
+ 'i2c.dev_write': 'supported',
161
153
  },
162
154
  },
163
155
  spi: {
164
156
  supported: true,
165
157
  partialCoverage: false,
166
158
  ops: {
167
- 'spi.begin': 'supported', 'spi.end': 'supported', 'spi.transfer': 'supported',
168
- 'spi.begin_transaction': 'supported', 'spi.end_transaction': 'supported',
169
- 'spi.set_mode': 'supported', 'spi.set_bit_order': 'supported',
170
- 'spi.cs_low': 'supported', 'spi.cs_high': 'supported', 'spi.read_buffer': 'supported',
159
+ // Thin SPI device (hal/spi-target.ts): spi_dt_spec against the DT
160
+ // child node the overlay emits per constructed target.
161
+ 'spi.transceive': 'supported',
162
+ 'spi.dev_write': 'supported',
163
+ 'spi.reg_read': 'supported',
171
164
  },
172
165
  },
173
166
  uart: {
174
167
  supported: true,
175
168
  partialCoverage: true,
176
169
  ops: {
177
- 'uart.begin': 'supported', 'uart.end': 'supported', 'uart.print': 'supported',
178
- 'uart.println': 'supported', 'uart.printf': 'supported', 'uart.write': 'supported',
179
- 'uart.read': 'supported', 'uart.peek': 'supported', 'uart.available': 'supported',
180
- 'uart.flush': 'supported',
170
+ // Thin UART (hal/uart-port.ts): poll API with construction baud.
171
+ 'uart.poll_write': 'supported',
172
+ // Interrupt-drained RX ring (hal/uart-port.ts).
173
+ 'uart.rx_arm': 'supported',
174
+ 'uart.rx_available': 'supported',
175
+ 'uart.rx_peek': 'supported',
176
+ 'uart.rx_read': 'supported',
181
177
  },
182
178
  },
183
- pulse: {
184
- supported: true,
185
- partialCoverage: true,
186
- ops: { 'pulse.in': 'supported', 'pulse.in_long': 'supported' },
187
- },
188
- shift: {
189
- supported: true,
190
- partialCoverage: false,
191
- ops: { 'shift.out': 'supported', 'shift.in': 'supported' },
192
- },
193
179
  board: {
194
180
  // Board constant resolution. Board.definition.<path> /
195
181
  // Pins.definition.<path> property accesses are folded by
@@ -207,13 +193,38 @@ export default defineFrameworkManifest({
207
193
  supported: true,
208
194
  partialCoverage: false,
209
195
  ops: {
210
- 'wdt.enable': 'supported',
211
- 'wdt.reset': 'supported',
212
196
  'wdt.disable': 'supported',
197
+ // Thin Watchdog (hal/watchdog.ts): construction timeout in ms.
198
+ 'wdt.setup': 'supported',
199
+ 'wdt.feed': 'supported',
200
+ },
201
+ },
202
+ // Thin Counter (hal/counter.ts) — Zephyr's counter driver with Zephyr's
203
+ // verbs, over the same per-instance state as hwtimer.*. Chips without a
204
+ // declared free counter lower to a comment + profileDiagnostics flag.
205
+ counter: {
206
+ supported: true,
207
+ partialCoverage: true,
208
+ ops: {
209
+ 'counter.on_alarm': 'supported',
210
+ 'counter.start': 'supported',
211
+ 'counter.stop': 'supported',
212
+ },
213
+ },
214
+ // Thin Thread (hal/thread.ts) — kernel threads. start(fn) is
215
+ // k_thread_create (K_NO_WAIT) over a per-slot stack sized by the
216
+ // construction stackKb; join is k_thread_join (K_FOREVER).
217
+ thread: {
218
+ supported: true,
219
+ partialCoverage: false,
220
+ ops: {
221
+ 'thread.start': 'supported',
222
+ 'thread.join': 'supported',
213
223
  },
214
224
  },
215
225
  // ── Partial: WiFi (STA connect + scan + config via conn_mgr/net_mgmt) ────
216
- // ESP32-S3 only profileDiagnostics flags wifi usage on radioless chips.
226
+ // ESP32 family only (esp32, esp32s3, esp32c3, esp32c6) profileDiagnostics
227
+ // flags wifi usage on radioless chips (nRF52840, RP2040/RP2350).
217
228
  // AP mode, credential persistence, static IP, and event callbacks deferred.
218
229
  wifi: {
219
230
  supported: true,
@@ -222,51 +233,34 @@ export default defineFrameworkManifest({
222
233
  // driver hook; credentials need a custom settings-subsystem layer; static IP
223
234
  // / auto-reconnect / tx-power aren't wifi-shaped or aren't exposed by the
224
235
  // esp32 Zephyr driver. See per-op reasons.
225
- unsupportedReason: 'AP client enumeration/IP/per-station config, credential persistence, static IP, auto-reconnect, and tx-power have no Zephyr lowering (no driver/Kconfig hook).',
236
+ unsupportedReason: 'Per-station AP enumeration and credential persistence have no Zephyr lowering (no driver/Kconfig hook).',
226
237
  ops: {
227
- // Connection (8) — net_mgmt connect/disconnect + L4 connectivity state.
228
- 'wifi.connect': 'supported', 'wifi.connect_start': 'supported',
229
- 'wifi.disconnect': 'supported', 'wifi.status': 'supported',
230
- 'wifi.is_connected': 'supported', 'wifi.local_ip': 'supported',
231
- 'wifi.rssi': 'supported', 'wifi.mac': 'supported',
232
- // Waits (2) — block on the L4 connected flag (k_msleep poll).
233
- 'wifi.wait_connected': 'supported', 'wifi.wait_disconnected': 'supported',
238
+ // Station (8) — join carries the construction facts (credentials,
239
+ // security, band/channel, timeout, static IPv4, power-save);
240
+ // net_mgmt connect/disconnect + L4 connectivity state underneath.
241
+ 'wifi.join': 'supported', 'wifi.connect_start': 'supported',
242
+ 'wifi.disconnect': 'supported', 'wifi.is_connected': 'supported',
243
+ 'wifi.local_ip': 'supported', 'wifi.rssi': 'supported',
244
+ 'wifi.mac': 'supported',
234
245
  // Scan (8) — net_mgmt NET_REQUEST_WIFI_SCAN + result pool.
235
- 'wifi.scan': 'supported', 'wifi.scan_start': 'supported',
246
+ // scan_start is the async split of scan (kick + poll scan_done);
247
+ // emitted synthetically by the async tier, no TS-facing method.
248
+ 'wifi.scan': 'supported',
249
+ 'wifi.scan_start': 'supported',
236
250
  'wifi.scan_done': 'supported', 'wifi.scan_count': 'supported',
237
251
  'wifi.scan_ssid': 'supported', 'wifi.scan_rssi': 'supported',
238
252
  'wifi.scan_encryption': 'supported', 'wifi.scan_channel': 'supported',
239
- // AP mode (2 of 7) — esp32 driver wires ap_enable/ap_disable. Only
240
- // ssid/password/channel are honored; the rest of the AP surface has no
241
- // driver hook (config_params isn't wired, max_clients hardcodes 5).
253
+ // AP mode (2) — esp32 driver wires ap_enable/ap_disable. Only
254
+ // ssid/psk/channel are honored (the thin WiFiAP facts carry exactly those).
242
255
  'wifi.ap_start': 'supported', 'wifi.ap_stop': 'supported',
243
- // Config (2) — hostname (best-effort no-op) + power save (real net_mgmt).
244
- 'wifi.set_hostname': 'supported', 'wifi.set_power_save': 'supported',
245
256
  // on_event: 'disconnect' (NET_EVENT_L4_DISCONNECTED) + 'connect'
246
257
  // (NET_EVENT_IPV4_ADDR_ADD) are lowered.
247
258
  'wifi.on_event': 'supported',
248
- // ── Genuinely unsupported (no Zephyr/driver hook) ───────────────────
259
+ // ── Genuinely unsupported (no driver hook) ─────────────────────────
249
260
  // ap_client_count: no API to enumerate connected AP stations.
250
- // ap_ip: set via net_if, not wifi net_mgmt.
251
- // ap_set_channel: channel set at ap_start; driver doesn't wire ap_config_params.
252
- // ap_set_hidden: esp32 ap_enable config has no ssid_hidden field.
253
- // ap_set_max_clients: driver hardcodes max_connection to 5; config_params unwired.
254
- // save_credentials/connect_saved/clear_credentials: no wifi-credentials API in
255
- // Zephyr (would need a custom settings-subsystem layer).
256
- // set_static_ip: a net_if operation, not a wifi net_mgmt request.
257
- // set_auto_reconnect: esp32 driver doesn't expose esp_wifi_set_auto_connect.
258
- // set_tx_power: driver owns the radio; the PHY ceiling isn't a Zephyr Kconfig (zephyr#45580).
259
261
  'wifi.ap_client_count': 'unsupported',
260
- 'wifi.ap_ip': 'unsupported',
261
- 'wifi.ap_set_channel': 'unsupported',
262
- 'wifi.ap_set_hidden': 'unsupported',
263
- 'wifi.ap_set_max_clients': 'unsupported',
264
- 'wifi.save_credentials': 'unsupported', 'wifi.connect_saved': 'unsupported',
265
- 'wifi.clear_credentials': 'unsupported',
266
- 'wifi.set_static_ip': 'unsupported',
267
- 'wifi.set_auto_reconnect': 'unsupported',
268
- 'wifi.set_tx_power': 'unsupported',
269
262
  },
263
+
270
264
  },
271
265
  http: {
272
266
  supported: true,
@@ -277,7 +271,7 @@ export default defineFrameworkManifest({
277
271
  // a networked target (ESP32 WiFi); profileDiagnostics flags usage on a
278
272
  // radioless chip as 'zephyr-http-unavailable-on-target'.
279
273
  ops: {
280
- 'http.begin': 'supported', 'http.reset': 'supported',
274
+ 'http.begin': 'supported',
281
275
  'http.set_header': 'supported', 'http.set_timeout': 'supported',
282
276
  'http.set_max_body': 'supported', 'http.set_body': 'supported',
283
277
  'http.set_insecure': 'supported', 'http.set_ca_cert': 'supported',
@@ -316,13 +310,6 @@ export default defineFrameworkManifest({
316
310
  },
317
311
 
318
312
  // ── Supported: Worker offload (k_work system workqueue + k_sem) ──────────
319
- // worker.* is lowered via lowerWorkerOp against the shared __tc_worker
320
- // contract; the Zephyr backing (worker-backing.ts) supplies k_work + k_sem.
321
- worker: {
322
- supported: true,
323
- partialCoverage: false,
324
- ops: { 'worker.submit': 'supported', 'worker.done': 'supported' },
325
- },
326
313
 
327
314
  // ── Honestly unsupported extended categories ─────────────────────────────
328
315
  // These have op-kinds in HAL_OPERATION_KINDS but no Zephyr lowering. Each
@@ -331,12 +318,6 @@ export default defineFrameworkManifest({
331
318
  // catchall schema (HalCoverageSchema) validates any declared extended
332
319
  // category; declaring them keeps the manifest a complete coverage record.
333
320
 
334
- rmt: {
335
- supported: false,
336
- unsupportedReason: 'RMT (ESP32 infrared/transaction peripheral) has no Zephyr lowering.',
337
- partialCoverage: false,
338
- ops: unsupportedOps('rmt.'),
339
- },
340
321
  snprintf: {
341
322
  supported: false,
342
323
  unsupportedReason: 'snprintf.emit is a raw escape hatch; the Zephyr resolver returns undefined (use rawCpp()).',
@@ -357,10 +338,8 @@ export default defineFrameworkManifest({
357
338
  supported: true,
358
339
  partialCoverage: false,
359
340
  ops: {
360
- 'preferences.begin': 'supported', 'preferences.end': 'supported',
361
341
  'preferences.clear': 'supported', 'preferences.remove': 'supported',
362
342
  'preferences.put_int': 'supported', 'preferences.get_int': 'supported',
363
- 'preferences.put_uint': 'supported', 'preferences.get_uint': 'supported',
364
343
  'preferences.put_bool': 'supported', 'preferences.get_bool': 'supported',
365
344
  'preferences.put_float': 'supported', 'preferences.get_float': 'supported',
366
345
  'preferences.put_string': 'supported', 'preferences.get_string': 'supported',
@@ -387,16 +366,10 @@ export default defineFrameworkManifest({
387
366
  supported: true,
388
367
  partialCoverage: false,
389
368
  ops: {
390
- 'fs.begin': 'supported', 'fs.read_text': 'supported', 'fs.write_text': 'supported',
369
+ 'fs.read_text': 'supported', 'fs.write_text': 'supported',
391
370
  'fs.exists': 'supported', 'fs.remove': 'supported',
392
371
  },
393
372
  },
394
- mdns: {
395
- supported: false,
396
- unsupportedReason: 'No mDNS lowering on Zephyr (requires networking stack).',
397
- partialCoverage: false,
398
- ops: unsupportedOps('mdns.'),
399
- },
400
373
  mqtt: {
401
374
  supported: true,
402
375
  partialCoverage: false,
@@ -413,43 +386,19 @@ export default defineFrameworkManifest({
413
386
  'mqtt.connected': 'supported', 'mqtt.disconnect': 'supported',
414
387
  },
415
388
  },
416
- ota: {
417
- supported: false,
418
- unsupportedReason: 'No OTA lowering on Zephyr (Zephyr has MCUmgr; not wired).',
419
- partialCoverage: false,
420
- ops: unsupportedOps('ota.'),
421
- },
422
- temp: {
423
- supported: false,
424
- unsupportedReason: 'No on-chip temperature lowering on Zephyr (nRF52840 TEMP peripheral; not wired).',
425
- partialCoverage: false,
426
- ops: { 'temp.read': 'unsupported' },
427
- },
428
- hwtimer: {
429
- // Hardware timers via the Zephyr counter driver (<zephyr/drivers/counter.h>).
430
- // set_frequency → top value (counter_freq/hz) + on_overflow callback;
431
- // start arms both; stop halts. A chip declares its free counters
432
- // (e.g. nRF RTC1; RTC0 is kernel-owned). This is distinct from the JS
433
- // setInterval/setTimeout k_timer polyfill, which is unaffected.
389
+ sensor: {
390
+ // DT-bound sensor parts — the generic catalog (hal/sensor.ts +
391
+ // sensor-catalog.generated.ts). fetch sensor_sample_fetch,
392
+ // get → sensor_channel_get on a per-sensor device handle; the overlay
393
+ // generator emits the DT child node, and the driver's own Kconfig
394
+ // `default y` lights it up (only CONFIG_SENSOR is set, usage-gated).
434
395
  supported: true,
435
- partialCoverage: true,
396
+ partialCoverage: false,
436
397
  ops: {
437
- 'hwtimer.set_frequency': 'supported', 'hwtimer.on_overflow': 'supported',
438
- 'hwtimer.start': 'supported', 'hwtimer.stop': 'supported',
398
+ 'sensor.fetch': 'supported',
399
+ 'sensor.get': 'supported',
439
400
  },
440
401
  },
441
- capacitive: {
442
- // FT6336U capacitive touch is handled via the strategy-owned touch adapter
443
- // (src/display/touch-adapter.ts → touch_init/touch_isTouched/touch_readRaw),
444
- // NOT via a HAL op lowering. The manifest marks it unsupported here (no
445
- // resolveHALOperation path for capacitive.read); the touch adapter provides
446
- // the integration. partialCoverage reflects that it works on targets with
447
- // the FT6336U DT node (ESP32), not on the bare nRF52840.
448
- supported: false,
449
- unsupportedReason: 'Capacitive touch is handled via the strategy touch adapter (FT6336U I2C), not a HAL op. Requires the ft6336u DT node.',
450
- partialCoverage: true,
451
- ops: { 'capacitive.read': 'unsupported' },
452
- },
453
402
  i2s: {
454
403
  supported: false,
455
404
  unsupportedReason: 'No I2S / digital audio lowering on Zephyr.',
@@ -463,8 +412,12 @@ export default defineFrameworkManifest({
463
412
  ops: unsupportedOps('twai.'),
464
413
  },
465
414
  usb: {
415
+ // CDC-ACM serial over the board's USB connector. BOARD-GATED: the
416
+ // lowering only fires when the board's manifest carries zephyr.usb.*
417
+ // (boardgen emits it from the board's own DTS) — the manifest probe
418
+ // runs with no board, so the honest declaration is unsupported here.
466
419
  supported: false,
467
- unsupportedReason: 'No USB OTG / USB-Serial lowering on Zephyr (Zephyr USB device stack not wired).',
420
+ unsupportedReason: 'Board-gated: USB lowers only on boards whose DTS enables the USB device controller (boardgen emits zephyr.usb.* from the catalog).',
468
421
  partialCoverage: false,
469
422
  ops: unsupportedOps('usb.'),
470
423
  },
@@ -507,7 +460,6 @@ export default defineFrameworkManifest({
507
460
  { id: 'wiring_compat', domain: 'standard', notes: 'HIGH/LOW/digitalRead/etc. macros routing Wiring tokens (referenced unconditionally by the UI runtime header) to the __tc_gpio_* helpers' },
508
461
  { id: 'string_methods', domain: 'embedded', notes: 'STL-free __tc_* string helpers (const char*, inline ASCII case conv, <cstring> only)' },
509
462
  { id: 'static_array', domain: 'embedded', notes: 'STL-free __tc_StaticArray<T,N> wrapper for no-<vector> mutated/struct array literals' },
510
- { id: 'timer_methods', domain: 'embedded', notes: 'k_timer + k_work pool (system workqueue); callbacks run in thread context' },
511
463
  { id: 'async_runtime', domain: 'embedded', notes: 'Heap-free static Promise/microtask runtime (generateStaticAsyncRuntime), pumped in loop()' },
512
464
  ],
513
465
  suppressed: [],
@@ -527,7 +479,7 @@ export default defineFrameworkManifest({
527
479
 
528
480
  typeEmission: {
529
481
  normalizeCppType: true,
530
- mathHeader: '<math.h>',
482
+ mathHeader: '<cmath>',
531
483
  needsStdString: false,
532
484
  needsStdVector: false,
533
485
  needsIostream: false,
@@ -546,17 +498,11 @@ export default defineFrameworkManifest({
546
498
  ambientTypes: ['Preferences'],
547
499
 
548
500
  conformance: {
549
- // Hardware-test groups each entry is backed by a tests/<group>.test.ts
550
- // file in this package (validated by the manifest validator). Mirrors the
551
- // framework-avr/framework-esp32 convention. These run on metal via
552
- // `npm run test:hw` (cuttlefish-test transpiles west build → flash).
553
- hardwareTestGroups: [
554
- '01-basics',
555
- '30-timing',
556
- '40-gpio',
557
- '41-analog',
558
- '42-timers',
559
- ],
501
+ // Hardware-test groups moved to the shared HAL suite
502
+ // (packages/hal/tests common/ + board/ via board test-pins.json), which
503
+ // runs on Zephyr targets through the hal board configs. The
504
+ // hal-resolution snapshots below stay.
505
+ hardwareTestGroups: [],
560
506
  // Per-op HAL-resolution suite — one tests/packages/framework-zephyr/
561
507
  // hal-resolution/<cat>.test.ts per category, snapshotting the exact C++
562
508
  // each op lowers to. Mirrors the framework-esp32 convention. These are
@@ -564,8 +510,9 @@ export default defineFrameworkManifest({
564
510
  // catches regressions like silent pull-resistor / interrupt no-ops.
565
511
  halResolutionTests: [
566
512
  'adc', 'ble', 'board', 'dac', 'fs', 'gpio', 'http', 'hwtimer', 'i2c',
567
- 'interrupts', 'mqtt', 'power', 'preferences', 'pulse', 'pwm', 'random',
568
- 'spi', 'timing', 'tone', 'uart', 'wdt', 'worker',
513
+ 'interrupts', 'mqtt', 'preferences', 'pwm', 'random',
514
+ 'spi', 'thin-buses', 'thin-classes', 'thread', 'timing',
515
+ 'uart', 'usb', 'wdt', 'wifi',
569
516
  ],
570
517
  },
571
518
 
package/src/index.ts CHANGED
@@ -1,41 +1,57 @@
1
- // ---------------------------------------------------------------------------
2
- // @typecad/framework-zephyr — public exports
3
- //
4
- // The cuttlefish loader (framework-package.ts) requires a `FrameworkStrategy`
5
- // export (the PlatformStrategy class it instantiates) and an optional
6
- // `Toolchain`. This package aliases ZephyrStrategy → FrameworkStrategy.
7
- // ---------------------------------------------------------------------------
8
-
9
- export { ZephyrStrategy as FrameworkStrategy } from './strategy.js';
10
- export { ZephyrStrategy } from './strategy.js';
11
- export { Toolchain } from './toolchain/index.js';
12
-
13
- // Create-time starter debug artifacts. The `cuttlefish create` flow reads this
14
- // optional named export off the loaded framework module (same loader pattern
15
- // as doctor/licenses) and calls it for freshly scaffolded projects, so F5 in
16
- // VS Code works before the first build. No-ops for non-GDB targets.
17
- export { writeProjectDebugArtifacts } from './toolchain/debug-config.js';
18
-
19
- // `cuttlefish doctor` — verify the installed Zephyr is reachable + inside the
20
- // declared compat range, and preview board-target normalization. Re-exported
21
- // under the dispatcher-facing alias `doctor` so the loader picks it up as
22
- // mod.doctor (see framework-package.ts).
23
- export { runDoctor as doctor } from './doctor.js';
24
-
25
- // `cuttlefish licenses` — enumerate the Zephyr kernel + west manifest projects
26
- // and resolve each one's SPDX license. Re-exported under the dispatcher-facing
27
- // alias `licenses` so the loader picks it up as mod.licenses (see
28
- // framework-package.ts). Mirrors framework-arduino's presenter.
29
- export { runLicensesPresenter as licenses } from './licenses.js';
30
-
31
- // Chip descriptor registry (for downstream tooling / additional boards).
32
- export {
33
- chipForTarget,
34
- setActiveChip,
35
- getActiveChip,
36
- XIAO_BLE,
37
- } from './chips/index.js';
38
- export type {
39
- ZephyrChipDescriptor,
40
- ZephyrGpioDtSpec,
41
- } from './chips/types.js';
1
+ // ---------------------------------------------------------------------------
2
+ // @typecad/framework-zephyr — public exports
3
+ //
4
+ // The cuttlefish loader (framework-package.ts) requires a `FrameworkStrategy`
5
+ // export (the PlatformStrategy class it instantiates) and an optional
6
+ // `Toolchain`. This package aliases ZephyrStrategy → FrameworkStrategy.
7
+ // ---------------------------------------------------------------------------
8
+
9
+ export { ZephyrStrategy as FrameworkStrategy } from './strategy.js';
10
+ export { ZephyrStrategy } from './strategy.js';
11
+ export { Toolchain } from './toolchain/index.js';
12
+ export { bossacTouchReset } from './toolchain/bossac-touch.js';
13
+
14
+ // Create-time starter debug artifacts. The `cuttlefish create` flow reads this
15
+ // optional named export off the loaded framework module (same loader pattern
16
+ // as doctor/licenses) and calls it for freshly scaffolded projects, so F5 in
17
+ // VS Code works before the first build. No-ops for non-GDB targets.
18
+ export { writeProjectDebugArtifacts } from './toolchain/debug-config.js';
19
+
20
+ // `cuttlefish doctor` verify the installed Zephyr is reachable + inside the
21
+ // declared compat range, and preview board-target normalization. Re-exported
22
+ // under the dispatcher-facing alias `doctor` so the loader picks it up as
23
+ // mod.doctor (see framework-package.ts).
24
+ export { runDoctor as doctor } from './doctor.js';
25
+
26
+ // `cuttlefish licenses` enumerate the Zephyr kernel + west manifest projects
27
+ // and resolve each one's SPDX license. Re-exported under the dispatcher-facing
28
+ // alias `licenses` so the loader picks it up as mod.licenses (see
29
+ // framework-package.ts). Mirrors framework-arduino's presenter.
30
+ export { runLicensesPresenter as licenses } from './licenses.js';
31
+
32
+ // Chip descriptor cache (the lowering's resolved-board view; no curated
33
+ // registry — every board reconstructs from its generated manifest).
34
+ export {
35
+ setActiveChip,
36
+ getActiveChip,
37
+ NO_BOARD_CHIP,
38
+ } from './chips/index.js';
39
+ export type {
40
+ ZephyrChipDescriptor,
41
+ ZephyrGpioDtSpec,
42
+ } from './chips/types.js';
43
+
44
+ // Board catalog sync — regenerate the local board overlay from the user's
45
+ // own Zephyr tree (`cuttlefish board sync`), so board add/change/remove
46
+ // tracks `west update` instead of cuttlefish releases.
47
+ export {
48
+ syncBoardCatalog,
49
+ ensureFreshBoardCatalog,
50
+ loadBoardCatalogOverlay,
51
+ resetBoardCatalogOverlayCache,
52
+ } from './sdk/board-catalog-sync.js';
53
+ export type {
54
+ BoardCatalogSyncReport,
55
+ BoardCatalogEnsureResult,
56
+ BoardCatalogOverlay,
57
+ } from './sdk/board-catalog-sync.js';