@typecad/framework-zephyr 1.0.0-alpha.13 → 1.0.0-alpha.15
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 -35
- 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/controllers.d.ts +28 -8
- package/dist/chips/controllers.js +49 -12
- 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 +298 -15
- 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 +382 -12
- package/dist/chips/xiao-ble.js +33 -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 +83 -1
- package/dist/dt-config/kconfig.js +116 -27
- package/dist/dt-config/overlay.js +623 -18
- package/dist/framework.manifest.d.ts +20 -30
- package/dist/framework.manifest.js +124 -178
- package/dist/index.d.ts +4 -1
- package/dist/index.js +8 -2
- package/dist/lowering/adc.d.ts +26 -5
- package/dist/lowering/adc.js +137 -31
- 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 +90 -10
- 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 +12 -6
- package/dist/lowering/power.js +0 -4
- package/dist/lowering/preferences.js +49 -77
- package/dist/lowering/pulse.js +5 -36
- package/dist/lowering/pwm.d.ts +32 -3
- package/dist/lowering/pwm.js +105 -17
- 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 +18 -5
- 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 +120 -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 +881 -212
- 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 +212 -72
- package/dist/toolchain/env-check.d.ts +4 -4
- package/dist/toolchain/env-check.js +5 -5
- package/dist/toolchain/index.d.ts +66 -1
- package/dist/toolchain/index.js +713 -58
- package/dist/toolchain/scaffold.d.ts +9 -0
- package/dist/toolchain/scaffold.js +84 -7
- package/dist/toolchain/west-discover.d.ts +8 -1
- package/dist/toolchain/west-discover.js +19 -6
- package/dist/toolchain/west-spawn.js +17 -5
- 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 +16 -16
- package/src/as-built.ts +206 -0
- package/src/boardgen.ts +1428 -0
- package/src/chips/controllers.ts +61 -12
- package/src/chips/index.ts +35 -54
- package/src/chips/resolve.ts +316 -14
- package/src/chips/types.ts +388 -13
- 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 +177 -19
- package/src/dt-config/overlay.ts +1058 -450
- package/src/framework.manifest.ts +125 -178
- package/src/index.ts +57 -41
- package/src/lowering/adc.ts +222 -102
- 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 -152
- 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 +12 -6
- package/src/lowering/preferences.ts +327 -354
- package/src/lowering/pwm.ts +167 -74
- 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 +120 -111
- package/src/sdk/board-catalog-sync.ts +62 -0
- package/src/strategy.ts +888 -229
- package/src/toolchain/bossac-touch.ts +112 -0
- package/src/toolchain/compat.ts +8 -3
- package/src/toolchain/debug-config.ts +666 -522
- package/src/toolchain/env-check.ts +9 -9
- package/src/toolchain/index.ts +765 -44
- package/src/toolchain/scaffold.ts +81 -7
- package/src/toolchain/west-discover.ts +334 -316
- package/src/toolchain/west-spawn.ts +17 -5
- 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 -70
- 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
package/dist/strategy.d.ts
CHANGED
|
@@ -1,4 +1,52 @@
|
|
|
1
1
|
import type { PlatformStrategy, ProgramIR, Diagnostic, PlatformContext, BoardConstants, RuntimePolyfillIR, StdLibSupport, AsyncRuntimeConfig, GraphicsCapacity, HALOpIR, DisplayHALOp, ResolvedDisplay, DisplayAdapterCode, DisplayProfile, TouchProfile, TouchAdapterCodegen } from '@typecad/cuttlefish/api/shared';
|
|
2
|
+
import { type BoardCatalogSyncReport, type BoardCatalogEnsureResult } from './sdk/board-catalog-sync.js';
|
|
3
|
+
/**
|
|
4
|
+
* Collect the distinct DT-bound sensors the program's ops reference, as
|
|
5
|
+
* `${part}|${bus}|${address}` keys (same shape as peripheral-usage's
|
|
6
|
+
* sensorPartsUsed). Feeds the per-sensor device-handle state block — only
|
|
7
|
+
* constructed sensors emit state, and only sensors whose ops were emitted
|
|
8
|
+
* get a DT node.
|
|
9
|
+
*/
|
|
10
|
+
export declare function collectSensors(program: ProgramIR | undefined): Map<string, {
|
|
11
|
+
part: string;
|
|
12
|
+
bus: string;
|
|
13
|
+
port: number | string;
|
|
14
|
+
busKind: string;
|
|
15
|
+
spiHz: number | string;
|
|
16
|
+
spiMode: number | string;
|
|
17
|
+
alertPin: number | string;
|
|
18
|
+
}> | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Collect the distinct thin SPI targets the program's ops reference
|
|
21
|
+
* (spi.transceive / spi.dev_write), keyed `${bus}|${cs}`. Mirrors
|
|
22
|
+
* collectSensors: only constructed targets whose ops were emitted get a
|
|
23
|
+
* spi_dt_spec state block and a DT child node.
|
|
24
|
+
*/
|
|
25
|
+
export declare function collectSpiTargets(program: ProgramIR | undefined): Map<string, {
|
|
26
|
+
bus: string;
|
|
27
|
+
cs: number;
|
|
28
|
+
hz: number;
|
|
29
|
+
mode: number;
|
|
30
|
+
}> | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Collect the distinct UART RX rings the program reads (uart.rx_* ops),
|
|
33
|
+
* keyed by controller index. Mirrors collectSpiTargets: only ports whose RX
|
|
34
|
+
* ops were emitted get a ring + ISR (an unused ISR is -Wunused-function
|
|
35
|
+
* under Zephyr's -Werror).
|
|
36
|
+
*/
|
|
37
|
+
export declare function collectUartRings(program: ProgramIR | undefined): Map<number, {
|
|
38
|
+
index: number;
|
|
39
|
+
ring: number;
|
|
40
|
+
}> | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Collect the distinct threads the program STARTS (thread.start ops), keyed
|
|
43
|
+
* by instance. Only started threads emit state — see shimLines.
|
|
44
|
+
*/
|
|
45
|
+
export declare function collectThreads(program: ProgramIR | undefined): Map<number, {
|
|
46
|
+
instance: number;
|
|
47
|
+
stackBytes: number;
|
|
48
|
+
priority: number;
|
|
49
|
+
}> | undefined;
|
|
2
50
|
export declare class ZephyrStrategy implements PlatformStrategy {
|
|
3
51
|
readonly id = "zephyr";
|
|
4
52
|
/**
|
|
@@ -6,10 +54,39 @@ export declare class ZephyrStrategy implements PlatformStrategy {
|
|
|
6
54
|
* by the methods that need the descriptor (shimLines, resolveHALOperation
|
|
7
55
|
* via lowerHalOp).
|
|
8
56
|
*
|
|
9
|
-
*
|
|
10
|
-
* fields (via boardConstants)
|
|
11
|
-
*
|
|
57
|
+
* The chip descriptor derives from the board/MCU manifest's zephyr
|
|
58
|
+
* fields (via boardConstants). There is no registry fallback — a board
|
|
59
|
+
* that never generated a manifest stays NO_BOARD_CHIP.
|
|
12
60
|
*/
|
|
61
|
+
/**
|
|
62
|
+
* Eagerly resolve + cache the chip for `program`. The emitter calls this
|
|
63
|
+
* before rendering any bodies — hal-op lowering reads the module-global
|
|
64
|
+
* chip cache, and the lazy resolve (inside shimLines) runs later than the
|
|
65
|
+
* first lowered statement.
|
|
66
|
+
*/
|
|
67
|
+
prepareChip(program: ProgramIR | undefined, ctx?: PlatformContext): void;
|
|
68
|
+
/**
|
|
69
|
+
* Contract-board generation: a custom PCB spec (typecad contract) names
|
|
70
|
+
* its wired pads and bus families; the SoC's bus controller labels come
|
|
71
|
+
* from the installed Zephyr tree's soc dtsi. Same builder as every board.
|
|
72
|
+
*/
|
|
73
|
+
generateContractBoardModule(opts: {
|
|
74
|
+
soc: string;
|
|
75
|
+
zephyrBase: string;
|
|
76
|
+
pinNames: readonly string[];
|
|
77
|
+
padAliases?: readonly {
|
|
78
|
+
exportName: string;
|
|
79
|
+
padName: string;
|
|
80
|
+
}[];
|
|
81
|
+
peripherals: {
|
|
82
|
+
i2c: boolean;
|
|
83
|
+
spi: boolean;
|
|
84
|
+
uart: boolean;
|
|
85
|
+
};
|
|
86
|
+
}): {
|
|
87
|
+
boardTs: string;
|
|
88
|
+
boardJson: string;
|
|
89
|
+
};
|
|
13
90
|
private resolveChip;
|
|
14
91
|
/**
|
|
15
92
|
* Resolve the debug mode for the active target from the platform context.
|
|
@@ -55,12 +132,19 @@ export declare class ZephyrStrategy implements PlatformStrategy {
|
|
|
55
132
|
shimLines(program?: ProgramIR, ctx?: PlatformContext): string[];
|
|
56
133
|
profileDiagnostics(program?: ProgramIR, ctx?: PlatformContext): Diagnostic[];
|
|
57
134
|
/**
|
|
58
|
-
*
|
|
59
|
-
* (
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
135
|
+
* Strip Arduino library headers that @typecad/hal's class surfaces register
|
|
136
|
+
* (I2CBus → <Wire.h>, SPIBus → <SPI.h>). The Zephyr
|
|
137
|
+
* equivalents are usage-gated forcedIncludes (<zephyr/drivers/i2c.h>, …),
|
|
138
|
+
* so an unstripped Wire.h reaches the west build and gcc rejects it
|
|
139
|
+
* ("Wire.h: No such file or directory") — this hook is why I2C/SPI class
|
|
140
|
+
* usage on Zephyr used to fail at compile time.
|
|
141
|
+
*/
|
|
142
|
+
filterRequiredIncludes(includes: string[]): string[];
|
|
143
|
+
/**
|
|
144
|
+
* Nothing to exclude: no shim or Zephyr core header forward-declares a user
|
|
145
|
+
* function extern (the old setup()/loop() bridge was the only consumer of
|
|
146
|
+
* this hook, excluding `loop`). The entrypoint itself (`main`) is already
|
|
147
|
+
* excluded from the static forward-declaration path because it equals
|
|
64
148
|
* entrypointFunctionName().
|
|
65
149
|
*/
|
|
66
150
|
forwardDeclarationExclusions(): string[];
|
|
@@ -89,9 +173,6 @@ export declare class ZephyrStrategy implements PlatformStrategy {
|
|
|
89
173
|
renderBoardDefinitionAccess(chain: string[], boardConstants?: BoardConstants): string | undefined;
|
|
90
174
|
promotesArrayLiteralsToStaticArray(): boolean;
|
|
91
175
|
renderThrow(_valueExpr: string): string;
|
|
92
|
-
isConsoleCall(callee: string): boolean;
|
|
93
|
-
transformConsoleCall(method: string, renderedArgs: string, forHeader: boolean): string;
|
|
94
|
-
transformConsoleExpression(_method: string, _renderedArgs: string): string | undefined;
|
|
95
176
|
objectFieldInitializer(): string | undefined;
|
|
96
177
|
overrideClassFieldType(_fieldName: string, normalizedType: string): string;
|
|
97
178
|
reservedNames(): ReadonlySet<string>;
|
|
@@ -110,14 +191,56 @@ export declare class ZephyrStrategy implements PlatformStrategy {
|
|
|
110
191
|
needsStdFunction(): boolean;
|
|
111
192
|
mathHeader(): string;
|
|
112
193
|
cstringHeader(): string;
|
|
113
|
-
needsVectorOverload(): boolean;
|
|
114
194
|
needsLargeEnumUnderlying(): boolean;
|
|
115
195
|
renameStructField(fieldName: string): string;
|
|
116
196
|
structFieldInitializer(): string | undefined;
|
|
117
197
|
getAsyncRuntimeConfig(): AsyncRuntimeConfig;
|
|
198
|
+
/**
|
|
199
|
+
* Board module generation: join the Zephyr board data pack (extracted
|
|
200
|
+
* from the pinned tree) with the curated soc descriptors. See
|
|
201
|
+
* src/boardgen.ts.
|
|
202
|
+
*/
|
|
203
|
+
generateBoardModule(target: string, opts?: {
|
|
204
|
+
factsJson?: string;
|
|
205
|
+
asBuiltJson?: string;
|
|
206
|
+
}): {
|
|
207
|
+
boardTs: string;
|
|
208
|
+
boardJson: string;
|
|
209
|
+
warnings?: readonly string[];
|
|
210
|
+
} | undefined;
|
|
211
|
+
/**
|
|
212
|
+
* Regenerate the board catalog overlay from the user's own Zephyr tree —
|
|
213
|
+
* `cuttlefish board sync`. After a `west update`, this is how new/changed/
|
|
214
|
+
* removed boards reach projects without a cuttlefish release. See
|
|
215
|
+
* src/sdk/board-catalog-sync.ts.
|
|
216
|
+
*/
|
|
217
|
+
syncBoardCatalog(zephyrBase?: string): BoardCatalogSyncReport;
|
|
218
|
+
/**
|
|
219
|
+
* Refresh the overlay only when it is stale (provenance no longer matches
|
|
220
|
+
* the tree) — the pre-step `cuttlefish board regen` runs so a regen after
|
|
221
|
+
* `west update` picks up the tree's boards automatically. Tree walk only
|
|
222
|
+
* happens when there is actual refreshing to do.
|
|
223
|
+
*/
|
|
224
|
+
ensureFreshBoardCatalog(): BoardCatalogEnsureResult;
|
|
118
225
|
asyncLoopInjection(taskVarNames: string[], config: AsyncRuntimeConfig): string[];
|
|
119
226
|
asyncLoopInjection(taskVarNames: string[], hasPromiseRuntime: boolean, hasTimers: boolean): string[];
|
|
120
227
|
asyncDriverFunctionName(): string;
|
|
228
|
+
/**
|
|
229
|
+
* Zephyr's scheduler loop for event-driven programs (UI mounted). The
|
|
230
|
+
* emitter wraps the per-frame work — ui_tick plus the asyncLoopInjection
|
|
231
|
+
* lines — in `while (__tc_zephyr_event_loop) { ...; k_msleep(1); }`: a
|
|
232
|
+
* 1 ms cooperative yield to the kernel each frame, matching the cadence the
|
|
233
|
+
* old setup()/loop() bridge gave loop(). The flag is never cleared — the
|
|
234
|
+
* loop is the program's lifetime — but keeping the bool gives the condition
|
|
235
|
+
* a used symbol (a bare `while (true)` would leave nothing to name, and an
|
|
236
|
+
* unused flag would trip -Werror's -Wunused-variable).
|
|
237
|
+
*/
|
|
238
|
+
hostEventLoop(): {
|
|
239
|
+
flagName: string;
|
|
240
|
+
continueCondition: string;
|
|
241
|
+
preIteration: string;
|
|
242
|
+
postIteration: string;
|
|
243
|
+
} | null;
|
|
121
244
|
shouldSkipTypeAlias(): boolean;
|
|
122
245
|
emitDiagnostics(): Diagnostic[];
|
|
123
246
|
currentTimeMillis(): string;
|
|
@@ -146,11 +269,7 @@ export declare class ZephyrStrategy implements PlatformStrategy {
|
|
|
146
269
|
isHalCall(name: string): boolean;
|
|
147
270
|
analogReadCallNames(): ReadonlySet<string>;
|
|
148
271
|
isRtosTarget(): boolean;
|
|
149
|
-
private _workerBacking;
|
|
150
272
|
private _displayState;
|
|
151
|
-
workerSpawnLines(handleId: number, trampolineName: string, waiterExpr: string): string[] | undefined;
|
|
152
|
-
workerSignalDoneExpr(handleId: number): string | undefined;
|
|
153
|
-
workerIsDoneExpr(handleId: number): string | undefined;
|
|
154
273
|
resolveDisplayOp(op: DisplayHALOp): {
|
|
155
274
|
code?: string;
|
|
156
275
|
expression?: string;
|