Embedded STM32 microcontroller development environment configuration teaching Win/Mac
- This tutorial supports Windows and Mac
- Windows optional development software for Keil, Clion, STM32CubeMX, free choice of development methods
- Mac development environment is (Clion+OpenOCD+STM32CubeMX), only supports HAL library
Windows Configuration Tutorial
There are various combinations of tools to develop Stm32 on Windows, you can simply use Keil to develop library functions, Hal library and registers, or you can use Stm32CubeMX with Keil to develop STM32 Hal library, or you can use the combination of CLion+OpenOCD+STM32CubeMX to develop Hal library in a more modern way. Hal library, each way has its advantages, the reader can choose a more suitable for their own development, I use the third is CLion + OpenOCD + STM32CubeMX combination, in addition to this chapter will talk about the installation and configuration of the software and the environment will also be the use of the configuration of the software project files in each development method of the configuration of the basic overview.
Keil5 Configuration Tutorial
Required installation package download address: Keil5 configuration package.zip
Link:/s/1joWgDoV7qujdAT3Jack0_w?pwd=nbvw
Extract code: nbvw
I. Introduction to the software
Microcontroller Development Kit (MDK for short) is a convenient development tool developed by Keil, an ARM company, for the ARM series of microcontrollers, which supports most of the microcontroller series on the market.
Second, environment configuration notes!!!
1. All paths of the installation do not have to be able to have Chinese appear!
2. Before configuring the environment please remove all on the computer!Note all!The antivirus software is all turned off including the security center that comes with Windows is also all turned off!!!!
Windows Security Center shutdown method:
- Click "Settings" > "Privacy & Security" > "Windows Security Center" > "Open Windows Security Center".
- Click on "Virus and Threat Protection" and "Firewall and Network Protection" to turn off the protection.
3. There should be the following files and folders in the unzipped folder after downloading, please check if they exist first.
·
· Keil.STM32F4xx_DFP.2.13.
· keil.STM32F1xx_DFP.2.2.
· .5.7.
· keygen_new2032.exe
- Serial debugging assistant (folder)
- ST-LINK driver (folder)
- CH340 Driver(USB Serial Driver)_XP_WIN7 Shared (Folder)
As shown in the figure below:
4. The installation configuration file is virus-free. If it is mistakenly deleted by the security software, please close the security software and recover the "harmonized" files from the security software with a small hand.
In the location shown in the figure below: check the files that will be quarantined by the discovered threats and select "Allow on device" and then click "Perform action".
III. Installation steps
1. Right mouse button click on " " and select start as administrator for installation
Click Next to start the installation
2. Installation in any position
Any location can be installed, but it is recommended that the installation location to choose the D-disk to prevent the later C-disk full (C-disk clean setup specific methods of operation can be viewed in my Blogs for this:Win11 Reduce C Disk Occupancy and Refresh System Configuration Tutorials)
Installation process will be required to fill in the name and address and other contact information, this part of whatever fill in what will not affect the subsequent use can be filled in freely!
Fill out the information and wait patiently for the installation can be completed in the process may appear CMD window, after the completion of the installation click Finish to complete the installation of the software body!
After clicking Finish, a Keil interface will appear, in this interface, select the upper-left corner of the Packs, remove the Check For Updates on launch and close the window, ignore the prompts.
3. Install the chip driver package
After installing the software, we also need to install the STM32 software driver package, we provide in the learning and project process commonly used in the F1 and F4 chip driver package for you to use, in turn, click on the beginning of the folder "Keil.STM32F4xx_DFP.2.13." and "keil.STM32F1xx_DFP.2.2." to install can be, the step may be Refer to the installation procedure of the software itself.
4. Cracking methods
After installation, we can not normally use this software also need to crack it, first of all in the desktop or in the start menu to find the installation of Keil5 software ("keil uVision5"), right-click to open as an administrator, select the upper left corner of the "File" under the "License Management" and copy the pop-up window inside the CID.
Then open the cracking software in the folder"keygen_new2032.exe"(PS: If you don't close the security center before unpacking, this cracker may be checked by the security center.) Paste what you just copied into the CID box.Target optionARMThe drop-down box below selects theProfessionalThen click Generate to get an activation code for the software.
Then copy the activation code and fill in the New License ID Code, click Add LIC, the activation content will appear in the middle table area, that is, the activation is successful.
At this point, the installation of keil has come to a perfect end. !!!!!!!!!!!!!!!!
STM32CubeMX Installation and Configuration Tutorial
I. Introduction to the software
STM32CubeMX is a graphical configuration tool for STM32 chips that ST STMicroelectronics has been strongly recommending in recent years, aiming at the convenience of developers, allowing users to use a graphical wizard to generate the C initialization code, which can greatly reduce the development work, time and cost, and improve the development efficiency.STM32CubeMX covers almost the whole series of STM32 chips. On CubeMX, the configuration can be realized through foolproof operation, from MCU/MPU selection, pin configuration, system clock and peripheral clock setting, to peripheral parameter configuration, middleware parameter configuration, it provides STM32 developers with a simple, convenient, and intuitive way to complete these tasks, and it can also generate the corresponding project and initialization C code according to the selected IDE after the completion of the configuration. After all configurations are done, it can generate the corresponding project and initialize C code according to the selected IDE. In addition, STM32CubeMX provides a power calculation tool that can be used as a reference for evaluating power consumption in product design. Finally, it can generate C code and support various tool chains, such as MDK, IAR For ARM, TrueStudio, etc. It saves our time to configure various peripherals, which greatly saves our time. Moreover, as ST stops updating the standard libraries, the ST official strongly recommends the use of CubeMX with the HAL libraries, although the standard libraries are still the home ground now. Although it is still the home of the standard library, the use of CubeMX is increasing year by year, so learning the basic use of CubeMX is also one of the skills we need to master.
The CubeMX/HAL library uses learning links:/UH7Ah
Java Official Site:/en/download/
CubeMX installation official website:/Designresource/detail/software/711298
II. Installation of software
1. Go to the STM32CubeMX website given above and click on download (Download in the official website need to register under the ST official account, the latest for the 6.10.0 version, the software itself is free, the use of Clion as a development tool do not download the latest version, it is recommended to download 6.4.0.After getting the installer, right-click on it and select Run with Administrator Privileges and select "Install For All Users".
2. Click Next on the screen that appears.
3. Select the installation path of the interface is recommended to install the software to the D disk, the size of the later software packages have a slightly larger installed in the D disk can prevent the C disk is full of impact on the speed of the system running
4. After that, always select Next and choose the default configuration to complete the installation.
Installation of chip driver package
Open the installed STM32CubeMX software and click Help->Manageembeddedsoftware packages above, a model selection interface will pop up to check the HAL library you want to install, click "InstallNow" until the installation is successful. Click "InstallNow" until the installation is successful.
At this point, the installation of STM32CubeMX is perfectly finished !!!!!!!!!!!!!!!!
OpenOCD Installation and Configuration Method
OpenOCD installation address:Download OpenOCD for Windows ()
I. Introduction to tools
OpenOCD (Open On-Chip Debugger) is an open source open on-chip debugging software, the need for debugging adapters (such as: JTAG, SWD, etc.) with the corresponding debugging of the system-on-chip, as well as in the embedded device to test the system program or boundary-crossing scanning test.
II. Installation methods
1. Select Download OpenOCD from the above link and unzip it.
2. Add the bin directory of the unzipped file to the environment variable and then you can use it.
First of all, open the system settings, in the search box, search for "environment" select Edit System Environment Variables, in the pop-up window, select the "Environment Variables" a
Then double-click on "Path" in the "System Variables" pane below to enter the editing window of the system environment variable.
Finally, click "Browse" in the pop-up window and select the Bin folder of OpenOCD.
At this point, the installation of OpenOCD has ended perfectly !!!!!!!!!!!!!!!!
Clion installation and configuration for embedded development
Clion installation address:CLion: A Cross-Platform IDE for C and C++ by JetBrains
I. Introduction to the software
Clion is Jetson launched a C and C + + integrated development environment, which can support embedded development, although this software is paid but if you are students or educators can apply for free use but the speed through the slow roughly 1Days like, there is another way to do not do too much reminiscence here (why don't you take a look at the almighty Tao Bao it???). Why don't you check out the almighty Tao Po?)
Also since Clion comes with MinGW, there is actually no need to re-download MinGW again to configure Clion as other online tutorials have said!!!!
II. Installation Tutorial
Clion's installation is relatively simple, we will not expand in detail here, the only thing to note is that in the installation interface, remember to check the "Add Bin file to the PATH" to avoid adding too much trouble later on, but after the installation is complete, you need to reboot to update the system environment variables.
III. Embedded Development Configuration
After installing Clion, STM32CubeMX and OpenOCD, you can start to configure Clion's embedded development environment, because the new version of Clion can not be opened in the startup interface to set up the software (or maybe I did not find the entrance?), readers can first create a new project and open it. The reader can create a new project and open it, click "File" -> "Build, Execute, Deploy" -> "Embedded Development" on the main page of the project, and then you need to select the installation path of the bin file corresponding to the reader's STM32CubeMX and OpenOCD, and generally speaking, the environment variables of STM32CubeMX and OpenOCD will be added. Generally speaking, after adding the environment variables of STM32CubeMX and OpenOCD, Clion will automatically update the path, but if the path is not automatically updated, you can also click on the back of the three points to manually select the path of the software.
After selecting the path to the software, you can click the Test button to test whether STM32CubeMX and OpenOCD are successfully configured on top of Clion, if the pop-up message after clicking Test is green, it means the configuration is correct.
At this point, the installation of Clion's embedded configuration has come to a perfect end. !!!!!!!!!!!!!!!!
Mac Configuration Tutorial
Due to the specificity of the Mac system, Mac temporarily can not install Keil, so only to choose to elegantly use CLion + OpenOCD + STM32CubeMX this set of cross-platform open source development tools, this set of tools to modernize the IDE tools Clion as the core, can be used to copy the development of multiple AI plug-ins such as Github's Copliot, the author's former development tools for this, with that is a long way to go!
Since the configuration method of Stm32CubeMX and Clion on Mac is almost the same as that on Win, you can refer to the installation process of Windows for the relevant content, this section only introduces the installation method of HomeBrew and OpenOCD on Mac.
The download paths for related software and tools on Mac are given here:
Clion:/clion/
STM32CubeMX:/en/development-tools/#get-software
HomeBrew Installation
I. Introduction to tools
Homebrew is a popular package manager designed for the MacOS (and Linux) operating systems. It allows users to easily install, update, and manage software packages through a command line interface.The main advantages of Homebrew are its ease of use, flexibility, and community support. Users can install the software they need with simple commands, without the need for a complicated configuration process. Homebrew works by managing the formulas (Formulas) of software packages through a central repository called Homebrew Formulae. Each formulae is a Ruby script that defines how to download, configure, compile, and install the software.The Homebrew community constantly updates these formulas to ensure that the packages are up-to-date and compatible.
II. Installation methods
Open the Mac's Terminal command line
1. Check if HomeBrew is available on your system
brew -v #If there is an output, it means that HomeBrew exists on the computer.
2. Uninstall HomeBrew if you have it.
/bin/bash -c "$(curl -fsSL /Homebrew/install/HEAD/)"
Similar to ROS, HomeBrew has an automated one-click install script (but you may need to hook up an agent for ke xue shang wang).
/bin/bash -c "$(curl -fsSL /Homebrew/install/HEAD/)" # Just follow the prompts and install step by step!
The following image appears to indicate that HomeBrew has been successfully installed
At this point, the installation of HomeBrew on Mac is perfectly finished !!!!!!!!!!!!!!!!
OpenOCD Installation
Mac due to the Unix kernel, so in the HomeBrew package management tool under the auspices of the Mac configuration environment to download tools than Win will be much easier, such as OpenOCD on the Mac can be installed and configured with just a single line of code to complete!
brew install open-ocd #Download OpenOCD
ARM toolchain installation
Since the Mac is an Arm system, you need to install Arm's development toolchain (similar to MinGW in Win), which can also be quickly solved with two lines of commands.
brew tap ArmMbed/homebrew-formulae
brew install arm-none-eabi-gcc
In order to test whether the installation is successful, you can enter the following commands in the terminal to check, the output means that the installation is successful
arm-none-eabi-gcc -v
The next step is to modify the STM32CubeMX and OpenOCD paths in Clion, which is configured in the same way as Win, so I won't go into details.
Problem solving during installation:
Any problems and solutions encountered during the installation process or errors in the documentation are welcome to contact me for additions and deletions!