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

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 (132) hide show
  1. package/LICENSE +202 -21
  2. package/README.md +49 -87
  3. package/dist/as-built.d.ts +2 -2
  4. package/dist/as-built.js +2 -2
  5. package/dist/boardgen.d.ts +1 -9
  6. package/dist/boardgen.js +228 -45
  7. package/dist/chips/types.d.ts +1 -1
  8. package/dist/debug-codegen.js +1 -1
  9. package/dist/display/touch-adapter.js +1 -1
  10. package/dist/display/ui-adapter.js +549 -549
  11. package/dist/doctor.js +4 -4
  12. package/dist/dt-config/custom-board.js +2 -2
  13. package/dist/dt-config/kconfig.js +18 -12
  14. package/dist/dt-config/overlay.d.ts +2 -2
  15. package/dist/dt-config/overlay.js +2 -2
  16. package/dist/framework.manifest.d.ts +3 -3
  17. package/dist/framework.manifest.js +10 -7
  18. package/dist/index.js +5 -5
  19. package/dist/licenses.d.ts +2 -2
  20. package/dist/licenses.js +8 -8
  21. package/dist/lowering/fs.js +1 -1
  22. package/dist/lowering/gpio.js +0 -32
  23. package/dist/lowering/http.js +264 -32
  24. package/dist/lowering/i2c.js +0 -8
  25. package/dist/lowering/interrupts.js +6 -0
  26. package/dist/lowering/mqtt.js +110 -8
  27. package/dist/lowering/usb.js +11 -11
  28. package/dist/lowering/wdt.js +2 -29
  29. package/dist/sdk/board-catalog-sync.d.ts +1 -3
  30. package/dist/sdk/board-catalog-sync.js +4 -10
  31. package/dist/strategy.d.ts +22 -44
  32. package/dist/strategy.js +152 -155
  33. package/dist/tmp-probe.d.ts +2 -0
  34. package/dist/tmp-probe.js +9 -0
  35. package/dist/toolchain/debug-config.d.ts +50 -90
  36. package/dist/toolchain/debug-config.js +239 -510
  37. package/dist/toolchain/env-check.d.ts +1 -3
  38. package/dist/toolchain/env-check.js +2 -7
  39. package/dist/toolchain/index.d.ts +16 -2
  40. package/dist/toolchain/index.js +383 -35
  41. package/dist/toolchain/runners.d.ts +16 -0
  42. package/dist/toolchain/runners.js +75 -0
  43. package/dist/toolchain/scaffold.d.ts +1 -1
  44. package/dist/toolchain/scaffold.js +12 -12
  45. package/dist/toolchain/west-discover.d.ts +6 -0
  46. package/dist/toolchain/west-discover.js +36 -13
  47. package/dist/toolchain/west-spawn.js +8 -2
  48. package/installer/README.md +328 -328
  49. package/installer/install.sh +2 -2
  50. package/installer/templates/project/.typecad/activate-zephyr.ps1 +1 -1
  51. package/installer/templates/project/.typecad/activate-zephyr.sh +1 -1
  52. package/installer/templates/project/.vscode/settings.json +1 -1
  53. package/installer/templates/project/README.md +2 -2
  54. package/package.json +5 -5
  55. package/src/as-built.ts +206 -206
  56. package/src/boardgen.ts +214 -48
  57. package/src/chips/types.ts +567 -567
  58. package/src/display/touch-adapter.ts +204 -204
  59. package/src/display/ui-adapter.ts +781 -781
  60. package/src/doctor.ts +4 -4
  61. package/src/dt-config/custom-board.ts +2 -2
  62. package/src/dt-config/kconfig.ts +18 -12
  63. package/src/dt-config/overlay.ts +1058 -1058
  64. package/src/framework.manifest.ts +538 -535
  65. package/src/index.ts +5 -5
  66. package/src/licenses.ts +425 -425
  67. package/src/lowering/fs.ts +135 -135
  68. package/src/lowering/gpio.ts +0 -33
  69. package/src/lowering/http.ts +264 -32
  70. package/src/lowering/i2c.ts +0 -9
  71. package/src/lowering/interrupts.ts +6 -0
  72. package/src/lowering/mqtt.ts +109 -8
  73. package/src/lowering/usb.ts +221 -221
  74. package/src/lowering/wdt.ts +2 -25
  75. package/src/sdk/board-catalog-sync.ts +4 -25
  76. package/src/strategy.ts +2265 -2309
  77. package/src/toolchain/debug-config.ts +262 -522
  78. package/src/toolchain/env-check.ts +279 -285
  79. package/src/toolchain/index.ts +1703 -1359
  80. package/src/toolchain/runners.ts +80 -0
  81. package/src/toolchain/scaffold.ts +296 -296
  82. package/src/toolchain/west-discover.ts +35 -13
  83. package/src/toolchain/west-spawn.ts +174 -168
  84. package/dist/async/timer-polyfill.d.ts +0 -10
  85. package/dist/async/timer-polyfill.js +0 -95
  86. package/dist/chips/board-overrides.d.ts +0 -7
  87. package/dist/chips/board-overrides.js +0 -11
  88. package/dist/chips/esp32.d.ts +0 -2
  89. package/dist/chips/esp32.js +0 -71
  90. package/dist/chips/esp32s3.d.ts +0 -2
  91. package/dist/chips/esp32s3.js +0 -103
  92. package/dist/chips/soc/.d.ts +0 -2
  93. package/dist/chips/soc/.js +0 -129
  94. package/dist/chips/soc/esp32.d.ts +0 -2
  95. package/dist/chips/soc/esp32.js +0 -120
  96. package/dist/chips/soc/esp32c3.d.ts +0 -2
  97. package/dist/chips/soc/esp32c3.js +0 -90
  98. package/dist/chips/soc/esp32c6.d.ts +0 -2
  99. package/dist/chips/soc/esp32c6.js +0 -109
  100. package/dist/chips/soc/esp32s3.d.ts +0 -2
  101. package/dist/chips/soc/esp32s3.js +0 -189
  102. package/dist/chips/soc/index.d.ts +0 -2
  103. package/dist/chips/soc/index.js +0 -23
  104. package/dist/chips/soc/nrf52840.d.ts +0 -2
  105. package/dist/chips/soc/nrf52840.js +0 -130
  106. package/dist/chips/soc/rp2040.d.ts +0 -2
  107. package/dist/chips/soc/rp2040.js +0 -141
  108. package/dist/chips/soc/rp2350a.d.ts +0 -2
  109. package/dist/chips/soc/rp2350a.js +0 -145
  110. package/dist/chips/soc/samd21g18a.d.ts +0 -2
  111. package/dist/chips/soc/samd21g18a.js +0 -143
  112. package/dist/chips/soc/stm32f411xe.d.ts +0 -2
  113. package/dist/chips/soc/stm32f411xe.js +0 -251
  114. package/dist/chips/xiao-ble.d.ts +0 -2
  115. package/dist/chips/xiao-ble.js +0 -100
  116. package/dist/lowering/power.d.ts +0 -9
  117. package/dist/lowering/power.js +0 -60
  118. package/dist/lowering/pulse.d.ts +0 -7
  119. package/dist/lowering/pulse.js +0 -51
  120. package/dist/lowering/tone.d.ts +0 -10
  121. package/dist/lowering/tone.js +0 -63
  122. package/dist/lowering/worker-backing.d.ts +0 -14
  123. package/dist/lowering/worker-backing.js +0 -79
  124. package/dist/lowering/worker.d.ts +0 -6
  125. package/dist/lowering/worker.js +0 -14
  126. package/dist/sdk/board-data.generated.d.ts +0 -2
  127. package/dist/sdk/board-data.generated.js +0 -4
  128. package/dist/sdk/catalog-walker.d.ts +0 -90
  129. package/dist/sdk/catalog-walker.js +0 -682
  130. package/dist/sdk/dts-reader.d.ts +0 -83
  131. package/dist/sdk/dts-reader.js +0 -596
  132. package/src/debug-codegen.ts +0 -207
package/dist/doctor.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // ---------------------------------------------------------------------------
2
2
  // @typecad/framework-zephyr — Zephyr environment doctor
3
3
  //
4
- // `cuttlefish doctor` (Zephyr framework) — verify west (the Zephyr build tool)
4
+ // `typecad-hal doctor` (Zephyr framework) — verify west (the Zephyr build tool)
5
5
  // is installed + responsive, the Zephyr RTOS is inside the framework's declared
6
6
  // compat range, and the configured board target exists in the checkout. Exits 0
7
7
  // if the environment is OK, non-zero otherwise. Follows the same contract
@@ -11,7 +11,7 @@
11
11
  import { existsSync, readFileSync } from 'node:fs';
12
12
  import { join } from 'node:path';
13
13
  import * as ui from '@typecad/cuttlefish/utils/ui';
14
- import { loadCuttlefishConfig } from '@typecad/cuttlefish/config-loader';
14
+ import { loadTypecadConfig } from '@typecad/cuttlefish/config-loader';
15
15
  import { checkZephyrEnv } from './toolchain/env-check.js';
16
16
  import { PINNED_ZEPHYR_MANIFEST_REV, PINNED_ZEPHYR_SDK_VERSION, sdkFingerprint } from '@typecad/cuttlefish/board-catalog';
17
17
  import { resolveChipFromBoard } from './chips/resolve.js';
@@ -23,7 +23,7 @@ import { resolveChipFromBoard } from './chips/resolve.js';
23
23
  export function runDoctor() {
24
24
  ui.printHeader();
25
25
  ui.printStep('Checking Zephyr environment...');
26
- const config = loadCuttlefishConfig(process.cwd());
26
+ const config = loadTypecadConfig(process.cwd());
27
27
  const buildTarget = config?.buildTarget;
28
28
  const result = checkZephyrEnv(buildTarget);
29
29
  const c = result.check;
@@ -69,7 +69,7 @@ export function runDoctor() {
69
69
  }
70
70
  }
71
71
  else {
72
- ui.printInfo('(no buildTarget in cuttlefish.config.ts — skipping board check)');
72
+ ui.printInfo('(no buildTarget in typecad-hal.config.ts — skipping board check)');
73
73
  }
74
74
  // Probe methods — from the board package's table, via the board constants
75
75
  // the transpile persists (candidates cover the standard out-dir layouts).
@@ -69,7 +69,7 @@ export function generateCustomBoard(projectRoot, chip, rawName) {
69
69
  '# package (or add a board package) instead of this file.',
70
70
  'board:',
71
71
  ` name: ${name}`,
72
- ` full_name: Cuttlefish custom board (${chip.soc})`,
72
+ ` full_name: TypeCAD custom board (${chip.soc})`,
73
73
  ` vendor: ${CUSTOM_BOARD_VENDOR}`,
74
74
  ' socs:',
75
75
  ` - name: ${soc}`,
@@ -95,7 +95,7 @@ export function generateCustomBoard(projectRoot, chip, rawName) {
95
95
  ...cb.dtsIncludes.map((inc) => `#include <${inc}>`),
96
96
  '',
97
97
  '/ {',
98
- ` model = "Cuttlefish custom board (${chip.soc})";`,
98
+ ` model = "TypeCAD custom board (${chip.soc})";`,
99
99
  ` compatible = "${CUSTOM_BOARD_VENDOR},${name.replace(/_/g, '-')}";`,
100
100
  '',
101
101
  ' chosen {',
@@ -246,12 +246,16 @@ export function resolveKconfigFragments(usage, debug) {
246
246
  // pinned-CA handshake fails with EPERM at connect (the insecure path
247
247
  // skips verification, so it works either way).
248
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.
249
+ // KNOWN LIMITATION on this Zephyr tree: pinned-CA (verified TLS) was
250
+ // observed failing at connect with EPERM — the tf-psa-crypto mbedTLS
251
+ // needs a wider symbol matrix (RSA public-key parse + PEM/DER glue)
252
+ // than the single-ciphersuite select pulls in, and forcing the extra
253
+ // symbols regressed the insecure path (two hardware cycles proved it
254
+ // upstream). CAVEAT: that diagnosis predates the 2026-09 fix of the
255
+ // request-fact reset ordering (every option — including caCert — was
256
+ // being wiped before each send, which alone reproduces connect
257
+ // failures); the matrix limitation needs a hardware re-run to confirm
258
+ // it still applies. insecure() HTTPS and no-CA https are unaffected.
255
259
  // Handshake/protocol buffers allocate from the mbedTLS heap; MBEDTLS_HEAP_SIZE
256
260
  // must hold ~2x MBEDTLS_SSL_MAX_CONTENT_LEN plus working state. 65000 fits on
257
261
  // the ESP32; mbedTLS requires the full libc and PEM (not DER) cert format.
@@ -306,12 +310,14 @@ export function resolveKconfigFragments(usage, debug) {
306
310
  // pinned-CA handshake fails with EPERM at connect (the insecure path
307
311
  // skips verification, so it works either way).
308
312
  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.
313
+ // KNOWN LIMITATION on this Zephyr tree: pinned-CA (verified TLS) was
314
+ // observed failing at connect with EPERM — the tf-psa-crypto mbedTLS
315
+ // needs a wider symbol matrix (RSA public-key parse + PEM/DER glue)
316
+ // than the single-ciphersuite select pulls in. CAVEAT: that diagnosis
317
+ // was made on the HTTPS path and predates the 2026-09 request-fact
318
+ // reset-ordering fix (options were wiped before every send, which
319
+ // alone reproduces connect failures); it is shared here because mqtts
320
+ // pins its CA through the same matrix — re-verify on hardware.
315
321
  m.set('CONFIG_MBEDTLS_ENABLE_HEAP', 'y');
316
322
  // 2x SSL_MAX_CONTENT_LEN record buffers + CA-chain parse state +
317
323
  // handshake working memory. 65000 fit insecure-mode handshakes but the
@@ -5,7 +5,7 @@ import type { KconfigUsage } from './kconfig.js';
5
5
  * Generate the overlay source for a board + usage. Returns the overlay text
6
6
  * (caller writes it to app/boards/<board>.overlay via writeIfChanged).
7
7
  */
8
- /** Display wiring from cuttlefish.config.ts (cs/dc/rst/spiFrequency/spiPins). */
8
+ /** Display wiring from typecad-hal.config.ts (cs/dc/rst/spiFrequency/spiPins). */
9
9
  export interface DisplayWiring {
10
10
  cs?: number;
11
11
  dc?: number;
@@ -28,7 +28,7 @@ export interface DisplayWiring {
28
28
  * backlight init is guarded by `DT_HAS_ALIAS` and compiles away. */
29
29
  backlightPin?: number;
30
30
  }
31
- /** Touch wiring from cuttlefish.config.ts (irq/resetPin/sda/scl; cs for SPI
31
+ /** Touch wiring from typecad-hal.config.ts (irq/resetPin/sda/scl; cs for SPI
32
32
  * resistive controllers, calibration for the XPT2046 DT binding). */
33
33
  export interface TouchWiring {
34
34
  /** Touch controller kind — selects the DT node shape (FT6336U node on I2C0
@@ -24,11 +24,11 @@ export function generateOverlay(chip, usage, display, wiring, touch, diagnostics
24
24
  if (touch && touch.controller !== 'xpt2046' && (touch.sda === undefined || touch.scl === undefined)) {
25
25
  diagnostics.push({
26
26
  severity: "warning",
27
- message: `touch: I2C controller '${touch.controller}' has no sda/scl pins in cuttlefish.config.ts — the overlay enables the bus without a pin assignment, so the controller may never answer. Add touch.sda and touch.scl (the board's default I2C pins are rarely the wired ones).`,
27
+ message: `touch: I2C controller '${touch.controller}' has no sda/scl pins in typecad-hal.config.ts — the overlay enables the bus without a pin assignment, so the controller may never answer. Add touch.sda and touch.scl (the board's default I2C pins are rarely the wired ones).`,
28
28
  });
29
29
  }
30
30
  const lines = [
31
- '/* Auto-generated by @typecad/framework-zephyr from cuttlefish.config.ts. */',
31
+ '/* Auto-generated by @typecad/framework-zephyr from typecad-hal.config.ts. */',
32
32
  '/* Enables peripherals the program uses. West merges this over the board DT. */',
33
33
  '',
34
34
  ];
@@ -9,7 +9,7 @@ declare const _default: {
9
9
  entrypoint: {
10
10
  entrypointFunctionName: string;
11
11
  requiresLoopFunction: boolean;
12
- sourceExtension: "cpp" | "h" | "ino" | "cc";
12
+ sourceExtension: "cpp" | "ino" | "cc" | "h";
13
13
  generateHeaderFile: boolean;
14
14
  overrideBaseName?: string | undefined;
15
15
  outputSubdirectory?: string | undefined;
@@ -22,7 +22,7 @@ declare const _default: {
22
22
  };
23
23
  hal: Record<string, {
24
24
  supported: boolean;
25
- ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
25
+ ops: Record<string, "stub" | "polyfill" | "unsupported" | "supported" | "probe-inconclusive">;
26
26
  partialCoverage: boolean;
27
27
  unsupportedReason?: string | undefined;
28
28
  }>;
@@ -50,7 +50,7 @@ declare const _default: {
50
50
  };
51
51
  typeEmission: {
52
52
  normalizeCppType: boolean;
53
- mathHeader: "<cmath>" | "none" | "<math.h>" | "<Arduino.h>";
53
+ mathHeader: "none" | "<cmath>" | "<math.h>" | "<Arduino.h>";
54
54
  needsStdString: boolean;
55
55
  needsStdVector: boolean;
56
56
  needsIostream: boolean;
@@ -359,14 +359,17 @@ export default defineFrameworkManifest({
359
359
  supported: true,
360
360
  partialCoverage: false,
361
361
  // MQTT 3.1.1 client over Zephyr <zephyr/net/mqtt.h> (mqtts:// TLS via
362
- // MQTT_TRANSPORT_SECURE + the shared mbedTLS matrix, encryption only — the
363
- // HAL surface has no CA-pinning op, so peer verify is NONE). The __tc_mqtt
364
- // shim resolves the broker, runs the mqtt_input/mqtt_live poll loop on a
365
- // background k_thread, and dispatches incoming PUBLISHes to the user's
362
+ // MQTT_TRANSPORT_SECURE + the shared mbedTLS matrix). caCert pins the
363
+ // broker's CA (DER-decoded at emit, tls_credential_add sec tag,
364
+ // TLS_PEER_VERIFY_REQUIRED); mqtts:// without a CA stays
365
+ // encrypted-but-unverified (TLS_PEER_VERIFY_NONE). The __tc_mqtt
366
+ // shim resolves the broker, runs the mqtt_input/mqtt_live poll loop on
367
+ // a background k_thread, and dispatches incoming PUBLISHes to the user's
366
368
  // onMessage callback. Requires a networked target (ESP32 WiFi);
367
369
  // profileDiagnostics flags usage on a radioless chip.
368
370
  ops: {
369
- 'mqtt.connect': 'supported', 'mqtt.on_message': 'supported',
371
+ 'mqtt.connect': 'supported', 'mqtt.set_ca_cert': 'supported',
372
+ 'mqtt.on_message': 'supported',
370
373
  'mqtt.subscribe': 'supported', 'mqtt.publish': 'supported',
371
374
  'mqtt.connected': 'supported', 'mqtt.disconnect': 'supported',
372
375
  },
@@ -502,10 +505,10 @@ export default defineFrameworkManifest({
502
505
  compat: {
503
506
  zephyr: '>=4.3 <5.0',
504
507
  },
505
- // `cuttlefish doctor` prints the detected Zephyr version + compat result and
508
+ // `typecad-hal doctor` prints the detected Zephyr version + compat result and
506
509
  // previews how the configured board target resolves for that version.
507
510
  doctor: { available: true },
508
- // `cuttlefish licenses` enumerates the Zephyr kernel + west manifest projects
511
+ // `typecad-hal licenses` enumerates the Zephyr kernel + west manifest projects
509
512
  // and resolves each one's SPDX license (mirrors framework-arduino).
510
513
  licenses: { available: true },
511
514
  });
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // ---------------------------------------------------------------------------
2
2
  // @typecad/framework-zephyr — public exports
3
3
  //
4
- // The cuttlefish loader (framework-package.ts) requires a `FrameworkStrategy`
4
+ // The typecad-hal loader (framework-package.ts) requires a `FrameworkStrategy`
5
5
  // export (the PlatformStrategy class it instantiates) and an optional
6
6
  // `Toolchain`. This package aliases ZephyrStrategy → FrameworkStrategy.
7
7
  // ---------------------------------------------------------------------------
@@ -9,17 +9,17 @@ export { ZephyrStrategy as FrameworkStrategy } from './strategy.js';
9
9
  export { ZephyrStrategy } from './strategy.js';
10
10
  export { Toolchain } from './toolchain/index.js';
11
11
  export { bossacTouchReset } from './toolchain/bossac-touch.js';
12
- // Create-time starter debug artifacts. The `cuttlefish create` flow reads this
12
+ // Create-time starter debug artifacts. The `typecad-hal create` flow reads this
13
13
  // optional named export off the loaded framework module (same loader pattern
14
14
  // as doctor/licenses) and calls it for freshly scaffolded projects, so F5 in
15
15
  // VS Code works before the first build. No-ops for non-GDB targets.
16
16
  export { writeProjectDebugArtifacts } from './toolchain/debug-config.js';
17
- // `cuttlefish doctor` — verify the installed Zephyr is reachable + inside the
17
+ // `typecad-hal doctor` — verify the installed Zephyr is reachable + inside the
18
18
  // declared compat range, and preview board-target normalization. Re-exported
19
19
  // under the dispatcher-facing alias `doctor` so the loader picks it up as
20
20
  // mod.doctor (see framework-package.ts).
21
21
  export { runDoctor as doctor } from './doctor.js';
22
- // `cuttlefish licenses` — enumerate the Zephyr kernel + west manifest projects
22
+ // `typecad-hal licenses` — enumerate the Zephyr kernel + west manifest projects
23
23
  // and resolve each one's SPDX license. Re-exported under the dispatcher-facing
24
24
  // alias `licenses` so the loader picks it up as mod.licenses (see
25
25
  // framework-package.ts). Mirrors framework-arduino's presenter.
@@ -28,6 +28,6 @@ export { runLicensesPresenter as licenses } from './licenses.js';
28
28
  // registry — every board reconstructs from its generated manifest).
29
29
  export { setActiveChip, getActiveChip, NO_BOARD_CHIP, } from './chips/index.js';
30
30
  // Board catalog sync — regenerate the local board overlay from the user's
31
- // own Zephyr tree (`cuttlefish board sync`), so board add/change/remove
31
+ // own Zephyr tree (`typecad-hal board sync`), so board add/change/remove
32
32
  // tracks `west update` instead of cuttlefish releases.
33
33
  export { syncBoardCatalog, ensureFreshBoardCatalog, loadBoardCatalogOverlay, resetBoardCatalogOverlayCache, } from './sdk/board-catalog-sync.js';
@@ -47,13 +47,13 @@ export declare function scanZephyrLicenses(runner: ZephyrLicensesRunner, all?: b
47
47
  /** @internal Test-only override of the default runner. Pass null to simulate west-not-found. */
48
48
  export declare function __setLicensesRunnerForTest(runner: ZephyrLicensesRunner | null | undefined): void;
49
49
  /**
50
- * `cuttlefish licenses` (Zephyr) presenter. Enumerates the Zephyr kernel +
50
+ * `typecad-hal licenses` (Zephyr) presenter. Enumerates the Zephyr kernel +
51
51
  * west manifest projects, resolves each one's license, classifies copyleft
52
52
  * risk, and renders a sorted table. Warns on unknown licenses; sets
53
53
  * process.exitCode under --strict when any strong-copyleft dependency is
54
54
  * present. Never calls process.exit().
55
55
  *
56
56
  * Default scope = only the modules the firmware actually links (from the last
57
- * `cuttlefish build`); `--all` lists every west manifest module.
57
+ * `typecad-hal build`); `--all` lists every west manifest module.
58
58
  */
59
59
  export declare function runLicensesPresenter(strict: boolean, all: boolean): void;
package/dist/licenses.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // ---------------------------------------------------------------------------
2
2
  // @typecad/framework-zephyr — Zephyr license scanner
3
3
  //
4
- // Zephyr-specific enumeration + presenter for the `cuttlefish licenses`
4
+ // Zephyr-specific enumeration + presenter for the `typecad-hal licenses`
5
5
  // subcommand. The framework-agnostic SPDX detection engine lives in the shared
6
6
  // cuttlefish core (`@typecad/cuttlefish/api/shared`); this module owns only the
7
7
  // Zephyr pieces: discovering the west workspace, enumerating the Zephyr kernel
@@ -12,7 +12,7 @@
12
12
  // links, derived from the build's `compile_commands.json` (a module is
13
13
  // listed iff its sources were compiled). A west manifest carries every
14
14
  // vendor HAL/library; almost none are linked by a single project, so the
15
- // default filters them out. Requires a prior `cuttlefish build` — without
15
+ // default filters them out. Requires a prior `typecad-hal build` — without
16
16
  // one, only the kernel is reported with a hint to build first.
17
17
  // - `--all`: every west manifest project (the whole workspace).
18
18
  //
@@ -23,7 +23,7 @@ import { spawnSync } from 'node:child_process';
23
23
  import { readFileSync, readdirSync } from 'node:fs';
24
24
  import * as path from 'node:path';
25
25
  import * as ui from '@typecad/cuttlefish/utils/ui';
26
- import { loadCuttlefishConfig } from '@typecad/cuttlefish/config-loader';
26
+ import { loadTypecadConfig } from '@typecad/cuttlefish/config-loader';
27
27
  import { resolveLibraryLicense, RISK_RANK, riskBracket, statusMark, countByRisk, } from '@typecad/cuttlefish/api/shared';
28
28
  import { discoverWest } from './toolchain/west-discover.js';
29
29
  import { westSpawn } from './toolchain/west-spawn.js';
@@ -271,14 +271,14 @@ export function __setLicensesRunnerForTest(runner) {
271
271
  testRunner = runner;
272
272
  }
273
273
  /**
274
- * `cuttlefish licenses` (Zephyr) presenter. Enumerates the Zephyr kernel +
274
+ * `typecad-hal licenses` (Zephyr) presenter. Enumerates the Zephyr kernel +
275
275
  * west manifest projects, resolves each one's license, classifies copyleft
276
276
  * risk, and renders a sorted table. Warns on unknown licenses; sets
277
277
  * process.exitCode under --strict when any strong-copyleft dependency is
278
278
  * present. Never calls process.exit().
279
279
  *
280
280
  * Default scope = only the modules the firmware actually links (from the last
281
- * `cuttlefish build`); `--all` lists every west manifest module.
281
+ * `typecad-hal build`); `--all` lists every west manifest module.
282
282
  */
283
283
  export function runLicensesPresenter(strict, all) {
284
284
  ui.printHeader();
@@ -289,7 +289,7 @@ export function runLicensesPresenter(strict, all) {
289
289
  // never blocks the license scan.
290
290
  let buildTarget;
291
291
  try {
292
- buildTarget = loadCuttlefishConfig(process.cwd())?.buildTarget;
292
+ buildTarget = loadTypecadConfig(process.cwd())?.buildTarget;
293
293
  }
294
294
  catch {
295
295
  /* best-effort */
@@ -314,8 +314,8 @@ export function runLicensesPresenter(strict, all) {
314
314
  // Project scope with no build: only the kernel is reported. Hint the user to
315
315
  // build (which records which modules actually link) or use --all.
316
316
  if (result.needsBuild) {
317
- ui.printInfo('(no build found — only the Zephyr kernel is shown. Run `cuttlefish build` to scope ' +
318
- 'this report to the modules your firmware actually links, or use `cuttlefish licenses --all` ' +
317
+ ui.printInfo('(no build found — only the Zephyr kernel is shown. Run `typecad-hal build` to scope ' +
318
+ 'this report to the modules your firmware actually links, or use `typecad-hal licenses --all` ' +
319
319
  'for every west module.)');
320
320
  }
321
321
  const counts = countByRisk(result.entries);
@@ -51,7 +51,7 @@ export function fsInitLines() {
51
51
  ' __tc_fs_mounted = true;',
52
52
  ' } else {',
53
53
  ' char __tc_fs_err[48];',
54
- ' (void)snprintf(__tc_fs_err, sizeof(__tc_fs_err), "cuttlefish-fs: mount failed rc=%d", rc);',
54
+ ' (void)snprintf(__tc_fs_err, sizeof(__tc_fs_err), "typecad-hal-fs: mount failed rc=%d", rc);',
55
55
  ' __tc_println(__tc_fs_err);',
56
56
  ' }',
57
57
  '}',
@@ -24,38 +24,6 @@ export function dtSpecVarName(dtSpec) {
24
24
  function findDtSpec(chip, pin) {
25
25
  return chip.gpio.dtSpecs.find((s) => s.pin === pin);
26
26
  }
27
- // HAL passes UPPERCASE modes ("OUTPUT") while docs say lowercase ("output").
28
- // The *_pullup / *_pulldown modes map to GPIO_INPUT (Zephyr does not have
29
- // separate input+pull mode flags) and OR in a GPIO_PULL_UP / GPIO_PULL_DOWN
30
- // bit via `dtFlagsForMode` — without that bit the pin floats, so INPUT_PULLUP
31
- // was a silent no-op (bug B1). Mirrors the gpio_pullup_en/gpio_pulldown_en
32
- // extras framework-esp32 emits for the same modes.
33
- const MODE_MAP = {
34
- output: 'GPIO_OUTPUT',
35
- OUTPUT: 'GPIO_OUTPUT',
36
- input: 'GPIO_INPUT',
37
- INPUT: 'GPIO_INPUT',
38
- input_pullup: 'GPIO_INPUT',
39
- INPUT_PULLUP: 'GPIO_INPUT',
40
- input_pulldown: 'GPIO_INPUT',
41
- INPUT_PULLDOWN: 'GPIO_INPUT',
42
- };
43
- /** Additional DT flag bits for a HAL mode, OR'd into the configure flags.
44
- * Returns '' for modes with no extra bits so the join leaves the mode alone. */
45
- function dtFlagsForMode(mode) {
46
- const m = (mode ?? '').toLowerCase();
47
- if (m === 'input_pullup')
48
- return ' | GPIO_PULL_UP';
49
- if (m === 'input_pulldown')
50
- return ' | GPIO_PULL_DOWN';
51
- return '';
52
- }
53
- /** Combined mode + pull flags for a HAL mode string, e.g.
54
- * 'INPUT_PULLUP' → 'GPIO_INPUT | GPIO_PULL_UP'. */
55
- function flagsForMode(mode) {
56
- const base = MODE_MAP[mode] ?? 'GPIO_INPUT';
57
- return base + dtFlagsForMode(mode);
58
- }
59
27
  // ── Thin GPIO (hal/gpio-pin.ts) — flag tokens ─────────────────────────────
60
28
  //
61
29
  // "GPIO.OUTPUT | GPIO.PULL_UP" token text maps name-for-name onto the GPIO_*