Ubuntu環(huán)境下,使用開(kāi)發(fā)STM32
Building STM32 development environment in Linux system
(Using Ubuntu 18.04 + Arm GNU Toolchain 12 + VS Code)
1.???? Add normal user to root:
(1)?? $ sudo vim /etc/sudoers
(2)?? Insert the command:

2.???? Install?Java
(1)?? Installation command:
$ sudo apt install openjdk-11-jdk
or $ sudo apt install openjdk-8-jdk (for other versions)
(2)?? verify installation:
$ java --version

(3)?? Add it to environment variable (optional):
$ sudo vim /etc/environment
add the java installation path: /usr/lib/jvm/java-11-openjdk-amd64

(4)?? Enable the change:
$ source /etc/environment
(5)? ?Verify the change:
$ echo $JAVA_HOME

3.???? Install the GCC-Arm:
(1)?? Download the gcc-arm toolchain:

(2)?? Copy the package to /usr/local/arm:
$ sudo cp arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi.tar.xz /usr/local/arm/

(3)?? Extract the package:
$ sudo tar -xvf arm-gnu-toolchain-12.3.rel1-x86_64-arm-none-eabi.tar.xz
(4)?? Add path to the environment:
$sudo vim /etc/profile

(5)?? After restart, verify the change:

(6)?? Set VSCode:

Find GCC installation path:


4.???? Install the OpenOCD:
(1)?? Use git to download the openocd:
$ git clone https://github.com/openocd-org/openocd.git
(2)?? Download the essential library:
$sudo apt install build-essential pkg-config autoconf automake libtool libusb-dev libusb-1.0-0-dev libhidapi-dev libtool libsysfs-dev
(3)?? Open the OpenOCD directory and enter $ sudo ./bootstrap

(4)?? Enter the $ sudo ./configure

(5)?? Enter $ sudo make and then enter $ sudo make install to finish the installation.
(6)?? Verify the installation:

5.?Install STM32CubeMX
(1)?? After unzipping the package, set the installation file as an executable file:
$ chmod 777 SetupSTM32CubeMX-6.9.1

(2)?? Run the installation application:
$./SetupSTM32CubeMX-6.9.1
(3)?? After finishing the installation, add STM32CubeMX path to environment variable:
$ sudo vim ~/.bashrc

And then adding this command to the end of file:

Save and quit Vim. Next enable the change:
$source ~/.bashrc

(4)?Verify the Change:

6.?Add STM32CubeProgrammer to the environment path:
$ sudo vim ~/.bashrc and then $ source ~/.bashrc

7.?Install the STM32CubeCLT:

8.?VSCode and Makefile setting:
(1)?? VScode

get Defines from Makefiles:

(2)?? Add?make flash command to Makefile file:

9.???? Set full screen display in Virtualbox:


