- Click on [arrow] besides Core in your project explorer
- Right Click on “Inc” folder and point your mouse at the “NEW” menu item.
- Select “header file” option
- A new Header file dialog box will appear
- Fill in the name of the header file in “Header file” with a dot h extension
- Click on finish
- Now open your main.c file and add your custom header file after USER CODE BEGIN Incudes
Category: Integrated Circuit
STM32L476vg ARM Cortex M4F Architecture
It uses ARM v7E-M architecture.
It a Harvard based architecture with two distinct buses for data and memory.
It has all the instruction set of M0, M1 and M3 .
It also has an additional feature set to support Floating-point Arithmetic. IEEE754 standard in single precision and double precision.
The following points are from the programming model.
There are three modes of operations:
- Thumb State
- Thread mode: Privileged
- Thread mode: Unprivileged
- Debug mode
Two thread mode are given to support a operating system. Kernel software run in priviledged mode and the user application software runs in unprivledged mode.
Unprivileged mode has some restriction on memory access.
Privileged mode has full access to system resources.
If an operating system is running and a user application needs to access the Privileged resources it has to generate an exception/interrupt and then the interrupt will be taken by the handler and put the system in privilege mode.
You can switch from privilege mode to unprivileged mode by setting nPRIV and SPSEL bit in the CONTROL register.
Just like all the other processors ARM Cotex M4 has registers and pointer registers.
The major difference is the use of two different stack pointer registers.
- Main Stack Pointer (MSP)
- Process Stack Pointer (PSP)
If application is running in privileged mode than main stack pointer will be used. And if the application is working in unprivileged the process stack pointer will be used.
General Purpose Registers:
R0 – R12 – General Purpose Register
R13 – Stack Pointer (SP) {MSP and PSP}
R14 – Link Register (LR)
R15 – program counter (PC)
Special registers:
- xPSR – {APSR, EPSR, IPSR}
- FAULTMASK
- BASEPERI
- PRIMASK
- CONTROL
There are 32 FPU registers from s0 to s31.
They group together to form a single 64-bit register. which are from D0 to D15
There is a Floating Point Status and Control Register (FPSCR).
ARM Processor Based Microcontrollers from ST
There are lot of ARM based microcontroller offered by ST.
They use ARM Cortex M processor with ST peripheral such as GPIO, ADC etc.
They mostly fall into these following groups:
- ARM Cortex M0
- ARM Cortex M3
- ARM Cortex M4
- ARM Cortex M33
- ARM Cortex M7
which is also known as M4F as it has an FPU unit.
Then there is ST classification :
- High performance
Higher clock speed, Has almost everything included from that segment. - Mainstream
Balanced between Low Power and High Performance. - Low Power
Clock speed reduced to a limit, Has additional hardware for switching off individual peripherals. - Wireless
Has cortex M0+, Peripherals support for radio
The widely available stm32f1 microcontroller also known as the blue pill has ARM cortex M3.
STM32L4 has an ARM Cortex M4F.
