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.
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.
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
Now that the environment is installed, let's create a project.

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

If the project doesn't use the StdPeriph library, it's enough to include the startup file and the CMSIS core.


Now we need to create or add the required files.




Once all the necessary files are included in the project, we can move on to configuring the project.

If the MCU is clocked from a crystal, you need to specify its frequency.

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.

The names of the interrupt handler functions can be found in the startup file.
The preparations are finished and we can move on to debugging, having first compiled the project.

To start debugging, click the button shown in the screenshot.
Then you can debug the program using the buttons shown below.

In fact, the program's functionality is much wider; the article describes only the minimum needed to get started.
"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.
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.
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
Now that the environment is installed, let's create a project.

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

If the project doesn't use the StdPeriph library, it's enough to include the startup file and the CMSIS core.


Now we need to create or add the required files.




Once all the necessary files are included in the project, we can move on to configuring the project.

If the MCU is clocked from a crystal, you need to specify its frequency.

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.

The names of the interrupt handler functions can be found in the startup file.
The preparations are finished and we can move on to debugging, having first compiled the project.

To start debugging, click the button shown in the screenshot.

Then you can debug the program using the buttons shown below.

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






