[嵌入式]WSL+Vscode+STM32开发环境配置

背景

基于WSL 安装Linux 实现STM32项目的编译下载和烧录

教程

https://lrl52.top/950/linux-build-embedded-env/
https://blog.youkuaiyun.com/qq_51769114/article/details/145268655

常用命令

手动安装arm-gnu-toolchain

  • 下载安装包
sudo wget -P /opt https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/13.2.rel1/binrel/arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz
  • 解压
 tar -xvf arm-gnu-toolchain-13.2.rel1-x86_64-arm-none-eabi.tar.xz
  • 移动到指定目录
sudo mv arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi /opt
  • 添加环境变量
sudo nano ~/.bashrc
export PATH=/opt/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin:$PATH
arm-none-eabi-gcc --version

错误处理:

miracle@miracle:/opt$ arm-none-eabi-gdb -v
arm-none-eabi-gdb: error while loading shared libraries: libncursesw.so.5: cannot open shared object file: No such file or directory

安装以下:

sudo apt install -y libncursesw5

安装gdb-multiarch

Ubuntu 官方 APT 源似乎对 gcc-arm-none-eabi 已经停止维护了,并且安装后不含有 arm-none-eabi-gdb 。可以考虑使用 gdb-multiarch 替代

sudo apt install gdb-multiarch

Cmake

安装stlink

git clone https://github.com/stlink-org/stlink.git
cd stlink
mkdir build
cd build
cmake ..
make
sudo make install

这下面两个链接也可以参考
https://lrl52.top/950/linux-build-embedded-env/
https://blog.youkuaiyun.com/qq_51769114/article/details/145268655

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值