Wiki
ARM Keil MDK (ARM microcontroller environment setup)
Existing English translations were reused. 6 current source blocks remain in Simplified Chinese, without triggering paid translation.
1.Introduction and Environment Recommendations
-
Keil MDK is official software under ARM. It is the most mainstream microcontroller development environment IDE, bar none.
-
Recommended versions:
-
Beginners: no-brainer ARM Keil MDK 5 + CubeMX (beginners must only install ARM Keil MDK 5 first, and are not allowed to use CubeMX)
-
Veterans: no-brainer VSCode + CMake + CubeMX
-
2.Arm Keil MDK 5 + CubeMX【推荐小鸟(新手)】
2.1.Introduction
-
The most mainstream development environment (even with many fatal flaws), bar none. Beginners should use it without thinking; beginners must use this solution to develop STM32.
-
The drawbacks are obvious: an ancient interface, ancient code completion, Windows-only support, and only an X86 32-bit version.
2.2.Windows
https://www.bilibili.com/video/BV18T411r7Yu
How to obtain the required documents:
-
Club USB drive (direct copy)
-
Official website:
-
MDK5 official website:https://www.keil.com/demo/eval/arm.htm
-
MDK5 firmware download link:https://www.keil.arm.com/devices/
-
ARM compiler download link:
-
ARMCC (AC5) required:https://developer.arm.com/downloads/view/ACOMP5?revision=r5p6-07rel1
-
ARMCLANG (AC6) is generally included in the latest version of MDK5,no need to download:https://developer.arm.com/downloads/view/ACOMPE
-
AC5 vs AC6 comparison (generally no need to look):https://developer.arm.com/Tools and Software/Arm Compiler for Embedded FuSa#Editions

-
-
Keil MDK 5 crack and keygen (please disable antivirus software before downloading): keygen.iso or https://www.duote.com/soft/907739.html
-
Java_JRE download (generally downloadWindows Offline (64-bit), JRE must be installed to open CubeMX):https://www.java.com/en/download/manual.jsp
-
CubeMX official website:https://www.st.com.cn/zh/development-tools/stm32cubemx.html
-
ALIENTEK accompanying materials 1 (A drive materials F1):http://www.openedv.com/docs/boards/stm32/zdyz_stm32f103_warshipV4.html
-
ALIENTEK accompanying materials 2 (A drive materials F4):http://www.openedv.com/docs/boards/stm32/zdyz_stm32f407_explorerV3.html
-



3.Arm Keil MDK 5 + VScode(Keil Assistant)【不推荐】
3.1.Introduction
- This method is a compromise, falling between MDK5 and MDK6, and can circumvent some of the shortcomings of MDK5. (However, because the C/C++ plugin is too poor, it isnot highly recommended).
3.2.Windows
3.2.1.Configuration Tutorial:
Quick configuration video:
https://www.bilibili.com/video/BV18e4y1H7xX
If you encounter some problems, please watch the video below:
https://www.bilibili.com/video/BV19V411g7gD/
-
Please install MDK5, CubeMX, VSCode, and other software
-
Install the VSCode plugin

-
Configure Keil Assistant
- Click extension settings

- Find the path of MDK5

- Copy the path

- Enter the path copied just now

-
Open the MDK5 project with VSCode
- Open the project



-
Then you can edit the source code with VSCode

3.2.2.Notes (must read):
3.2.2.1.Notice
-
该方式仅仅为折中方案,比单用MDK5好用一点,但远没有MDK6好用。
-
VScode只负责代码编辑(建议别用Keil Assistant的编译等功能)。
-
MDK5负责编译,下载,debug,添加源文件,头文件等其他一切操作。
-
优点:解决了AC6编译器的go to definition失效的问题(AC6全是优点,这是唯一缺点);解决了MDK5上古界面的不护眼;解决了MDK5代码提示拉跨;可以使用各种VScode的插件提高编辑效率。
-
缺点:需要同时开着VScode和MDK5,各司其职,不统一。C/C++插件的代码提示虽比mdk5好,但也是过于拉胯。(远不如MDK6+Clangd)
3.2.2.2.There is a problem with the text 🦟 encoding.
- The question is as follows:

- Manually change the encoding (click the UTF-8 in the bottom right corner; it is recommended to use the plugin below to solve this, which is more convenient than manual changes):




- Plugins (the defining feature of VSCode is its abundance of plugins; without plugins, VSCode loses its soul)

The plugin will automatically prompt you that the current encoding has a problem, automatically guess the correct encoding, and clicking yes will automatically fix it.

3.2.2.3.False positive error
Don't worry about it, as long as MDK5 compilation doesn't report errors.
3.2.2.4.Unable to go to definition
(Only do this if there is a problem; if there is no problem, leave it alone.)


Add the following in the box below: (after adding, it may still falsely report errors, but go to definition will already work normally)
..\**
Alternatively, change all the absolute paths in the Include Path field to relative paths (only a portion is listed below):
..\applications\Inc
..\bsp\boards\Inc
4.Arm Keil MDK 6 (基于VScode)【暂不推荐】
4.1.Introduction
-
Pros: It improves nearly all known shortcomings of MDK5; simply a boon for developers.
-
Cons: High learning cost; without a certain amount of computer common sense, you cannot handle it.
-
For now, for the time being,not very recommended for standalone usebecause even if you know how to use it, your teammates may not necessarily know how to use it, so the project cannot be shared. But if you have the ability and just want to use MDK6, then there is no harm in using it; the main thing is that it works smoothly for you.
-
However,it is highly recommended to use in combinationuse MDK6 together with MDK5. Use MDK5 to add source files, add header files, and perform other operations (do not forget to compile once with MDK5 after adding the source files and header files); use MDK6 to convert the MDK5 project you just made, and perform source code editing, compilation, debugging, and other operations. (In this way, whether your teammates use MDK5 or MDK6, they can open your project and use it directly.) (If you do not understand this passage, ask a senior student.)
4.2.Windows && Linux
5.告别Keil MDK : VScode+CMake环境部署【非常推荐老鸟】
(Development currently feels quite comfortable. If the electrical control team leader finds it useful in the future, we can standardize the IDE.)
Currently, there are mainly three widely used compilers.
armclang(AC6): Compilation is extremely fast, with extremely low overhead. (Both compilation and overhead are excellent.)
armcc(AC5): Compilation is extremely slow, with very low overhead. (It is merely low overhead.)
armgcc: Compilation is faster, with slightly larger overhead. (It is merely faster to compile.)
So ARM GCC does not have that big an advantage, but it is also acceptable.
The main reason is that ARMCC and ARMCLANG are commercial compilers, while ARMGCC is an open-source compiler, so it can be used with CMake, Makefile, etc., allowing for better project management and support for all platforms (Windows, Linux, MacOS, etc.).
详细教程STM32+CMake工程部署