@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
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface BoardOverride {
|
|
2
|
+
/** LED pin name for boards whose user LED is not a gpio-leds node (the
|
|
3
|
+
* ESP32-S3 DevKitC's addressable RGB on GPIO48 — driven as plain GPIO,
|
|
4
|
+
* same as the deleted board package did). */
|
|
5
|
+
readonly led?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const BOARD_OVERRIDES: Readonly<Record<string, BoardOverride>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// board-overrides.ts — curated board-level facts the devicetree cannot
|
|
3
|
+
// express. The honest residue of the board-package deletion: things a board
|
|
4
|
+
// vendor documents in a datasheet but never encodes in DTS.
|
|
5
|
+
//
|
|
6
|
+
// Keyed by the bare board id (the first segment of the qualified target, so
|
|
7
|
+
// every variant/qualifier of the board inherits the override).
|
|
8
|
+
// ----------------------------------------------------------------------------
|
|
9
|
+
export const BOARD_OVERRIDES = {
|
|
10
|
+
esp32s3_devkitc: { led: 'GPIO48' },
|
|
11
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ZephyrChipDescriptor } from './types.js';
|
|
1
|
+
import type { ZephyrChipDescriptor, ZephyrGpioController } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Resolve the devicetree nodelabel of the GPIO controller that owns `pin`.
|
|
4
4
|
*
|
|
@@ -9,13 +9,33 @@ import type { ZephyrChipDescriptor } from './types.js';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function controllerNodelabelForPin(chip: ZephyrChipDescriptor, pin: number): string;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* The owning controller range for a HAL pin, if the chip declares a split.
|
|
13
|
+
*/
|
|
14
|
+
export declare function controllerRangeForPin(chip: ZephyrChipDescriptor, pin: number): ZephyrGpioController | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* The PORT-RELATIVE pin index for the raw gpio_pin_*_raw() API — the Zephyr
|
|
17
|
+
* raw calls address the index WITHIN the controller, not the global HAL pin
|
|
18
|
+
* number. For split SoCs each controller's `minPin` is its base (STM32:
|
|
19
|
+
* gpiob minPin 16, so PB12 = pin 28 → raw 12); single-controller SoCs have
|
|
20
|
+
* no offset. Emitting the global number against a port driver would address
|
|
21
|
+
* a nonexistent port bit (STM32 gpiob is 0–15) and fail at runtime.
|
|
22
|
+
*/
|
|
23
|
+
export declare function controllerRawPinForPin(chip: ZephyrChipDescriptor, pin: number): number;
|
|
24
|
+
/**
|
|
25
|
+
* Emit the C++ source for runtime pin → GPIO-device / port-relative-index
|
|
26
|
+
* dispatchers.
|
|
27
|
+
*
|
|
28
|
+
* Returns lines defining:
|
|
29
|
+
* - `static inline const struct device* __tc_gpio_dev(uint32_t pin)` — the
|
|
30
|
+
* owning controller's device, resolved via DEVICE_DT_GET(DT_NODELABEL(...))
|
|
31
|
+
* at compile time (the macro is evaluated per branch, so it is always
|
|
32
|
+
* statically valid); only `pin` is runtime.
|
|
33
|
+
* - `static inline gpio_pin_t __tc_gpio_pin(uint32_t pin)` — the
|
|
34
|
+
* port-relative index for gpio_pin_*_raw() (see controllerRawPinForPin).
|
|
35
|
+
* The runtime shim paths (UI pin-watch, safety voters) take a runtime pin,
|
|
36
|
+
* so they cannot bake the offset in at emit time.
|
|
13
37
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* compile time (the macro is evaluated per branch, so it is always statically
|
|
17
|
-
* valid); only `pin` is runtime. For a single-controller SoC this collapses to
|
|
18
|
-
* a one-liner returning that controller, so the existing XIAO nRF52840 behavior
|
|
19
|
-
* is byte-for-byte unchanged.
|
|
38
|
+
* For a single-controller SoC both collapse to one-liners, so the existing
|
|
39
|
+
* XIAO nRF52840 behavior is byte-for-byte unchanged.
|
|
20
40
|
*/
|
|
21
41
|
export declare function emitGpioDevDispatcher(chip: ZephyrChipDescriptor): string[];
|
|
@@ -27,23 +27,47 @@
|
|
|
27
27
|
* for out-of-range pins (e.g. the manifest probe's synthetic pin 0).
|
|
28
28
|
*/
|
|
29
29
|
export function controllerNodelabelForPin(chip, pin) {
|
|
30
|
+
const hit = controllerRangeForPin(chip, pin);
|
|
31
|
+
return hit ? hit.nodelabel : chip.gpioController;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The owning controller range for a HAL pin, if the chip declares a split.
|
|
35
|
+
*/
|
|
36
|
+
export function controllerRangeForPin(chip, pin) {
|
|
30
37
|
const ranges = chip.gpioControllers;
|
|
31
38
|
if (ranges && ranges.length > 0) {
|
|
32
|
-
|
|
33
|
-
if (hit)
|
|
34
|
-
return hit.nodelabel;
|
|
39
|
+
return ranges.find((r) => pin >= r.minPin && pin <= r.maxPin);
|
|
35
40
|
}
|
|
36
|
-
return
|
|
41
|
+
return undefined;
|
|
37
42
|
}
|
|
38
43
|
/**
|
|
39
|
-
*
|
|
44
|
+
* The PORT-RELATIVE pin index for the raw gpio_pin_*_raw() API — the Zephyr
|
|
45
|
+
* raw calls address the index WITHIN the controller, not the global HAL pin
|
|
46
|
+
* number. For split SoCs each controller's `minPin` is its base (STM32:
|
|
47
|
+
* gpiob minPin 16, so PB12 = pin 28 → raw 12); single-controller SoCs have
|
|
48
|
+
* no offset. Emitting the global number against a port driver would address
|
|
49
|
+
* a nonexistent port bit (STM32 gpiob is 0–15) and fail at runtime.
|
|
50
|
+
*/
|
|
51
|
+
export function controllerRawPinForPin(chip, pin) {
|
|
52
|
+
const hit = controllerRangeForPin(chip, pin);
|
|
53
|
+
return pin - (hit?.minPin ?? 0);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Emit the C++ source for runtime pin → GPIO-device / port-relative-index
|
|
57
|
+
* dispatchers.
|
|
58
|
+
*
|
|
59
|
+
* Returns lines defining:
|
|
60
|
+
* - `static inline const struct device* __tc_gpio_dev(uint32_t pin)` — the
|
|
61
|
+
* owning controller's device, resolved via DEVICE_DT_GET(DT_NODELABEL(...))
|
|
62
|
+
* at compile time (the macro is evaluated per branch, so it is always
|
|
63
|
+
* statically valid); only `pin` is runtime.
|
|
64
|
+
* - `static inline gpio_pin_t __tc_gpio_pin(uint32_t pin)` — the
|
|
65
|
+
* port-relative index for gpio_pin_*_raw() (see controllerRawPinForPin).
|
|
66
|
+
* The runtime shim paths (UI pin-watch, safety voters) take a runtime pin,
|
|
67
|
+
* so they cannot bake the offset in at emit time.
|
|
40
68
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* compile time (the macro is evaluated per branch, so it is always statically
|
|
44
|
-
* valid); only `pin` is runtime. For a single-controller SoC this collapses to
|
|
45
|
-
* a one-liner returning that controller, so the existing XIAO nRF52840 behavior
|
|
46
|
-
* is byte-for-byte unchanged.
|
|
69
|
+
* For a single-controller SoC both collapse to one-liners, so the existing
|
|
70
|
+
* XIAO nRF52840 behavior is byte-for-byte unchanged.
|
|
47
71
|
*/
|
|
48
72
|
export function emitGpioDevDispatcher(chip) {
|
|
49
73
|
const ranges = chip.gpioControllers;
|
|
@@ -53,14 +77,27 @@ export function emitGpioDevDispatcher(chip) {
|
|
|
53
77
|
` (void)pin;`,
|
|
54
78
|
` return DEVICE_DT_GET(DT_NODELABEL(${chip.gpioController}));`,
|
|
55
79
|
'}',
|
|
80
|
+
'static inline gpio_pin_t __tc_gpio_pin(uint32_t pin) {',
|
|
81
|
+
` return (gpio_pin_t)pin;`,
|
|
82
|
+
'}',
|
|
56
83
|
];
|
|
57
84
|
}
|
|
58
85
|
const lines = [
|
|
59
86
|
'static inline const struct device* __tc_gpio_dev(uint32_t pin) {',
|
|
60
87
|
];
|
|
88
|
+
const pinLines = [
|
|
89
|
+
'static inline gpio_pin_t __tc_gpio_pin(uint32_t pin) {',
|
|
90
|
+
];
|
|
61
91
|
for (const r of ranges) {
|
|
62
92
|
lines.push(` if (pin >= ${r.minPin} && pin <= ${r.maxPin}) { return DEVICE_DT_GET(DT_NODELABEL(${r.nodelabel})); }`);
|
|
93
|
+
if (r.minPin === 0) {
|
|
94
|
+
pinLines.push(` if (pin >= ${r.minPin} && pin <= ${r.maxPin}) { return (gpio_pin_t)pin; }`);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
pinLines.push(` if (pin >= ${r.minPin} && pin <= ${r.maxPin}) { return (gpio_pin_t)(pin - ${r.minPin}); }`);
|
|
98
|
+
}
|
|
63
99
|
}
|
|
64
100
|
lines.push(` return DEVICE_DT_GET(DT_NODELABEL(${chip.gpioController}));`, '}');
|
|
65
|
-
return
|
|
101
|
+
pinLines.push(` return (gpio_pin_t)pin;`, '}');
|
|
102
|
+
return [...lines, ...pinLines];
|
|
66
103
|
}
|
package/dist/chips/esp32s3.js
CHANGED
|
@@ -51,4 +51,53 @@ export const ESP32S3_DEVKITC = {
|
|
|
51
51
|
// WiFi: the ESP32-S3 has a 2.4GHz radio; conn_mgr + the esp32 wifi driver
|
|
52
52
|
// (CONFIG_WIFI_ESP32) provide connectivity. Omitted on radioless targets.
|
|
53
53
|
wifi: { supported: true },
|
|
54
|
+
// User buses, mirroring the devkit's verified facts (the
|
|
55
|
+
// board-constants path is authoritative in real builds; this registry
|
|
56
|
+
// entry is the fallback when board constants are absent — e.g. the
|
|
57
|
+
// transpile test harness). uart1 (not uart0 — the console) with the
|
|
58
|
+
// pinctrl group + current-speed the esp32-uart binding requires; i2c0;
|
|
59
|
+
// spi2/spi3.
|
|
60
|
+
i2c: { controllers: [{ nodeLabel: 'i2c0' }] },
|
|
61
|
+
spi: { controllers: [{ nodeLabel: 'spi2' }, { nodeLabel: 'spi3' }] },
|
|
62
|
+
uart: {
|
|
63
|
+
controllers: [
|
|
64
|
+
{
|
|
65
|
+
nodeLabel: 'uart1',
|
|
66
|
+
pinctrlRef: 'uart1_default',
|
|
67
|
+
props: ['current-speed = <115200>;'],
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
// USB CDC-ACM over the S3's native USB-OTG (D-/D+ on the dedicated GPIO19/20
|
|
72
|
+
// pads, no GPIO matrix). The board DTS already aliases the DWC2 controller
|
|
73
|
+
// node and enables it (`zephyr_udc0: &usb_otg { status = "okay"; }` —
|
|
74
|
+
// esp32s3_devkitc_procpu.dts), and the UDC DWC2 driver is DT-default-on, so
|
|
75
|
+
// declaring it here is all usb.* needs: the overlay composes one CDC-ACM
|
|
76
|
+
// instance child and the kconfig resolver enables the "next" USB stack.
|
|
77
|
+
// Console stays on uart0 (the devkit's USB-serial bridge) unless
|
|
78
|
+
// `console.output: 'usb'` rebinds zephyr,console to the CDC port.
|
|
79
|
+
usb: { controller: 'zephyr_udc0', cdcInstances: 1, vid: '0x2FE3', pid: '0x0006' },
|
|
80
|
+
// PWM: the LEDC controller (ledc0 in esp32s3_common.dtsi) — 8 channels, each
|
|
81
|
+
// routable to nearly any pad through the GPIO matrix, so this is a matrix
|
|
82
|
+
// (channels assigned to the driven pins at build time), not a static spec
|
|
83
|
+
// list. Pin selection excludes: GPIO0 (boot strap / BOOT button), GPIO19/20
|
|
84
|
+
// (USB D-/D+), GPIO26–32 (SPI flash/PSRAM), GPIO33–37 (octal PSRAM on OPI
|
|
85
|
+
// modules), GPIO43/44 (uart0 console pads). The driver
|
|
86
|
+
// (CONFIG_PWM_LED_ESP32, DT-default-on) requires a pinctrl group routing
|
|
87
|
+
// each used channel (LEDC_CH<ch>_GPIO<pin> pinmux tokens, all 8×46 pairs in
|
|
88
|
+
// esp32s3-pinctrl.h) plus per-channel child nodes (reg + timer) — both
|
|
89
|
+
// emitted by the overlay generator (dt-config/overlay.ts emitPwmNodes).
|
|
90
|
+
pwm: {
|
|
91
|
+
specs: [],
|
|
92
|
+
matrix: {
|
|
93
|
+
controller: 'ledc0',
|
|
94
|
+
channelCount: 8,
|
|
95
|
+
pins: [
|
|
96
|
+
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
|
|
97
|
+
21,
|
|
98
|
+
38, 39, 40, 41, 42,
|
|
99
|
+
45, 46, 47, 48,
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
},
|
|
54
103
|
};
|
package/dist/chips/index.d.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import type { ZephyrChipDescriptor } from './types.js';
|
|
2
|
-
import { XIAO_BLE } from './xiao-ble.js';
|
|
3
|
-
import { ESP32S3_DEVKITC } from './esp32s3.js';
|
|
4
|
-
import { ESP32_DEVKITC } from './esp32.js';
|
|
5
|
-
export { XIAO_BLE, ESP32S3_DEVKITC, ESP32_DEVKITC };
|
|
6
|
-
export type { ZephyrChipDescriptor, ZephyrGpioDtSpec } from './types.js';
|
|
7
|
-
export declare function setActiveChip(d: ZephyrChipDescriptor): void;
|
|
8
|
-
export declare function getActiveChip(): ZephyrChipDescriptor;
|
|
9
2
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* path ('esp32s3_devkitc/esp32s3/procpu', 'esp32_devkitc/esp32/procpu').
|
|
3
|
+
* The no-board fallback: no controllers, no buses, no silicon facts. The
|
|
4
|
+
* lowering treats it as "unsupported operation" per subsystem, which is the
|
|
5
|
+
* honest answer when no board resolved.
|
|
14
6
|
*/
|
|
15
|
-
export declare
|
|
7
|
+
export declare const NO_BOARD_CHIP: ZephyrChipDescriptor;
|
|
8
|
+
export declare function setActiveChip(d: ZephyrChipDescriptor): void;
|
|
9
|
+
export declare function getActiveChip(): ZephyrChipDescriptor;
|
package/dist/chips/index.js
CHANGED
|
@@ -1,45 +1,29 @@
|
|
|
1
1
|
// ---------------------------------------------------------------------------
|
|
2
|
-
// Chip descriptor
|
|
2
|
+
// Chip descriptor cache — the mechanism the strategy's lowering reads.
|
|
3
3
|
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
4
|
+
// There is no curated descriptor registry: every board's chip view is
|
|
5
|
+
// reconstructed from its generated board manifest via resolveChipFromBoard
|
|
6
|
+
// (src/chips/resolve.ts). This module only caches that resolved descriptor
|
|
7
|
+
// for the process lifetime (setActiveChip during profile resolution, the
|
|
8
|
+
// lowering reads getActiveChip) and provides the empty fallback for
|
|
9
|
+
// contexts with no board at all.
|
|
8
10
|
// ---------------------------------------------------------------------------
|
|
9
|
-
import { XIAO_BLE } from './xiao-ble.js';
|
|
10
|
-
import { ESP32S3_DEVKITC } from './esp32s3.js';
|
|
11
|
-
import { ESP32_DEVKITC } from './esp32.js';
|
|
12
|
-
export { XIAO_BLE, ESP32S3_DEVKITC, ESP32_DEVKITC };
|
|
13
11
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* The no-board fallback: no controllers, no buses, no silicon facts. The
|
|
13
|
+
* lowering treats it as "unsupported operation" per subsystem, which is the
|
|
14
|
+
* honest answer when no board resolved.
|
|
16
15
|
*/
|
|
17
|
-
const
|
|
18
|
-
|
|
16
|
+
export const NO_BOARD_CHIP = {
|
|
17
|
+
id: 'no-board',
|
|
18
|
+
soc: '',
|
|
19
|
+
gpioController: 'gpio0',
|
|
20
|
+
gpio: { dtSpecs: [] },
|
|
21
|
+
probeMethods: [],
|
|
22
|
+
};
|
|
23
|
+
let activeChip = NO_BOARD_CHIP;
|
|
19
24
|
export function setActiveChip(d) {
|
|
20
25
|
activeChip = d;
|
|
21
26
|
}
|
|
22
27
|
export function getActiveChip() {
|
|
23
28
|
return activeChip;
|
|
24
29
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Resolve a chip descriptor from the Zephyr board target string
|
|
27
|
-
* (frameworkData.buildTarget / frameworkData.target). Accepts the bare board
|
|
28
|
-
* id ('xiao_ble', 'esp32s3_devkitc', 'esp32_devkitc') or a board/qualifier
|
|
29
|
-
* path ('esp32s3_devkitc/esp32s3/procpu', 'esp32_devkitc/esp32/procpu').
|
|
30
|
-
*/
|
|
31
|
-
export function chipForTarget(target) {
|
|
32
|
-
const t = (target ?? '').trim().toLowerCase();
|
|
33
|
-
const boardId = t.split('/')[0];
|
|
34
|
-
switch (boardId) {
|
|
35
|
-
case 'xiao_ble':
|
|
36
|
-
return XIAO_BLE;
|
|
37
|
-
case 'esp32s3_devkitc':
|
|
38
|
-
return ESP32S3_DEVKITC;
|
|
39
|
-
case 'esp32_devkitc':
|
|
40
|
-
return ESP32_DEVKITC;
|
|
41
|
-
case '':
|
|
42
|
-
default:
|
|
43
|
-
return DEFAULT_CHIP;
|
|
44
|
-
}
|
|
45
|
-
}
|
package/dist/chips/resolve.d.ts
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import type { BoardConstants } from '@typecad/cuttlefish/api/shared';
|
|
2
|
-
import type { ZephyrChipDescriptor } from './types.js';
|
|
2
|
+
import type { ZephyrChipDescriptor, ZephyrPwmSpec } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Try to derive a ZephyrChipDescriptor from board/MCU package constants.
|
|
5
5
|
*
|
|
6
6
|
* Returns null when no zephyr info is available in the board constants
|
|
7
|
-
* (the caller should
|
|
7
|
+
* (the caller should treat the board as unresolved — NO_BOARD_CHIP).
|
|
8
8
|
*/
|
|
9
9
|
export declare function resolveChipFromBoard(bc: BoardConstants | undefined): ZephyrChipDescriptor | null;
|
|
10
|
+
/**
|
|
11
|
+
* Board-level PWM specs from the generated board manifest (zephyr.pwm.specs.*
|
|
12
|
+
* — the pwm-leds facts boardgen emits on virtual pins 8192+). The active
|
|
13
|
+
* chip's spec table is silicon-curated; these JOIN it (see mergeBoardPwmSpecs)
|
|
14
|
+
* so a board's own devicetree-aliased PWM LED is addressable without curation.
|
|
15
|
+
*/
|
|
16
|
+
export declare function boardPwmSpecsFromConstants(bc: BoardConstants | undefined): ZephyrPwmSpec[];
|
|
17
|
+
/**
|
|
18
|
+
* Merge board-level PWM specs into a chip descriptor. Collision rule: a
|
|
19
|
+
* board spec whose pin OR dtSpec already exists in the chip's table is
|
|
20
|
+
* dropped (the curated entry wins — e.g. the XIAO's hand-tuned pwm-led0
|
|
21
|
+
* spec). Returns the chip unchanged when nothing joins.
|
|
22
|
+
*/
|
|
23
|
+
export declare function mergeBoardPwmSpecs(chip: ZephyrChipDescriptor, boardSpecs: readonly ZephyrPwmSpec[]): ZephyrChipDescriptor;
|