Creating STM32 Project with IAR Programming Software

Keil and IAR microcontroller programming software are currently two of the most widely used microcontroller programming tools. There are certain differences in their usage. In this article, I will explain the detailed method of creating an STM32 project using IAR programming software, hoping that everyone can gain something from this article.

STM32 is a very popular microcontroller, and many people have joined the ranks of learning STM32. The commonly used STM32 compilers are IAR and MDK. The following is the process of creating a project template using STM32 firmware library 3.5 under IAR:

1. Create a new folder in your commonly used directory. According to personal preference, create several folders to separately store files from the firmware library and user files.

Creating STM32 Project with IAR Programming Software

Creating STM32 Project with IAR Programming Software

2. Copy the assembly files from the firmware library directory E:\STM32\stm32 firmware library 3.5\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x\startup\iar to the newly created template directory F:\STM32-IAR\demo\CMSIS\Startup.

Creating STM32 Project with IAR Programming Software

3. Copy the files from the firmware library directory E:\STM32\stm32 firmware library 3.5\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x to the newly created template directory F:\STM32-IAR\demo\CMSIS\System.

Creating STM32 Project with IAR Programming Software

4. Copy the driver files from the firmware library directory E:\STM32\stm32 firmware library 3.5\STM32F10x_StdPeriph_Lib_V3.5.0\Libraries\STM32F10x_StdPeriph_Driver to the template directory F:\STM32-IAR\demo\FWLIB.

Creating STM32 Project with IAR Programming Software

5. Copy the .icf file from the firmware library directory E:\STM32\stm32 firmware library 3.5\STM32F10x_StdPeriph_Lib_V3.5.0\Project\STM32F10x_StdPeriph_Template\EWARM to the template directory F:\STM32-IAR\demo\Config.

Creating STM32 Project with IAR Programming Software

6. Copy the directory E:\STM32\stm32 firmware library 3.5\STM32F10x_StdPeriph_Lib_V3.5.0\Project\STM32F10x_StdPeriph_Template to F:\STM32-IAR\demo\User.

Creating STM32 Project with IAR Programming Software

At this point, the preparation work before creating the project is complete. Next, open IAR to create the project. Open IAR -> File -> New -> Workspace. After creating the workspace, select Project -> Create New Project to create a new project. Next, right-click in the workspace area on the left and select Add to add the workgroup as shown in the figure, with the same name as the template folder.

Creating STM32 Project with IAR Programming Software

Next, add the .C files from the template folder into the project.

Creating STM32 Project with IAR Programming Software

Now all the necessary files have been added. Next is the configuration of IAR. Again, right-click on the workspace on the left and select Options for configuration. In General Options -> Target -> Device, select the corresponding chip model you are using. Other options under General Options can remain default.

Creating STM32 Project with IAR Programming Software

Next, set the C/C++ Compiler as shown in the following image.

Creating STM32 Project with IAR Programming Software

For the next few settings, just follow the images provided below.

Creating STM32 Project with IAR Programming Software

Creating STM32 Project with IAR Programming Software

Creating STM32 Project with IAR Programming Software

Next is a commonly overlooked issue; make sure to select the circled option in the image, otherwise the compilation will fail.

Creating STM32 Project with IAR Programming Software

Finally, add the main function to the project, and the template is complete.

Creating STM32 Project with IAR Programming Software

Leave a Comment