@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
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
import type { ToolchainOptions, CompileResult, UploadResult } from '@typecad/cuttlefish/api/shared';
|
|
2
|
+
import type { ZephyrChipDescriptor } from '../chips/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Distinct DT-bound sensors the emitted sources reference — the lowering's
|
|
5
|
+
* state blocks name each one `__tc_sensor_<part>_i2c<N>_0x<addr>_dev`
|
|
6
|
+
* (lowering/sensor.ts sensorNames), so var-presence is the authoritative
|
|
7
|
+
* signal. Feeds the overlay's DT child nodes; the part group is greedy so a
|
|
8
|
+
* compatible containing '_i2c<N>_' still resolves to the longest part match.
|
|
9
|
+
*/
|
|
10
|
+
export interface ScannedSensorPart {
|
|
11
|
+
part: string;
|
|
12
|
+
busIndex: number;
|
|
13
|
+
port: number;
|
|
14
|
+
busKind: 'i2c' | 'spi';
|
|
15
|
+
spiHz: number;
|
|
16
|
+
spiMode: number;
|
|
17
|
+
alertPin: number;
|
|
18
|
+
}
|
|
19
|
+
export interface ScannedSpiTarget {
|
|
20
|
+
busIndex: number;
|
|
21
|
+
cs: number;
|
|
22
|
+
hz: number;
|
|
23
|
+
mode: number;
|
|
24
|
+
}
|
|
25
|
+
/** Scan the emitted source for thin SPI targets (hal/spi-target.ts): the
|
|
26
|
+
* spi_dt_spec state block's tc-spit-cfg comment carries the construction
|
|
27
|
+
* facts, the same channel tc-sensor-cfg uses. */
|
|
28
|
+
export declare function scanSpiTargets(src: string): ScannedSpiTarget[];
|
|
29
|
+
export declare function scanSensorParts(src: string): ScannedSensorPart[];
|
|
2
30
|
/**
|
|
3
31
|
* Derive the Zephyr project root from the cuttlefish-emitted source path.
|
|
4
32
|
*
|
|
@@ -26,7 +54,83 @@ export declare function projectRootFromOptions(o: ToolchainOptions): string;
|
|
|
26
54
|
* Exported (pure) so the runner-selection contract is unit-testable without
|
|
27
55
|
* spawning west.
|
|
28
56
|
*/
|
|
29
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Resolve HOW this build attaches to the board for flashing OR debugging:
|
|
59
|
+
* the friendly `zephyr.probe` id from the board's probeMethods table (quirks
|
|
60
|
+
* included), or the raw `zephyr.runner` escape hatch. Exported (pure) so the
|
|
61
|
+
* selection contract is unit-testable without spawning west.
|
|
62
|
+
*
|
|
63
|
+
* Rules:
|
|
64
|
+
* - `probe` + `runner` together is an error (two ways of saying it — pick one).
|
|
65
|
+
* - An unknown `probe` id is an error listing what the board supports; a board
|
|
66
|
+
* with no probeMethods table gets a hint to use `runner` directly.
|
|
67
|
+
* - purpose 'debug': the chosen method must be debug-capable (`debug` is not
|
|
68
|
+
* false — a bootloader is not a debugger). Non-capable or unknown ids list
|
|
69
|
+
* the debug-capable methods.
|
|
70
|
+
* - User `runnerArgs` are appended AFTER the method's args, so they can
|
|
71
|
+
* override the method's baked-in flags (argparse takes the last value).
|
|
72
|
+
*/
|
|
73
|
+
export type ProbeResolution = {
|
|
74
|
+
ok: true;
|
|
75
|
+
runner?: string;
|
|
76
|
+
args: string[];
|
|
77
|
+
} | {
|
|
78
|
+
ok: false;
|
|
79
|
+
error: string;
|
|
80
|
+
};
|
|
81
|
+
export declare function resolveProbeMethod(zc: Record<string, unknown> | undefined, chip: ZephyrChipDescriptor, purpose?: 'flash' | 'debug'): ProbeResolution;
|
|
82
|
+
/**
|
|
83
|
+
* Run an openocd session against the board's probe config — the shared
|
|
84
|
+
* engine for the pre-flash quiesce and the post-flash SYSRESETREQ (see the
|
|
85
|
+
* call sites in upload()). The config is the probe method's verbatim
|
|
86
|
+
* debugCfg from the board catalog (the same lines `west debug` uses);
|
|
87
|
+
* `commands` are appended after `-f <cfg> -c init`. Returns a flash note on
|
|
88
|
+
* success, undefined when skipped or failed (best-effort by design).
|
|
89
|
+
*/
|
|
90
|
+
/**
|
|
91
|
+
* Resolve the openocd binary (plus script search dirs) for the probe session.
|
|
92
|
+
*
|
|
93
|
+
* Resolution order mirrors how west's own openocd runner finds the binary, so
|
|
94
|
+
* the session and `west flash` drive the SAME openocd:
|
|
95
|
+
* 1. $OPENOCD — the variable Zephyr's CMake reads into the build cache.
|
|
96
|
+
* 2. A Zephyr-SDK-hosted install ($ZEPHYR_SDK_INSTALL_DIR, else the
|
|
97
|
+
* discovered west install's SDK). Layout differs by SDK generation —
|
|
98
|
+
* hosttools/openocd/share/openocd/scripts vs hosttools/openocd/scripts —
|
|
99
|
+
* so both script dirs are collected.
|
|
100
|
+
* 3. PATH — Linux distro / conda / micromamba installs (a micromamba-env
|
|
101
|
+
* openocd is the common Linux setup; the SDK layout check alone made the
|
|
102
|
+
* deterministic probe session unreachable there, silently dropping every
|
|
103
|
+
* Linux flash to the racy `west flash` fallback).
|
|
104
|
+
*
|
|
105
|
+
* A non-SDK binary resolves with no explicit -s dirs: it finds its own
|
|
106
|
+
* interface/target scripts via its compiled-in search path. Returns undefined
|
|
107
|
+
* when no openocd can be found (the caller then uses the west fallback).
|
|
108
|
+
*
|
|
109
|
+
* Exported (pure) so the resolution contract is unit-testable without
|
|
110
|
+
* spawning openocd.
|
|
111
|
+
*/
|
|
112
|
+
export interface SessionOpenOcd {
|
|
113
|
+
readonly exe: string;
|
|
114
|
+
readonly searchDirs: readonly string[];
|
|
115
|
+
}
|
|
116
|
+
export declare function resolveSessionOpenOcd(env?: {
|
|
117
|
+
OPENOCD?: string | undefined;
|
|
118
|
+
ZEPHYR_SDK_INSTALL_DIR?: string | undefined;
|
|
119
|
+
PATH?: string | undefined;
|
|
120
|
+
}, sdkInstallDir?: string): SessionOpenOcd | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* Whether a flash runner carries the upload over a serial port. Runner-gated,
|
|
123
|
+
* never board-name-gated: esptool and bossac are the only runners
|
|
124
|
+
* `buildFlashArgs` forwards `--port` to, so they are the only ones that
|
|
125
|
+
* cannot flash without one. Probe runners (openocd, jlink) and USB flows
|
|
126
|
+
* (dfu-util, uf2 mass storage) need no port — a missing `--port` must not
|
|
127
|
+
* block them.
|
|
128
|
+
*
|
|
129
|
+
* Exported (pure) so the port-requirement contract is unit-testable without
|
|
130
|
+
* spawning west.
|
|
131
|
+
*/
|
|
132
|
+
export declare function uploadRequiresPort(runner: string | undefined): boolean;
|
|
133
|
+
export declare function buildFlashArgs(buildDir: string, userRunner: string | undefined, port: string | undefined, flashRunner?: string, runnerArgs?: readonly string[]): string[];
|
|
30
134
|
/**
|
|
31
135
|
* Classify a `west flash` result as success/failure.
|
|
32
136
|
*
|
|
@@ -46,6 +150,16 @@ export declare function buildFlashArgs(buildDir: string, board: string, userRunn
|
|
|
46
150
|
* Exported (pure) so the classification is unit-testable without spawning west.
|
|
47
151
|
*/
|
|
48
152
|
export declare function classifyUploadResult(runner: string | undefined, status: number | null, output: string): boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Whether a `west flash` (openocd) output carries one of the known
|
|
155
|
+
* target-ignored-SWD signatures — the DAP connect failing ("init mode
|
|
156
|
+
* failed (unable to connect to the target)", i.e. the DPIDR read never
|
|
157
|
+
* succeeded) or a reset/halt never landing ("timed out while waiting for
|
|
158
|
+
* target halted" / "TARGET: <name> - Not halted"). Both mean the board (or
|
|
159
|
+
* probe) needs a power-cycle or the SWD-free DFU path, not a retry of the
|
|
160
|
+
* same command. Centralized so the upload hint stays testable.
|
|
161
|
+
*/
|
|
162
|
+
export declare function isTargetSwdFailure(output: string): boolean;
|
|
49
163
|
/**
|
|
50
164
|
* Cleanse the `west flash` output shown to the user.
|
|
51
165
|
*
|