Skip to content

Commit 4a40ba9

Browse files
authored
Merge pull request #4407 from hyhkjiy/feature/nrf5x
[ADD]vscode support for nrf52832
2 parents 7628f36 + d42e66c commit 4a40ba9

File tree

5 files changed

+104
-2
lines changed

5 files changed

+104
-2
lines changed

bsp/nrf5x/nrf52832/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# vscode common config
2+
.vscode/*
3+
!.vscode/launch.json
4+
!.vscode/tasks.json
5+
6+
# OS X icon info
7+
.DS_Store
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"type": "cortex-debug",
6+
"request": "launch",
7+
"servertype": "jlink",
8+
"cwd": "${workspaceRoot}",
9+
"executable": "rt-thread.elf",
10+
"name": "Cortex Debug",
11+
"device": "nrf52",
12+
"interface": "swd"
13+
}
14+
]
15+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "config",
8+
"type": "shell",
9+
"command": "RTT_ROOT=../../.. scons --pyconfig",
10+
"problemMatcher": []
11+
},
12+
{
13+
"label": "build",
14+
"type": "shell",
15+
"command": "scons",
16+
"problemMatcher": [],
17+
"group": {
18+
"kind": "build",
19+
"isDefault": true
20+
}
21+
},
22+
{
23+
"label": "clean",
24+
"type": "shell",
25+
"command": "scons -c",
26+
"problemMatcher": []
27+
},
28+
{
29+
"label": "flash",
30+
"type": "shell",
31+
"command": "nrfjprog -f nrf52 --program rt-thread.hex --sectorerase",
32+
"group": "build",
33+
"problemMatcher": []
34+
},
35+
{
36+
"label": "flash_softdevice",
37+
"type": "shell",
38+
"command": "nrfjprog -f nrf52 --program packages/nrf5x_sdk-latest/components/softdevice/s132/hex/s132_nrf52_7.0.1_softdevice.hex --sectorerase",
39+
"problemMatcher": []
40+
},
41+
{
42+
"label": "erase",
43+
"type": "shell",
44+
"command": "nrfjprog -f nrf52 --eraseall",
45+
"problemMatcher": []
46+
},
47+
{
48+
"label": "reset",
49+
"type": "shell",
50+
"command": "nrfjprog -f nrf52 --reset",
51+
"problemMatcher": []
52+
}
53+
]
54+
}

bsp/nrf5x/nrf52832/README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## 简介
44

5-
该文件夹主要存放所有主芯片为nRF52840的板级支持包。目前默认支持的开发板是官方[PCA10040](https://www.nordicsemi.com/Software-and-tools/Development-Kits/nRF52-DK)
5+
该文件夹主要存放所有主芯片为nRF52832的板级支持包。目前默认支持的开发板是官方[PCA10040](https://www.nordicsemi.com/Software-and-tools/Development-Kits/nRF52-DK)
66
主要内容如下:
77

88
- 开发板资源介绍
@@ -61,6 +61,30 @@ PCA10040-nrf52832开发板常用 **板载资源** 如下:
6161
4. 输入`scons --target=mdk4/mdk5/iar` 命令重新生成工程。
6262

6363

64+
### VS Code开发支持
65+
66+
配置步骤:
67+
68+
1. 在命令行设置以下两个环境变量:
69+
70+
```bash
71+
export RTT_CC=gcc
72+
export RTT_EXEC_PATH=<工具链路径/bin>
73+
```
74+
75+
2. 搜索插件`Cortex-debug`并安装。
76+
3. 安装[nRF Command Line Tools](https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Command-Line-Tools)以支持`nrfjprog`命令。
77+
4. 在.vscode/settings.json内配置工具链和`JlinkGDBServer`,sample:
78+
79+
```json
80+
{
81+
"cortex-debug.armToolchainPath": "/usr/local/gcc-arm-none-eabi-9-2019-q4-major/bin/",
82+
"cortex-debug.armToolchainPrefix": "arm-none-eabi",
83+
"cortex-debug.JLinkGDBServerPath": "/Applications/SEGGER/JLink/JLinkGDBServer"
84+
}
85+
```
86+
87+
5. 点击`终端`->`运行任务`->`build`编译,点击`终端`->`运行任务`->`flash`烧录,点击左侧`debug`->`run`使用VS Code进行debug。
6488

6589
## 支持其他开发板
6690

bsp/nrf5x/nrf52832/rtconfig.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@
5454
else:
5555
CFLAGS += ' -O2'
5656

57-
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
57+
POST_ACTION = OBJCPY + ' -O binary $TARGET rt-thread.bin\n'
58+
POST_ACTION += OBJCPY + ' -O ihex $TARGET rt-thread.hex\n'
59+
POST_ACTION += SIZE + ' $TARGET \n'
5860

5961
elif PLATFORM == 'armcc':
6062
# toolchains

0 commit comments

Comments
 (0)