Mastering Keil MDK: Complete Guide to Interface, Configuration, and Tips for STM32 Development
This comprehensive tutorial walks readers through downloading MDK, understanding its core concepts, exploring the full UI—including menu, toolbar, and project settings—offering practical shortcuts, configuration details, and handy usage tips to boost productivity when developing STM32 applications with Keil MDK.
0. Source Code and Prerequisites
All required files (MDK5 installer, chip firmware, and an STM32F103C8T6 template project) are provided via a free WeChat request (note: "1122"). These resources enable readers to follow the tutorial without additional setup.
1. What Is MDK?
MDK (Microcontroller Development Kit), also known as MDK‑ARM or Keil MDK, is a comprehensive development suite for ARM‑based microcontrollers. It bundles a powerful compiler, debugger, simulator, extensive device database, and example code. Keil is the company name; uVision is the integrated development environment (IDE) that ships with MDK, offering project management, code editing, compilation, debugging, and simulation.
2. Main Interface Overview
The MDK UI consists of four primary panes: Menu bar, Toolbar, Editing window, and Information window. Each pane provides specific functions for project creation, code editing, build output, and debugging.
2.1 Menu Bar Details
File : New, Open, Close, Save, etc.
Edit : Standard edit operations.
View : Window layout controls.
Project : Project‑related commands.
Flash : Programming and flashing tools.
Debug : Debugger controls.
Peripherals : External device configuration (not shown in the example).
Tools : Includes PC‑Lint (static analysis) and other utilities.
SVCS : Software version control system.
Windows : Window management.
Help : Documentation and help resources.
2.2 Toolbar Shortcuts
File Operations : Ctrl+N (New), Ctrl+O (Open), Ctrl+S (Save), Ctrl+X (Cut), Ctrl+C (Copy), Ctrl+V (Paste).
Navigation : Ctrl+Z (Undo), Ctrl+Y (Redo), Ctrl+- (Back), Ctrl+Shift+- (Forward).
Bookmarks : Ctrl+F2 (Add), Shift+F2 (Prev), F2 (Next), Ctrl+Shift+F2 (Clear all).
Line Operations : Tab (Indent), Shift+Tab (Unindent).
Search : Ctrl+Shift+F (Find in files), Ctrl+F (Find), Ctrl+I (Incremental search).
Debugging : Ctrl+F5 (Start/Stop debug), F9 (Toggle breakpoint), Ctrl+F9 (Disable breakpoint), Ctrl+Shift+F9 (Clear all breakpoints).
Window/Config : No default shortcuts; the wrench icon opens configuration.
Compile/Download : Ctrl+F7 (Compile current file), F7 (Compile modified files), F8 (Download program).
Project Options : Alt+F7 (Open target options).
3. Project Configuration Details
3.1 Device
Select the target MCU (e.g., STM32F103C8T6) and its parameters.
3.2 Target
Crystal frequency (used for simulation).
Operating system selection (usually none).
System view file (default is fine).
Cross‑module optimization and micro‑library usage.
ROM and RAM address configuration (internal/external).
3.3 Output
Output path (default: Objects folder).
Executable name (e.g., HEX file).
Choose between executable or library output.
Options: Debug information, Create HEX file, Browse information.
3.4 Listing
Set folder for listing files.
Enable assembly listing ( .lst).
Generate C compilation listings ( .txt, .i).
Generate or suppress .map file.
3.5 User
Pre‑/post‑build commands.
Beep on build completion.
Auto‑start debugging.
3.6 C/C++ Settings
Pre‑processor definitions.
Code generation options for size/speed.
Include paths and other compiler flags.
3.7 Assembler Settings
Conditional assembly symbols.
Position‑independent code options, Thumb mode, warning suppression, etc.
3.8 Linker Settings
Make RW/RO sections position‑independent.
Do not search standard libraries.
Report “might fail” conditions as errors.
Base address settings (X/O, R/O, R/W).
Disable warnings.
3.9 Debug Settings
Hardware and software simulation configuration.
Limit simulation speed to real‑time.
Load application at startup.
Run to main() option.
Initialization file for debug commands.
Restore previous debug session settings.
DLL requirements (located in ARM\BIN).
3.10 Utilities
Flash menu configuration (e.g., “Update Target Driver for Flash Programming”).
Debug driver usage, pre‑debug update, and reset‑and‑run settings.
Image file handling utilities.
4. Practical Tips
4.1 Text Beautification
Set Tab to 4 spaces for consistent formatting.
Customize font, colors, and keyword highlighting.
Enable code hinting and syntax checking.
Settings are stored in global.prop under XXX\UV4\global.prop; back up this file to restore configurations on a new machine.
4.2 Code Editing Tricks
Use the Tab‑space setting together with indent/unindent shortcuts.
Locate definitions via “Browse Information” (right‑click → Browse Information or press F12).
Quick comment/uncomment: right‑click → Advanced → Comment/Uncomment Selection or use the toolbar icons.
4.3 Find & Replace
Open header files directly from the editor (right‑click → Open Document).
Use “Find in Files” for project‑wide searches; “Find” for current document or selection.
Replace via the standard replace dialog.
4.4 Post‑Compile Error Navigation
Errors and warnings appear in the Build Output window; double‑clicking jumps to the source line. Resolve issues sequentially from top to bottom.
4.5 Restoring Window Layout
If a window is accidentally closed, use the “Window” menu to reopen default panes.
4.6 Adjusting Editor Font Size
Hover over the editor and press Ctrl while scrolling the mouse wheel to change font size.
5. Conclusion
The guide provides a thorough walkthrough of MDK5 for STM32 development, covering installation, UI navigation, detailed configuration, and productivity tips. Beginners can start with basic compile‑and‑flash steps, while more experienced users can fine‑tune settings to optimize code size, performance, and debugging workflow.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
