@typecad/framework-zephyr 1.0.0-alpha.14 → 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 (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 +211 -71
  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 +66 -1
  106. package/dist/toolchain/index.js +650 -70
  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 +666 -522
  173. package/src/toolchain/env-check.ts +9 -9
  174. package/src/toolchain/index.ts +1286 -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
@@ -1,12 +1,24 @@
1
- // ---------------------------------------------------------------------------
2
- // Kconfig fragment resolver — extracts the prj.conf symbol logic
3
- //
4
- // Previously inline in scaffold.ts as token-scanning of the emitted source.
5
- // Formalized here as a typed, unit-testable function keyed off a usage-analysis
6
- // object (the same ctx.analysis.usesX flags the strategy uses). scaffold.ts
7
- // calls this instead of inlining the scan, keeping prj.conf generation honest
8
- // and testable.
9
- // ---------------------------------------------------------------------------
1
+ import { SENSOR_PART_INFO } from '@typecad/hal';
2
+ /**
3
+ * Apply the per-part Kconfig exceptions the generated catalog records, for
4
+ * exactly the parts the program constructs. Lines are CONFIG_<SYM>=<value>
5
+ * strings parsed into the map; a symbol the user set explicitly in
6
+ * zephyr.kconfig is left alone (scaffold.ts already skips user overrides for
7
+ * auto symbols, and Map.set idempotence covers the rest). The lookup is a
8
+ * parameter so tests can drive it with a synthetic catalog.
9
+ */
10
+ export function applySensorKconfigExceptions(m, parts, lookup = SENSOR_PART_INFO) {
11
+ if (!parts)
12
+ return;
13
+ for (const sp of parts) {
14
+ for (const line of lookup[sp.part]?.kconfig ?? []) {
15
+ const eq = line.indexOf('=');
16
+ if (eq <= 0)
17
+ continue;
18
+ m.set(line.slice(0, eq), line.slice(eq + 1));
19
+ }
20
+ }
21
+ }
10
22
  /**
11
23
  * Resolve the Kconfig symbol→value map for a prj.conf. Returns a Map preserving
12
24
  * insertion order (callers join with '\n'). Core GPIO + C++ + workqueue symbols
@@ -21,6 +33,22 @@ export function resolveKconfigFragments(usage, debug) {
21
33
  m.set('CONFIG_CONSOLE', 'y');
22
34
  if (usage.usesAdc)
23
35
  m.set('CONFIG_ADC', 'y');
36
+ // Sensors: only the umbrella — each in-tree driver is `default y` on its
37
+ // DT_HAS_<COMPAT>_ENABLED, so the overlay's child node enables the driver.
38
+ if (usage.usesSensor)
39
+ m.set('CONFIG_SENSOR', 'y');
40
+ // The rare driver that is NOT DT-default-on: the catalog records its
41
+ // Kconfig lines (from the driver's own Kconfig) and they are applied for
42
+ // exactly the parts the program constructs. Empty for every in-tree part
43
+ // today — this path is insurance for the next exception.
44
+ applySensorKconfigExceptions(m, usage.sensorParts);
45
+ // Float formatting: cbprintf builds float conversions only under
46
+ // FP_SUPPORT, which depends on the COMPLETE implementation — without these,
47
+ // %f silently prints garbage instead of the value.
48
+ if (usage.usesFloatFormat) {
49
+ m.set('CONFIG_CBPRINTF_COMPLETE', 'y');
50
+ m.set('CONFIG_CBPRINTF_FP_SUPPORT', 'y');
51
+ }
24
52
  if (usage.usesPwm)
25
53
  m.set('CONFIG_PWM', 'y');
26
54
  if (usage.usesDac)
@@ -29,8 +57,37 @@ export function resolveKconfigFragments(usage, debug) {
29
57
  m.set('CONFIG_I2C', 'y');
30
58
  if (usage.usesSpi)
31
59
  m.set('CONFIG_SPI', 'y');
60
+ // USB CDC-ACM serial: the "next" USB device stack + the CDC-ACM class.
61
+ // Symbol names verified against Zephyr 4.3 (subsys/usb/device_next/Kconfig):
62
+ // - USB_DEVICE_STACK_NEXT is the new stack (selects UDC_DRIVER);
63
+ // USB_DEVICE_STACK is the LEGACY stack — deprecated in 4.3 (selects
64
+ // DEPRECATED) and its assignment is what trips the build.
65
+ // - USBD_CDC_ACM_CLASS is the class (note the USBD_ prefix — a bare
66
+ // CDC_ACM_CLASS is an undefined symbol). It depends on SERIAL +
67
+ // DT_HAS_ZEPHYR_CDC_ACM_UART_ENABLED (the overlay's cdc-acm-uart node)
68
+ // and selects UART_INTERRUPT_DRIVEN/RING_BUFFER itself; assigning it
69
+ // keeps prj.conf explicit.
70
+ // - UART_LINE_CTRL gates the driver's line_ctrl_get — usb.connected()
71
+ // polls DTR through it.
72
+ if (usage.usesUsb) {
73
+ m.set('CONFIG_USB_DEVICE_STACK_NEXT', 'y');
74
+ m.set('CONFIG_USBD_CDC_ACM_CLASS', 'y');
75
+ m.set('CONFIG_UART_LINE_CTRL', 'y');
76
+ m.set('CONFIG_SERIAL', 'y');
77
+ // The device presents a serial-number string descriptor sourced from
78
+ // hwinfo (the SoC's unique ID). Without it Windows keys the CDC devnode
79
+ // on the physical USB port: replugs reuse stale nodes and repeated flash
80
+ // cycles wedge them into permanent "access denied" opens. A serial makes
81
+ // the instance path identity-based — stable across ports, immune to the
82
+ // port-keyed ghost pool.
83
+ m.set('CONFIG_HWINFO', 'y');
84
+ }
32
85
  if (usage.usesWdt)
33
86
  m.set('CONFIG_WATCHDOG', 'y');
87
+ // STM32: keep the debugger attachable in sleep/stop (see the shim's
88
+ // DBGMCU init — this covers the Zephyr-side DBG_STOP bit via LL headers).
89
+ if (usage.usesStm32DebugSleep)
90
+ m.set('CONFIG_STM32_ENABLE_DEBUG_SLEEP_STOP', 'y');
34
91
  // Hardware timers via the counter driver.
35
92
  if (usage.usesHwtimer)
36
93
  m.set('CONFIG_COUNTER', 'y');
@@ -87,11 +144,6 @@ export function resolveKconfigFragments(usage, debug) {
87
144
  m.set('CONFIG_SPIRAM_MODE_QUAD', 'y');
88
145
  }
89
146
  }
90
- // deep_sleep_pin wake needs PM + PM_DEVICE.
91
- if (usage.usesPower) {
92
- m.set('CONFIG_PM', 'y');
93
- m.set('CONFIG_PM_DEVICE', 'y');
94
- }
95
147
  if (usage.usesWifi) {
96
148
  // Master networking switch — every CONFIG_NET_* symbol depends on NETWORKING
97
149
  // (without it, Kconfig silently forces them all to n).
@@ -104,7 +156,7 @@ export function resolveKconfigFragments(usage, debug) {
104
156
  m.set('CONFIG_NET_DHCPV4', 'y');
105
157
  // NOT CONFIG_NET_CONFIG_SETTINGS: that runs net_config_init() at boot which
106
158
  // BLOCKS up to NET_CONFIG_INIT_TIMEOUT (default 30s) waiting for the iface
107
- // to come up — but our shim brings the iface up itself in setup() (connect),
159
+ // to come up — but our shim brings the iface up itself in main() (connect),
108
160
  // so net_config waits the full 30s, then the dual management of the same
109
161
  // iface crashes the driver. Our shim owns connectivity (net_mgmt connect/
110
162
  // disconnect + conn_mgr monitor for L4), exactly like the standalone Zephyr
@@ -189,13 +241,26 @@ export function resolveKconfigFragments(usage, debug) {
189
241
  // server's RSA cert (rsa:2048) and is widely offered; add more ciphersuites
190
242
  // here to broaden server compatibility.
191
243
  m.set('CONFIG_MBEDTLS_CIPHERSUITE_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'y');
244
+ // Ciphersuites only *depend on* X509_CRT_PARSE_C (they don't select it) —
245
+ // without it sockets_tls.c compiles out mbedtls_x509_crt_parse and every
246
+ // pinned-CA handshake fails with EPERM at connect (the insecure path
247
+ // skips verification, so it works either way).
248
+ m.set('CONFIG_MBEDTLS_X509_CRT_PARSE_C', 'y');
249
+ // KNOWN LIMITATION on this Zephyr tree: pinned-CA (verified TLS) fails at
250
+ // connect — the tf-psa-crypto mbedTLS needs a wider symbol matrix
251
+ // (RSA public-key parse + PEM/DER glue) than the single-ciphersuite
252
+ // select pulls in, and forcing the extra symbols regresses the insecure
253
+ // path. insecure() HTTPS is fully verified; caCert() chain verification
254
+ // stays open until the upstream matrix is mapped.
192
255
  // Handshake/protocol buffers allocate from the mbedTLS heap; MBEDTLS_HEAP_SIZE
193
256
  // must hold ~2x MBEDTLS_SSL_MAX_CONTENT_LEN plus working state. 65000 fits on
194
257
  // the ESP32; mbedTLS requires the full libc and PEM (not DER) cert format.
195
258
  m.set('CONFIG_MBEDTLS_ENABLE_HEAP', 'y');
196
- m.set('CONFIG_MBEDTLS_HEAP_SIZE', '65000');
259
+ // 2x SSL_MAX_CONTENT_LEN record buffers + CA-chain parse state +
260
+ // handshake working memory. 65000 fit insecure-mode handshakes but the
261
+ // pinned-CA path (verification state) overflowed → EPERM at connect.
262
+ m.set('CONFIG_MBEDTLS_HEAP_SIZE', '100000');
197
263
  m.set('CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN', '16384');
198
- m.set('CONFIG_MBEDTLS_PEM_CERTIFICATE_FORMAT', 'y');
199
264
  m.set('CONFIG_PSA_CRYPTO', 'y');
200
265
  m.set('CONFIG_REQUIRES_FULL_LIBC', 'y');
201
266
  // The http client + TLS handshake are stack-hungry; mirror the wifi bumps
@@ -219,6 +284,12 @@ export function resolveKconfigFragments(usage, debug) {
219
284
  m.set('CONFIG_NET_SOCKETS', 'y');
220
285
  m.set('CONFIG_MQTT_LIB', 'y');
221
286
  m.set('CONFIG_MQTT_LIB_TLS', 'y');
287
+ // The shim getaddrinfo-resolves the broker host — without the DNS
288
+ // resolver linked, getaddrinfo fails numeric AND hostname lookups with
289
+ // EAI_FAIL even while plain HTTP (which selects DNS via its own block)
290
+ // works.
291
+ m.set('CONFIG_DNS_RESOLVER', 'y');
292
+ m.set('CONFIG_DNS_SERVER_IP_ADDRESSES', 'y');
222
293
  // NET_MAX_CONTEXTS / NET_MAX_CONN: same exhaustion risk as HTTP — sequential
223
294
  // connections linger after close. Give the broker session + headroom.
224
295
  m.set('CONFIG_NET_MAX_CONTEXTS', '16');
@@ -230,10 +301,23 @@ export function resolveKconfigFragments(usage, debug) {
230
301
  m.set('CONFIG_MBEDTLS', 'y');
231
302
  m.set('CONFIG_MBEDTLS_BUILTIN', 'y');
232
303
  m.set('CONFIG_MBEDTLS_CIPHERSUITE_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256', 'y');
304
+ // Ciphersuites only *depend on* X509_CRT_PARSE_C (they don't select it) —
305
+ // without it sockets_tls.c compiles out mbedtls_x509_crt_parse and every
306
+ // pinned-CA handshake fails with EPERM at connect (the insecure path
307
+ // skips verification, so it works either way).
308
+ m.set('CONFIG_MBEDTLS_X509_CRT_PARSE_C', 'y');
309
+ // KNOWN LIMITATION on this Zephyr tree: pinned-CA (verified TLS) fails at
310
+ // connect — the tf-psa-crypto mbedTLS needs a wider symbol matrix
311
+ // (RSA public-key parse + PEM/DER glue) than the single-ciphersuite
312
+ // select pulls in, and forcing the extra symbols regresses the insecure
313
+ // path. insecure() HTTPS is fully verified; caCert() chain verification
314
+ // stays open until the upstream matrix is mapped.
233
315
  m.set('CONFIG_MBEDTLS_ENABLE_HEAP', 'y');
234
- m.set('CONFIG_MBEDTLS_HEAP_SIZE', '65000');
316
+ // 2x SSL_MAX_CONTENT_LEN record buffers + CA-chain parse state +
317
+ // handshake working memory. 65000 fit insecure-mode handshakes but the
318
+ // pinned-CA path (verification state) overflowed → EPERM at connect.
319
+ m.set('CONFIG_MBEDTLS_HEAP_SIZE', '100000');
235
320
  m.set('CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN', '16384');
236
- m.set('CONFIG_MBEDTLS_PEM_CERTIFICATE_FORMAT', 'y');
237
321
  m.set('CONFIG_PSA_CRYPTO', 'y');
238
322
  m.set('CONFIG_REQUIRES_FULL_LIBC', 'y');
239
323
  m.set('CONFIG_NET_TX_STACK_SIZE', '2048');
@@ -271,19 +355,24 @@ export function resolveKconfigFragments(usage, debug) {
271
355
  m.set('CONFIG_FLASH_MAP', 'y');
272
356
  m.set('CONFIG_FILE_SYSTEM', 'y');
273
357
  m.set('CONFIG_FILE_SYSTEM_LITTLEFS', 'y');
358
+ // fs_mkfs (the lazy first-use format in the shim) is gated behind this —
359
+ // without it the mount path links fine but the format call is undefined.
360
+ m.set('CONFIG_FILE_SYSTEM_MKFS', 'y');
274
361
  }
275
362
  // usesUart: the board enables the console UART by default; the overlay (not
276
363
  // Kconfig) is where a UART node would be enabled, so no symbol here.
277
364
  // Random: <zephyr/random/random.h> sys_rand_get is backed by the random
278
- // generator subsystem. CONFIG_RANDOM_GENERATOR is the umbrella that selects a
279
- // working backend for the board (nRF52840 hardware RNG via the entropy
280
- // driver; QEMU/host → the test generator). CONFIG_ENTROPY_GENERATOR is its
281
- // hard dependency on hardware targets. Both default on for most boards, but
282
- // setting them explicitly keeps the symbol set honest and survives a board
283
- // whose defconfig leaves them off.
365
+ // generator subsystem's RNG_GENERATOR_CHOICE. There is no umbrella symbol
366
+ // CONFIG_RANDOM_GENERATOR is a phantom in 4.x (assigning an undefined symbol
367
+ // aborts the build). The choice defaults to the entropy-device generator
368
+ // when the board has a driver (ENTROPY_HAS_DRIVER: nRF52840, ESP32, …);
369
+ // RNG-less SoCs (STM32F411 has no hardware RNG) need
370
+ // CONFIG_TEST_RANDOM_GENERATOR to unlock the timer-clock fallback, which
371
+ // the choice then picks by default. Setting both keys gets the best
372
+ // available source per board.
284
373
  if (usage.usesRandom) {
285
374
  m.set('CONFIG_ENTROPY_GENERATOR', 'y');
286
- m.set('CONFIG_RANDOM_GENERATOR', 'y');
375
+ m.set('CONFIG_TEST_RANDOM_GENERATOR', 'y');
287
376
  }
288
377
  // System workqueue — bumped for worker-offload AND timer callbacks. The
289
378
  // workqueue itself is unconditionally built (no CONFIG_SYSTEM_WORKQUEUE symbol