@kvell007/embed-labs-cli 0.1.0-alpha.31 → 0.1.0-alpha.33
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 +8 -1
- package/dist/index.js +18 -14
- package/dist/index.js.map +1 -1
- package/dist/local-toolchain.js +201 -41
- package/dist/local-toolchain.js.map +1 -1
- package/package.json +3 -3
package/dist/local-toolchain.js
CHANGED
|
@@ -11,6 +11,7 @@ const DEFAULT_RELEASE_ROOT = "/Volumes/LLVM-TSPI/tspi-rk3566-llvm-release-minima
|
|
|
11
11
|
const DEFAULT_QT_SMOKE_SOURCE = "/Users/kvell/kk-project/DBT-Agent-Project/llvm-build-tspi/qt-smoke";
|
|
12
12
|
const DEFAULT_BOARD_ID = "taishanpi-1m-rk3566";
|
|
13
13
|
const PICO2W_RP2350_BOARD_ID = "pico2w-rp2350-monitor";
|
|
14
|
+
const COLOREASYPICO2_RP2350_BOARD_ID = "coloreasypico2-rp2350-monitor";
|
|
14
15
|
const DEFAULT_CHANNEL = "stable";
|
|
15
16
|
const DEFAULT_DOWNLOAD_BASE_URL = "https://download.embedboard.com";
|
|
16
17
|
const DOWNLOAD_REQUEST_TIMEOUT_MS = 12_000;
|
|
@@ -20,13 +21,15 @@ const BUILT_IN_CHANNEL = {
|
|
|
20
21
|
packages: [
|
|
21
22
|
{ id: "embedlabs.tools.vendor.rockchip", version: "1.0.0", manifest: "" },
|
|
22
23
|
{ id: "embedlabs.tools.common.llvm", version: "22.1.3", manifest: "" },
|
|
24
|
+
{ id: "embedlabs.tools.common.arm-none-eabi", version: "15.2.rel1", manifest: "" },
|
|
23
25
|
{ id: "embedlabs.tools.common.e2fsprogs", version: "1.0.0", manifest: "" },
|
|
24
26
|
{ id: "embedlabs.tools.runtime.qtquick-live-preview", version: "1.0.31", manifest: "" },
|
|
25
27
|
{ id: "embedlabs.tools.runtime.rp2350-monitor", version: "1.0.31", manifest: "" },
|
|
26
28
|
{ id: "embedlabs.family.rk356x", version: "1.0.0", manifest: "" },
|
|
27
29
|
{ id: "embedlabs.family.rp2350", version: "1.0.0", manifest: "" },
|
|
28
30
|
{ id: "embedlabs.board.taishanpi.1m-rk3566", version: "1.0.31", manifest: "" },
|
|
29
|
-
{ id: "embedlabs.board.pico2w.rp2350-monitor", version: "1.0.31", manifest: "" }
|
|
31
|
+
{ id: "embedlabs.board.pico2w.rp2350-monitor", version: "1.0.31", manifest: "" },
|
|
32
|
+
{ id: "embedlabs.board.coloreasypico2.rp2350-monitor", version: "1.0.31", manifest: "" }
|
|
30
33
|
]
|
|
31
34
|
};
|
|
32
35
|
const BUILT_IN_MANIFESTS = {
|
|
@@ -46,6 +49,14 @@ const BUILT_IN_MANIFESTS = {
|
|
|
46
49
|
hosts: ["darwin-arm64", "linux-x86_64"],
|
|
47
50
|
provides: ["llvm.clang", "llvm.clangxx", "llvm.ld_lld", "llvm.ar", "llvm.objcopy", "llvm.readelf"]
|
|
48
51
|
},
|
|
52
|
+
"embedlabs.tools.common.arm-none-eabi": {
|
|
53
|
+
schema: "embedlabs.package.v1",
|
|
54
|
+
id: "embedlabs.tools.common.arm-none-eabi",
|
|
55
|
+
version: "15.2.rel1",
|
|
56
|
+
kind: "tools",
|
|
57
|
+
hosts: ["darwin-arm64"],
|
|
58
|
+
provides: ["arm-none-eabi.gcc", "arm-none-eabi.g++", "arm-none-eabi.objcopy", "picotool"]
|
|
59
|
+
},
|
|
49
60
|
"embedlabs.tools.common.e2fsprogs": {
|
|
50
61
|
schema: "embedlabs.package.v1",
|
|
51
62
|
id: "embedlabs.tools.common.e2fsprogs",
|
|
@@ -89,7 +100,8 @@ const BUILT_IN_MANIFESTS = {
|
|
|
89
100
|
kind: "family",
|
|
90
101
|
family: "rp2350",
|
|
91
102
|
requires: [
|
|
92
|
-
{ id: "embedlabs.tools.
|
|
103
|
+
{ id: "embedlabs.tools.common.arm-none-eabi", version: "15.x", roles: ["compile", "uf2"] },
|
|
104
|
+
{ id: "embedlabs.tools.runtime.rp2350-monitor", version: "^1.0.31", roles: ["hardware-control", "logic-analyzer", "debug-probe"] }
|
|
93
105
|
]
|
|
94
106
|
},
|
|
95
107
|
"embedlabs.board.taishanpi.1m-rk3566": {
|
|
@@ -105,8 +117,7 @@ const BUILT_IN_MANIFESTS = {
|
|
|
105
117
|
{ id: "embedlabs.tools.vendor.rockchip", version: "^1.0.0", roles: ["flash", "resource-image"] },
|
|
106
118
|
{ id: "embedlabs.tools.common.llvm", version: "22.x", roles: ["compile"] },
|
|
107
119
|
{ id: "embedlabs.tools.common.e2fsprogs", version: "^1.0.0", roles: ["userdata-image"] },
|
|
108
|
-
{ id: "embedlabs.tools.runtime.qtquick-live-preview", version: "^1.0.31", roles: ["qtquick-preview"] }
|
|
109
|
-
{ id: "embedlabs.tools.runtime.rp2350-monitor", version: "^1.0.31", roles: ["rp2350-monitor"] }
|
|
120
|
+
{ id: "embedlabs.tools.runtime.qtquick-live-preview", version: "^1.0.31", roles: ["qtquick-preview"] }
|
|
110
121
|
],
|
|
111
122
|
build_modes: ["local-llvm"]
|
|
112
123
|
},
|
|
@@ -115,16 +126,32 @@ const BUILT_IN_MANIFESTS = {
|
|
|
115
126
|
id: "embedlabs.board.pico2w.rp2350-monitor",
|
|
116
127
|
version: "1.0.31",
|
|
117
128
|
kind: "board",
|
|
118
|
-
display_name: "Pico 2 W
|
|
129
|
+
display_name: "Pico 2 W",
|
|
119
130
|
family: "rp2350",
|
|
120
131
|
board: "Pico 2 W",
|
|
121
|
-
variant: "RP2350 Monitor",
|
|
122
132
|
board_id: PICO2W_RP2350_BOARD_ID,
|
|
123
133
|
requires: [
|
|
124
134
|
{ id: "embedlabs.family.rp2350", version: "^1.0.0" },
|
|
135
|
+
{ id: "embedlabs.tools.common.arm-none-eabi", version: "15.x", roles: ["compile", "uf2", "picotool"] },
|
|
125
136
|
{ id: "embedlabs.tools.runtime.rp2350-monitor", version: "^1.0.31", roles: ["hardware-control", "logic-analyzer", "debug-probe"] }
|
|
126
137
|
],
|
|
127
|
-
build_modes: ["local-monitor"]
|
|
138
|
+
build_modes: ["local-pico-sdk", "optional-rp2350-monitor"]
|
|
139
|
+
},
|
|
140
|
+
"embedlabs.board.coloreasypico2.rp2350-monitor": {
|
|
141
|
+
schema: "embedlabs.package.v1",
|
|
142
|
+
id: "embedlabs.board.coloreasypico2.rp2350-monitor",
|
|
143
|
+
version: "1.0.31",
|
|
144
|
+
kind: "board",
|
|
145
|
+
display_name: "ColorEasyPICO2",
|
|
146
|
+
family: "rp2350",
|
|
147
|
+
board: "ColorEasyPICO2",
|
|
148
|
+
board_id: COLOREASYPICO2_RP2350_BOARD_ID,
|
|
149
|
+
requires: [
|
|
150
|
+
{ id: "embedlabs.family.rp2350", version: "^1.0.0" },
|
|
151
|
+
{ id: "embedlabs.tools.common.arm-none-eabi", version: "15.x", roles: ["compile", "uf2", "picotool"] },
|
|
152
|
+
{ id: "embedlabs.tools.runtime.rp2350-monitor", version: "^1.0.31", roles: ["hardware-control", "logic-analyzer", "debug-probe"] }
|
|
153
|
+
],
|
|
154
|
+
build_modes: ["local-pico-sdk", "optional-rp2350-monitor"]
|
|
128
155
|
}
|
|
129
156
|
};
|
|
130
157
|
const INSTALL_COPY_PATHS = [
|
|
@@ -137,7 +164,9 @@ const INSTALL_COPY_PATHS = [
|
|
|
137
164
|
"tools/mac",
|
|
138
165
|
"toolkit-runtime/qtquick-live-preview",
|
|
139
166
|
"toolkit-runtime/rp2350-monitor",
|
|
140
|
-
"
|
|
167
|
+
"rp2350-sdk",
|
|
168
|
+
"rp2350-initial-firmware",
|
|
169
|
+
"rp2350-examples",
|
|
141
170
|
"images/current",
|
|
142
171
|
"userdata/rootfs",
|
|
143
172
|
"boot-workspace",
|
|
@@ -377,7 +406,7 @@ export async function listLocalToolchainEnvironments(options = {}) {
|
|
|
377
406
|
components: download?.components?.map(localToolchainEnvironmentComponent),
|
|
378
407
|
install_command: `embedlabs local toolchain install --board ${boardId} --mode ${mode}`,
|
|
379
408
|
update_command: `embedlabs local toolchain install --board ${boardId} --mode ${mode} --force`,
|
|
380
|
-
notes: environmentNotes({ status, downloadError, unsupportedPackages: hostSupport.unsupportedPackages })
|
|
409
|
+
notes: environmentNotes({ boardId, status, downloadError, unsupportedPackages: hostSupport.unsupportedPackages })
|
|
381
410
|
});
|
|
382
411
|
}
|
|
383
412
|
const filteredEnvironments = options.installedOnly
|
|
@@ -435,8 +464,8 @@ export async function installLocalToolchain(options = {}) {
|
|
|
435
464
|
}
|
|
436
465
|
await mkdir(releaseRoot, { recursive: true });
|
|
437
466
|
const installedPaths = [];
|
|
438
|
-
for (const relativePath of
|
|
439
|
-
const sourcePath =
|
|
467
|
+
for (const relativePath of installCopyPathsForBoard(latest.board_id)) {
|
|
468
|
+
const sourcePath = await resolveInstallSourcePathForBoard(sourceRoot.path, relativePath, latest.board_id);
|
|
440
469
|
if (!await pathExists(sourcePath)) {
|
|
441
470
|
continue;
|
|
442
471
|
}
|
|
@@ -478,7 +507,7 @@ export async function validateLocalToolchain(input) {
|
|
|
478
507
|
const releaseRoot = typeof input === "string" ? input : input?.releaseRoot;
|
|
479
508
|
const mode = normalizeLocalToolchainInstallMode(typeof input === "string" ? undefined : input?.mode);
|
|
480
509
|
const boardId = normalizeBoardId(typeof input === "string" ? DEFAULT_BOARD_ID : input?.boardId ?? DEFAULT_BOARD_ID);
|
|
481
|
-
const resolvedRoot = await resolveLocalReleaseRoot(releaseRoot);
|
|
510
|
+
const resolvedRoot = await resolveLocalReleaseRoot(releaseRoot, boardId);
|
|
482
511
|
const required = requiredLocalToolchainChecks(mode, boardId);
|
|
483
512
|
const checked_paths = [];
|
|
484
513
|
for (const [label, relativePath] of required) {
|
|
@@ -518,7 +547,7 @@ function normalizeLocalToolchainInstallMode(mode) {
|
|
|
518
547
|
throw new Error(`Unsupported local toolchain install mode ${normalized}; expected ${LOCAL_TOOLCHAIN_INSTALL_MODES.join(", ")}.`);
|
|
519
548
|
}
|
|
520
549
|
function requiredLocalToolchainChecks(mode, boardId) {
|
|
521
|
-
if (boardId
|
|
550
|
+
if (isRp2350MonitorBoardId(boardId)) {
|
|
522
551
|
return requiredRp2350MonitorChecks(mode);
|
|
523
552
|
}
|
|
524
553
|
const base = [
|
|
@@ -530,8 +559,6 @@ function requiredLocalToolchainChecks(mode, boardId) {
|
|
|
530
559
|
["boot resource image", "boot-workspace/out/resource.img"],
|
|
531
560
|
["boot image", "boot-workspace/out/boot.img"],
|
|
532
561
|
["boot DTB", "boot-workspace/out/tspi-rk3566-user-v10-linux.dtb"],
|
|
533
|
-
["RP2350 Monitor CLI", "toolkit-runtime/rp2350-monitor/tools/rpmon_cli.py"],
|
|
534
|
-
["RP2350 Monitor logic analyzer", "toolkit-runtime/rp2350-monitor/ui/bin/embed-labs-logic-analyzer"],
|
|
535
562
|
["package metadata", "meta"]
|
|
536
563
|
];
|
|
537
564
|
const compile = [
|
|
@@ -572,23 +599,43 @@ function requiredLocalToolchainChecks(mode, boardId) {
|
|
|
572
599
|
return [...base, ...compile, ...qt, ...images, ...full];
|
|
573
600
|
}
|
|
574
601
|
function requiredRp2350MonitorChecks(mode) {
|
|
575
|
-
const
|
|
602
|
+
const base = [
|
|
576
603
|
["release root", "."],
|
|
604
|
+
];
|
|
605
|
+
const runtime = [
|
|
577
606
|
["RP2350 Monitor UI", "toolkit-runtime/rp2350-monitor/ui/index.html"],
|
|
578
607
|
["RP2350 Monitor bridge", "toolkit-runtime/rp2350-monitor/ui/bridge/rpmon_bridge.py"],
|
|
579
608
|
["RP2350 Monitor CLI", "toolkit-runtime/rp2350-monitor/tools/rpmon_cli.py"],
|
|
609
|
+
["RP2350 picotool", "toolkit-runtime/rp2350-monitor/tools/picotool"],
|
|
580
610
|
["RP2350 Monitor logic analyzer", "toolkit-runtime/rp2350-monitor/ui/bin/embed-labs-logic-analyzer"],
|
|
581
611
|
["RP2350 Monitor AI operation contract", "toolkit-runtime/rp2350-monitor/ui/docs/ai-operation-contract.md"],
|
|
582
612
|
["package metadata", "meta"]
|
|
583
613
|
];
|
|
584
614
|
const firmware = [
|
|
585
|
-
["
|
|
586
|
-
["
|
|
615
|
+
["RP2350 Monitor UF2", "toolkit-runtime/rp2350-monitor/firmware/rp2350_monitor.uf2"],
|
|
616
|
+
["RP2350 Monitor firmware source", "toolkit-runtime/rp2350-monitor/firmware/src/main.cpp"]
|
|
587
617
|
];
|
|
588
|
-
|
|
589
|
-
|
|
618
|
+
const initialFirmware = [
|
|
619
|
+
["Pico 2 W initialization UF2", "rp2350-initial-firmware/pico2w/initial.uf2"],
|
|
620
|
+
["ColorEasyPICO2 initialization UF2", "rp2350-initial-firmware/coloreasypico2/initial.uf2"]
|
|
621
|
+
];
|
|
622
|
+
const compile = [
|
|
623
|
+
["Pico SDK", "rp2350-sdk/pico-sdk/pico_sdk_init.cmake"],
|
|
624
|
+
["Pico SDK CMakeLists", "rp2350-sdk/pico-sdk/CMakeLists.txt"],
|
|
625
|
+
["ARM bare-metal C compiler", "rp2350-sdk/toolchains/arm-gnu-toolchain-15.2.rel1-darwin-arm64-arm-none-eabi/bin/arm-none-eabi-gcc"],
|
|
626
|
+
["ARM bare-metal C++ compiler", "rp2350-sdk/toolchains/arm-gnu-toolchain-15.2.rel1-darwin-arm64-arm-none-eabi/bin/arm-none-eabi-g++"],
|
|
627
|
+
["picotool", "rp2350-sdk/picotool/install/picotool/picotool"]
|
|
628
|
+
];
|
|
629
|
+
if (mode === "compile") {
|
|
630
|
+
return [...base, ...compile, ...initialFirmware];
|
|
590
631
|
}
|
|
591
|
-
|
|
632
|
+
if (mode === "firmware") {
|
|
633
|
+
return [...base, ...runtime, ...firmware, ...initialFirmware];
|
|
634
|
+
}
|
|
635
|
+
if (mode === "full") {
|
|
636
|
+
return [...base, ...runtime, ...firmware, ...initialFirmware, ...compile];
|
|
637
|
+
}
|
|
638
|
+
return [...base, ...runtime];
|
|
592
639
|
}
|
|
593
640
|
export async function compileTaishanPiSingleFile(options) {
|
|
594
641
|
assertAuthenticated(options.auth);
|
|
@@ -689,17 +736,26 @@ async function loadLocalToolchainMetadata(metadataRoot, channelName) {
|
|
|
689
736
|
return { channel, manifests, metadataRoot: root };
|
|
690
737
|
}
|
|
691
738
|
async function resolveLocalToolchainDownloadPlan(input) {
|
|
739
|
+
const requestedBoardId = normalizeBoardId(input.boardId);
|
|
740
|
+
const compatibleBoardIds = compatibleDownloadBoardIds(requestedBoardId);
|
|
692
741
|
const channelUrl = downloadChannelUrl(input.channel);
|
|
693
742
|
const channel = await fetchJson(channelUrl);
|
|
694
743
|
if (channel.schema !== "embedlabs.download-channel.v1") {
|
|
695
744
|
throw new Error(`Unexpected download channel schema ${channel.schema}.`);
|
|
696
745
|
}
|
|
697
|
-
const
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
746
|
+
const entries = channel.packages ?? [];
|
|
747
|
+
let entry;
|
|
748
|
+
for (const boardId of compatibleBoardIds) {
|
|
749
|
+
entry = entries.find((item) => {
|
|
750
|
+
return normalizeBoardId(item.board_id ?? "") === boardId
|
|
751
|
+
&& item.host === input.host
|
|
752
|
+
&& item.toolchain === input.toolchain
|
|
753
|
+
&& (item.kind === undefined || item.kind === "toolchain-archive" || item.kind === "board-support-archive");
|
|
754
|
+
});
|
|
755
|
+
if (entry) {
|
|
756
|
+
break;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
703
759
|
if (!entry?.manifest) {
|
|
704
760
|
return undefined;
|
|
705
761
|
}
|
|
@@ -708,8 +764,9 @@ async function resolveLocalToolchainDownloadPlan(input) {
|
|
|
708
764
|
if (manifest.id !== entry.id || manifest.version !== entry.version) {
|
|
709
765
|
throw new Error(`Download manifest mismatch for ${entry.id}@${entry.version}.`);
|
|
710
766
|
}
|
|
711
|
-
|
|
712
|
-
|
|
767
|
+
const manifestBoardId = normalizeBoardId(manifest.board_id ?? "");
|
|
768
|
+
if (!compatibleBoardIds.includes(manifestBoardId) || manifest.host !== input.host || manifest.toolchain !== input.toolchain) {
|
|
769
|
+
throw new Error(`Download manifest does not match requested ${requestedBoardId}/${input.host}/${input.toolchain}.`);
|
|
713
770
|
}
|
|
714
771
|
if ((!manifest.archive?.file || !manifest.archive.sha256 || !Number.isFinite(manifest.archive.size_bytes))
|
|
715
772
|
&& (!Array.isArray(manifest.components) || manifest.components.length === 0)) {
|
|
@@ -726,7 +783,7 @@ async function resolveLocalToolchainDownloadPlan(input) {
|
|
|
726
783
|
size_bytes: Number.isFinite(mirror.size_bytes) ? mirror.size_bytes : manifest.archive?.size_bytes
|
|
727
784
|
})), manifest.download_policy?.preferred_order)
|
|
728
785
|
: [];
|
|
729
|
-
const components = (manifest.components ?? []).map((component) => normalizeDownloadComponent(component, manifest, manifestUrl));
|
|
786
|
+
const components = downloadComponentsForBoard(requestedBoardId, (manifest.components ?? []).map((component) => normalizeDownloadComponent(component, manifest, manifestUrl)));
|
|
730
787
|
const first = mirrors[0];
|
|
731
788
|
if (!first && components.length === 0) {
|
|
732
789
|
return undefined;
|
|
@@ -736,7 +793,7 @@ async function resolveLocalToolchainDownloadPlan(input) {
|
|
|
736
793
|
manifest_url: manifestUrl,
|
|
737
794
|
package_id: manifest.id,
|
|
738
795
|
version: manifest.version,
|
|
739
|
-
board_id:
|
|
796
|
+
board_id: requestedBoardId,
|
|
740
797
|
host: input.host,
|
|
741
798
|
toolchain: input.toolchain,
|
|
742
799
|
source_url: first?.url,
|
|
@@ -843,18 +900,27 @@ function resolvePackageRefs(packageId, channel, manifests, seen = new Set()) {
|
|
|
843
900
|
return refs;
|
|
844
901
|
}
|
|
845
902
|
function boardPackageIdFor(boardId) {
|
|
846
|
-
|
|
903
|
+
const normalized = normalizeBoardId(boardId);
|
|
904
|
+
if (normalized === DEFAULT_BOARD_ID || normalized === "taishanpi" || normalized === "taishanpi-1m-rk3566") {
|
|
847
905
|
return "embedlabs.board.taishanpi.1m-rk3566";
|
|
848
906
|
}
|
|
849
|
-
if (
|
|
850
|
-
||
|
|
851
|
-
||
|
|
852
|
-
||
|
|
853
|
-
||
|
|
854
|
-
||
|
|
907
|
+
if (normalized === COLOREASYPICO2_RP2350_BOARD_ID
|
|
908
|
+
|| normalized === "coloreasypico2"
|
|
909
|
+
|| normalized === "color-easy-pico2"
|
|
910
|
+
|| normalized === "color-easy-pico-2"
|
|
911
|
+
|| normalized === "color-easy-pico-2-rp2350-monitor"
|
|
912
|
+
|| normalized === "ce-pico2") {
|
|
913
|
+
return "embedlabs.board.coloreasypico2.rp2350-monitor";
|
|
914
|
+
}
|
|
915
|
+
if (normalized === PICO2W_RP2350_BOARD_ID
|
|
916
|
+
|| normalized === "pico2w"
|
|
917
|
+
|| normalized === "pico-2-w"
|
|
918
|
+
|| normalized === "pico2"
|
|
919
|
+
|| normalized === "rp2350"
|
|
920
|
+
|| normalized === "rp2350-monitor") {
|
|
855
921
|
return "embedlabs.board.pico2w.rp2350-monitor";
|
|
856
922
|
}
|
|
857
|
-
if (
|
|
923
|
+
if (normalized.startsWith("embedlabs.board.")) {
|
|
858
924
|
return boardId;
|
|
859
925
|
}
|
|
860
926
|
throw new Error(`Unsupported local toolchain board ${boardId}.`);
|
|
@@ -883,6 +949,38 @@ function boardIdForPackageManifest(manifest) {
|
|
|
883
949
|
function normalizeBoardId(boardId) {
|
|
884
950
|
return boardId.trim().toLowerCase().replaceAll("_", "-");
|
|
885
951
|
}
|
|
952
|
+
function isRp2350MonitorBoardId(boardId) {
|
|
953
|
+
const normalized = normalizeBoardId(boardId);
|
|
954
|
+
return normalized === PICO2W_RP2350_BOARD_ID
|
|
955
|
+
|| normalized === COLOREASYPICO2_RP2350_BOARD_ID
|
|
956
|
+
|| normalized === "pico2w"
|
|
957
|
+
|| normalized === "pico-2-w"
|
|
958
|
+
|| normalized === "pico2"
|
|
959
|
+
|| normalized === "rp2350"
|
|
960
|
+
|| normalized === "rp2350-monitor"
|
|
961
|
+
|| normalized === "coloreasypico2"
|
|
962
|
+
|| normalized === "color-easy-pico2"
|
|
963
|
+
|| normalized === "color-easy-pico-2"
|
|
964
|
+
|| normalized === "ce-pico2";
|
|
965
|
+
}
|
|
966
|
+
function compatibleDownloadBoardIds(boardId) {
|
|
967
|
+
const normalized = normalizeBoardId(boardId);
|
|
968
|
+
if (normalized === COLOREASYPICO2_RP2350_BOARD_ID) {
|
|
969
|
+
return [COLOREASYPICO2_RP2350_BOARD_ID, PICO2W_RP2350_BOARD_ID];
|
|
970
|
+
}
|
|
971
|
+
return [normalized];
|
|
972
|
+
}
|
|
973
|
+
function downloadComponentsForBoard(boardId, components) {
|
|
974
|
+
const normalized = normalizeBoardId(boardId);
|
|
975
|
+
if (normalized === DEFAULT_BOARD_ID) {
|
|
976
|
+
return components.filter((component) => !isRp2350MonitorComponent(component));
|
|
977
|
+
}
|
|
978
|
+
return components;
|
|
979
|
+
}
|
|
980
|
+
function isRp2350MonitorComponent(component) {
|
|
981
|
+
const text = `${component.id} ${component.role ?? ""} ${component.archive.file}`.toLowerCase();
|
|
982
|
+
return text.includes("rp2350-monitor") || text.includes("pico2w-rp2350-monitor");
|
|
983
|
+
}
|
|
886
984
|
function compareVersionLike(left, right) {
|
|
887
985
|
return left.localeCompare(right, undefined, { numeric: true, sensitivity: "base" });
|
|
888
986
|
}
|
|
@@ -904,6 +1002,12 @@ function packageHostSupport(packages, manifests, host) {
|
|
|
904
1002
|
}
|
|
905
1003
|
function environmentNotes(input) {
|
|
906
1004
|
const notes = [];
|
|
1005
|
+
if (normalizeBoardId(input.boardId) === COLOREASYPICO2_RP2350_BOARD_ID) {
|
|
1006
|
+
notes.push("ColorEasyPICO2 uses the same RP2350/Pico SDK, ARM bare-metal toolchain, picotool, and optional RP2350 Monitor image package as Pico 2 W; Wi-Fi operations are not declared for this no-Wi-Fi board.");
|
|
1007
|
+
}
|
|
1008
|
+
if (isRp2350MonitorBoardId(input.boardId)) {
|
|
1009
|
+
notes.push("RP2350 Monitor is an optional hardware-control firmware image; the board environment itself is the Pico 2 W or ColorEasyPICO2 C/C++ SDK environment.");
|
|
1010
|
+
}
|
|
907
1011
|
if (input.status === "available") {
|
|
908
1012
|
notes.push("Environment is available but not installed on this computer.");
|
|
909
1013
|
}
|
|
@@ -997,7 +1101,7 @@ async function writeCurrentRegistry(installRoot, latest, releaseRoot, mode, sour
|
|
|
997
1101
|
updated_at: new Date().toISOString()
|
|
998
1102
|
}, null, 2)}\n`, "utf8");
|
|
999
1103
|
}
|
|
1000
|
-
async function resolveLocalReleaseRoot(releaseRoot) {
|
|
1104
|
+
async function resolveLocalReleaseRoot(releaseRoot, boardId = DEFAULT_BOARD_ID) {
|
|
1001
1105
|
if (releaseRoot?.trim()) {
|
|
1002
1106
|
return resolve(releaseRoot);
|
|
1003
1107
|
}
|
|
@@ -1005,7 +1109,7 @@ async function resolveLocalReleaseRoot(releaseRoot) {
|
|
|
1005
1109
|
if (envRoot) {
|
|
1006
1110
|
return resolve(envRoot);
|
|
1007
1111
|
}
|
|
1008
|
-
const current = await currentLocalToolchain(undefined,
|
|
1112
|
+
const current = await currentLocalToolchain(undefined, boardId);
|
|
1009
1113
|
if (current.release_root) {
|
|
1010
1114
|
return resolve(current.release_root);
|
|
1011
1115
|
}
|
|
@@ -1148,6 +1252,62 @@ function selectedDownloadComponents(components, mode) {
|
|
|
1148
1252
|
return component.install_modes.includes(mode);
|
|
1149
1253
|
});
|
|
1150
1254
|
}
|
|
1255
|
+
function installCopyPathsForBoard(boardId) {
|
|
1256
|
+
if (normalizeBoardId(boardId) === DEFAULT_BOARD_ID) {
|
|
1257
|
+
return INSTALL_COPY_PATHS.filter((relativePath) => {
|
|
1258
|
+
const normalized = relativePath.toLowerCase();
|
|
1259
|
+
return normalized !== "toolkit-runtime/rp2350-monitor"
|
|
1260
|
+
&& normalized !== "toolkit-runtime/rp2350-monitor/";
|
|
1261
|
+
});
|
|
1262
|
+
}
|
|
1263
|
+
return INSTALL_COPY_PATHS;
|
|
1264
|
+
}
|
|
1265
|
+
async function resolveInstallSourcePathForBoard(sourceRoot, relativePath, boardId) {
|
|
1266
|
+
const direct = resolve(sourceRoot, relativePath);
|
|
1267
|
+
if (await pathExists(direct)) {
|
|
1268
|
+
return direct;
|
|
1269
|
+
}
|
|
1270
|
+
if (!isRp2350MonitorBoardId(boardId)) {
|
|
1271
|
+
return direct;
|
|
1272
|
+
}
|
|
1273
|
+
const legacyRp2350Root = await findLegacyRp2350Root(sourceRoot);
|
|
1274
|
+
if (!legacyRp2350Root) {
|
|
1275
|
+
return direct;
|
|
1276
|
+
}
|
|
1277
|
+
if (relativePath === "rp2350-sdk") {
|
|
1278
|
+
return legacyRp2350Root;
|
|
1279
|
+
}
|
|
1280
|
+
if (relativePath === "rp2350-initial-firmware") {
|
|
1281
|
+
return resolve(legacyRp2350Root, "initial_firmware");
|
|
1282
|
+
}
|
|
1283
|
+
if (relativePath === "rp2350-examples") {
|
|
1284
|
+
return resolve(legacyRp2350Root, "validation");
|
|
1285
|
+
}
|
|
1286
|
+
return direct;
|
|
1287
|
+
}
|
|
1288
|
+
async function findLegacyRp2350Root(sourceRoot) {
|
|
1289
|
+
const direct = resolve(sourceRoot, "RP2350");
|
|
1290
|
+
if (await pathExists(resolve(direct, "pico-sdk", "pico_sdk_init.cmake"))) {
|
|
1291
|
+
return direct;
|
|
1292
|
+
}
|
|
1293
|
+
let entries;
|
|
1294
|
+
try {
|
|
1295
|
+
entries = await readdir(sourceRoot, { withFileTypes: true });
|
|
1296
|
+
}
|
|
1297
|
+
catch {
|
|
1298
|
+
return undefined;
|
|
1299
|
+
}
|
|
1300
|
+
for (const entry of entries) {
|
|
1301
|
+
if (!entry.isDirectory()) {
|
|
1302
|
+
continue;
|
|
1303
|
+
}
|
|
1304
|
+
const candidate = resolve(sourceRoot, entry.name, "RP2350");
|
|
1305
|
+
if (await pathExists(resolve(candidate, "pico-sdk", "pico_sdk_init.cmake"))) {
|
|
1306
|
+
return candidate;
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
return undefined;
|
|
1310
|
+
}
|
|
1151
1311
|
async function downloadToolchainArchive(sourceUrl, installRoot, expected) {
|
|
1152
1312
|
const downloadsDir = join(installRoot, "cache", "downloads");
|
|
1153
1313
|
await mkdir(downloadsDir, { recursive: true });
|