Explanation of the usage of stm32 library files

Publisher:不羁少年Latest update time:2018-10-06 Source: eefocusKeywords:stm32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. We need to add those files to run a program:

First of all, we need to have a certain understanding of the library files. Among them, STM32F10xR.LIB is a packaged .C file, which includes stm32f10x_conf.c stm32f10x_adc.c stm32f10x_gpio.c, etc. To use these C functions, just include the header files stm32f10x_conf.h stm32f10x_adc.h stm32f10x_gpio.h, but the header files can also be directly included with stm32f10x_lib.h, so we only need to add the four files in SOURCE in GROUP in Keil.


 

Explanation of the usage of stm32 library files

The stm32f10x_vector.s is the startup file. Some versions are called startup_stm32f10x_hd.s. The name is determined by the version and chip model. In short, its function is to start the code. The stm32f10x_lib.h is included in main.c. The stm32f10x_it.c is the interrupt-related program and is not used for the time being. The above pictures are not compiled. If compiled, you will see that there will be many .H header files under the .C file.

Explanation of the usage of stm32 library files

You can also right-click on the C file to hide these .H header files.

Let's take a look at what is added to the program of the HuoNiu development board to run a pipeline program:

Explanation of the usage of stm32 library files

From here, we can see that there is a library file LIB which contains only 5 .C files to be used. You don't need to add header files in the process of adding files, because after you add the corresponding C files, the header files will be automatically included after compilation. As long as you put the header files in the correct location, now let's talk about how to add the correct location so that KEIL can find the header files. First look at the following figure

Explanation of the usage of stm32 library files

To change the location of the header file in this marquee program of Huoniu, you can change the location of the inc folder. Then you just need to find this location according to the location in the picture above, and recompile it to point to the new location.

If you want to add a new location for the header file, use the following figure

Explanation of the usage of stm32 library files

In summary, there are two points: a: First, add the startup file, the .C file written by the user, and the C file in the function library

                 b: Then just specify the location of the .h file so that the compiler can find them during compilation.


2. The following mainly talks about the meaning of each C file and the meaning of each header file:

a. First is stm32f10x_map.h. This file actually changed its name in the new version. Now its name is stm32f10x.h. It defines the startup settings and all register macro definitions.

b. You can ignore the addition of core_cm3.h for now. Beginners don’t need it. It is kernel-related knowledge.

c. stm32f10x_conf.h is used to include

#include "stm32f10x_adc.h" 

#include "stm32f10x_bkp.h" 

#include "stm32f10x_can.h" 

#include "stm32f10x_crc.h" 

#include "stm32f10x_dac.h" 

#include "stm32f10x_dbgmcu.h" 

#include "stm32f10x_dma.h" 

#include "stm32f10x_exti.h"

#include "stm32f10x_flash.h" 

#include "stm32f10x_gpio.h"

#include "stm32f10x_i2c.h" 

#include "stm32f10x_iwdg.h" 

#include "stm32f10x_pwr.h" 

#include "stm32f10x_rcc.h"

#include "stm32f10x_rtc.h" 

#include "stm32f10x_spi.h"

#include "stm32f10x_tim.h" 

#include "stm32f10x_usart.h"

#include "stm32f10x_wwdg.h" 

#include "misc.h" and other files to avoid writing too many included header files in the main function, which is not concise enough. However, in the main function main, stm32f10x.h is used to include stm32f10x_conf.h. In this way, directly including in the main function is equivalent to including so many header files above, which is equivalent to the transfer function.

d. stdint.h defines integer types such as int16_t, uint32_t, and int64_t. These can be used instead of short, unsigned long long, etc. when an integer of a certain size is needed.

e. system_stm32f10x.h, microcontroller-specific system file

I have to admit that the library files loaded by the program supporting the HuoNiu development board are really too messy. You have to read the contents of many library files yourself to understand their usage and meaning.


Keywords:stm32 Reference address:Explanation of the usage of stm32 library files

Previous article:stm32 firmware library file description
Next article:STM32 MCU key debounce and FPGA key debounce

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号