Visual Studio Code 嵌入式开发环境

使用下一代的嵌入式IDE-PlatformIO 教程 1.生成工程 1.1 打开STM32CubeMX: 选择你的MCU,这里我用的是STM32F103RC RCC中开启外部HSE时钟,外部时钟比HSI更稳定些 开启DEBUG 4线 打开串口1用于打印调试信息,波特率115200,校验位0,停止位1 打开串口2用于MODBUS协议,波特率9600,校验位0,停止位1 接入RT-thread:参考官方文档 基于 CubeMX 移植 RT-Thread Nano 根据官方文档,需要1.取消生成HardFault_Handler、PendSV_Handler、Sy 阅读详情

Visual Studio Code 嵌入式开发环境

写在前面

还记得你上一次打开嵌入式集成开发环境(例如 KEIL、IAR)是什么时候吗?随着开源软件的流行,用到 KEIL、IAR 此类付费 IDE 的机会是越来越少了。写代码用“现代化”的代码编辑器、代码编译用 GCC、调试代码用 GDB,这些工具几乎都是可以跨平台使用,当迁移开发环境时,重新学习成本也是相对小很多。

Visual Studio Code 是由微软开发,同时支持 Windows 、 Linux 和 macOS 等操作系统且开放源代码的代码编辑器,支持测试,并内置了 Git 版本控制功能,同时也具有开发环境功能,例如代码补全、代码片段和代码重构等。[维基百科]

如果搭配一些扩展工具以及 GNU ARM 嵌入式工具链,VS Code 可以完全替代其他嵌入式 IDE。本文将介绍如何基于 Visual Studio Code 来搭建嵌入式开发环境 ,以实现快速开发调试嵌入式应用。

硬件平台

  • 本文使用 nRF52840-MDK 开发板,其他开发板类似
  • Windows/macOS/Linux PC

安装 Visual Studio Code

  1. 根据使用的操作系统,直接从 Visual Studio Code 官网下载安装最新版本
  2. 打开 VS Code,点击 “Extensions” 图标
  3. 搜索 C/C++ 插件(由 Microsoft 提供),点击安装
    安装 C/C++ 插件

安装 pyOCD

pyOCD 是使用 Python 实现的、开源、跨平台的调试工具,配合基于 CMSIS-DAP 的硬件调试器,可以下载调试市面上绝大部分 Arm Cortex-M 微控制器。没错,你可以简单地认为这就是开源版的 J-Link 软件!

最新稳定版本的 pyOCD 可以通过 pip 安装,命令如下:

pip install -U pyocd

安装 GNU Arm Embedded Toolchain

你还需要用 GCC 编译、GDB 调试,GNU Arm Embedded Toolchain 是目前使用比较广泛的嵌入式工具链,该工具链已经由 Arm 官方维护,比较稳定可靠了。

根据所使用的操作系统,从官网下载适当版本并安装。安装完成后,你需要将工具链的 bin 目录添加到系统环境变量中。

# 将工具链 bin 目录添加到系统环境变量中
export PATH="<path to install directory>/gcc-arm-none-eabi-6-2017-q2-update/bin:${PATH}"

然后验证是否能够正常使用:

arm-none-eabi-gcc --version

配置调试功能

Visual Studio Code 使用 launch.json 文件来对调试功能进行配置,可以参考以下步骤:

  1. 打开项目工程目录

  2. 在项目根目录下找到 .vscode/launch.json 文件,没有的话则自己新建。在该文件中输入以下配置:

{
   
   
    "version": "0.2.0",
    "configurations": [
        {
   
   
            "name": "C++ Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceRoot}/armgcc/_build/nrf52840_xxaa.out",
            "args": [],
            "stopAtEntry": true,
            "cwd": "${workspaceRoot}"
告别Arduino IDE:用VS Code与Arduino CLI打造专业级开发环境 在嵌入式开发中,集成开发环境(IDE)和命令行工具(CLI)是提升效率的核心。传统IDE提供了便捷的图形化操作,但在处理复杂项目、代码导航和自动化构建时往往力不从心。命令行工具则通过脚本化和可编程接口,为构建、库管理和部署流程带来了高度的灵活性与可重复性。结合现代代码编辑器强大的智能感知和项目管理功能,开发者能在保留原有生态便利的同时,实现高效的代码编写、调试与版本控制。本文以Arduino开发为例,深入解析如何将Arduino CLI的命令行能力与Visual Studio Code的编辑特性深度融合,构 阅读详情

相关推荐

打造嵌入式开发利器——超强IDE工具VS Code

通过安装必要的扩展和进行基本的配置,你可以将VS Code打造成无敌的嵌入式开发神器。通过安装C/C++扩展和嵌入式开发相关的扩展(如PlatformIO IDE、Arduino和Cortex-Debug),你可以轻松创建、编译和调试嵌入式项目。总之,通过将VS Code与适当的扩展和配置相结合,你可以将其打造成一个强大的嵌入式开发工具。在众多的IDE工具中,Visual Studio Code(简称VS Code)凭借其灵活性、扩展性和强大的功能成为了许多开发者的首选。),搜索并安装"C/C++"扩展。

DevCyberX的博客 507

pyOCDgdb:基于pyOCD的GDB服务器

pyOCDgdb pyOCDgdb 是一个完整的 GDB 服务器,使用库实现。 借助适当的 GDB 客户端,pyOCDgdb 提供了一个远程目标,可用于在源代码级别调试 pyOCD 支持的任何嵌入式系统。 安装 要安装最新的开发版本(master 分支),您可以执行以下操作: $ pip install --pre -U https://github.com/ < user> /pyOCDgdb/archive/master.zip 请注意,您可能会遇到运行这些命令的权限问题。 您在这里有几个选择: 使用sudo -H运行以全局安装 pyOCDgdb 和依赖项 指定--user选项以本地安装到您的用户 在特定项目工作集的本地运行命令。 您还可以通过克隆 git 存储库并运行来从源代码安装 $ python setup.py install 独立 GDB 服务器 安装 pyOC

Python库 | pyocd-0.24.0-py2.py3-none-any.whl

资源分类:Python库 所属语言:Python 资源全名:pyocd-0.24.0-py2.py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.youkuaiyun.com/article/details/101784059

Transformers 中的 Softmax 可以并行加速么?

通过融合前两个计算步骤,降低执行Reduce_max和Reduce_sum等操作的通信开销。利用共享内存来存储临时数据,以减少对全局内存的访问成本。

stephen147的博客 1234

【Python】SUMO + Python 联合仿真平台

强化学习的核心思想是让智能体 (Agent) 通过与环境 (Environment) 的交互来学习如何做出最优决策,以最大化累积奖励 (Cumulative Reward)。在交通场景中,智能体可以是交通信号控制器、自动驾驶车辆或交通管理中心,环境则是 SUMO 模拟的交通路网,奖励则与交通效率、安全、环保等目标相关。交通系统本质上是动态的、随机的、高度复杂的系统,传统的基于规则或模型的优化方法在面对不断变化的需求和突发事件时,往往显得力不从心。强化学习的优势在于:在交通领域,强化学习已经被广泛应用于:为了

宅男很神经 1989

深入解析国家企业征信系统瑞数6vmp算法逆向实战

本文深入解析了国家企业征信系统所采用的双层防护机制,重点聚焦于瑞数6代vmp算法的逆向实战。文章详细拆解了从加速乐521状态码的绕过,到瑞数412挑战的核心算法还原过程,提供了通过动态Hook、日志分析进行算法逆向,并用Python实现自动化请求链的完整技术方案,旨在为安全研究与技术学习提供参考。

yellow的专栏 612

【深度学习驱动流体力学】完整配置安装 OpenFOAM 及其所需的ThirdParty与QT5工具

针对以上文件及文件目录介绍其功能特性:Allclean:这是一个脚本或命令,通常用于清理(即删除)所有编译生成的临时文件和目标文件。执行后,可以将编译过程中生成的中间文件和已编译的程序删除,以便重新开始编译或者清理空间。Allwmake:这是一个脚本或命令,用于编译并安装ThirdParty-10目录中的所有软件包。执行此命令会遍历所有子目录,编译其中的软件包并将它们安装到指定位置。这是一个脚本或命令,用于编译和安装Libccmio库。

源代码杀手的博客 1997

学习STM32的CAN总线通信

在配置时,确保您启用了CAN总线功能。CAN节点是CAN总线上的一个设备,每个节点都有唯一的标识符。在CAN总线中,有两种类型的节点:CAN控制器和CAN外设。步骤2:配置CAN总线 在STM32CubeMX中,选择CAN总线模块并进行必要的配置。在CAN总线中,有两个重要的概念:CAN节点和CAN帧。步骤5:测试CAN总线通信 在成功编译和烧录代码后,您可以使用串口调试助手或其他CAN总线工具来测试CAN总线通信。步骤3:编写CAN总线通信代码 在项目的主代码文件中,我们将编写CAN总线通信的示例代码。

2401_85258012的博客 496

innovus: 如何让两个generate clock balance skew group?

如题,在sdc约束中两个generate clock被设置到同一个clock group中,工具虽然会生成对应的两个skew group,但是阅读ccoot_spec发现工具并没有让两个skew group进行balance,这时就需要手动设置balance skew group。我正在「拾陆楼」和朋友们讨论有趣的话题,你⼀起来吧?

m0_61544122的博客 4049

Matlab仿真:均匀面阵方向图、均匀线阵方向图、均匀圆阵方向图

其中,阵列方向图是评价阵列性能的重要参数之一。均匀面阵由若干个相同的阵元构成,阵元间等距排列,阵元的方向图形状为一个圆盘。均匀线阵由若干个相同的阵元构成,阵元间等距排列,阵元的方向图形状为一个矩形。本文将采用Matlab进行仿真,分别实现均匀面阵方向图、均匀线阵方向图和均匀圆阵方向图,并对三种阵列进行比较分析。通过以上代码仿真,我们可以对均匀面阵、均匀线阵和均匀圆阵进行方向图的绘制,进一步分析不同阵列在天线性能方面的差异。Matlab仿真:均匀面阵方向图、均匀线阵方向图、均匀圆阵方向图。

2301_79326857的博客 3436

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

上一篇: Google OpenSK 快速入门指南
makerdiary
博客等级 码龄7年 2粉丝 2原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值