Keil μVision5: Tutorial for Beginners

Table of Contents

Keil μVision5

What is Keil μVision5?

Keil μVision5 is an embedded software development tool used for writing, debugging, and testing applications for embedded systems. It provides various features and tools, including a code editor, compiler, debugger, simulator, and performance analyzer, to support the development of hardware and software platforms. Keil μVision5 supports multiple programming languages, including C, C++, and assembly language, and is compatible with many popular embedded operating systems. It also offers practical tools such as real-time variable monitor, memory mapper, and timeline analyzer to assist developers in debugging and optimization during the development process.

Keil Related Terms

IDE

Integrated Development Environment, which means development integrated environment, generally includes tools such as code editor, compiler, debugger and graphical user interface.

Keil is a company name, and the software developed by it are all named starting with Keil. Currently there are Keil MDK-ARM, Keil C51, KeilC166 and KeilC251 versions.

uVision is an integrated development environment (IDE) developed by keil, which can perform code editing, file management, program compilation and debugging, etc. It contains four versions: uVision2, uVision3, uVision4, and uVision5. The latest version is uVision5.

If you want to develop ARM core chips, you need to install MDK-ARM. If you want to develop 51 core chips, you need to install c51. In other words, MDK and c51 are just different development integrated environments developed by Keil for different chip cores.

ARM Cortex™ Microcontroller Software Interface Standard (CMSIS: Cortex Microcontroller Software Interface Standard) is a vendor-neutral hardware abstraction layer for the Cortex-M processor family.

How to Use Keil μVision5?

Step 1: Download and Install Keil5

Visit the official Keil website and download the latest version of the MDK software, then proceed with the installation.

Download MDK-Arm Software from Keil
Download MDK-Arm Software from Keil
Setup MDK-ARM V5.38a
Setup MDK-ARM V5.38a

Step 2: Installing Device Packs

In Keil, click on “Pack Installer” to automatically update information on all device packs from the official website. After the update, select the desired chip model, e.g., STM32G071, and in the right window, find “Device Specific” -> “Keil:STM32G0xx_DFP” and click “Install” to download and install. Once completed, the “Install” button will change to “up to date,” indicating successful installation.

Select the Devices Specific in Pack Installer_Keil
Select the Devices Specific in Pack Installer_Keil
Select CMSIS Interface for the Keil Project
Select CMSIS Interface for the Keil Project

If unable to install from Keil, download the required device pack from the Keil official website:
https://www.keil.arm.com/packs/stm32g0xx_dfp-keil/devices/

Download Chip Pack from Keil Site
Download Chip Pack from Keil Site

Step 3: Creating a New Project

Click on “Project” -> “New Project” to create a new project. Choose the project’s save path and set the project name. The software will prompt for the MCU model; select STM32G071RBTx and choose the CMSIS interface standard.

Create A New Project in Keil MDK
Create A New Project in Keil MDK
Select STM32G071RBTx Device for Project
Select STM32G071RBTx Device for Project

Step 4: Adding/Creating Files

Add necessary code files such as “main.c,” rules for LED blinking, and driver files to the project folder.

Add main Code Files to the Target Project
Add main Code Files to the Target Project

Step 5: Project Configuration

Include header file paths manually for the core code files.

Specifying the .h File Path of the Target Project
Specifying the .h File Path of the Target Project

Select the debugger type, e.g., ST-Link, for online debugging.

Choose ST-Link Debugger
Choose ST-Link Debugger
Use Debug Driver for Target Project
Use Debug Driver for Target Project
Choose SW Port for Target Project
Choose SW Port for Target Project

Choose “Create HEX File” to generate a Hex executable file.

Choose Creat HEX File Output Option for Target Project
Choose "Creat HEX File" Output Option for Target Project

Select “Reset and Run” to run the program immediately after programming.

Specifying the Download Function for Driver Setup
Specifying the Download Function for Driver Setup

Step 6: Compilation

After adding files and configuring the project, click on compile. The software will invoke the compiler and linker to convert the source code (.c, .h files) into a machine-readable .axf file containing binary machine code and debugging information.

Build Target File for your Project
Build Target File for your Project

Note: Resolve any error messages before successfully generating the executable file. Warning messages can be addressed based on the situation.

Step 7: Programming

Connect the programming tool to the development board and check the connection under “Project” -> “Options for Target ‘xxx'” -> “Debug” -> “Setting.” If connected, click on “Project” to start programming. A progress bar will indicate the programming status.

Download code to Flash Memory
Download code to Flash Memory

After programming, observe the board; if the LED blinks normally, the program is running correctly.

Testing the LED Blinking on the Board
Testing the LED Blinking on the Board

Step 8: Debugging

  • Online Debugging: With a development board, burn the software into the microcontroller and use the debugger to monitor the running program in real-time. Keil provides a user-friendly interface for quick issue identification.

  • Offline Simulation: Without a development board, use offline simulation to roughly test the logic. However, this method is not suitable if the logic involves peripherals or external circuitry.

Subscribe

Join our subscribers list to get monthly blog updates, technology news, case studies. We will never send spam, and you can unsubscribe at any time.

About Author

Picture of Aidan Taylor
Aidan Taylor

I am Aidan Taylor and I have over 10 years of experience in the field of PCB Reverse Engineering, PCB design and IC Unlock.

Need Help?

Don't hesitate - Get in touch today to find out how we can help take your project to the next level.

Scroll to Top
welldone pcb manufacturer

Start to Achieve Your PCB Project