@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
package/src/chips/xiao-ble.ts
CHANGED
|
@@ -1,70 +1,82 @@
|
|
|
1
|
-
// ---------------------------------------------------------------------------
|
|
2
|
-
// Seeed Studio XIAO nRF52840 — Zephyr board descriptor
|
|
3
|
-
//
|
|
4
|
-
// Board target: `xiao_ble` (mainline Zephyr, boards/seeed/xiao_ble).
|
|
5
|
-
// The onboard user LED is active-low and exposed as the DT alias `led0`.
|
|
6
|
-
// ---------------------------------------------------------------------------
|
|
7
|
-
|
|
8
|
-
import type { ZephyrChipDescriptor } from './types.js';
|
|
9
|
-
|
|
10
|
-
export const XIAO_BLE: ZephyrChipDescriptor = {
|
|
11
|
-
id: 'xiao_ble',
|
|
12
|
-
soc: 'nrf52840',
|
|
13
|
-
gpioController: 'gpio0',
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
nodeLabel: '
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Seeed Studio XIAO nRF52840 — Zephyr board descriptor
|
|
3
|
+
//
|
|
4
|
+
// Board target: `xiao_ble` (mainline Zephyr, boards/seeed/xiao_ble).
|
|
5
|
+
// The onboard user LED is active-low and exposed as the DT alias `led0`.
|
|
6
|
+
// ---------------------------------------------------------------------------
|
|
7
|
+
|
|
8
|
+
import type { ZephyrChipDescriptor } from './types.js';
|
|
9
|
+
|
|
10
|
+
export const XIAO_BLE: ZephyrChipDescriptor = {
|
|
11
|
+
id: 'xiao_ble',
|
|
12
|
+
soc: 'nrf52840',
|
|
13
|
+
gpioController: 'gpio0',
|
|
14
|
+
// GPIO is split across two devicetree controllers: gpio0 (P0.00–P0.31)
|
|
15
|
+
// and gpio1 (P1.00–P1.15, HAL pins 32–47). Declaring the split makes the
|
|
16
|
+
// raw path emit the port-relative index against gpio1 (P1.11 = raw 11),
|
|
17
|
+
// which NRF_GPIO_PIN_MAP(1, 11) resolves to absolute pin 43 — the same
|
|
18
|
+
// physical pin the old single-controller form reached only by accident:
|
|
19
|
+
// gpio0 + global 43 also maps to 43 (MAP(0, 43) = 43), but that form
|
|
20
|
+
// trips the generic layer's port_pin_mask __ASSERT ("Unsupported pin",
|
|
21
|
+
// gpio0's mask covers 0–31) on any assert-enabled build.
|
|
22
|
+
gpioControllers: [
|
|
23
|
+
{ nodelabel: 'gpio0', minPin: 0, maxPin: 31 },
|
|
24
|
+
{ nodelabel: 'gpio1', minPin: 32, maxPin: 47 },
|
|
25
|
+
],
|
|
26
|
+
gpio: {
|
|
27
|
+
dtSpecs: [
|
|
28
|
+
// Onboard RGB LEDs — active-low (GPIO_ACTIVE_LOW in xiao_ble_common.dtsi).
|
|
29
|
+
// Verified against the board's `aliases { led0 = &led0; led1 = &led1; led2 = &led2; }`.
|
|
30
|
+
{ pin: 26, dtSpec: 'led0' }, // Red (P0.26)
|
|
31
|
+
{ pin: 30, dtSpec: 'led1' }, // Green (P0.30)
|
|
32
|
+
{ pin: 6, dtSpec: 'led2' }, // Blue (P0.06)
|
|
33
|
+
],
|
|
34
|
+
// The XIAO nRF52840 has a user button on P0.04, but mainline Zephyr's
|
|
35
|
+
// xiao_ble board (verified against Zephyr 4.3.99) does NOT expose it as a
|
|
36
|
+
// DT `sw0` alias — there is no gpio-keys node in xiao_ble.dts. Emitting
|
|
37
|
+
// GPIO_DT_SPEC_GET(DT_ALIAS(sw0), gpios) therefore fails to compile
|
|
38
|
+
// ('DT_N_ALIAS_sw0_... was not declared'). Until a button node + alias is
|
|
39
|
+
// added (via an overlay or an upstream board update), interruptPins stays
|
|
40
|
+
// empty: attachInterrupt on this board lowers to the no-DT-spec comment
|
|
41
|
+
// fallback rather than a hard compile error.
|
|
42
|
+
interruptPins: [],
|
|
43
|
+
},
|
|
44
|
+
// The XIAO connector wiring (from seeed_xiao_connector.dtsi + xiao_ble-pinctrl.dtsi):
|
|
45
|
+
// xiao_i2c → i2c1 (SDA P0.04/D4, SCL P0.05/D5)
|
|
46
|
+
// xiao_spi → spi2 (SCK P1.13/D8, MOSI P1.15/D10, MISO P1.14/D9)
|
|
47
|
+
// xiao_serial → uart0 (TX P1.11/D6, RX P1.12/D7)
|
|
48
|
+
// The board DTS leaves i2c0/spi0/spi1 disabled (shared instances).
|
|
49
|
+
i2c: {
|
|
50
|
+
controllers: [{ nodeLabel: 'i2c1' }],
|
|
51
|
+
},
|
|
52
|
+
spi: {
|
|
53
|
+
controllers: [{ nodeLabel: 'spi2' }],
|
|
54
|
+
},
|
|
55
|
+
uart: {
|
|
56
|
+
controllers: [{ nodeLabel: 'uart0' }],
|
|
57
|
+
},
|
|
58
|
+
pwm: {
|
|
59
|
+
// pwm-led0 drives the board PWM LED (PWM_OUT0 on P0.17, inverted).
|
|
60
|
+
specs: [{ pin: 17, dtSpec: 'pwm-led0' }],
|
|
61
|
+
},
|
|
62
|
+
adc: {
|
|
63
|
+
// SAADC node is `adc`; no pre-declared channels. XIAO D0–D3 = AIN0–AIN3
|
|
64
|
+
// (P0.02/P0.03/P0.28/P0.29). Internal VREF ~0.6V with VDD/4 gain ⇒ 3000mV.
|
|
65
|
+
nodeLabel: 'adc',
|
|
66
|
+
resolution: 12,
|
|
67
|
+
vrefMv: 3000,
|
|
68
|
+
channels: [
|
|
69
|
+
{ pin: 2, channel: 0 }, // P0.02 / D0 / AIN0
|
|
70
|
+
{ pin: 3, channel: 1 }, // P0.03 / D1 / AIN1
|
|
71
|
+
{ pin: 28, channel: 2 }, // P0.28 / D2 / AIN2
|
|
72
|
+
{ pin: 29, channel: 3 }, // P0.29 / D3 / AIN3
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
wdt: { nodeLabel: 'wdt0' },
|
|
76
|
+
// Hardware timer: nRF RTC1 is the free counter (RTC0 is kernel-owned by the
|
|
77
|
+
// softdevice/clock driver). The hwtimer lowering drives it as a Zephyr
|
|
78
|
+
// counter device (counter_start/stop + a top-value alarm for set_frequency).
|
|
79
|
+
// Verified against the nRF52840 SoC dtsi (rtc0/rtc1 nodes). The kernel uses
|
|
80
|
+
// RTC0 for the system tick; RTC1 is available for application use.
|
|
81
|
+
hwtimer: { controllers: [{ nodeLabel: 'rtc1' }] },
|
|
82
|
+
};
|
package/src/dt-config/kconfig.ts
CHANGED
|
@@ -35,6 +35,17 @@ export interface KconfigUsage {
|
|
|
35
35
|
/** PSRAM type ('opi' | 'quad') when the target board has PSRAM. Emits the
|
|
36
36
|
* CONFIG_SPIRAM symbols so the ESP heap serves PSRAM for canvas allocations. */
|
|
37
37
|
psram?: 'opi' | 'quad';
|
|
38
|
+
/** HAL pin numbers the program reads with adc.* — scanned from the emitted
|
|
39
|
+
* `__tc_adc<N>_setup()` calls at compile time. Only the overlay generator
|
|
40
|
+
* consumes this (to rewrite the ADC node's pinctrl-0 to the used channels
|
|
41
|
+
* on SoCs that need pad muxing, e.g. STM32); prj.conf ignores it. */
|
|
42
|
+
adcReadPins?: readonly number[];
|
|
43
|
+
/** HAL pin numbers the program drives with pwm.* — scanned from the
|
|
44
|
+
* emitted `__tc_pwm_*` spec references at compile time. Only the overlay
|
|
45
|
+
* generator consumes this (synthesized pwm-leds consumers + aliases are
|
|
46
|
+
* emitted per used pin, so the DT carries no dead channels); prj.conf
|
|
47
|
+
* ignores it. */
|
|
48
|
+
pwmUsedPins?: readonly number[];
|
|
38
49
|
}
|
|
39
50
|
|
|
40
51
|
/**
|
|
@@ -123,7 +134,7 @@ export function resolveKconfigFragments(
|
|
|
123
134
|
// (without it, Kconfig silently forces them all to n).
|
|
124
135
|
m.set('CONFIG_NETWORKING', 'y');
|
|
125
136
|
m.set('CONFIG_WIFI', 'y');
|
|
126
|
-
m.set('CONFIG_WIFI_ESP32', 'y'); //
|
|
137
|
+
m.set('CONFIG_WIFI_ESP32', 'y'); // family-wide ESP32 driver (esp32/s3/c3/c6)
|
|
127
138
|
m.set('CONFIG_NET_L2_ETHERNET', 'y');
|
|
128
139
|
m.set('CONFIG_NET_IPV4', 'y');
|
|
129
140
|
m.set('CONFIG_NET_UDP', 'y'); // transitive dep of NET_DHCPV4
|