vscode+cmake编译Telink Demo

第一步:安装Telink_RDS

What?还是要安装Telink_RDS,我安装了Telink_RDS,我还用VSCode?
哦,如果你不想安装Telink_RDS,那在这里来下载Telink_RDS里面的工具链,也可以,因为安装Telink_RDS就是为了用它的工具链,它的编辑代码的环境还是没有VSCode舒服的。
Telink_RDS下载地址:http://wiki.telink-semi.cn/tools_and_sdk/Tools/IDE/telink_v323_rds_official_windows.zip
安装过程就不说了
如果只下载了工具链,下载下来解压到一个路径下,后面会用这个路径。

第二步:配置vsCode

用vsCode打开B91_Driver_SDK下的B91_Driver_Demo文件夹,
Ctrl+Shift+p打开命令栏,输入settings,选择“打开工作区设置(JSON)”,添加settings.json
image.png

在settings.json中添加

{
    "terminal.integrated.env.windows": {
        "path":"D:/Programs/Python/Python38/Scripts;D:/Andestech/AndeSight_RDS_v323/toolchains/nds32le-elf-mculib-v5f/bin/;D:/Andestech/AndeSight_RDS_v323/cygwin/bin/"
    }
}

注意:这里的路径都要替换成你电脑上的路径哦;就是前面下载的工具链中的两个文件夹,加一个cmake的路径
注意:这里不用cygwin里的cmake,原因是它的加载路径是/cygwin/**/*打头的,到时候编译错误,你就不好定位

第三步:编辑CMakeLists.txt

官方模板:http://wiki.telink-semi.cn/telink-document-package/CMakeLists.txt
需要小小的一点改动,来避免cmake的工具链测试异常
image.png

第四步:CMake

这里需要注意的是检查不要用到cygwin里面的cmake了
打开终端,执行命令 “Get-Command cmake”,可以查看cmake的路径

PS E:\Work\TeLink\B91_BLE_SDK\eagle_ble_sdk\build> Get-Command cmake

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     cmake.exe                                          0.0.0.0    D:/Programs/Python/Python38/Scripts\cmake.exe


PS E:\Work\TeLink\B91_BLE_SDK\eagle_ble_sdk\build>

然后逐步执行:

mkdir build
cd build/
cmake .. -G 'Unix Makefiles'

结果如下:

PS E:\Work\TeLink\B91_Driver_SDK\B91_Driver_Demo> mkdir build


    目录: E:\Work\TeLink\B91_Driver_SDK\B91_Driver_Demo


Mode                 LastWriteTime         Length Name                                                                                                                                                                                             
----                 -------------         ------ ----                                                                                                                                                                                             
d-----         2021/7/20     11:04                build                                                                                                                                                                                            


PS E:\Work\TeLink\B91_Driver_SDK\B91_Driver_Demo> cd .\build\
PS E:\Work\TeLink\B91_Driver_SDK\B91_Driver_Demo\build> cmake .. -G 'Unix Makefiles'
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: D:/Andestech/AndeSight_RDS_v323/toolchains/nds32le-elf-mculib-v5f/bin/riscv32-elf-gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: D:/Andestech/AndeSight_RDS_v323/toolchains/nds32le-elf-mculib-v5f/bin/riscv32-elf-g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM compiler identification is GNU
-- Found assembler: D:/Andestech/AndeSight_RDS_v323/toolchains/nds32le-elf-mculib-v5f/bin/riscv32-elf-gcc.exe
-- Configuring done
-- Generating done
-- Build files have been written to: E:/Work/TeLink/B91_Driver_SDK/B91_Driver_Demo/build

到这里,cmake就搞定了,
后面执行make就可以编译了。

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值