What is CMSIS

table of Contents

I. Introduction

2. CMSIS standard

Three, CMSIS file

1. Include file

2. Source file

Four, summary


I. Introduction

Friends who have used ARM microcontrollers must have heard of CMSIS. It can be said that CMSIS is the golden key to turn on the ARM microcontroller. Did you think of the startup file of the MCU? Yes, the startup file is only part of CMSIS. Are you right like me? Does it feel both familiar and unfamiliar?

2. CMSIS standard

CMSIS (Cortex Microcontroller Software Interface Standard), translated into ARM Cortex™ Microcontroller Software Interface Standard . Who mentioned this standard? What is the standard for? I have to talk about the relationship between ARM and STM32 and TI companies. ARM is a company that makes chip standards. It is responsible for the architecture design of chip cores. Companies like TI and ST do not make standards. They It is a chip company. They design their own chips according to the chip core standard provided by ARM. Therefore, for any Cortex M3 chip, their core structure is the same. The difference is their memory capacity, on-chip peripheral IO and other modules.

 

Who mentioned the standard? ARM and chip manufacturers jointly proposed that the purpose is for the Cortex-M3 chips produced by different chip manufacturers to be basically compatible in software, and each chip manufacturer has to write their own chip core drivers according to this standard, such as system function naming, Chip initialization and startup process, etc.; STM32 official libraries (standard library, HAL library, LL library) are written in accordance with this standard.

What is this standard used for? As shown in the figure below, it is responsible for directly dealing with the kernel and various peripherals, and providing the function interface called by the user program of the real-time operating system upward. Divided into 3 basic functional layers:

Peripheral access layer in the core: the access provided by ARM, which defines the address of the processor's internal registers and functional functions.

Middleware access layer: defines the general API for accessing middleware, which is also provided by ARM.

Peripheral access layer: define the address of the hardware register and the access function of the peripheral.

Three, CMSIS file

After reading the above introduction, is it dizzy? After reading it, I didn't see the actual code like I didn't read it. Let’s open CMSIS under any project. I take STM32F4xx as an example. Under the path \CMSIS\Device\ST\STM32F4xx , there are two files, Include and Source. We mainly use these two files dedicated to the microcontroller Header file, startup code.

1. Include file

Stm32f4xx.h and stm32f429xx.h are mainly used in this file (this file is different for different chips), as shown below

(1) The stm32f429xx.h header file contains the register definitions and package memory operations of all peripherals of the chip. You can control the peripherals by directly operating these registers. Any type of STM32 chip needs to include this header file.

(2) In stm32f4xx.h , the corresponding header file ( stm32f429xx.h ) will be selected according to the chip model macro identifier (I am STM32F429xx here ). If the USE_HAL_DRIVER macro identifier is defined, the HAL library peripheral driver will be included , The specific inclusion relationship is:

 

2. Source file

System_stm32f4xx.c, startup_stm32f429xx.s, stm32f429xx_flash.icf are mainly used in this file . As shown below:

startup_stm32f429xx.s

The function of the startup file is mainly to initialize the stack, interrupt vector table and interrupt function definition. After setting the system reset, directly call the SystemInit function to initialize the system. Another very important function is to boot into the main function after the system is reset.

system_stm32f4xx.c

It mainly declares and defines the system initialization function SystemInit and the system clock update function SystemCoreClockUpdate. The function of the SystemInit function is to perform some initialization operations of the clock system and set the offset address of the interrupt vector table, but it does not set a specific clock value

stm32f429xx_flash.icf

Defines the start and end address and size of the chip's FLASH and RAM

The startup process of STM32 microcontroller:

 

Four, summary

CMSIS defines a set of standards for chip peripheral control and writing specifications. When we transplant a new project, we only need to modify and add:

1、添加system_stm32f4xx.c、startup_stm32f429xx.s、stm32f429xx_flash.icf

2. Add stm32f4xx.h

3. Modify the global macro identification STM32F429xx

Guess you like

Origin blog.csdn.net/m0_37845735/article/details/105829019