学习日志之STM32固件库

对固件库结构的理解

stm32固件库分为4层:

  • 应用层(application layer)
  • 板级支持包BSP(BSP(board specific package)
  • 硬件抽象层HAL(hardware abstraction layer)
  • 硬件层(hardware)
  1. 应用层:包含有函数使用的工程模板(和相应的开发工具对应)
  2. BSP:这个给外设用的比如led、lcd之类的东西的功能函数库(对应的设备是官方的STMicroelectronics evaluation boards)
  3. HAL:这个是用来控制寄存器的函数库
    • CMSIS:内核外设访问接口,STM32F4xx外设接口,Cortex-M系列的信号处理函数
    • STM32F4xx 标准外设驱动:给所有的外设提供头函数和驱动函数,通过CMSIS访问STM32F4的寄存器

固件库头文件之间的包含关系

学习日志之STM32固件库

  • stm32f4xx_conf.h
    Peripheral’s drivers configuration file
    The user can enable or disable peripheral header file inclusion by using the template
    This file can also be used to enable or disable the Library run-time failure detection before compiling the firmware library drivers, through the preprocessor define USE_FULL_ASSERT

  • stm32f4xx_ppp.h
    Header file of PPP peripheral
    This file includes the PPP peripheral function and variable definitions used within these functions.

  • stm32f4xx_ppp.c
    Driver source code file of PPP peripheral written in C language

  • stm32f4xx_it.h
    Header file including all interrupt handlers prototypes

  • stm32f4xx_it.c
    Template source file containing the interrupt service routine (ISR) for Cortex-M4F exceptions.
    User can add additional ISR(s) for the used peripheral(s) (for the available peripheral interrupt handler’s name, please refer to the startup file startup_stm32f4xx.s).

  • stm32f4xx.h
    CMSIS Cortex-M4F STM32F4xx device peripheral access layer header file.
    The file is the unique include file that the application programmer is using in the C source code, usually in main.c.

  • system_stm32f4xx.h
    CMSIS Cortex-M4F STM32F4xx devices peripheral access layer system header file

  • system_stm32f4xx.c
    CMSIS Cortex-M4F STM32F4xx devices peripheral access layer system source file.

  • startup_stm32f4xx.s
    STM32F4xx devices startup file, one file per compiler…