1. Install STLink driver
1. Install dependencies
sudo apt-get install cmake
sudo apt-get install libgtk-3-dev
sudo apt-get install libusb-dev
sudo apt-get install libusb-1.0-0-dev
2. Get stlink source code
git clone https://github.com/texane/stlink
3. Compile stlink
cd stlink
make release
make debug
cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make
cd Release
sudo make install && sudo ldconfig
cd ../.. && sudo cp etc/udev/rules.d/* /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger
4. Add rules for udev rules
1> lsusb check product ID and vendor ID of STM development board
2> Add product id and vendor id corresponding to the development board
sudo vim /etc/udev/rules.d/49-stlinkv2.rules, add the following:
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", \
MODE="660", GROUP="plugdev", TAG+="uaccess", ENV{ID_MM_DEVICE_IGNORE}="1", \
SYMLINK+="stlinkv2_%n"
2. Software development tools
1.STM32CubeProgrammer
1> Introduction
STM32CubeProgrammer for short STM32CubeProg, is a cross-platform, all-in-one program programming tool for STM32 series products.
- "Cross-platform" is reflected in the support of Windows, macOS and Linux operating systems, so the software requires a Java environment to run.
- "All-in-one" is reflected in the support of USB, ST-LINK, UART, OTA to burn firmware.
2> Download link
STM32CubeProg
3> Installation steps
-
Installation premise: Since ST's tools are developed using Oracle's JDK, you need to install Oracle's JDK on ubuntu
-
jdk installation (download link: jdk )
sudo mkdir /usr/lib/jvm
sudo tar -xzvf jdk-8u60-linux-x64.tar.gz -C /usr/lib/jvm
//系统注册jdk
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_60/jre/bin/java 300
//切换jdk版本
sudo update-alternatives –config java
- STM32CubeProgrammer installation
//解压下载的安装包
unzip en.stm32cubeprog.zip
//执行安装程序
./stm32cubeprog/SetupSTM32CubeProgrammer-2.2.1.linux
2. STM32CubeMX installation
1> Introduction
STM32CubeMX is a graphical tool, through which we can easily configure related peripheral parameters and generate corresponding initialization code. Therefore, it allows us to focus more on the writing of actual product logic code without spending too much time on the configuration of various peripheral registers and the call of basic library functions, which greatly improves our software. Development efficiency.
2> Download link
STM32CubeMX
3> Installation steps
One-click installation