一、所需资源文件
序号 | 文件 | 描述 | 连接 |
---|---|---|---|
1 | SEGGER Embedded Studio (SES) | SEGGER推出的集成开放环境 | SES下载 |
2 | nRF Mesh.apk | 安卓手机端APP | APP下载 |
3 | nRF5_SDK_17.0.2_d674dde.zip | nRF5软件开发包 | 开发包 |
4 | nrf5_SDK_for_Mesh_v5.0.0_src.zip | Mesh软件开发包 | mesh SDK |
其中软件安装至相应平台,SDK开发包放置纯英文路径并解压。
二、安装SES
直接下载Embedded Studio for ARM V5.62版本,按照提示顺序安装完成即可,无需激活步骤可直接使用。
1、打开SES,选择Tools -> Package Manager 找到NORDIC
2、选中nRF CPU Support Package 右键 选中 install selected packages后,点击next->nesxt等待安装完成即可
3、打开Projects -> Open existing找到解压后的SDK包,并打开路径nrf5_SDK_for_Mesh_v5.0.0_src\examples\light_switch\server\light_switch_server_nrf52832_xxAA_s132_7_2_0.emProject
三、编译工程
打开工程后,根据SES.md文件内容提示,首先配置SDK_ROOT路径
# Segger Embedded Studio: SDK_ROOT first time setup
Segger Embedded Studio determines the location of the nRF5 SDK through macros.
Before building the Bluetooth mesh examples with SEGGER Embedded Studio, you must complete
a one-time setup of the `SDK_ROOT` macro in SEGGER Embedded Studio.
You can either:
- Use the default settings of the `SDK_ROOT` macro. It defaults to an nRF5 SDK 17.0.2
instance unzipped right next to the nRF5 SDK for Mesh folder.
- Set the `SDK_ROOT` macro to a custom nRF5 SDK instance.
To set the `SDK_ROOT` macro manually in SEGGER Embedded Studio:
1. Go to "Tools" -> "Options".
2. Select "Building".
3. Under "Build" in the configuration list, edit "Global macros" to
contain `SDK_ROOT=<the path to nRF5 SDK instance>`.
4. Save the configuration.
You can verify the path by opening one of the source files under the nRF5 SDK
file group. If the macro is set correctly, the file opens in the editor
window. If not, an error message is displayed with information that the file cannot
be found.
此处指明了该mesh SDK包对应那个版本的nRF5 SDK包,并且如何设置SDK_ROOT宏
接下来,编译执行即可;
编译:Build -> Build light_switch… 快捷键【F7】
执行:Debug-> Go 快捷键【F5】
执行成功后,电路板2个LED快闪2次,即表示运行成功。此时用手机nRF Mesh可以搜索到对应设备。
至此完成环境搭建及程序运行。