Select microcontroller in keil uvision 5Keil uvision 5 device search

While getting started with STM32 most people choose Keil MDK for their development options. Which is fine. Although, the new STM32CubeIDE is completely free from the ST itself. But some people still find it confusing and wanted to stick with Keil uVision. Today, I am going to cover how to create a new project in Keil uVision 5 for the STM32 family. We are strictly focusing on a new project creation and just like our previous tutorials, this would be purely to the point tutorial where we explain step by step instructions to create a new project from scratch.

Step 1: Download and Install Keil uVision 5 MDK

First of all, go to the official Keil Website and download the Keil uVision 5 MDK for ARM. Remember that Keil create multiple products including compiler support for different microcontrollers. Another very famous is Keil for C51 series which is used to develop code for 8051 microcontrollers. But in this tutorial, we are just focusing on the STM32 series which falls under the ARM based microcontrollers. So, we need to download the Keil ARM MDK Keil Product Downloads.

Download Keil MDK-Arm

Download this MDK-Arm and install into your system. You just need to follow the instructions provided by the installer. Once you done installing you can launch the Keil uVision 5 from the short cut icon created on Desktop of your PC.

Step 2: Create a New Keil uVision Project

Once Keil is opened, go to the project menu from top menu bar and select New Project. Here are list of steps which you should follow as it is.

  • Click on “Project” in the menu.
  • Select “New µVision Project…”
  • Choose a project location, enter a project name, and click “Save.”
Create New Project in Keil

Step 3: Select Device for your project

Now that you named your project and saved, the next window will pop up which will ask you to select your microcontroller. Here is the default dialogue which will show you all of your supported device packs which you already had installed. If we are creating project for STM32F4 we need to make sure that we had installed Keil.STM32F4xx_DFP.2.17.1 or any latest from the Keil Package Manager. If you do not know how to do this we will explain it in next step.

Select Device for Target in Keil

Here in the search field, you can write name of your microcontroller. For example, If I type STM32F103C8 which is the microcontroller name on the STM32 blue pill board, it will give me option to select that microcontroller like this.

searching STM32F103C8 microcontroller in Keil target selection search bar

Select appropriate microcontroller and press OK.

Step 4: Manage Run Time

Next diague box will appear which will let you manage your run time for the microcontroller. Here you can select the device startup file and the Standard Peripheral Libraries or FreeRTOS or STM32 HAL libraries from the manage run time dialogue box. At first, it will look something like this.

Keil manage runtime

You have to expand the Device Tree and select the startup checkbox. This will ask you for further CIMSIS dependency which you can include by simply pressing the Resolve button at the bottom. Here is how it will look.

STM32 device startup file in keil project

Once you click on the Resolve button, all the required dependencies will automatically be selected and you can press OK if you do not need any further assistance or package to select from here. Optionally, you can select the StdPeriph Drivers if you which.

Step 5: Add main.c file to your source group

Now your project is ready and you can create the source files. You can also add any library files if you already had before from some of your previous projects. Here are enlisted steps which you have to follow to create new main.c file into your project.

  • Right-click on the “Source Group 1” folder in the “Project” window.
  • Select “Add New Item to Group ‘Source Group 1′” and add your source files (e.g., main.c).
  • You can also add any necessary header files.
Add New Item to Group for adding the main.c file in keil project

By Abdul Rehman

My name is Abdul Rehman and I love to do Reasearch in Embedded Systems, Artificial Intelligence, Computer Vision and Engineering related fields. With 10+ years of experience in Research and Development field in Embedded systems I touched lot of technologies including Web development, and Mobile Application development. Now with the help of Social Presence, I like to share my knowledge and to document everything I learned and still learning.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.