ARM芯片 - CMSIS标准 (学习C做复杂嵌入式开发,不错的参考)
·
CMSIS是什么
ARM公司,Cortex-M系列IP的硬件抽象标准。(Cortex-A5,A7,A9也用支持该标准)
CMSIS:Cortex Microcontroller Software Interface Standard
采用CMSIS优点:
可以为处理器和外设实现一致且简单的软件接口,
简化软件的重用、缩短微控制器新开发人员的学习过程,并缩短新设备的开发周期。
源码
https://arm-software.github.io/CMSIS_5/General/html/index.html
基于CMSIS标准的软件架构主要有四层:
用户应用层、
操作系统层、
CMSIS层
和硬件寄存器层。
CMSIS层主要分为3个部分:
- 核内外设访问层(CPAL),由ARM负责实现对寄存器名称、地址定义、NVIC接口等定义,统一用_INLINE屏蔽差异,其接口函数均是可重入的。
- 片上外设访问层(DPAL),由芯片厂商负责实现,可调用CPAL提供的接口函数处理相应的外设中断请求
- 外设访问函数(AFP),由芯片厂商负责,提供访问片上外设的函数
Coding Rules
The CMSIS uses the following essential coding rules and conventions:
- Compliant with ANSI C (C99) and C++ (C++03).
- Uses ANSI C standard data types defined in <stdint.h>.
- Variables and parameters have a complete data type.
- Expressions for #define constants are enclosed in parenthesis.
- Conforms to MISRA 2012 (but does not claim MISRA compliance). MISRA rule violations are documented.
In addition, the CMSIS recommends the following conventions for identifiers:
- CAPITAL names to identify Core Registers, Peripheral Registers, and CPU Instructions.
- CamelCase names to identify function names and interrupt functions.
- Namespace_ prefixes avoid clashes with user identifiers and provide functional groups (i.e. for peripherals, RTOS, or DSP Library).
The CMSIS is documented within the source files with:
- Comments that use the C or C++ style.
- Doxygen compliant function comments that provide:
- brief function overview.
- detailed description of the function.
- detailed parameter explanation.
- detailed information about return values.
更多推荐



所有评论(0)