Creating a New Project for STM32 in Keil IDE

This is the Series of tutorials on STM32 Microcontroller. The aim of this series is to provide easy and practical examples that anyone can understand. In this tutorial, we will see how to create a new project for STM32 in Keil IDE.

Installation of Keil IDE

The very first thing is, we need to install the Keil IDE MDK 5.25 or later. MDK 5 uses Software Packs to distribute processor-specific software, examples, and middleware. MDK 5 is installed and the Packs you need are downloaded from the web. They can also be imported manually. You can create your own Packs.

  1. You can download the MDK5 in  www.keil.com/mdk5/install or www.keil.com/mdk5/525.
  2. Install MDK into the default folder. You can install into any folder, but this tutorial uses the default C:\Keil_v5

µVision Software Packs Download and Install

  1. Open the Pack Installer by clicking on its icon: refer to the below image.
  2. A Pack Installer Welcome screen will open. Read and close it.: refer to the below image.
  3. In our STM32 tutorials, we are going to use STM32F401VE. So, select the Devices tab, Select STM32F4 Series as shown below: This will filter the Packs list.  Install the  Keil:STM32F4xx_DFP.  As I have already installed,  it shows as  Up to date instead of install.

As of now, we have installed the required software. Now let’s create the new project for STM32.

Creating a New project for STM32

  1. Click on the Project/New µVision Project. Refer to the below image.
  2. Create a new folder and provide the desired project name and click the save button in the window as shown below image. I called it the first_project. You can name anything.
  3. As soon as you click on Save, the next window opens. There you need to select your device which is STM32F401VE.
  4. Expand STMicroelectronics, then STM32F4 Series, then STM32F401, then STM32F401VE, and then finally select STM32F401VETx as shown here:  Then Click OK.
  5. The Manage Run-Time Environment window shown below opens.
  6. Select STM32F4-Discovery as the BSP as shown below.
  7. Expand CMSIS and select Core. Expand Device and select Startup as shown below.New project for STM32
  8. They will be highlighted in Green indicating there are no other files needed. Click OK as shown below.
  9. You now have a new project list as shown below: The appropriate CMSIS files you selected have been automatically entered and configured.
  10. You have created a blank µVision project using MDK 5 Software Packs. All we need to do now is add our own source files.
  11. Right click on Source Group 1 in the Project window and select Add New Item to Group ‘Source Group 1’.Refer below image.
  12. Highlight the upper left icon: C file (.c). And enter your source file’s name. I called it as main.c. Please refer the below image.New project for STM32
  13. Click on Add to close this window.
  14. Now click on “Options for Target” button as shown below:
  15. Click the Output tab and select “Create HEX file” as the below image. Then click OK.
  16. Now we have added the new file to our project. We can save our project by Clicking on File/Save All. You can add your source to that file. Like this, you can add as many files as you want.

This is pretty straight forward. In our next tutorial, we will see the GPIO of STM32 with an example.

5 1 vote
Article Rating
Subscribe
Notify of
guest

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

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
%d bloggers like this: