@typecad/framework-zephyr 1.0.0-alpha.14 → 1.0.0-alpha.16

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 (185) hide show
  1. package/README.md +22 -47
  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/esp32s3.js +49 -0
  10. package/dist/chips/index.d.ts +6 -12
  11. package/dist/chips/index.js +18 -34
  12. package/dist/chips/resolve.d.ts +16 -2
  13. package/dist/chips/resolve.js +267 -10
  14. package/dist/chips/soc/.d.ts +2 -0
  15. package/dist/chips/soc/.js +129 -0
  16. package/dist/chips/soc/esp32.d.ts +2 -0
  17. package/dist/chips/soc/esp32.js +120 -0
  18. package/dist/chips/soc/esp32c3.d.ts +2 -0
  19. package/dist/chips/soc/esp32c3.js +90 -0
  20. package/dist/chips/soc/esp32c6.d.ts +2 -0
  21. package/dist/chips/soc/esp32c6.js +109 -0
  22. package/dist/chips/soc/esp32s3.d.ts +2 -0
  23. package/dist/chips/soc/esp32s3.js +189 -0
  24. package/dist/chips/soc/index.d.ts +2 -0
  25. package/dist/chips/soc/index.js +23 -0
  26. package/dist/chips/soc/nrf52840.d.ts +2 -0
  27. package/dist/chips/soc/nrf52840.js +130 -0
  28. package/dist/chips/soc/rp2040.d.ts +2 -0
  29. package/dist/chips/soc/rp2040.js +141 -0
  30. package/dist/chips/soc/rp2350a.d.ts +2 -0
  31. package/dist/chips/soc/rp2350a.js +145 -0
  32. package/dist/chips/soc/samd21g18a.d.ts +2 -0
  33. package/dist/chips/soc/samd21g18a.js +143 -0
  34. package/dist/chips/soc/stm32f411xe.d.ts +2 -0
  35. package/dist/chips/soc/stm32f411xe.js +251 -0
  36. package/dist/chips/types.d.ts +319 -0
  37. package/dist/chips/xiao-ble.js +21 -0
  38. package/dist/display/profiles.js +1 -1
  39. package/dist/doctor.js +38 -4
  40. package/dist/dt-config/custom-board.d.ts +23 -0
  41. package/dist/dt-config/custom-board.js +227 -0
  42. package/dist/dt-config/kconfig.d.ts +72 -1
  43. package/dist/dt-config/kconfig.js +115 -26
  44. package/dist/dt-config/overlay.js +548 -28
  45. package/dist/framework.manifest.d.ts +3 -3
  46. package/dist/framework.manifest.js +122 -185
  47. package/dist/index.d.ts +4 -1
  48. package/dist/index.js +8 -2
  49. package/dist/lowering/adc.d.ts +20 -2
  50. package/dist/lowering/adc.js +121 -29
  51. package/dist/lowering/ble.js +31 -28
  52. package/dist/lowering/dac.js +9 -9
  53. package/dist/lowering/fs.js +18 -10
  54. package/dist/lowering/gpio.d.ts +2 -0
  55. package/dist/lowering/gpio.js +82 -5
  56. package/dist/lowering/http.js +39 -14
  57. package/dist/lowering/hwtimer.d.ts +4 -0
  58. package/dist/lowering/hwtimer.js +35 -10
  59. package/dist/lowering/i2c.js +46 -54
  60. package/dist/lowering/index.d.ts +5 -5
  61. package/dist/lowering/index.js +15 -16
  62. package/dist/lowering/interrupts.d.ts +22 -5
  63. package/dist/lowering/interrupts.js +104 -22
  64. package/dist/lowering/mqtt.js +3 -5
  65. package/dist/lowering/power.js +0 -4
  66. package/dist/lowering/preferences.js +49 -77
  67. package/dist/lowering/pulse.js +0 -31
  68. package/dist/lowering/pwm.d.ts +12 -1
  69. package/dist/lowering/pwm.js +78 -14
  70. package/dist/lowering/random.js +3 -3
  71. package/dist/lowering/sensor.d.ts +37 -0
  72. package/dist/lowering/sensor.js +119 -0
  73. package/dist/lowering/spi.d.ts +12 -0
  74. package/dist/lowering/spi.js +65 -40
  75. package/dist/lowering/thread.d.ts +14 -0
  76. package/dist/lowering/thread.js +55 -0
  77. package/dist/lowering/timing.js +20 -46
  78. package/dist/lowering/tone.js +16 -4
  79. package/dist/lowering/uart.d.ts +13 -0
  80. package/dist/lowering/uart.js +72 -51
  81. package/dist/lowering/usb.d.ts +34 -0
  82. package/dist/lowering/usb.js +206 -0
  83. package/dist/lowering/wdt.d.ts +1 -1
  84. package/dist/lowering/wdt.js +17 -7
  85. package/dist/lowering/wifi.d.ts +3 -2
  86. package/dist/lowering/wifi.js +97 -111
  87. package/dist/sdk/board-catalog-sync.d.ts +16 -0
  88. package/dist/sdk/board-catalog-sync.js +41 -0
  89. package/dist/sdk/board-data.generated.d.ts +2 -0
  90. package/dist/sdk/board-data.generated.js +4 -0
  91. package/dist/sdk/catalog-walker.d.ts +90 -0
  92. package/dist/sdk/catalog-walker.js +682 -0
  93. package/dist/sdk/dts-reader.d.ts +83 -0
  94. package/dist/sdk/dts-reader.js +596 -0
  95. package/dist/strategy.d.ts +136 -17
  96. package/dist/strategy.js +839 -222
  97. package/dist/toolchain/bossac-touch.d.ts +18 -0
  98. package/dist/toolchain/bossac-touch.js +88 -0
  99. package/dist/toolchain/compat.d.ts +2 -2
  100. package/dist/toolchain/compat.js +8 -3
  101. package/dist/toolchain/debug-config.d.ts +21 -26
  102. package/dist/toolchain/debug-config.js +226 -76
  103. package/dist/toolchain/env-check.d.ts +4 -4
  104. package/dist/toolchain/env-check.js +5 -5
  105. package/dist/toolchain/index.d.ts +115 -1
  106. package/dist/toolchain/index.js +680 -71
  107. package/dist/toolchain/scaffold.js +39 -7
  108. package/dist/toolchain/west-discover.d.ts +4 -0
  109. package/dist/toolchain/west-discover.js +17 -6
  110. package/installer/CHANGELOG.md +473 -0
  111. package/installer/README.md +328 -0
  112. package/installer/environment.yml +46 -0
  113. package/installer/etc/conda/activate.d/zephyr.bat +7 -0
  114. package/installer/etc/conda/activate.d/zephyr.ps1 +12 -0
  115. package/installer/etc/conda/activate.d/zephyr.sh +20 -0
  116. package/installer/etc/conda/deactivate.d/zephyr.bat +6 -0
  117. package/installer/etc/conda/deactivate.d/zephyr.ps1 +6 -0
  118. package/installer/etc/conda/deactivate.d/zephyr.sh +4 -0
  119. package/installer/install.mjs +580 -0
  120. package/installer/install.ps1 +619 -0
  121. package/installer/install.sh +310 -0
  122. package/installer/lib/detect-platform.sh +62 -0
  123. package/installer/lib/fetch-sdk.sh +304 -0
  124. package/installer/lib/init-workspace.sh +153 -0
  125. package/installer/lib/write-activation.sh +76 -0
  126. package/installer/patches/tfm-c-include-separators.patch +19 -0
  127. package/installer/patches/zephyr-tfm-nordic-zephyr-include.patch +24 -0
  128. package/installer/templates/project/.typecad/activate-zephyr.ps1 +31 -0
  129. package/installer/templates/project/.typecad/activate-zephyr.sh +31 -0
  130. package/installer/templates/project/.vscode/settings.json +30 -0
  131. package/installer/templates/project/README.md +58 -0
  132. package/installer/versions.env +110 -0
  133. package/package.json +15 -15
  134. package/src/as-built.ts +206 -0
  135. package/src/boardgen.ts +1428 -0
  136. package/src/chips/index.ts +35 -54
  137. package/src/chips/resolve.ts +285 -10
  138. package/src/chips/types.ts +325 -1
  139. package/src/display/profiles.ts +1 -1
  140. package/src/doctor.ts +110 -77
  141. package/src/dt-config/custom-board.ts +325 -0
  142. package/src/dt-config/kconfig.ts +165 -18
  143. package/src/dt-config/overlay.ts +537 -25
  144. package/src/framework.manifest.ts +123 -185
  145. package/src/index.ts +57 -41
  146. package/src/lowering/adc.ts +222 -118
  147. package/src/lowering/ble.ts +32 -28
  148. package/src/lowering/dac.ts +82 -82
  149. package/src/lowering/fs.ts +18 -10
  150. package/src/lowering/gpio.ts +242 -155
  151. package/src/lowering/http.ts +512 -488
  152. package/src/lowering/hwtimer.ts +139 -101
  153. package/src/lowering/i2c.ts +116 -126
  154. package/src/lowering/index.ts +91 -93
  155. package/src/lowering/interrupts.ts +113 -21
  156. package/src/lowering/mqtt.ts +3 -5
  157. package/src/lowering/preferences.ts +327 -354
  158. package/src/lowering/pwm.ts +167 -99
  159. package/src/lowering/random.ts +3 -3
  160. package/src/lowering/sensor.ts +155 -0
  161. package/src/lowering/spi.ts +164 -124
  162. package/src/lowering/thread.ts +63 -0
  163. package/src/lowering/timing.ts +46 -72
  164. package/src/lowering/uart.ts +73 -51
  165. package/src/lowering/usb.ts +221 -0
  166. package/src/lowering/wdt.ts +95 -84
  167. package/src/lowering/wifi.ts +97 -112
  168. package/src/sdk/board-catalog-sync.ts +62 -0
  169. package/src/strategy.ts +848 -237
  170. package/src/toolchain/bossac-touch.ts +112 -0
  171. package/src/toolchain/compat.ts +8 -3
  172. package/src/toolchain/debug-config.ts +676 -522
  173. package/src/toolchain/env-check.ts +9 -9
  174. package/src/toolchain/index.ts +1359 -645
  175. package/src/toolchain/scaffold.ts +38 -7
  176. package/src/toolchain/west-discover.ts +19 -6
  177. package/src/async/timer-polyfill.ts +0 -107
  178. package/src/chips/esp32.ts +0 -74
  179. package/src/chips/esp32s3.ts +0 -57
  180. package/src/chips/xiao-ble.ts +0 -82
  181. package/src/lowering/power.ts +0 -70
  182. package/src/lowering/pulse.ts +0 -93
  183. package/src/lowering/tone.ts +0 -60
  184. package/src/lowering/worker-backing.ts +0 -94
  185. 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,28 +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
- // rpi_pico / rpi_pico2 / esp32c3 / esp32c6 / blackpill_f411ce resolve via
55
- // the board packages' zephyr chip data (resolveChipFromBoard), not the
56
- // hardcoded chip registry.
57
- targets: [
58
- 'xiao_ble', 'esp32s3_devkitc', 'esp32_devkitc',
59
- 'rpi_pico', 'rpi_pico2/rp2350a/m33',
60
- 'esp32c3_devkitm/esp32c3', 'esp32c6_devkitc/esp32c6/hpcore',
61
- 'blackpill_f411ce/stm32f411xe',
62
- ],
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: [],
63
58
  forcedIncludes: ['<zephyr/kernel.h>', '<zephyr/drivers/gpio.h>', '<cstdint>'],
64
59
  symbolAliases: {},
65
60
  },
@@ -73,27 +68,29 @@ export default defineFrameworkManifest({
73
68
  'gpio.write': 'supported',
74
69
  'gpio.read': 'supported',
75
70
  'gpio.toggle': 'supported',
76
- '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',
77
77
  },
78
78
  },
79
79
 
80
- // ── Supported: Timing (delay/millis/delay_us/micros/free_heap; timers via polyfill) ─
80
+ // ── Supported: Timing (delay/millis/delay_us/micros; timers via polyfill) ─
81
81
  timing: {
82
82
  supported: true,
83
83
  partialCoverage: false,
84
84
  ops: {
85
- 'timing.delay': 'supported', // → k_msleep(ms)
86
- 'timing.delay_microseconds': 'supported', // → k_busy_wait(us)
87
- 'timing.millis': 'supported', // → k_uptime_get_32()
88
- 'timing.micros': 'supported', // → k_cycle_get_32 + cycles/sec
89
- 'timing.free_heap': 'supported', // → 0 (no portable query; see lowering)
90
85
  // Timer ops are POLYFILL_BACKED_OPS → timer_methods. The validator skips
91
86
  // the resolver probe (these legitimately return polyfill-helper calls,
92
87
  // not direct lowering) and requires the polyfill be in polyfills.emitted.
93
- 'timing.set_interval': 'polyfill',
94
- 'timing.set_timeout': 'polyfill',
95
- 'timing.clear_interval': 'polyfill',
96
- '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
97
94
  },
98
95
  },
99
96
 
@@ -102,9 +99,11 @@ export default defineFrameworkManifest({
102
99
  supported: true,
103
100
  partialCoverage: false,
104
101
  ops: {
105
- 'pwm.write': 'supported',
106
- 'pwm.get_frequency': 'supported',
107
- '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',
108
107
  },
109
108
  },
110
109
 
@@ -113,11 +112,10 @@ export default defineFrameworkManifest({
113
112
  supported: true,
114
113
  partialCoverage: false,
115
114
  ops: {
116
- 'adc.read': 'supported',
117
- 'adc.get_resolution': 'supported',
118
- 'adc.set_reference': 'supported',
119
- 'adc.get_reference': 'supported',
120
- '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',
121
119
  },
122
120
  },
123
121
  dac: {
@@ -127,77 +125,57 @@ export default defineFrameworkManifest({
127
125
  // (zephyr-dac-pin-unavailable).
128
126
  supported: true,
129
127
  partialCoverage: true,
130
- ops: { 'dac.write': 'supported' },
128
+ ops: {
129
+ // Thin DAC (hal/dac-pin.ts): raw code, construction resolution.
130
+ 'dac.write_value': 'supported',
131
+ },
131
132
  },
132
133
  interrupts: {
133
134
  supported: true,
134
135
  partialCoverage: true,
135
136
  unsupportedReason: undefined,
136
137
  ops: {
137
- 'interrupt.attach': 'supported',
138
138
  'interrupt.detach': 'supported',
139
- },
140
- },
141
- tone: {
142
- supported: true,
143
- partialCoverage: true,
144
- ops: {
145
- 'tone.play': 'supported', // PWM-based square wave (blocking for duration)
146
- 'tone.stop': 'supported',
147
- },
148
- },
149
- power: {
150
- supported: true,
151
- partialCoverage: true,
152
- ops: {
153
- 'power.deep_sleep': 'supported', // k_sleep (deepest allowed state)
154
- 'power.light_sleep': 'supported', // pm_state_force SUSPEND_TO_IDLE
155
- 'power.set_cpu_frequency': 'supported', // comment (nRF clock API deferred)
156
- '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',
157
142
  },
158
143
  },
159
144
  i2c: {
160
145
  supported: true,
161
146
  partialCoverage: false,
162
147
  ops: {
163
- 'i2c.begin': 'supported', 'i2c.end': 'supported', 'i2c.set_clock': 'supported',
164
- 'i2c.begin_transmission': 'supported', 'i2c.write': 'supported',
165
- 'i2c.write_bytes': 'supported', 'i2c.write_buffer': 'supported',
166
- 'i2c.read_buffer': 'supported', 'i2c.end_transmission': 'supported',
167
- 'i2c.request_from': 'supported', 'i2c.available': 'supported', 'i2c.read': 'supported',
168
- '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',
169
153
  },
170
154
  },
171
155
  spi: {
172
156
  supported: true,
173
157
  partialCoverage: false,
174
158
  ops: {
175
- 'spi.begin': 'supported', 'spi.end': 'supported', 'spi.transfer': 'supported',
176
- 'spi.begin_transaction': 'supported', 'spi.end_transaction': 'supported',
177
- 'spi.set_mode': 'supported', 'spi.set_bit_order': 'supported',
178
- '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',
179
164
  },
180
165
  },
181
166
  uart: {
182
167
  supported: true,
183
168
  partialCoverage: true,
184
169
  ops: {
185
- 'uart.begin': 'supported', 'uart.end': 'supported', 'uart.print': 'supported',
186
- 'uart.println': 'supported', 'uart.printf': 'supported', 'uart.write': 'supported',
187
- 'uart.read': 'supported', 'uart.peek': 'supported', 'uart.available': 'supported',
188
- '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',
189
177
  },
190
178
  },
191
- pulse: {
192
- supported: true,
193
- partialCoverage: true,
194
- ops: { 'pulse.in': 'supported', 'pulse.in_long': 'supported' },
195
- },
196
- shift: {
197
- supported: true,
198
- partialCoverage: false,
199
- ops: { 'shift.out': 'supported', 'shift.in': 'supported' },
200
- },
201
179
  board: {
202
180
  // Board constant resolution. Board.definition.<path> /
203
181
  // Pins.definition.<path> property accesses are folded by
@@ -215,9 +193,33 @@ export default defineFrameworkManifest({
215
193
  supported: true,
216
194
  partialCoverage: false,
217
195
  ops: {
218
- 'wdt.enable': 'supported',
219
- 'wdt.reset': 'supported',
220
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',
221
223
  },
222
224
  },
223
225
  // ── Partial: WiFi (STA connect + scan + config via conn_mgr/net_mgmt) ────
@@ -231,51 +233,34 @@ export default defineFrameworkManifest({
231
233
  // driver hook; credentials need a custom settings-subsystem layer; static IP
232
234
  // / auto-reconnect / tx-power aren't wifi-shaped or aren't exposed by the
233
235
  // esp32 Zephyr driver. See per-op reasons.
234
- 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).',
235
237
  ops: {
236
- // Connection (8) — net_mgmt connect/disconnect + L4 connectivity state.
237
- 'wifi.connect': 'supported', 'wifi.connect_start': 'supported',
238
- 'wifi.disconnect': 'supported', 'wifi.status': 'supported',
239
- 'wifi.is_connected': 'supported', 'wifi.local_ip': 'supported',
240
- 'wifi.rssi': 'supported', 'wifi.mac': 'supported',
241
- // Waits (2) — block on the L4 connected flag (k_msleep poll).
242
- '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',
243
245
  // Scan (8) — net_mgmt NET_REQUEST_WIFI_SCAN + result pool.
244
- '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',
245
250
  'wifi.scan_done': 'supported', 'wifi.scan_count': 'supported',
246
251
  'wifi.scan_ssid': 'supported', 'wifi.scan_rssi': 'supported',
247
252
  'wifi.scan_encryption': 'supported', 'wifi.scan_channel': 'supported',
248
- // AP mode (2 of 7) — esp32 driver wires ap_enable/ap_disable. Only
249
- // ssid/password/channel are honored; the rest of the AP surface has no
250
- // 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).
251
255
  'wifi.ap_start': 'supported', 'wifi.ap_stop': 'supported',
252
- // Config (2) — hostname (best-effort no-op) + power save (real net_mgmt).
253
- 'wifi.set_hostname': 'supported', 'wifi.set_power_save': 'supported',
254
256
  // on_event: 'disconnect' (NET_EVENT_L4_DISCONNECTED) + 'connect'
255
257
  // (NET_EVENT_IPV4_ADDR_ADD) are lowered.
256
258
  'wifi.on_event': 'supported',
257
- // ── Genuinely unsupported (no Zephyr/driver hook) ───────────────────
259
+ // ── Genuinely unsupported (no driver hook) ─────────────────────────
258
260
  // ap_client_count: no API to enumerate connected AP stations.
259
- // ap_ip: set via net_if, not wifi net_mgmt.
260
- // ap_set_channel: channel set at ap_start; driver doesn't wire ap_config_params.
261
- // ap_set_hidden: esp32 ap_enable config has no ssid_hidden field.
262
- // ap_set_max_clients: driver hardcodes max_connection to 5; config_params unwired.
263
- // save_credentials/connect_saved/clear_credentials: no wifi-credentials API in
264
- // Zephyr (would need a custom settings-subsystem layer).
265
- // set_static_ip: a net_if operation, not a wifi net_mgmt request.
266
- // set_auto_reconnect: esp32 driver doesn't expose esp_wifi_set_auto_connect.
267
- // set_tx_power: driver owns the radio; the PHY ceiling isn't a Zephyr Kconfig (zephyr#45580).
268
261
  'wifi.ap_client_count': 'unsupported',
269
- 'wifi.ap_ip': 'unsupported',
270
- 'wifi.ap_set_channel': 'unsupported',
271
- 'wifi.ap_set_hidden': 'unsupported',
272
- 'wifi.ap_set_max_clients': 'unsupported',
273
- 'wifi.save_credentials': 'unsupported', 'wifi.connect_saved': 'unsupported',
274
- 'wifi.clear_credentials': 'unsupported',
275
- 'wifi.set_static_ip': 'unsupported',
276
- 'wifi.set_auto_reconnect': 'unsupported',
277
- 'wifi.set_tx_power': 'unsupported',
278
262
  },
263
+
279
264
  },
280
265
  http: {
281
266
  supported: true,
@@ -286,7 +271,7 @@ export default defineFrameworkManifest({
286
271
  // a networked target (ESP32 WiFi); profileDiagnostics flags usage on a
287
272
  // radioless chip as 'zephyr-http-unavailable-on-target'.
288
273
  ops: {
289
- 'http.begin': 'supported', 'http.reset': 'supported',
274
+ 'http.begin': 'supported',
290
275
  'http.set_header': 'supported', 'http.set_timeout': 'supported',
291
276
  'http.set_max_body': 'supported', 'http.set_body': 'supported',
292
277
  'http.set_insecure': 'supported', 'http.set_ca_cert': 'supported',
@@ -325,13 +310,6 @@ export default defineFrameworkManifest({
325
310
  },
326
311
 
327
312
  // ── Supported: Worker offload (k_work system workqueue + k_sem) ──────────
328
- // worker.* is lowered via lowerWorkerOp against the shared __tc_worker
329
- // contract; the Zephyr backing (worker-backing.ts) supplies k_work + k_sem.
330
- worker: {
331
- supported: true,
332
- partialCoverage: false,
333
- ops: { 'worker.submit': 'supported', 'worker.done': 'supported' },
334
- },
335
313
 
336
314
  // ── Honestly unsupported extended categories ─────────────────────────────
337
315
  // These have op-kinds in HAL_OPERATION_KINDS but no Zephyr lowering. Each
@@ -340,12 +318,6 @@ export default defineFrameworkManifest({
340
318
  // catchall schema (HalCoverageSchema) validates any declared extended
341
319
  // category; declaring them keeps the manifest a complete coverage record.
342
320
 
343
- rmt: {
344
- supported: false,
345
- unsupportedReason: 'RMT (ESP32 infrared/transaction peripheral) has no Zephyr lowering.',
346
- partialCoverage: false,
347
- ops: unsupportedOps('rmt.'),
348
- },
349
321
  snprintf: {
350
322
  supported: false,
351
323
  unsupportedReason: 'snprintf.emit is a raw escape hatch; the Zephyr resolver returns undefined (use rawCpp()).',
@@ -366,10 +338,8 @@ export default defineFrameworkManifest({
366
338
  supported: true,
367
339
  partialCoverage: false,
368
340
  ops: {
369
- 'preferences.begin': 'supported', 'preferences.end': 'supported',
370
341
  'preferences.clear': 'supported', 'preferences.remove': 'supported',
371
342
  'preferences.put_int': 'supported', 'preferences.get_int': 'supported',
372
- 'preferences.put_uint': 'supported', 'preferences.get_uint': 'supported',
373
343
  'preferences.put_bool': 'supported', 'preferences.get_bool': 'supported',
374
344
  'preferences.put_float': 'supported', 'preferences.get_float': 'supported',
375
345
  'preferences.put_string': 'supported', 'preferences.get_string': 'supported',
@@ -396,16 +366,10 @@ export default defineFrameworkManifest({
396
366
  supported: true,
397
367
  partialCoverage: false,
398
368
  ops: {
399
- 'fs.begin': 'supported', 'fs.read_text': 'supported', 'fs.write_text': 'supported',
369
+ 'fs.read_text': 'supported', 'fs.write_text': 'supported',
400
370
  'fs.exists': 'supported', 'fs.remove': 'supported',
401
371
  },
402
372
  },
403
- mdns: {
404
- supported: false,
405
- unsupportedReason: 'No mDNS lowering on Zephyr (requires networking stack).',
406
- partialCoverage: false,
407
- ops: unsupportedOps('mdns.'),
408
- },
409
373
  mqtt: {
410
374
  supported: true,
411
375
  partialCoverage: false,
@@ -422,43 +386,19 @@ export default defineFrameworkManifest({
422
386
  'mqtt.connected': 'supported', 'mqtt.disconnect': 'supported',
423
387
  },
424
388
  },
425
- ota: {
426
- supported: false,
427
- unsupportedReason: 'No OTA lowering on Zephyr (Zephyr has MCUmgr; not wired).',
428
- partialCoverage: false,
429
- ops: unsupportedOps('ota.'),
430
- },
431
- temp: {
432
- supported: false,
433
- unsupportedReason: 'No on-chip temperature lowering on Zephyr (nRF52840 TEMP peripheral; not wired).',
434
- partialCoverage: false,
435
- ops: { 'temp.read': 'unsupported' },
436
- },
437
- hwtimer: {
438
- // Hardware timers via the Zephyr counter driver (<zephyr/drivers/counter.h>).
439
- // set_frequency → top value (counter_freq/hz) + on_overflow callback;
440
- // start arms both; stop halts. A chip declares its free counters
441
- // (e.g. nRF RTC1; RTC0 is kernel-owned). This is distinct from the JS
442
- // 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).
443
395
  supported: true,
444
- partialCoverage: true,
396
+ partialCoverage: false,
445
397
  ops: {
446
- 'hwtimer.set_frequency': 'supported', 'hwtimer.on_overflow': 'supported',
447
- 'hwtimer.start': 'supported', 'hwtimer.stop': 'supported',
398
+ 'sensor.fetch': 'supported',
399
+ 'sensor.get': 'supported',
448
400
  },
449
401
  },
450
- capacitive: {
451
- // FT6336U capacitive touch is handled via the strategy-owned touch adapter
452
- // (src/display/touch-adapter.ts → touch_init/touch_isTouched/touch_readRaw),
453
- // NOT via a HAL op lowering. The manifest marks it unsupported here (no
454
- // resolveHALOperation path for capacitive.read); the touch adapter provides
455
- // the integration. partialCoverage reflects that it works on targets with
456
- // the FT6336U DT node (ESP32), not on the bare nRF52840.
457
- supported: false,
458
- unsupportedReason: 'Capacitive touch is handled via the strategy touch adapter (FT6336U I2C), not a HAL op. Requires the ft6336u DT node.',
459
- partialCoverage: true,
460
- ops: { 'capacitive.read': 'unsupported' },
461
- },
462
402
  i2s: {
463
403
  supported: false,
464
404
  unsupportedReason: 'No I2S / digital audio lowering on Zephyr.',
@@ -472,8 +412,12 @@ export default defineFrameworkManifest({
472
412
  ops: unsupportedOps('twai.'),
473
413
  },
474
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.
475
419
  supported: false,
476
- 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).',
477
421
  partialCoverage: false,
478
422
  ops: unsupportedOps('usb.'),
479
423
  },
@@ -516,7 +460,6 @@ export default defineFrameworkManifest({
516
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' },
517
461
  { id: 'string_methods', domain: 'embedded', notes: 'STL-free __tc_* string helpers (const char*, inline ASCII case conv, <cstring> only)' },
518
462
  { id: 'static_array', domain: 'embedded', notes: 'STL-free __tc_StaticArray<T,N> wrapper for no-<vector> mutated/struct array literals' },
519
- { id: 'timer_methods', domain: 'embedded', notes: 'k_timer + k_work pool (system workqueue); callbacks run in thread context' },
520
463
  { id: 'async_runtime', domain: 'embedded', notes: 'Heap-free static Promise/microtask runtime (generateStaticAsyncRuntime), pumped in loop()' },
521
464
  ],
522
465
  suppressed: [],
@@ -536,7 +479,7 @@ export default defineFrameworkManifest({
536
479
 
537
480
  typeEmission: {
538
481
  normalizeCppType: true,
539
- mathHeader: '<math.h>',
482
+ mathHeader: '<cmath>',
540
483
  needsStdString: false,
541
484
  needsStdVector: false,
542
485
  needsIostream: false,
@@ -555,17 +498,11 @@ export default defineFrameworkManifest({
555
498
  ambientTypes: ['Preferences'],
556
499
 
557
500
  conformance: {
558
- // Hardware-test groups each entry is backed by a tests/<group>.test.ts
559
- // file in this package (validated by the manifest validator). Mirrors the
560
- // framework-avr/framework-esp32 convention. These run on metal via
561
- // `npm run test:hw` (cuttlefish-test transpiles west build → flash).
562
- hardwareTestGroups: [
563
- '01-basics',
564
- '30-timing',
565
- '40-gpio',
566
- '41-analog',
567
- '42-timers',
568
- ],
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: [],
569
506
  // Per-op HAL-resolution suite — one tests/packages/framework-zephyr/
570
507
  // hal-resolution/<cat>.test.ts per category, snapshotting the exact C++
571
508
  // each op lowers to. Mirrors the framework-esp32 convention. These are
@@ -573,8 +510,9 @@ export default defineFrameworkManifest({
573
510
  // catches regressions like silent pull-resistor / interrupt no-ops.
574
511
  halResolutionTests: [
575
512
  'adc', 'ble', 'board', 'dac', 'fs', 'gpio', 'http', 'hwtimer', 'i2c',
576
- 'interrupts', 'mqtt', 'power', 'preferences', 'pulse', 'pwm', 'random',
577
- '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',
578
516
  ],
579
517
  },
580
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';