Skip to content

Commit bc86a80

Browse files
authored
Merge pull request #28 from RT-Thread/copilot/add-more-bsp-boards
feat: Add 25 boards with bilingual descriptions to create-project UI
2 parents 7aff41e + b2b68a5 commit bc86a80

File tree

5 files changed

+243
-31
lines changed

5 files changed

+243
-31
lines changed

resources/bi.json

Lines changed: 166 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,191 @@
11
[
2+
{
3+
"manufacturer": "QEMU",
4+
"boards": [
5+
{
6+
"name": "qemu-vexpress-a9",
7+
"description": "VExpress A9 evaluation board, QEMU ARM emulation for ARM Cortex-A 32-bit series machines. VExpress A9评估板卡,可以使用QEMU ARM来模拟ARM Cortex-A 32位系列机器。",
8+
"board": "qemu-vexpress-a9",
9+
"path": "bsp/qemu-vexpress-a9"
10+
},
11+
{
12+
"name": "qemu-virt64-aarch64",
13+
"description": "QEMU emulated virt aarch64 machine. QEMU模拟的virt aarch64机器。",
14+
"board": "qemu-virt64-aarch64",
15+
"path": "bsp/qemu-virt64-aarch64"
16+
},
17+
{
18+
"name": "qemu-virt64-riscv",
19+
"description": "QEMU emulated virt RISC-V 64-bit machine. QEMU模拟的virt RISC-V 64位机器。",
20+
"board": "qemu-virt64-riscv",
21+
"path": "bsp/qemu-virt64-riscv"
22+
}
23+
]
24+
},
225
{
326
"manufacturer": "ST",
427
"boards": [
528
{
629
"name": "stm32f407-rt-spark",
7-
"description" : "RT-Thread官方的星火一号开发板,基于STM32F407",
30+
"description": "RT-Thread official Spark board No.1, based on STM32F407. RT-Thread官方的星火一号开发板,基于STM32F407",
831
"board": "stm32f407-rt-spark",
932
"path": "bsp/stm32/stm32f407-rt-spark"
10-
1133
},
1234
{
1335
"name": "stm32f412-st-nucleo",
14-
"description": "ST官方的STM32F412 Nucleo开发板",
36+
"description": "ST official STM32F412 Nucleo development board. ST官方的STM32F412 Nucleo开发板",
1537
"board": "stm32f412-st-nucleo",
16-
"path":"bsp/stm32/stm32f412-st-nucleo"
38+
"path": "bsp/stm32/stm32f412-st-nucleo"
39+
},
40+
{
41+
"name": "stm32f401-st-nucleo",
42+
"description": "ST official STM32F401 Nucleo development board with ARM Cortex-M4. ST官方的STM32F401 Nucleo开发板,搭载ARM Cortex-M4内核。",
43+
"board": "stm32f401-st-nucleo",
44+
"path": "bsp/stm32/stm32f401-st-nucleo"
45+
},
46+
{
47+
"name": "stm32f103-atk-nano",
48+
"description": "Alientek STM32F103 Nano development board, based on STM32F103RB. 正点原子STM32F103 Nano开发板,基于STM32F103RB。",
49+
"board": "stm32f103-atk-nano",
50+
"path": "bsp/stm32/stm32f103-atk-nano"
51+
},
52+
{
53+
"name": "stm32f103-blue-pill",
54+
"description": "Popular low-cost STM32F103 Blue Pill board, widely used for learning and prototyping. 流行的低成本STM32F103蓝色药丸板,广泛用于学习和原型开发。",
55+
"board": "stm32f103-blue-pill",
56+
"path": "bsp/stm32/stm32f103-blue-pill"
57+
},
58+
{
59+
"name": "stm32f407-atk-explorer",
60+
"description": "Alientek STM32F407 Explorer development board with rich peripherals. 正点原子STM32F407探索者开发板,外设丰富。",
61+
"board": "stm32f407-atk-explorer",
62+
"path": "bsp/stm32/stm32f407-atk-explorer"
63+
},
64+
{
65+
"name": "stm32f429-atk-apollo",
66+
"description": "Alientek STM32F429 Apollo development board with LCD and camera support. 正点原子STM32F429阿波罗开发板,支持LCD和摄像头。",
67+
"board": "stm32f429-atk-apollo",
68+
"path": "bsp/stm32/stm32f429-atk-apollo"
69+
},
70+
{
71+
"name": "stm32h750-artpi",
72+
"description": "RT-Thread official ART-Pi development board, based on STM32H750 with high performance. RT-Thread官方ART-Pi开发板,基于高性能STM32H750。",
73+
"board": "stm32h750-artpi",
74+
"path": "bsp/stm32/stm32h750-artpi"
1775
}
1876
]
1977
},
2078
{
21-
"manufacturer": "QEMU",
79+
"manufacturer": "Raspberry Pi",
2280
"boards": [
2381
{
24-
"name": "qemu-vexpress-a9",
25-
"description": "VExpress A9评估板卡,可以使用QEMU ARM来模拟ARM Cortex-A 32位系列机器",
26-
"board": "qemu-vexpress-a9",
27-
"path": "bsp/qemu-vexpress-a9"
82+
"name": "raspberry-pico",
83+
"description": "Raspberry Pi Pico board based on RP2040 microcontroller. 树莓派Pico开发板,基于RP2040微控制器。",
84+
"board": "raspberry-pico",
85+
"path": "bsp/raspberry-pico"
2886
},
2987
{
30-
"name": "qemu-virt64-aarch64",
31-
"description": "QEMU模拟的virt aarch64机器",
32-
"board": "qemu-virt64-aarch64",
33-
"path": "bsp/qemu-virt64-aarch64"
88+
"name": "raspberry-pi-4b",
89+
"description": "Raspberry Pi 4 Model B single-board computer with quad-core Cortex-A72. 树莓派4B单板计算机,搭载四核Cortex-A72。",
90+
"board": "raspberry-pi-4b",
91+
"path": "bsp/raspberry-pi/raspi4-64"
92+
}
93+
]
94+
},
95+
{
96+
"manufacturer": "Renesas",
97+
"boards": [
98+
{
99+
"name": "ra6m3-hmi-board",
100+
"description": "Renesas RA6M3 HMI development board with Cortex-M4 core and rich graphics features. 瑞萨RA6M3 HMI开发板,搭载Cortex-M4内核和丰富的图形功能。",
101+
"board": "ra6m3-hmi-board",
102+
"path": "bsp/renesas/ra6m3-hmi-board"
103+
},
104+
{
105+
"name": "ra8d1-vision-board",
106+
"description": "Renesas RA8D1 Vision Board with high-performance graphics and vision processing. 瑞萨RA8D1视觉开发板,具有高性能图形和视觉处理能力。",
107+
"board": "ra8d1-vision-board",
108+
"path": "bsp/renesas/ra8d1-vision-board"
109+
},
110+
{
111+
"name": "rzn2l-etherkit",
112+
"description": "Renesas RZ/N2L EtherKit for industrial Ethernet applications. 瑞萨RZ/N2L以太网套件,用于工业以太网应用。",
113+
"board": "rzn2l-etherkit",
114+
"path": "bsp/renesas/rzn2l_etherkit"
115+
}
116+
]
117+
},
118+
{
119+
"manufacturer": "Infineon",
120+
"boards": [
121+
{
122+
"name": "psoc6-evaluationkit-062S2",
123+
"description": "Infineon PSoC 6 Evaluation Kit with dual-core ARM Cortex-M4/M0+ processor. 英飞凌PSoC 6评估套件,搭载双核ARM Cortex-M4/M0+处理器。",
124+
"board": "psoc6-evaluationkit-062S2",
125+
"path": "bsp/Infineon/psoc6-evaluationkit-062S2"
126+
}
127+
]
128+
},
129+
{
130+
"manufacturer": "NXP",
131+
"boards": [
132+
{
133+
"name": "imxrt1052-evk",
134+
"description": "NXP i.MX RT1052 EVK board with ARM Cortex-M7 crossover MCU. 恩智浦i.MX RT1052评估板,搭载ARM Cortex-M7跨界MCU。",
135+
"board": "imxrt1052-evk",
136+
"path": "bsp/imxrt/imxrt1052-evk"
137+
},
138+
{
139+
"name": "imxrt1064-evk",
140+
"description": "NXP i.MX RT1064 EVK board with ARM Cortex-M7 and advanced peripherals. 恩智浦i.MX RT1064评估板,搭载ARM Cortex-M7和先进外设。",
141+
"board": "imxrt1064-evk",
142+
"path": "bsp/imxrt/imxrt1064-evk"
143+
},
144+
{
145+
"name": "frdm-mcxa156",
146+
"description": "NXP FRDM-MCXA156 Freedom development board with ARM Cortex-M33. 恩智浦FRDM-MCXA156自由开发板,搭载ARM Cortex-M33内核。",
147+
"board": "frdm-mcxa156",
148+
"path": "bsp/nxp/mcx/mcxa/frdm-mcxa156"
149+
},
150+
{
151+
"name": "frdm-mcxa346",
152+
"description": "NXP FRDM-MCXA346 Freedom development board with ARM Cortex-M33. 恩智浦FRDM-MCXA346自由开发板,搭载ARM Cortex-M33内核。",
153+
"board": "frdm-mcxa346",
154+
"path": "bsp/nxp/mcx/mcxa/frdm-mcxa346"
155+
},
156+
{
157+
"name": "frdm-mcxn947",
158+
"description": "NXP FRDM-MCXN947 Freedom development board with dual ARM Cortex-M33 cores. 恩智浦FRDM-MCXN947自由开发板,搭载双核ARM Cortex-M33内核。",
159+
"board": "frdm-mcxn947",
160+
"path": "bsp/nxp/mcx/mcxn/frdm-mcxn947"
161+
}
162+
]
163+
},
164+
{
165+
"manufacturer": "Allwinner",
166+
"boards": [
167+
{
168+
"name": "allwinner-d1",
169+
"description": "Allwinner D1 RISC-V based application processor. 全志D1基于RISC-V的应用处理器。",
170+
"board": "allwinner-d1",
171+
"path": "bsp/allwinner/d1"
172+
}
173+
]
174+
},
175+
{
176+
"manufacturer": "GigaDevice",
177+
"boards": [
178+
{
179+
"name": "gd32450z-eval",
180+
"description": "GigaDevice GD32450Z evaluation board with ARM Cortex-M4 and rich peripherals. 兆易创新GD32450Z评估板,搭载ARM Cortex-M4内核和丰富外设。",
181+
"board": "gd32450z-eval",
182+
"path": "bsp/gd32/arm/gd32450z-eval"
34183
},
35184
{
36-
"name": "qemu-virt64-riscv64",
37-
"description": "QEMU模拟的virt riscv64机器",
38-
"board": "qemu-virt64-riscv64",
39-
"path": "bsp/qemu-virt64-riscv64"
185+
"name": "gd32407v-start",
186+
"description": "GigaDevice GD32407V starter board with ARM Cortex-M4 core. 兆易创新GD32407V起始板,搭载ARM Cortex-M4内核。",
187+
"board": "gd32407v-start",
188+
"path": "bsp/gd32/arm/gd32407v-start"
40189
}
41190
]
42191
}

src/api.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,26 @@ export function initAPI(context:vscode.ExtensionContext) {
2828
export function getBoardInfo(): any {
2929
let bi = [];
3030

31+
for (const item of _bi) {
32+
let vendor = { manufacturer : item.manufacturer, boards : [] as any[]};
33+
34+
for (const board of item.boards) {
35+
vendor.boards.push({
36+
name: board.name,
37+
board: board.board,
38+
description: board.description,
39+
path: board.path
40+
});
41+
}
42+
bi.push(vendor);
43+
}
44+
45+
return bi;
46+
}
47+
48+
export function getBoardInfoSimple(): any {
49+
let bi = [];
50+
3151
for (const item of _bi) {
3252
let vendor = { manufacturer : item.manufacturer, boards : [] as string[]};
3353

src/vue/create-project/App.vue

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
<el-select class="create-project-select" v-model="projectInfo.board" :placeholder="'请选择'" @change="boardChanged">
2929
<el-option
3030
v-for="item in projectInfo.projectList[vendorIndex].boards"
31-
:key="item"
32-
:label="item"
33-
:value="item"
31+
:key="typeof item === 'string' ? item : item.board"
32+
:label="typeof item === 'string' ? item : item.name"
33+
:value="typeof item === 'string' ? item : item.board"
3434
/>
3535
</el-select>
3636
<el-button type="primary" plain @click="createProject">创建</el-button>
@@ -48,6 +48,10 @@
4848
<h3 class="rt-section-title">创建工程说明</h3>
4949
<p>请在工程名称中填写名称,它会在工程空间路径中创建这样名称的目录放置新创建的工程。</p>
5050
<p class="create-project-warning">⚠️ 请确保空间路径 + 工程名称的路径不存在;否则创建检查失败。</p>
51+
<div v-if="selectedBoardDescription" class="create-project-board-info">
52+
<h4 class="rt-subsection-title">选中的板卡信息</h4>
53+
<p>{{ selectedBoardDescription }}</p>
54+
</div>
5155
</div>
5256
</div>
5357
</div>
@@ -95,6 +99,31 @@ const vendorIndex = computed(() => {
9599
return current;
96100
});
97101
102+
const selectedBoardDescription = computed(() => {
103+
if (!projectInfo.value.board || !projectInfo.value.projectList || projectInfo.value.projectList.length === 0) {
104+
return '';
105+
}
106+
107+
const currentVendor = projectInfo.value.projectList[vendorIndex.value];
108+
if (!currentVendor || !currentVendor.boards) {
109+
return '';
110+
}
111+
112+
const board = currentVendor.boards.find((b: any) => {
113+
if (typeof b === 'string') {
114+
return b === projectInfo.value.board;
115+
} else {
116+
return b.board === projectInfo.value.board;
117+
}
118+
});
119+
120+
if (board && typeof board === 'object' && board.description) {
121+
return board.description;
122+
}
123+
124+
return '';
125+
});
126+
98127
const vendorChanged = () => {
99128
let current = -1;
100129
projectInfo.value.projectList.filter((item: any, index: number) => {
@@ -105,7 +134,10 @@ const vendorChanged = () => {
105134
if (current === -1) {
106135
projectInfo.value.board = '';
107136
} else {
108-
projectInfo.value.board = projectInfo.value.projectList[current].boards[0];
137+
const boards = projectInfo.value.projectList[current].boards;
138+
if (boards && boards.length > 0) {
139+
projectInfo.value.board = typeof boards[0] === 'string' ? boards[0] : boards[0].board;
140+
}
109141
}
110142
};
111143

src/vue/create-project/index.less

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,25 @@
7676
}
7777
}
7878

79+
.create-project-board-info {
80+
margin-top: @spacing-lg;
81+
padding-top: @spacing-lg;
82+
border-top: 1px solid @el-border-color-lighter;
83+
84+
.rt-subsection-title {
85+
margin: 0 0 @spacing-sm;
86+
font-size: @font-size-base;
87+
font-weight: 600;
88+
color: @color-text-primary;
89+
}
90+
91+
p {
92+
margin: 0;
93+
line-height: 1.6;
94+
color: @el-text-color-regular;
95+
}
96+
}
97+
7998
.create-project-warning {
8099
margin: 0;
81100
color: @color-warning;

src/webviews/create-project.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,9 @@ export function openCreateProjectWebview(context: vscode.ExtensionContext) {
111111

112112
let workspace = vscode.workspace.workspaceFolders?.[0];
113113
// 获取BSP工程信息
114-
if (workspace) {
115-
const rtthreadFn = path.join(workspace.uri.fsPath, '.vscode', 'rtthread.json');
116-
if (fs.existsSync(rtthreadFn)) {
117-
let rtthreadObj = readJsonObject(rtthreadFn);
118-
if (rtthreadObj && rtthreadObj.board_info) {
119-
extensionInfo.projectList = getBoardInfo();
120-
}
121-
}
122-
}
114+
extensionInfo.projectList = getBoardInfo();
123115

124-
// 如果没有从workspace获取到projectList,则使用默认值
116+
// 如果没有从bi.json获取到projectList,则使用默认值
125117
if (!extensionInfo.projectList || extensionInfo.projectList.length === 0) {
126118
extensionInfo.projectList = [
127119
{

0 commit comments

Comments
 (0)