Skip to content

Commit 0fa659f

Browse files
CopilotBernardXiong
andcommitted
Add 20+ boards to bi.json with bilingual descriptions and UI support
Co-authored-by: BernardXiong <[email protected]>
1 parent 325d84c commit 0fa659f

File tree

5 files changed

+214
-31
lines changed

5 files changed

+214
-31
lines changed

resources/bi.json

Lines changed: 137 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,162 @@
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-riscv64",
19+
"description": "QEMU emulated virt riscv64 machine. QEMU模拟的virt riscv64机器。",
20+
"board": "qemu-virt64-riscv64",
21+
"path": "bsp/qemu-virt64-riscv64"
22+
},
23+
{
24+
"name": "qemu-riscv-virt32",
25+
"description": "QEMU emulated RISC-V 32-bit virt machine. QEMU模拟的RISC-V 32位虚拟机器。",
26+
"board": "qemu-riscv-virt32",
27+
"path": "bsp/qemu-riscv-virt32"
28+
},
29+
{
30+
"name": "qemu-riscv-virt64",
31+
"description": "QEMU emulated RISC-V 64-bit virt machine. QEMU模拟的RISC-V 64位虚拟机器。",
32+
"board": "qemu-riscv-virt64",
33+
"path": "bsp/qemu-riscv-virt64"
34+
}
35+
]
36+
},
237
{
338
"manufacturer": "ST",
439
"boards": [
540
{
641
"name": "stm32f407-rt-spark",
7-
"description" : "RT-Thread官方的星火一号开发板,基于STM32F407",
42+
"description": "RT-Thread official Spark board No.1, based on STM32F407. RT-Thread官方的星火一号开发板,基于STM32F407",
843
"board": "stm32f407-rt-spark",
944
"path": "bsp/stm32/stm32f407-rt-spark"
10-
1145
},
1246
{
1347
"name": "stm32f412-st-nucleo",
14-
"description": "ST官方的STM32F412 Nucleo开发板",
48+
"description": "ST official STM32F412 Nucleo development board. ST官方的STM32F412 Nucleo开发板",
1549
"board": "stm32f412-st-nucleo",
16-
"path":"bsp/stm32/stm32f412-st-nucleo"
50+
"path": "bsp/stm32/stm32f412-st-nucleo"
51+
},
52+
{
53+
"name": "stm32f401-st-nucleo",
54+
"description": "ST official STM32F401 Nucleo development board with ARM Cortex-M4. ST官方的STM32F401 Nucleo开发板,搭载ARM Cortex-M4内核。",
55+
"board": "stm32f401-st-nucleo",
56+
"path": "bsp/stm32/stm32f401-st-nucleo"
57+
},
58+
{
59+
"name": "stm32f103-atk-nano",
60+
"description": "Alientek STM32F103 Nano development board, based on STM32F103RB. 正点原子STM32F103 Nano开发板,基于STM32F103RB。",
61+
"board": "stm32f103-atk-nano",
62+
"path": "bsp/stm32/stm32f103-atk-nano"
63+
},
64+
{
65+
"name": "stm32f103-blue-pill",
66+
"description": "Popular low-cost STM32F103 Blue Pill board, widely used for learning and prototyping. 流行的低成本STM32F103蓝色药丸板,广泛用于学习和原型开发。",
67+
"board": "stm32f103-blue-pill",
68+
"path": "bsp/stm32/stm32f103-blue-pill"
69+
},
70+
{
71+
"name": "stm32f407-atk-explorer",
72+
"description": "Alientek STM32F407 Explorer development board with rich peripherals. 正点原子STM32F407探索者开发板,外设丰富。",
73+
"board": "stm32f407-atk-explorer",
74+
"path": "bsp/stm32/stm32f407-atk-explorer"
75+
},
76+
{
77+
"name": "stm32f429-atk-apollo",
78+
"description": "Alientek STM32F429 Apollo development board with LCD and camera support. 正点原子STM32F429阿波罗开发板,支持LCD和摄像头。",
79+
"board": "stm32f429-atk-apollo",
80+
"path": "bsp/stm32/stm32f429-atk-apollo"
81+
},
82+
{
83+
"name": "stm32h750-artpi",
84+
"description": "RT-Thread official ART-Pi development board, based on STM32H750 with high performance. RT-Thread官方ART-Pi开发板,基于高性能STM32H750。",
85+
"board": "stm32h750-artpi",
86+
"path": "bsp/stm32/stm32h750-artpi"
1787
}
1888
]
1989
},
2090
{
21-
"manufacturer": "QEMU",
91+
"manufacturer": "Raspberry Pi",
2292
"boards": [
2393
{
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"
94+
"name": "raspberry-pico",
95+
"description": "Raspberry Pi Pico board based on RP2040 microcontroller. 树莓派Pico开发板,基于RP2040微控制器。",
96+
"board": "raspberry-pico",
97+
"path": "bsp/raspberry-pico"
2898
},
2999
{
30-
"name": "qemu-virt64-aarch64",
31-
"description": "QEMU模拟的virt aarch64机器",
32-
"board": "qemu-virt64-aarch64",
33-
"path": "bsp/qemu-virt64-aarch64"
100+
"name": "raspberry-pi-4b",
101+
"description": "Raspberry Pi 4 Model B single-board computer with quad-core Cortex-A72. 树莓派4B单板计算机,搭载四核Cortex-A72。",
102+
"board": "raspberry-pi-4b",
103+
"path": "bsp/raspberry-pi/raspi4-64"
104+
}
105+
]
106+
},
107+
{
108+
"manufacturer": "Espressif",
109+
"boards": [
110+
{
111+
"name": "esp32c3",
112+
"description": "Espressif ESP32-C3 RISC-V based Wi-Fi and Bluetooth SoC. 乐鑫ESP32-C3基于RISC-V的Wi-Fi和蓝牙SoC。",
113+
"board": "esp32c3",
114+
"path": "bsp/esp32c3"
34115
},
35116
{
36-
"name": "qemu-virt64-riscv64",
37-
"description": "QEMU模拟的virt riscv64机器",
38-
"board": "qemu-virt64-riscv64",
39-
"path": "bsp/qemu-virt64-riscv64"
117+
"name": "esp32",
118+
"description": "Espressif ESP32 dual-core Wi-Fi and Bluetooth SoC. 乐鑫ESP32双核Wi-Fi和蓝牙SoC。",
119+
"board": "esp32",
120+
"path": "bsp/esp32"
121+
}
122+
]
123+
},
124+
{
125+
"manufacturer": "NXP",
126+
"boards": [
127+
{
128+
"name": "imxrt1052-evk",
129+
"description": "NXP i.MX RT1052 EVK board with ARM Cortex-M7 crossover MCU. 恩智浦i.MX RT1052评估板,搭载ARM Cortex-M7跨界MCU。",
130+
"board": "imxrt1052-evk",
131+
"path": "bsp/imxrt/imxrt1052-evk"
132+
},
133+
{
134+
"name": "imxrt1064-evk",
135+
"description": "NXP i.MX RT1064 EVK board with ARM Cortex-M7 and advanced peripherals. 恩智浦i.MX RT1064评估板,搭载ARM Cortex-M7和先进外设。",
136+
"board": "imxrt1064-evk",
137+
"path": "bsp/imxrt/imxrt1064-evk"
138+
}
139+
]
140+
},
141+
{
142+
"manufacturer": "Allwinner",
143+
"boards": [
144+
{
145+
"name": "allwinner-d1",
146+
"description": "Allwinner D1 RISC-V based application processor. 全志D1基于RISC-V的应用处理器。",
147+
"board": "allwinner-d1",
148+
"path": "bsp/allwinner/d1"
149+
}
150+
]
151+
},
152+
{
153+
"manufacturer": "GigaDevice",
154+
"boards": [
155+
{
156+
"name": "gd32vf103-rvstar",
157+
"description": "GigaDevice GD32VF103 RV-STAR board with RISC-V core. 兆易创新GD32VF103 RV-STAR开发板,搭载RISC-V内核。",
158+
"board": "gd32vf103-rvstar",
159+
"path": "bsp/gd32vf103-rvstar"
40160
}
41161
]
42162
}

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 @color-border-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: @color-text-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)