@typecad/framework-zephyr 1.0.0-alpha.15 → 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.
- package/LICENSE +202 -21
- package/README.md +49 -87
- package/dist/as-built.d.ts +2 -2
- package/dist/as-built.js +2 -2
- package/dist/boardgen.d.ts +1 -9
- package/dist/boardgen.js +228 -45
- package/dist/chips/types.d.ts +1 -1
- package/dist/debug-codegen.js +1 -1
- package/dist/display/touch-adapter.js +1 -1
- package/dist/display/ui-adapter.js +549 -549
- package/dist/doctor.js +4 -4
- package/dist/dt-config/custom-board.js +2 -2
- package/dist/dt-config/kconfig.js +18 -12
- package/dist/dt-config/overlay.d.ts +2 -2
- package/dist/dt-config/overlay.js +2 -2
- package/dist/framework.manifest.d.ts +3 -3
- package/dist/framework.manifest.js +10 -7
- package/dist/index.js +5 -5
- package/dist/licenses.d.ts +2 -2
- package/dist/licenses.js +8 -8
- package/dist/lowering/fs.js +1 -1
- package/dist/lowering/gpio.js +0 -32
- package/dist/lowering/http.js +264 -32
- package/dist/lowering/i2c.js +0 -8
- package/dist/lowering/interrupts.js +6 -0
- package/dist/lowering/mqtt.js +110 -8
- package/dist/lowering/usb.js +11 -11
- package/dist/lowering/wdt.js +2 -29
- package/dist/sdk/board-catalog-sync.d.ts +1 -3
- package/dist/sdk/board-catalog-sync.js +4 -10
- package/dist/strategy.d.ts +22 -44
- package/dist/strategy.js +152 -155
- package/dist/tmp-probe.d.ts +2 -0
- package/dist/tmp-probe.js +9 -0
- package/dist/toolchain/debug-config.d.ts +50 -90
- package/dist/toolchain/debug-config.js +241 -502
- package/dist/toolchain/env-check.d.ts +1 -3
- package/dist/toolchain/env-check.js +2 -7
- package/dist/toolchain/index.d.ts +65 -2
- package/dist/toolchain/index.js +432 -55
- package/dist/toolchain/runners.d.ts +16 -0
- package/dist/toolchain/runners.js +75 -0
- package/dist/toolchain/scaffold.d.ts +1 -1
- package/dist/toolchain/scaffold.js +12 -12
- package/dist/toolchain/west-discover.d.ts +6 -0
- package/dist/toolchain/west-discover.js +36 -13
- package/dist/toolchain/west-spawn.js +8 -2
- package/installer/README.md +328 -328
- package/installer/install.sh +2 -2
- package/installer/templates/project/.typecad/activate-zephyr.ps1 +1 -1
- package/installer/templates/project/.typecad/activate-zephyr.sh +1 -1
- package/installer/templates/project/.vscode/settings.json +1 -1
- package/installer/templates/project/README.md +2 -2
- package/package.json +5 -5
- package/src/as-built.ts +206 -206
- package/src/boardgen.ts +214 -48
- package/src/chips/types.ts +567 -567
- package/src/display/touch-adapter.ts +204 -204
- package/src/display/ui-adapter.ts +781 -781
- package/src/doctor.ts +4 -4
- package/src/dt-config/custom-board.ts +2 -2
- package/src/dt-config/kconfig.ts +18 -12
- package/src/dt-config/overlay.ts +1058 -1058
- package/src/framework.manifest.ts +538 -535
- package/src/index.ts +5 -5
- package/src/licenses.ts +425 -425
- package/src/lowering/fs.ts +135 -135
- package/src/lowering/gpio.ts +0 -33
- package/src/lowering/http.ts +264 -32
- package/src/lowering/i2c.ts +0 -9
- package/src/lowering/interrupts.ts +6 -0
- package/src/lowering/mqtt.ts +109 -8
- package/src/lowering/usb.ts +221 -221
- package/src/lowering/wdt.ts +2 -25
- package/src/sdk/board-catalog-sync.ts +4 -25
- package/src/strategy.ts +2265 -2309
- package/src/toolchain/debug-config.ts +264 -514
- package/src/toolchain/env-check.ts +279 -285
- package/src/toolchain/index.ts +1703 -1286
- package/src/toolchain/runners.ts +80 -0
- package/src/toolchain/scaffold.ts +296 -296
- package/src/toolchain/west-discover.ts +35 -13
- package/src/toolchain/west-spawn.ts +174 -168
- package/dist/async/timer-polyfill.d.ts +0 -10
- package/dist/async/timer-polyfill.js +0 -95
- package/dist/chips/board-overrides.d.ts +0 -7
- package/dist/chips/board-overrides.js +0 -11
- package/dist/chips/esp32.d.ts +0 -2
- package/dist/chips/esp32.js +0 -71
- package/dist/chips/esp32s3.d.ts +0 -2
- package/dist/chips/esp32s3.js +0 -103
- package/dist/chips/soc/.d.ts +0 -2
- package/dist/chips/soc/.js +0 -129
- package/dist/chips/soc/esp32.d.ts +0 -2
- package/dist/chips/soc/esp32.js +0 -120
- package/dist/chips/soc/esp32c3.d.ts +0 -2
- package/dist/chips/soc/esp32c3.js +0 -90
- package/dist/chips/soc/esp32c6.d.ts +0 -2
- package/dist/chips/soc/esp32c6.js +0 -109
- package/dist/chips/soc/esp32s3.d.ts +0 -2
- package/dist/chips/soc/esp32s3.js +0 -189
- package/dist/chips/soc/index.d.ts +0 -2
- package/dist/chips/soc/index.js +0 -23
- package/dist/chips/soc/nrf52840.d.ts +0 -2
- package/dist/chips/soc/nrf52840.js +0 -130
- package/dist/chips/soc/rp2040.d.ts +0 -2
- package/dist/chips/soc/rp2040.js +0 -141
- package/dist/chips/soc/rp2350a.d.ts +0 -2
- package/dist/chips/soc/rp2350a.js +0 -145
- package/dist/chips/soc/samd21g18a.d.ts +0 -2
- package/dist/chips/soc/samd21g18a.js +0 -143
- package/dist/chips/soc/stm32f411xe.d.ts +0 -2
- package/dist/chips/soc/stm32f411xe.js +0 -251
- package/dist/chips/xiao-ble.d.ts +0 -2
- package/dist/chips/xiao-ble.js +0 -100
- package/dist/lowering/power.d.ts +0 -9
- package/dist/lowering/power.js +0 -60
- package/dist/lowering/pulse.d.ts +0 -7
- package/dist/lowering/pulse.js +0 -51
- package/dist/lowering/tone.d.ts +0 -10
- package/dist/lowering/tone.js +0 -63
- package/dist/lowering/worker-backing.d.ts +0 -14
- package/dist/lowering/worker-backing.js +0 -79
- package/dist/lowering/worker.d.ts +0 -6
- package/dist/lowering/worker.js +0 -14
- package/dist/sdk/board-data.generated.d.ts +0 -2
- package/dist/sdk/board-data.generated.js +0 -4
- package/dist/sdk/catalog-walker.d.ts +0 -90
- package/dist/sdk/catalog-walker.js +0 -682
- package/dist/sdk/dts-reader.d.ts +0 -83
- package/dist/sdk/dts-reader.js +0 -596
- package/src/debug-codegen.ts +0 -207
|
@@ -40,7 +40,7 @@ export interface ZephyrEnvCheck {
|
|
|
40
40
|
compatRange: string | undefined;
|
|
41
41
|
/** Result of the compat-range check against the detected version. */
|
|
42
42
|
compatStatus: CompatStatus;
|
|
43
|
-
/** Raw board target from
|
|
43
|
+
/** Raw board target from typecad-hal.config.ts, if configured. */
|
|
44
44
|
buildTarget: string | undefined;
|
|
45
45
|
/** buildTarget normalized for the installed Zephyr version (may equal it). */
|
|
46
46
|
resolvedBoardTarget: string | undefined;
|
|
@@ -61,8 +61,6 @@ export type ZephyrEnvFailure = {
|
|
|
61
61
|
fixCommand: string | undefined;
|
|
62
62
|
};
|
|
63
63
|
export type ZephyrEnvResult = ZephyrEnvOk | ZephyrEnvFailure;
|
|
64
|
-
/** Clear the west-probe cache (for tests). Also resets discovery cache. */
|
|
65
|
-
export declare function resetWestProbeCacheForTest(): void;
|
|
66
64
|
/**
|
|
67
65
|
* Gather west facts: discover a usable install, then run `west --version`
|
|
68
66
|
* through it to capture the version. Memoized for the process lifetime (west
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// ---------------------------------------------------------------------------
|
|
2
|
-
// Zephyr environment check — the shared detection behind `
|
|
2
|
+
// Zephyr environment check — the shared detection behind `typecad-hal doctor`.
|
|
3
3
|
//
|
|
4
4
|
// Zephyr environment check: gather the impure
|
|
5
5
|
// environment facts once (west presence + version, Zephyr version, board
|
|
@@ -21,16 +21,11 @@
|
|
|
21
21
|
import { spawnSync } from 'node:child_process';
|
|
22
22
|
import { existsSync, readdirSync } from 'node:fs';
|
|
23
23
|
import { join } from 'node:path';
|
|
24
|
-
import { discoverWest
|
|
24
|
+
import { discoverWest } from './west-discover.js';
|
|
25
25
|
import { westSpawn } from './west-spawn.js';
|
|
26
26
|
import { detectZephyrVersion, checkZephyrCompat, resolveBoardTarget, } from './compat.js';
|
|
27
27
|
// ---- west probe (impure; isolated + cached + overridable) ------------------
|
|
28
28
|
let cachedProbe;
|
|
29
|
-
/** Clear the west-probe cache (for tests). Also resets discovery cache. */
|
|
30
|
-
export function resetWestProbeCacheForTest() {
|
|
31
|
-
cachedProbe = undefined;
|
|
32
|
-
resetWestDiscoveryCache();
|
|
33
|
-
}
|
|
34
29
|
/**
|
|
35
30
|
* Gather west facts: discover a usable install, then run `west --version`
|
|
36
31
|
* through it to capture the version. Memoized for the process lifetime (west
|
|
@@ -28,7 +28,7 @@ export interface ScannedSpiTarget {
|
|
|
28
28
|
export declare function scanSpiTargets(src: string): ScannedSpiTarget[];
|
|
29
29
|
export declare function scanSensorParts(src: string): ScannedSensorPart[];
|
|
30
30
|
/**
|
|
31
|
-
* Derive the Zephyr project root from the
|
|
31
|
+
* Derive the Zephyr project root from the typecad-hal-emitted source path.
|
|
32
32
|
*
|
|
33
33
|
* Cuttlefish emits `src/main.cpp` under the output dir. The CLI passes
|
|
34
34
|
* `sourcePath` = full path to `main.cpp` and `outputDir` = its parent (`src/`).
|
|
@@ -43,7 +43,7 @@ export declare function projectRootFromOptions(o: ToolchainOptions): string;
|
|
|
43
43
|
* runner for its hardware (xiao_ble → nrfutil, esp32* → esptool), and `west
|
|
44
44
|
* flash` resolves it automatically. The framework only intervenes where the
|
|
45
45
|
* board default needs an argument it can't infer:
|
|
46
|
-
* - An explicit `zephyr.runner` (from
|
|
46
|
+
* - An explicit `zephyr.runner` (from typecad-hal.config.ts) always wins.
|
|
47
47
|
* - ESP32 boards forward the port via `--esp-device` (esptool reads the
|
|
48
48
|
* device from it); board.cmake still picks the runner.
|
|
49
49
|
* - Every other board trusts the board.cmake default. Previously this forced
|
|
@@ -78,7 +78,55 @@ export type ProbeResolution = {
|
|
|
78
78
|
ok: false;
|
|
79
79
|
error: string;
|
|
80
80
|
};
|
|
81
|
+
/**
|
|
82
|
+
* The board a cached build dir was configured for (CMakeCache.txt's
|
|
83
|
+
* BOARD:STRING — the exact value passed to `west build -b`), or undefined
|
|
84
|
+
* when no cache exists. compile() compares it against the requested board
|
|
85
|
+
* and nukes the dir on mismatch: `west build`'s --pristine=auto covers
|
|
86
|
+
* cmake/config churn, NOT a board switch — west aborts with "refusing to
|
|
87
|
+
* proceed without --force", and cuttlefish doesn't forward that flag.
|
|
88
|
+
*/
|
|
89
|
+
export declare function cachedBuildBoard(buildDir: string): string | undefined;
|
|
81
90
|
export declare function resolveProbeMethod(zc: Record<string, unknown> | undefined, chip: ZephyrChipDescriptor, purpose?: 'flash' | 'debug'): ProbeResolution;
|
|
91
|
+
/**
|
|
92
|
+
* Run an openocd session against the board's probe config — the shared
|
|
93
|
+
* engine for the pre-flash quiesce and the post-flash SYSRESETREQ (see the
|
|
94
|
+
* call sites in upload()). The config is the probe method's verbatim
|
|
95
|
+
* debugCfg from the board catalog (the same lines `west debug` uses);
|
|
96
|
+
* `commands` are appended after `-f <cfg> -c init`. Returns a flash note on
|
|
97
|
+
* success, undefined when skipped or failed (best-effort by design).
|
|
98
|
+
*/
|
|
99
|
+
/**
|
|
100
|
+
* Resolve the openocd binary (plus script search dirs) for the probe session.
|
|
101
|
+
*
|
|
102
|
+
* Resolution order mirrors how west's own openocd runner finds the binary, so
|
|
103
|
+
* the session and `west flash` drive the SAME openocd:
|
|
104
|
+
* 1. $OPENOCD — the variable Zephyr's CMake reads into the build cache.
|
|
105
|
+
* 2. A Zephyr-SDK-hosted install ($ZEPHYR_SDK_INSTALL_DIR, else the
|
|
106
|
+
* discovered west install's SDK). Layout differs by SDK generation —
|
|
107
|
+
* hosttools/openocd/share/openocd/scripts vs hosttools/openocd/scripts —
|
|
108
|
+
* so both script dirs are collected.
|
|
109
|
+
* 3. PATH — Linux distro / conda / micromamba installs (a micromamba-env
|
|
110
|
+
* openocd is the common Linux setup; the SDK layout check alone made the
|
|
111
|
+
* deterministic probe session unreachable there, silently dropping every
|
|
112
|
+
* Linux flash to the racy `west flash` fallback).
|
|
113
|
+
*
|
|
114
|
+
* A non-SDK binary resolves with no explicit -s dirs: it finds its own
|
|
115
|
+
* interface/target scripts via its compiled-in search path. Returns undefined
|
|
116
|
+
* when no openocd can be found (the caller then uses the west fallback).
|
|
117
|
+
*
|
|
118
|
+
* Exported (pure) so the resolution contract is unit-testable without
|
|
119
|
+
* spawning openocd.
|
|
120
|
+
*/
|
|
121
|
+
export interface SessionOpenOcd {
|
|
122
|
+
readonly exe: string;
|
|
123
|
+
readonly searchDirs: readonly string[];
|
|
124
|
+
}
|
|
125
|
+
export declare function resolveSessionOpenOcd(env?: {
|
|
126
|
+
OPENOCD?: string | undefined;
|
|
127
|
+
ZEPHYR_SDK_INSTALL_DIR?: string | undefined;
|
|
128
|
+
PATH?: string | undefined;
|
|
129
|
+
}, sdkInstallDir?: string): SessionOpenOcd | undefined;
|
|
82
130
|
/**
|
|
83
131
|
* Whether a flash runner carries the upload over a serial port. Runner-gated,
|
|
84
132
|
* never board-name-gated: esptool and bossac are the only runners
|
|
@@ -111,6 +159,16 @@ export declare function buildFlashArgs(buildDir: string, userRunner: string | un
|
|
|
111
159
|
* Exported (pure) so the classification is unit-testable without spawning west.
|
|
112
160
|
*/
|
|
113
161
|
export declare function classifyUploadResult(runner: string | undefined, status: number | null, output: string): boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Whether a `west flash` (openocd) output carries one of the known
|
|
164
|
+
* target-ignored-SWD signatures — the DAP connect failing ("init mode
|
|
165
|
+
* failed (unable to connect to the target)", i.e. the DPIDR read never
|
|
166
|
+
* succeeded) or a reset/halt never landing ("timed out while waiting for
|
|
167
|
+
* target halted" / "TARGET: <name> - Not halted"). Both mean the board (or
|
|
168
|
+
* probe) needs a power-cycle or the SWD-free DFU path, not a retry of the
|
|
169
|
+
* same command. Centralized so the upload hint stays testable.
|
|
170
|
+
*/
|
|
171
|
+
export declare function isTargetSwdFailure(output: string): boolean;
|
|
114
172
|
/**
|
|
115
173
|
* Cleanse the `west flash` output shown to the user.
|
|
116
174
|
*
|
|
@@ -148,4 +206,9 @@ export declare const Toolchain: {
|
|
|
148
206
|
upload(o: ToolchainOptions): UploadResult;
|
|
149
207
|
monitor(o: ToolchainOptions): void;
|
|
150
208
|
debug(o: ToolchainOptions): void;
|
|
209
|
+
debugServer(o: ToolchainOptions, action: "start" | "stop"): void;
|
|
151
210
|
};
|
|
211
|
+
/** How long `--monitor` waits for the port to (re)appear after a flash reset. */
|
|
212
|
+
export declare const MONITOR_PORT_WAIT_MS = 8000;
|
|
213
|
+
/** argv for the pyserial port wait — exported for the toolchain unit tests. */
|
|
214
|
+
export declare function serialPortWaitArgs(port: string, timeoutMs: number): string[];
|