1. Set up the project directory structure
Begin by creating a main folder for your entire project. Within this folder, establish subfolders to organize different types of files effectively:
i. Place the official template files such as stm32f10x_conf.h, stm32f10x_it.c, stm32f10x_it.h, and an empty main.c into the main project folder.
ii. Create an "Obj" folder to store the project files. Copy the cortexm3_macro.s, lnkarm_flash.xcl, lnkarm_ram.xcl, and stm32f10x_vector.c files from the official template into this folder.
iii. Create a "Library" folder to hold the STM32 Firmware Library. Transfer the official firmware library provided into this directory.
2. Create a new project in IAR
Launch IAR Embedded Workbench and create a new project via the Project menu. Save the project inside the "Obj" subfolder you just created.
3. Configure and manage the project
i. To streamline project management, add several groups within the newly created project to categorize different file types:
1). FWLib – Store the header files of the required firmware library.
2). StartUp – Place the startup code here, including cortexm3_macro.s and stm32f10x_vector.c (interrupt vector table).
3). User – Store user-specific files, such as main.c and stm32f10x_it.c (which contains empty interrupt functions).
ii. Configure the project settings:
Right-click on the project and select “Options†to open the project settings window. In the General Options -> Target -> Device section, choose the ARM device model “ST STM32F10xâ€. In C/C++ Compiler -> Preprocessor, add the additional include directories as $PROJ_DIR$\..\library\inc. Note that $PROJ_DIR$ refers to the project’s location, and \..\ navigates back one directory level.
Next, in the Linker -> Config -> Linker Command File, select “Override default†and input the appropriate linker script based on your target: $PROJ_DIR$\lnkarm_ram.xcl for RAM-based debugging or $PROJ_DIR$\lnkarm_flash.xcl for Flash-based debugging. Also, define symbols such as VECT_TAB_RAM or VECT_TAB_FLASH in the Preprocessor Defined Symbols section.
In the Debugger -> Driver section, select “Third-Party Driver†and specify the ST LinkII driver path, such as C:\Manley\drivers\STLink\STM32Driver.dll, under Third-Party Driver -> IAR Debugger Driver.
4. Compile and debug the project
Uncomment or remove any unused peripherals in the stm32f10x_conf.h file. Include the necessary peripheral header files into your project based on the components you plan to use. This ensures that only the required libraries are compiled, reducing overhead and improving performance.
Petrochemical Industry Pressure Gauge
Petrochemical Pressure Gauge,Industrial Pressure Measurement,High-Quality Gauges
ZHOUSHAN JIAERLING METER CO.,LTD , https://www.zsjrlmeter.com