Creating a Project in Keil uVision.

One of the questions that comes up when switching to STM32 is:
"Which development environment should I choose?"
The most popular ones are probably Coocox, IAR and Keil uVision; I use the last one.
Its main advantage over the others is a powerful simulator with peripheral support and many virtual instruments.
All these goodies "make life easier" for an experienced developer and help a beginner figure out the rich peripherals of modern MCUs. A screenshot of the interface is shown below.
Creating a Project in Keil uVision.

The firmware size in the free version is limited to 32K, which is enough in most cases.

To install it, download MDK-ARM from the official website.
Creating a Project in Keil uVision.

Creating a Project in Keil uVision.

Creating a Project in Keil uVision.

And install it.
All good, but when creating a project you won't be able to select the right MCU. This can be fixed by installing the required pack; for example, for the STM32F1xx family this pack is called Keil.STM32F1xx_DFP.x.x.x.pack
Creating a Project in Keil uVision.

Now that the environment is installed, let's create a project.
Creating a Project in Keil uVision.

It's advisable to create a separate folder for the project, since there will be many files.
Creating a Project in Keil uVision.

If the project doesn't use the StdPeriph library, it's enough to include the startup file and the CMSIS core.
Creating a Project in Keil uVision.

Creating a Project in Keil uVision.

Now we need to create or add the required files.
Creating a Project in Keil uVision.

Creating a Project in Keil uVision.

Creating a Project in Keil uVision.

Creating a Project in Keil uVision.

Once all the necessary files are included in the project, we can move on to configuring the project.
Creating a Project in Keil uVision.

If the MCU is clocked from a crystal, you need to specify its frequency.
Creating a Project in Keil uVision.

The SYSCLK frequency, which clocks all the MCU buses, can be selected in the system_stm32f10x.c file; to do this, just uncomment the desired line.
Creating a Project in Keil uVision.

Creating a Project in Keil uVision.

The names of the interrupt handler functions can be found in the startup file.
Creating a Project in Keil uVision.

The preparations are finished and we can move on to debugging, having first compiled the project.
Creating a Project in Keil uVision.

To start debugging, click the button shown in the screenshot.
Creating a Project in Keil uVision.

Then you can debug the program using the buttons shown below.
Creating a Project in Keil uVision.


In fact, the program's functionality is much wider; the article describes only the minimum needed to get started.