安装LSP
LSP(Language Server Protocol,语言服务协议)是新一代查看源码的神器。
Rust语言的LSP推荐使用rust-analyzer。
git clone https://github.com/rust-analyzer/rust-analyzer.git
cd rust-analyzer
cargo xtask install
VScode
如果使用VSCode,需要在安装完成VSCode之后再安装rust-analyzer。
安装完成后,VSCode是开箱即用的。
STM32CubeIDE
STM32CubeIDE是基于Eclipse的,因此只需要安装Rust的插件就可让STM32CubeIDE支持Rust语言
Rust插件
需要安装版本较新的Rust插件,否则无法支持rust-analyzer。
先增加地址:Help -> Install New Softwares... -> Add...
http://mirrors.ustc.edu.cn/eclipse/corrosion/releases/latest/

然后在Help -> Eclipse Marketplace...中搜索Rust并安装

Rust设置
点击 Window -> Rust 检查一下rustup,cargo,rust-analyzer等的路径是否正确。

调试
和调试C的代码一样,使用STLink可在STM32CubeIDE中给Rust的代码设置断点。


本文指导如何在STM32CubeIDE中启用Rust支持,包括rust-analyzer的安装、VSCode的配置以及调试步骤,适合STM32开发者接入Rust语言。
3421

被折叠的 条评论
为什么被折叠?



