@typecad/framework-zephyr 1.0.0-alpha.13 → 1.0.0-alpha.14
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 +13 -1
- package/dist/chips/controllers.d.ts +28 -8
- package/dist/chips/controllers.js +49 -12
- package/dist/chips/resolve.js +32 -6
- package/dist/chips/types.d.ts +63 -12
- package/dist/chips/xiao-ble.js +12 -0
- package/dist/dt-config/kconfig.d.ts +11 -0
- package/dist/dt-config/kconfig.js +1 -1
- package/dist/dt-config/overlay.js +85 -0
- package/dist/framework.manifest.d.ts +20 -30
- package/dist/framework.manifest.js +12 -3
- package/dist/lowering/adc.d.ts +7 -4
- package/dist/lowering/adc.js +25 -11
- package/dist/lowering/gpio.js +9 -6
- package/dist/lowering/mqtt.js +9 -1
- package/dist/lowering/pulse.js +7 -7
- package/dist/lowering/pwm.d.ts +21 -3
- package/dist/lowering/pwm.js +28 -4
- package/dist/lowering/spi.js +2 -2
- package/dist/lowering/tone.js +3 -2
- package/dist/lowering/wifi.js +28 -5
- package/dist/strategy.js +56 -4
- package/dist/toolchain/debug-config.js +1 -1
- package/dist/toolchain/index.d.ts +1 -1
- package/dist/toolchain/index.js +83 -8
- package/dist/toolchain/scaffold.d.ts +9 -0
- package/dist/toolchain/scaffold.js +45 -0
- package/dist/toolchain/west-discover.d.ts +4 -1
- package/dist/toolchain/west-discover.js +2 -0
- package/dist/toolchain/west-spawn.js +17 -5
- package/package.json +5 -5
- package/src/chips/controllers.ts +61 -12
- package/src/chips/resolve.ts +32 -5
- package/src/chips/types.ts +63 -12
- package/src/chips/xiao-ble.ts +82 -70
- package/src/dt-config/kconfig.ts +12 -1
- package/src/dt-config/overlay.ts +546 -450
- package/src/framework.manifest.ts +12 -3
- package/src/lowering/adc.ts +28 -12
- package/src/lowering/gpio.ts +9 -6
- package/src/lowering/mqtt.ts +9 -1
- package/src/lowering/pulse.ts +7 -7
- package/src/lowering/pwm.ts +29 -4
- package/src/lowering/spi.ts +2 -2
- package/src/lowering/tone.ts +3 -3
- package/src/lowering/wifi.ts +29 -5
- package/src/strategy.ts +52 -4
- package/src/toolchain/debug-config.ts +1 -1
- package/src/toolchain/index.ts +645 -565
- package/src/toolchain/scaffold.ts +43 -0
- package/src/toolchain/west-discover.ts +321 -316
- package/src/toolchain/west-spawn.ts +17 -5
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
// ---------------------------------------------------------------------------
|
|
17
17
|
|
|
18
18
|
import type { SpawnSyncOptions } from 'node:child_process';
|
|
19
|
-
import { dirname } from 'node:path';
|
|
19
|
+
import { dirname, join } from 'node:path';
|
|
20
|
+
import { existsSync } from 'node:fs';
|
|
20
21
|
import { type WestInstall, discoverWest } from './west-discover.js';
|
|
21
22
|
|
|
22
23
|
export interface WestInvocation {
|
|
@@ -57,8 +58,19 @@ export function buildEnv(install: WestInstall): NodeJS.ProcessEnv {
|
|
|
57
58
|
if (install.zephyrBase && !env.ZEPHYR_BASE) {
|
|
58
59
|
env.ZEPHYR_BASE = install.zephyrBase;
|
|
59
60
|
}
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
// SWD flashing (`zephyr.runner: 'openocd'`): west's openocd runner resolves
|
|
62
|
+
// a bare `openocd` from PATH. The Zephyr SDK ships it under
|
|
63
|
+
// hosttools/openocd/bin (the SDK's own setup.cmd puts that dir on PATH for
|
|
64
|
+
// activated terminals) — do the same for spawned west processes so ST-Link
|
|
65
|
+
// flashing works without activation. $ZEPHYR_SDK_INSTALL_DIR (set by an
|
|
66
|
+
// activated env) wins over the discovered install dir.
|
|
67
|
+
const sdkRoot = env.ZEPHYR_SDK_INSTALL_DIR || install.sdkInstallDir;
|
|
68
|
+
const openocdBin = sdkRoot ? join(sdkRoot, 'hosttools', 'openocd', 'bin') : undefined;
|
|
69
|
+
const prepend = [
|
|
70
|
+
openocdBin !== undefined && existsSync(openocdBin) ? openocdBin : undefined,
|
|
71
|
+
venvBinDir(install),
|
|
72
|
+
].filter((d): d is string => d !== undefined);
|
|
73
|
+
if (prepend.length > 0) {
|
|
62
74
|
const sep = process.platform === 'win32' ? ';' : ':';
|
|
63
75
|
// On Windows the PATH environment variable may be cased as `Path` (the
|
|
64
76
|
// registry-native form, the only one populated when node is launched from
|
|
@@ -66,9 +78,9 @@ export function buildEnv(install: WestInstall): NodeJS.ProcessEnv {
|
|
|
66
78
|
// casing can leave the other stale/empty, which under PowerShell would drop
|
|
67
79
|
// the user's real PATH (cmake, ninja, …) — breaking `west` configure. Read
|
|
68
80
|
// whichever casing is populated and write that same casing back, preserving
|
|
69
|
-
// the full existing value with the
|
|
81
|
+
// the full existing value with the discovered dirs prepended.
|
|
70
82
|
const existing = env.Path ?? env.PATH ?? '';
|
|
71
|
-
const updated =
|
|
83
|
+
const updated = prepend.join(sep) + sep + existing;
|
|
72
84
|
if (env.Path !== undefined || (env.PATH === undefined && process.platform === 'win32')) {
|
|
73
85
|
env.Path = updated;
|
|
74
86
|
} else {
|