summaryrefslogtreecommitdiff
path: root/bsp/nrf5x
diff options
context:
space:
mode:
authorhyhkjiy <[email protected]>2021-03-01 00:02:58 +0800
committerhyhkjiy <[email protected]>2021-03-02 13:47:40 +0800
commitd42e66cb0d956a4a9bc459be78f04d6749eecf66 (patch)
tree42eab0bcf82c0f04c00529f15d96443a96f1eb69 /bsp/nrf5x
parent339ebf3c16e4c067f4ddfb7880709a534d41cf53 (diff)
[ADD]vscode support for nrf52832
Diffstat (limited to 'bsp/nrf5x')
-rw-r--r--bsp/nrf5x/nrf52832/.gitignore7
-rw-r--r--bsp/nrf5x/nrf52832/.vscode/launch.json15
-rw-r--r--bsp/nrf5x/nrf52832/.vscode/tasks.json54
-rw-r--r--bsp/nrf5x/nrf52832/README.md26
-rw-r--r--bsp/nrf5x/nrf52832/rtconfig.py4
5 files changed, 104 insertions, 2 deletions
diff --git a/bsp/nrf5x/nrf52832/.gitignore b/bsp/nrf5x/nrf52832/.gitignore
new file mode 100644
index 0000000000..2541e31630
--- /dev/null
+++ b/bsp/nrf5x/nrf52832/.gitignore
@@ -0,0 +1,7 @@
+# vscode common config
+.vscode/*
+!.vscode/launch.json
+!.vscode/tasks.json
+
+# OS X icon info
+.DS_Store \ No newline at end of file
diff --git a/bsp/nrf5x/nrf52832/.vscode/launch.json b/bsp/nrf5x/nrf52832/.vscode/launch.json
new file mode 100644
index 0000000000..c3a54b371b
--- /dev/null
+++ b/bsp/nrf5x/nrf52832/.vscode/launch.json
@@ -0,0 +1,15 @@
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "cortex-debug",
+ "request": "launch",
+ "servertype": "jlink",
+ "cwd": "${workspaceRoot}",
+ "executable": "rt-thread.elf",
+ "name": "Cortex Debug",
+ "device": "nrf52",
+ "interface": "swd"
+ }
+ ]
+} \ No newline at end of file
diff --git a/bsp/nrf5x/nrf52832/.vscode/tasks.json b/bsp/nrf5x/nrf52832/.vscode/tasks.json
new file mode 100644
index 0000000000..68331caaad
--- /dev/null
+++ b/bsp/nrf5x/nrf52832/.vscode/tasks.json
@@ -0,0 +1,54 @@
+{
+ // See https://go.microsoft.com/fwlink/?LinkId=733558
+ // for the documentation about the tasks.json format
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "label": "config",
+ "type": "shell",
+ "command": "RTT_ROOT=../../.. scons --pyconfig",
+ "problemMatcher": []
+ },
+ {
+ "label": "build",
+ "type": "shell",
+ "command": "scons",
+ "problemMatcher": [],
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ }
+ },
+ {
+ "label": "clean",
+ "type": "shell",
+ "command": "scons -c",
+ "problemMatcher": []
+ },
+ {
+ "label": "flash",
+ "type": "shell",
+ "command": "nrfjprog -f nrf52 --program rt-thread.hex --sectorerase",
+ "group": "build",
+ "problemMatcher": []
+ },
+ {
+ "label": "flash_softdevice",
+ "type": "shell",
+ "command": "nrfjprog -f nrf52 --program packages/nrf5x_sdk-latest/components/softdevice/s132/hex/s132_nrf52_7.0.1_softdevice.hex --sectorerase",
+ "problemMatcher": []
+ },
+ {
+ "label": "erase",
+ "type": "shell",
+ "command": "nrfjprog -f nrf52 --eraseall",
+ "problemMatcher": []
+ },
+ {
+ "label": "reset",
+ "type": "shell",
+ "command": "nrfjprog -f nrf52 --reset",
+ "problemMatcher": []
+ }
+ ]
+} \ No newline at end of file
diff --git a/bsp/nrf5x/nrf52832/README.md b/bsp/nrf5x/nrf52832/README.md
index 8892190001..e5f46d456f 100644
--- a/bsp/nrf5x/nrf52832/README.md
+++ b/bsp/nrf5x/nrf52832/README.md
@@ -2,7 +2,7 @@
## 简介
-该文件夹主要存放所有主芯片为nRF52840的板级支持包。目前默认支持的开发板是官方[PCA10040](https://www.nordicsemi.com/Software-and-tools/Development-Kits/nRF52-DK)
+该文件夹主要存放所有主芯片为nRF52832的板级支持包。目前默认支持的开发板是官方[PCA10040](https://www.nordicsemi.com/Software-and-tools/Development-Kits/nRF52-DK)
主要内容如下:
- 开发板资源介绍
@@ -61,6 +61,30 @@ PCA10040-nrf52832开发板常用 **板载资源** 如下:
4. 输入`scons --target=mdk4/mdk5/iar` 命令重新生成工程。
+### VS Code开发支持
+
+配置步骤:
+
+1. 在命令行设置以下两个环境变量:
+
+ ```bash
+ export RTT_CC=gcc
+ export RTT_EXEC_PATH=<工具链路径/bin>
+ ```
+
+2. 搜索插件`Cortex-debug`并安装。
+3. 安装[nRF Command Line Tools](https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Command-Line-Tools)以支持`nrfjprog`命令。
+4. 在.vscode/settings.json内配置工具链和`JlinkGDBServer`,sample:
+
+ ```json
+ {
+ "cortex-debug.armToolchainPath": "/usr/local/gcc-arm-none-eabi-9-2019-q4-major/bin/",
+ "cortex-debug.armToolchainPrefix": "arm-none-eabi",
+ "cortex-debug.JLinkGDBServerPath": "/Applications/SEGGER/JLink/JLinkGDBServer"
+ }
+ ```
+
+5. 点击`终端`->`运行任务`->`build`编译,点击`终端`->`运行任务`->`flash`烧录,点击左侧`debug`->`run`使用VS Code进行debug。
## 支持其他开发板
diff --git a/bsp/nrf5x/nrf52832/rtconfig.py b/bsp/nrf5x/nrf52832/rtconfig.py
index 219d20d303..3be0db8de1 100644
--- a/bsp/nrf5x/nrf52832/rtconfig.py
+++ b/bsp/nrf5x/nrf52832/rtconfig.py
@@ -54,7 +54,9 @@ if PLATFORM == 'gcc':
else:
CFLAGS += ' -O2'
- POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
+ POST_ACTION = OBJCPY + ' -O binary $TARGET rt-thread.bin\n'
+ POST_ACTION += OBJCPY + ' -O ihex $TARGET rt-thread.hex\n'
+ POST_ACTION += SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains