I recently started learning about STM32 and began writing code in IAR a few days ago. I quickly realized that many online tutorials were outdated and didn't work with the latest version of IAR. I faced numerous challenges along the way, and most of them had to be solved on my own. With the help of some online communities, I finally managed to get my first project up and running. Now, I'm sharing my experience with you in hopes that it might help you avoid some of the same issues.
I’m using IAR version 5.3 and the firmware library version 3.0 (note that versions 3.0 and above are generally similar). The first step is to create a folder for all your project files. Then, copy the STM32 firmware libraries provided by ST into this folder. Also, create two text files: one named "project" and another named "readme."
Next, open the project and copy four documents into the folder—these can be found in any of ST’s example projects. Then, create a new folder named "EWARMv5," as shown in the image.
Inside the EWARMv5 folder, copy six more documents, which can also be found in any of the example projects from ST.
Now, open IAR. Choose "Empty Project" and select the folder you created earlier. Name your project "LED" and save it in the EWARMv5 directory.
Add groups and files as shown in the image. Right-click on the project name, go to "Options," and set the output file path. You’ll need to include the following directories:
- CMSIS: Core support files for the Cortex-M3
- EVAL: Files for connecting buttons, serial ports, etc.
- Startup: Select the startup file based on your chip’s flash size (e.g., STM32F10x_LD for low-density, STM32F10x_MD for medium, STM32F10x_HD for high)
- Fwlib: Contains peripheral .c files needed for your program
Set the target device by selecting the appropriate STM32 model. Add include paths such as:
- $PROJ_DIR$\..
- $PROJ_DIR$\..\..\Libraries\CMSIS\CM3\CoreSupport
- $PROJ_DIR$\..\..\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F10x
- $PROJ_DIR$\..\..\Libraries\STM32F10x_StdPeriph_Driver\inc
- $PROJ_DIR$\..\..\..\Utilities\STM32_EVAL
- $PROJ_DIR$\..\..\..\Utilities\STM32_EVAL\Common
- $PROJ_DIR$\..\..\..\Utilities\STM32_EVAL\STM3210E_EVAL
Define macros like USE_STDPERIPH_DRIVER (indicating use of the standard peripheral library), STM32F10X_HD (for high-density chips), and USE_STM3210E_EVAL (if you're using the evaluation board).
This setup should give you a solid foundation for your STM32 project in IAR. I hope this guide helps you save time and avoid some of the frustrations I experienced while getting started.
Gy06 Military Green Ultra Wave Cleaner,Military Green Receiving Antenna,Military Green Terminal Antenna Plastic Antenna
Mianyang Ouxun Information Industry Co., Ltd , https://www.ouxunantenna.com