Linux环境准备
Environment Introduction
This tutorial covers the environment setup:
- System: Fedora 43 KDE Edition Linux
- System kernel: Linux 6.19.12-200.fc43.x86_64
- Architecture: X86_64 (amd64)
Other Linux environments are also acceptable.
Install various software and environments
Install CubeMX

Download link:
https://www.st.com.cn/zh/development-tools/stm32cubemx.html
推荐下载最新版本(此时最新版本是6.15.0)


Decompress it.

用root权限打开这个软件SetupSTM32CubeMX-6.15.0(不建议)
sudo ./SetupSTM32CubeMX-6.15.0
(更建议:也可以不用root权限打开,但在选择安装路径的时候注意以下,自己改成/home/xxx里的某个文件夹里)
./SetupSTM32CubeMX-6.15.0

In the newly popped-up window, just keep clicking Next until the installation finishes. When it looks like the image below, the installation is successful.

/usr/local/STMicroelectronics/STM32Cube/STM32CubeMX(如果你不是root权限安装的,你的路径不是这个,需要选择对应的路径)进入这个文件夹,然后打开终端输入
./STM32CubeMX

Next, you can configure a desktop shortcut for CubeMX application for quick access. For detailed instructions, refer to the Appimage section of the Vinci Robotics Team Linux Beginner Tutorial. You can use Ctrl+F to quickly locate that section.
The desktop shortcut is as follows:
(如果你不是root权限安装的,你的路径不是这个/usr/local/STMicroelectronics/STM32Cube/STM32CubeMX/,需要选择对应的路径)
[Desktop Entry]
Name=STM32CubeMX
Exec=/usr/local/STMicroelectronics/STM32Cube/STM32CubeMX/STM32CubeMX
Icon=/usr/local/STMicroelectronics/STM32Cube/STM32CubeMX/help/STM32CubeMX.png
Type=Application
Categories=Development;Electronics;Embedded;
Comment=STM32CubeMX configuration and code generation tool
Terminal=false
Just follow the tutorial, and you'll be able to achieve this effect.


Install VSCode
https://code.visualstudio.com/Download

If it's a Debian-based system, download the .deb; if it's an RHEL-based system, download the .rpm.
After downloading, open your browser, locate the folder containing this installation package, and open a terminal in that path.

Debian-based: Enter sudo apt install ./code then press the tab key to autocomplete the filename, then press Enter.
RHEL series: Enter sudo dnf install ./code and then press the tab key to autocomplete the filename, then press Enter.
For example, after completion:
sudo dnf install ./code-1.102.1-1752598767.el8.x86_64.rpm

安装openOCD
Install
我们主要用openocd来进行debug,这样才支持LiveWatch,而pyocd暂时不支持。
# Debian系(如Ubuntu,但Ubuntu一般自带的openocd版本太低了,可能需要自己自行从源码编译)
sudo apt install openocd
# 红帽系(如Fedora,一般openocd都是最新版,无需在意版本号问题)
sudo dnf install openocd

安装udev
先要知道:
/etc/udev/rules.d/
→ 你自己手工配置的规则,现在基本清空
/usr/lib/udev/rules.d/
→ Linux 软件包提供的系统规则
└── 60-openocd.rules
查看openocd是否在系统里自动装了udev了:
# debian系(ubuntu)
dpkg -L openocd | grep -E 'udev|rules'
# 红帽系(fedora)
rpm -ql openocd | grep -E 'udev|rules'
如下图,说明openocd安装过udev了。(这比pyocd方便多了)
