1925|0

504

帖子

4

TA的资源

纯净的硅(高级)

楼主
 

飞凌OK3568-C开发板基于vscode直接板上开发调试 [复制链接]

本帖最后由 qinyunti 于 2023-10-27 14:05 编辑

一.前言

前面我们搭建了libusb的开发环境进行编译和调试,但是都是基于命令行的方式,不是很方便。这一篇我们来介绍基于vscode的开发环境搭建。

 

二.安装vscode

sudo apt install software-properties-common apt-transport-https wget

 

wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add -

 

sudo add-apt-repository "deb [arch=arm64] https://packages.microsoft.com/repos/vscode stable main"

 

sudo apt install code

 

此时看到安装的vscode,但是还不能直接打开

 

 

 

需要按如下设置

 

 

输入code查找到vscode,右键点击Edit

 

 

修改命令行为/usr/share/code/code --no-sandbox --unity-launch %F,点击save

 

 

 

 

此时就可以打开vscode了

 

开始需要设置一个密码

 

 

 

 

 

三.Vscode使用

3.1打开文件夹

 

 

 

 

 

 

3.2编译配置

创建.vscode文件夹,下面创建tasks.json文件

输入以下内容

{

    // See https://go.microsoft.com/fwlink/?LinkId=733558

    // for the documentation about the tasks.json format

    "version": "2.0.0",

    "tasks": [

        {

            "label": "Build",

            "type": "shell",

            "command": "gcc libusb/*.c libusb/os/events_posix.c libusb/os/linux_udev.c libusb/os/linux_usbfs.c libusb/os/threads_posix.c ./examples/listdevs.c -Ilibusb -Ilibusb/os -Iexamples -lpthread -ludev -g -o listdevs",

            "problemMatcher": [],

            "group": {

                "kind": "build",

                "isDefault": true

            }

        }

    ]

}

此时可以菜单栏Terminal->Run Build Task...进行编译

 

 

 

3.3调试配置

安装c++扩展

 

 

 

 

 

创建launch.json文件

输入以下内容

{

    // Use IntelliSense to learn about possible attributes.

    // Hover to view descriptions of existing attributes.

    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387

    "version": "0.2.0",

    "configurations": [

        {

            "name": "(gdb) Launch",    

            "type": "cppdbg",

            "request": "launch",

            "program": "${workspaceFolder}/listdevs",   

            "args": [],

            "stopAtEntry": true,

            "cwd": "${workspaceFolder}",    

            "environment": [],

            "externalConsole": false,

            "MIMode": "gdb",    

            "setupCommands": [

                {

                    "description": "Enable pretty-printing for gdb",

                    "text": "-enable-pretty-printing",

                    "ignoreFailures": true

                }

            ],

        }

    ]

}

 

点击Run->Start Debugging

 

 

 

自动停在了main函数处

 

  

 

 

可以使用如下按钮进行执行控制,这样比直接使用gdb命令行调试更方便一些,阅读代码也更方便直观。

 

  

 

 

  • 总结

使用vscode轻量高效,推荐使用该方法。

得益于改开发板强劲的性能和完善的开发环境,可以直接将开发板作为开发主机进行来发,

并且基于vscode可以实现轻量化的ide开发,比命令行开发调试更高效,又避免了交叉开发的繁琐。

此帖出自ARM技术论坛
点赞 关注
 

回复
举报
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/9 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表