@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.
- package/README.md +22 -47
- package/dist/as-built.d.ts +33 -0
- package/dist/as-built.js +188 -0
- package/dist/async/timer-polyfill.js +1 -1
- package/dist/boardgen.d.ts +128 -0
- package/dist/boardgen.js +1366 -0
- package/dist/chips/board-overrides.d.ts +7 -0
- package/dist/chips/board-overrides.js +11 -0
- package/dist/chips/esp32s3.js +49 -0
- package/dist/chips/index.d.ts +6 -12
- package/dist/chips/index.js +18 -34
- package/dist/chips/resolve.d.ts +16 -2
- package/dist/chips/resolve.js +267 -10
- package/dist/chips/soc/.d.ts +2 -0
- package/dist/chips/soc/.js +129 -0
- package/dist/chips/soc/esp32.d.ts +2 -0
- package/dist/chips/soc/esp32.js +120 -0
- package/dist/chips/soc/esp32c3.d.ts +2 -0
- package/dist/chips/soc/esp32c3.js +90 -0
- package/dist/chips/soc/esp32c6.d.ts +2 -0
- package/dist/chips/soc/esp32c6.js +109 -0
- package/dist/chips/soc/esp32s3.d.ts +2 -0
- package/dist/chips/soc/esp32s3.js +189 -0
- package/dist/chips/soc/index.d.ts +2 -0
- package/dist/chips/soc/index.js +23 -0
- package/dist/chips/soc/nrf52840.d.ts +2 -0
- package/dist/chips/soc/nrf52840.js +130 -0
- package/dist/chips/soc/rp2040.d.ts +2 -0
- package/dist/chips/soc/rp2040.js +141 -0
- package/dist/chips/soc/rp2350a.d.ts +2 -0
- package/dist/chips/soc/rp2350a.js +145 -0
- package/dist/chips/soc/samd21g18a.d.ts +2 -0
- package/dist/chips/soc/samd21g18a.js +143 -0
- package/dist/chips/soc/stm32f411xe.d.ts +2 -0
- package/dist/chips/soc/stm32f411xe.js +251 -0
- package/dist/chips/types.d.ts +319 -0
- package/dist/chips/xiao-ble.js +21 -0
- package/dist/display/profiles.js +1 -1
- package/dist/doctor.js +38 -4
- package/dist/dt-config/custom-board.d.ts +23 -0
- package/dist/dt-config/custom-board.js +227 -0
- package/dist/dt-config/kconfig.d.ts +72 -1
- package/dist/dt-config/kconfig.js +115 -26
- package/dist/dt-config/overlay.js +548 -28
- package/dist/framework.manifest.d.ts +3 -3
- package/dist/framework.manifest.js +122 -185
- package/dist/index.d.ts +4 -1
- package/dist/index.js +8 -2
- package/dist/lowering/adc.d.ts +20 -2
- package/dist/lowering/adc.js +121 -29
- package/dist/lowering/ble.js +31 -28
- package/dist/lowering/dac.js +9 -9
- package/dist/lowering/fs.js +18 -10
- package/dist/lowering/gpio.d.ts +2 -0
- package/dist/lowering/gpio.js +82 -5
- package/dist/lowering/http.js +39 -14
- package/dist/lowering/hwtimer.d.ts +4 -0
- package/dist/lowering/hwtimer.js +35 -10
- package/dist/lowering/i2c.js +46 -54
- package/dist/lowering/index.d.ts +5 -5
- package/dist/lowering/index.js +15 -16
- package/dist/lowering/interrupts.d.ts +22 -5
- package/dist/lowering/interrupts.js +104 -22
- package/dist/lowering/mqtt.js +3 -5
- package/dist/lowering/power.js +0 -4
- package/dist/lowering/preferences.js +49 -77
- package/dist/lowering/pulse.js +0 -31
- package/dist/lowering/pwm.d.ts +12 -1
- package/dist/lowering/pwm.js +78 -14
- package/dist/lowering/random.js +3 -3
- package/dist/lowering/sensor.d.ts +37 -0
- package/dist/lowering/sensor.js +119 -0
- package/dist/lowering/spi.d.ts +12 -0
- package/dist/lowering/spi.js +65 -40
- package/dist/lowering/thread.d.ts +14 -0
- package/dist/lowering/thread.js +55 -0
- package/dist/lowering/timing.js +20 -46
- package/dist/lowering/tone.js +16 -4
- package/dist/lowering/uart.d.ts +13 -0
- package/dist/lowering/uart.js +72 -51
- package/dist/lowering/usb.d.ts +34 -0
- package/dist/lowering/usb.js +206 -0
- package/dist/lowering/wdt.d.ts +1 -1
- package/dist/lowering/wdt.js +17 -7
- package/dist/lowering/wifi.d.ts +3 -2
- package/dist/lowering/wifi.js +97 -111
- package/dist/sdk/board-catalog-sync.d.ts +16 -0
- package/dist/sdk/board-catalog-sync.js +41 -0
- package/dist/sdk/board-data.generated.d.ts +2 -0
- package/dist/sdk/board-data.generated.js +4 -0
- package/dist/sdk/catalog-walker.d.ts +90 -0
- package/dist/sdk/catalog-walker.js +682 -0
- package/dist/sdk/dts-reader.d.ts +83 -0
- package/dist/sdk/dts-reader.js +596 -0
- package/dist/strategy.d.ts +136 -17
- package/dist/strategy.js +839 -222
- package/dist/toolchain/bossac-touch.d.ts +18 -0
- package/dist/toolchain/bossac-touch.js +88 -0
- package/dist/toolchain/compat.d.ts +2 -2
- package/dist/toolchain/compat.js +8 -3
- package/dist/toolchain/debug-config.d.ts +21 -26
- package/dist/toolchain/debug-config.js +226 -76
- package/dist/toolchain/env-check.d.ts +4 -4
- package/dist/toolchain/env-check.js +5 -5
- package/dist/toolchain/index.d.ts +115 -1
- package/dist/toolchain/index.js +680 -71
- package/dist/toolchain/scaffold.js +39 -7
- package/dist/toolchain/west-discover.d.ts +4 -0
- package/dist/toolchain/west-discover.js +17 -6
- package/installer/CHANGELOG.md +473 -0
- package/installer/README.md +328 -0
- package/installer/environment.yml +46 -0
- package/installer/etc/conda/activate.d/zephyr.bat +7 -0
- package/installer/etc/conda/activate.d/zephyr.ps1 +12 -0
- package/installer/etc/conda/activate.d/zephyr.sh +20 -0
- package/installer/etc/conda/deactivate.d/zephyr.bat +6 -0
- package/installer/etc/conda/deactivate.d/zephyr.ps1 +6 -0
- package/installer/etc/conda/deactivate.d/zephyr.sh +4 -0
- package/installer/install.mjs +580 -0
- package/installer/install.ps1 +619 -0
- package/installer/install.sh +310 -0
- package/installer/lib/detect-platform.sh +62 -0
- package/installer/lib/fetch-sdk.sh +304 -0
- package/installer/lib/init-workspace.sh +153 -0
- package/installer/lib/write-activation.sh +76 -0
- package/installer/patches/tfm-c-include-separators.patch +19 -0
- package/installer/patches/zephyr-tfm-nordic-zephyr-include.patch +24 -0
- package/installer/templates/project/.typecad/activate-zephyr.ps1 +31 -0
- package/installer/templates/project/.typecad/activate-zephyr.sh +31 -0
- package/installer/templates/project/.vscode/settings.json +30 -0
- package/installer/templates/project/README.md +58 -0
- package/installer/versions.env +110 -0
- package/package.json +15 -15
- package/src/as-built.ts +206 -0
- package/src/boardgen.ts +1428 -0
- package/src/chips/index.ts +35 -54
- package/src/chips/resolve.ts +285 -10
- package/src/chips/types.ts +325 -1
- package/src/display/profiles.ts +1 -1
- package/src/doctor.ts +110 -77
- package/src/dt-config/custom-board.ts +325 -0
- package/src/dt-config/kconfig.ts +165 -18
- package/src/dt-config/overlay.ts +537 -25
- package/src/framework.manifest.ts +123 -185
- package/src/index.ts +57 -41
- package/src/lowering/adc.ts +222 -118
- package/src/lowering/ble.ts +32 -28
- package/src/lowering/dac.ts +82 -82
- package/src/lowering/fs.ts +18 -10
- package/src/lowering/gpio.ts +242 -155
- package/src/lowering/http.ts +512 -488
- package/src/lowering/hwtimer.ts +139 -101
- package/src/lowering/i2c.ts +116 -126
- package/src/lowering/index.ts +91 -93
- package/src/lowering/interrupts.ts +113 -21
- package/src/lowering/mqtt.ts +3 -5
- package/src/lowering/preferences.ts +327 -354
- package/src/lowering/pwm.ts +167 -99
- package/src/lowering/random.ts +3 -3
- package/src/lowering/sensor.ts +155 -0
- package/src/lowering/spi.ts +164 -124
- package/src/lowering/thread.ts +63 -0
- package/src/lowering/timing.ts +46 -72
- package/src/lowering/uart.ts +73 -51
- package/src/lowering/usb.ts +221 -0
- package/src/lowering/wdt.ts +95 -84
- package/src/lowering/wifi.ts +97 -112
- package/src/sdk/board-catalog-sync.ts +62 -0
- package/src/strategy.ts +848 -237
- package/src/toolchain/bossac-touch.ts +112 -0
- package/src/toolchain/compat.ts +8 -3
- package/src/toolchain/debug-config.ts +676 -522
- package/src/toolchain/env-check.ts +9 -9
- package/src/toolchain/index.ts +1359 -645
- package/src/toolchain/scaffold.ts +38 -7
- package/src/toolchain/west-discover.ts +19 -6
- package/src/async/timer-polyfill.ts +0 -107
- package/src/chips/esp32.ts +0 -74
- package/src/chips/esp32s3.ts +0 -57
- package/src/chips/xiao-ble.ts +0 -82
- package/src/lowering/power.ts +0 -70
- package/src/lowering/pulse.ts +0 -93
- package/src/lowering/tone.ts +0 -60
- package/src/lowering/worker-backing.ts +0 -94
- package/src/lowering/worker.ts +0 -17
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as catalog from '@typecad/cuttlefish/board-catalog';
|
|
2
|
+
export type BoardCatalogSyncReport = catalog.BoardCatalogSyncReport;
|
|
3
|
+
export type BoardCatalogEnsureResult = catalog.BoardCatalogEnsureResult;
|
|
4
|
+
export type BoardCatalogOverlay = catalog.BoardCatalogOverlay;
|
|
5
|
+
export declare const GENERATOR_REV: number, isZephyrBase: typeof catalog.isZephyrBase, locateZephyrBaseCheap: typeof catalog.locateZephyrBaseCheap, overlayPathFor: typeof catalog.overlayPathFor, readBoardCatalogOverlayFile: typeof catalog.readBoardCatalogOverlayFile, loadBoardCatalogOverlay: typeof catalog.loadBoardCatalogOverlay, resetBoardCatalogOverlayCache: typeof catalog.resetBoardCatalogOverlayCache, isOverlayStale: typeof catalog.isOverlayStale, diffBoardCatalogs: typeof catalog.diffBoardCatalogs, boardRecordFingerprint: typeof catalog.boardRecordFingerprint, findBoardInCatalog: typeof catalog.findBoardInCatalog, activeBoardCatalog: typeof catalog.activeBoardCatalog, resetActiveBoardCatalog: typeof catalog.resetActiveBoardCatalog;
|
|
6
|
+
/** Sync with the full west discovery cascade behind it (the CLI's path):
|
|
7
|
+
* falls back through spawn-based discovery when the cheap fs probes find
|
|
8
|
+
* nothing. */
|
|
9
|
+
export declare function syncBoardCatalog(opts?: {
|
|
10
|
+
zephyrBase?: string;
|
|
11
|
+
}): catalog.BoardCatalogSyncReport;
|
|
12
|
+
/** The build-path pre-step: refresh a stale overlay before a regen
|
|
13
|
+
* (fs-only discovery — no spawns during builds). */
|
|
14
|
+
export declare function ensureFreshBoardCatalog(): catalog.BoardCatalogEnsureResult;
|
|
15
|
+
/** Locate a Zephyr tree by any means (spawn cascade included). */
|
|
16
|
+
export declare function locateZephyrBaseFull(): string | undefined;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// sdk/board-catalog-sync.ts — framework-side catalog orchestration.
|
|
3
|
+
//
|
|
4
|
+
// The catalog tooling (walker, overlay store, fs-only discovery) lives in
|
|
5
|
+
// @typecad/cuttlefish/board-catalog — the create flow needs it before any
|
|
6
|
+
// framework is installed. This module adds the one thing the framework owns
|
|
7
|
+
// — the full spawn-based west discovery cascade for an explicit
|
|
8
|
+
// `cuttlefish board sync` — and re-exports the store for the strategy's
|
|
9
|
+
// import surface.
|
|
10
|
+
// ----------------------------------------------------------------------------
|
|
11
|
+
import path from 'node:path';
|
|
12
|
+
import * as catalog from '@typecad/cuttlefish/board-catalog';
|
|
13
|
+
import { discoverWest } from '../toolchain/west-discover.js';
|
|
14
|
+
export const { GENERATOR_REV, isZephyrBase, locateZephyrBaseCheap, overlayPathFor, readBoardCatalogOverlayFile, loadBoardCatalogOverlay, resetBoardCatalogOverlayCache, isOverlayStale, diffBoardCatalogs, boardRecordFingerprint, findBoardInCatalog, activeBoardCatalog, resetActiveBoardCatalog, } = catalog;
|
|
15
|
+
/** Sync with the full west discovery cascade behind it (the CLI's path):
|
|
16
|
+
* falls back through spawn-based discovery when the cheap fs probes find
|
|
17
|
+
* nothing. */
|
|
18
|
+
export function syncBoardCatalog(opts = {}) {
|
|
19
|
+
if (opts.zephyrBase)
|
|
20
|
+
return catalog.syncBoardCatalog(opts);
|
|
21
|
+
const cheap = catalog.locateZephyrBaseCheap();
|
|
22
|
+
if (cheap)
|
|
23
|
+
return catalog.syncBoardCatalog({ zephyrBase: cheap });
|
|
24
|
+
const install = discoverWest();
|
|
25
|
+
const base = install?.zephyrBase && catalog.isZephyrBase(install.zephyrBase)
|
|
26
|
+
? path.resolve(install.zephyrBase)
|
|
27
|
+
: undefined;
|
|
28
|
+
return catalog.syncBoardCatalog(base ? { zephyrBase: base } : {});
|
|
29
|
+
}
|
|
30
|
+
/** The build-path pre-step: refresh a stale overlay before a regen
|
|
31
|
+
* (fs-only discovery — no spawns during builds). */
|
|
32
|
+
export function ensureFreshBoardCatalog() {
|
|
33
|
+
return catalog.ensureFreshBoardCatalog();
|
|
34
|
+
}
|
|
35
|
+
/** Locate a Zephyr tree by any means (spawn cascade included). */
|
|
36
|
+
export function locateZephyrBaseFull() {
|
|
37
|
+
const install = discoverWest();
|
|
38
|
+
return install?.zephyrBase && catalog.isZephyrBase(install.zephyrBase)
|
|
39
|
+
? path.resolve(install.zephyrBase)
|
|
40
|
+
: undefined;
|
|
41
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { BoardDataEntry } from '@typecad/cuttlefish/api/shared';
|
|
2
|
+
/** Provenance of a walked catalog — pins it to the exact tree it describes. */
|
|
3
|
+
export interface BoardCatalogProvenance {
|
|
4
|
+
/** The Zephyr base directory the walk read (resolved). */
|
|
5
|
+
readonly zephyrBase: string;
|
|
6
|
+
/** VERSION file contents rendered 'MAJOR.MINOR.PATCH' (best-effort). */
|
|
7
|
+
readonly version: string;
|
|
8
|
+
/** Git HEAD of the tree when readable (best-effort; tarballs carry none). */
|
|
9
|
+
readonly gitHead?: string;
|
|
10
|
+
/** Boards-dir mtime (epoch ms) — the fallback change signal for git-less trees. */
|
|
11
|
+
readonly boardsMtimeMs: number;
|
|
12
|
+
/** ISO timestamp of the walk. */
|
|
13
|
+
readonly generatedAt: string;
|
|
14
|
+
/** Variant count, carried for quick display without loading `boards`. */
|
|
15
|
+
readonly variants: number;
|
|
16
|
+
}
|
|
17
|
+
/** A completed walk: records in boards/ directory order + provenance. */
|
|
18
|
+
export interface BoardCatalogWalkResult {
|
|
19
|
+
readonly boards: Readonly<Record<string, BoardDataEntry>>;
|
|
20
|
+
readonly provenance: BoardCatalogProvenance;
|
|
21
|
+
readonly stats: {
|
|
22
|
+
readonly variants: number;
|
|
23
|
+
readonly withFacts: number;
|
|
24
|
+
readonly failures: number;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/** board.yml soc lookup, both formats Zephyr ships:
|
|
28
|
+
* - legacy single-board (`board:` / top-level `socs:`): every soc listed
|
|
29
|
+
* under the socs: block → `uniqueSocs`;
|
|
30
|
+
* - multi-board directories (top-level `boards:` list — lyra_24_dvk,
|
|
31
|
+
* lyra_dvk, …): each entry carries its own socs; single-soc entries map
|
|
32
|
+
* board name → soc in `byName`. Multi-soc entries stay unmapped (their
|
|
33
|
+
* variant yamls carry qualified identifiers).
|
|
34
|
+
* `boardNames` lists every declared board name (the `boards:` entries and
|
|
35
|
+
* the legacy `board:` name) — the CONFIG_BOARD_<X> stem a variant's
|
|
36
|
+
* board.cmake guards its runner args with. */
|
|
37
|
+
export interface BoardYmlSocIndex {
|
|
38
|
+
readonly byName: ReadonlyMap<string, string>;
|
|
39
|
+
readonly uniqueSocs: readonly string[];
|
|
40
|
+
readonly boardNames: readonly string[];
|
|
41
|
+
}
|
|
42
|
+
/** Read board.yml's board→soc index (see BoardYmlSocIndex). */
|
|
43
|
+
export declare function boardYmlSocIndex(dir: string): BoardYmlSocIndex;
|
|
44
|
+
/** How the caller pins runner args to ONE variant of a shared board dir. */
|
|
45
|
+
export interface VariantPin {
|
|
46
|
+
/** CONFIG_BOARD stems to try in order: the board.yml entry name this
|
|
47
|
+
* target belongs to, then the full underscored target name. */
|
|
48
|
+
readonly boardConfigs?: readonly string[];
|
|
49
|
+
/** The target's soc segment ('nrf5340'). */
|
|
50
|
+
readonly soc?: string;
|
|
51
|
+
/** Qualifier segments after the soc ('cpunet', ['a53','smp']). */
|
|
52
|
+
readonly quals?: readonly string[];
|
|
53
|
+
}
|
|
54
|
+
export declare function boardProbeMethods(dir: string, variant?: VariantPin): BoardDataEntry['probeMethods'];
|
|
55
|
+
/** VERSION file → 'MAJOR.MINOR.PATCH' ('' when unreadable). */
|
|
56
|
+
export declare function zephyrVersionOf(zephyrBase: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* Git HEAD of the tree, read straight off the filesystem (no git spawn —
|
|
59
|
+
* sync runs where git may be absent). Handles the plain clone (.git dir,
|
|
60
|
+
* HEAD → ref → loose ref or packed-refs) and the worktree/submodule form
|
|
61
|
+
* (.git file pointing at a gitdir). Best-effort: undefined when unreadable.
|
|
62
|
+
*/
|
|
63
|
+
export declare function gitHeadOf(zephyrBase: string): string | undefined;
|
|
64
|
+
/** Every build target a board.yml declares, with the naming facts the
|
|
65
|
+
* synthesizer needs (board.yml-driven dirs ship NO per-variant yamls —
|
|
66
|
+
* nucleo_n657x0_q's sb target exists only as a board.yml entry). */
|
|
67
|
+
export interface BoardYmlTarget {
|
|
68
|
+
readonly identifier: string;
|
|
69
|
+
/** The board entry name the target belongs to (CONFIG_BOARD stem). */
|
|
70
|
+
readonly boardName: string;
|
|
71
|
+
readonly soc?: string;
|
|
72
|
+
/** Variant chain segments after the soc ('sb', ['a53','smp']). */
|
|
73
|
+
readonly chain: readonly string[];
|
|
74
|
+
readonly fullName?: string;
|
|
75
|
+
readonly vendor?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Parse board.yml into its declared build targets, both shapes:
|
|
79
|
+
* multi-board (`boards:` list) and legacy (`board:` block), with socs and
|
|
80
|
+
* (nested) variants. Variant chains accumulate through nesting levels
|
|
81
|
+
* (board/soc/v1/v2).
|
|
82
|
+
*/
|
|
83
|
+
export declare function boardYmlTargets(dir: string): BoardYmlTarget[];
|
|
84
|
+
/**
|
|
85
|
+
* Walk `<zephyrBase>/boards` and extract one record per board variant.
|
|
86
|
+
* Reader failures degrade to the base record (identifier/name/vendor/dts +
|
|
87
|
+
* probe methods) — a board whose DTS defeats the reader still resolves, it
|
|
88
|
+
* just carries no pin facts.
|
|
89
|
+
*/
|
|
90
|
+
export declare function walkBoardCatalog(zephyrBase: string): BoardCatalogWalkResult;
|