当前位置:网站首页>STM32 single chip microcomputer -- volatile keyword
STM32 single chip microcomputer -- volatile keyword
2022-07-05 08:15:00 【chen_ bx】
volatile keyword
1. Application scenarios
volatile Keyword analysis , It is often used in three occasions
1) When multithreaded programming shares global variables , The global variable needs to be added with volatile To embellish , Let the compiler not optimize the variable .
2) During bare metal programming , When a function shares a global variable with an interrupt service function , The global variable needs to be added with volatile To embellish , Let the compiler not optimize the variable .
3)ARM When the register is defined , A register points to an address , To add volatile To embellish , Let the compiler omit access to the variable without optimization .
The compiler should not optimize this variable, which means to prevent the compiler from over Optimizing , Cause code operation failure .
add volatile The assembly code generated by keywords will change significantly , Also called delay function , The speed of the lamp changes !
2. Example
delay Function in -O2 Grade , Whether to add volatile keyword , Disassembly analysis .
边栏推荐
- Problem solving: interpreter error: no file or directory
- Management and use of DokuWiki
- Imx6ull bare metal development learning 2- use C language to light LED indicator
- Soem EtherCAT source code analysis attachment 1 (establishment of communication operation environment)
- OLED 0.96 inch test
- Shape template matching based on Halcon learning [v] find_ cocoa_ packages_ max_ deformation. Hdev routine
- Talk about the function of magnetic beads in circuits
- Live555 RTSP audio and video streaming summary (II) modify RTSP server streaming URL address
- Measurement fitting based on Halcon learning [i] fuse Hdev routine
- STM32 outputs 1PPS with adjustable phase
猜你喜欢

Explain task scheduling based on Cortex-M3 in detail (Part 2)

Communication standard -- communication protocol
![[paper reading] the latest transfer ability in deep learning: a survey in 2022](/img/6b/b564fb7a6895329073fb5eaff64340.png)
[paper reading] the latest transfer ability in deep learning: a survey in 2022

Circleq of linked list

How to copy formatted notepad++ text?

导电滑环磨损快的原因

Let's briefly talk about the chips commonly used in mobile phones - OVP chips
![Measurement fitting based on Halcon learning [i] fuse Hdev routine](/img/91/34c92065e797c87d6ce5ea13903993.jpg)
Measurement fitting based on Halcon learning [i] fuse Hdev routine

STM32 virtualization environment of QEMU

STM32 tutorial triple ADC interleaved sampling
随机推荐
生产中影响滑环质量的因素
Imx6ull bare metal development learning 2- use C language to light LED indicator
Interview catalogue
Shape template matching based on Halcon learning [viii] PM_ multiple_ models. Hdev routine
导电滑环磨损快的原因
Several important parameters of LDO circuit design and type selection
Matlab2018b problem solving when installing embedded coder support package for stmicroelectronic
More than 90% of hardware engineers will encounter problems when MOS tubes are burned out!
H264 (I) i/p/b frame gop/idr/ and other parameters
NTC thermistor application - temperature measurement
Design a clock frequency division circuit that can be switched arbitrarily
C language enhancement -- pointer
C WinForm [exit application] - practice 3
如何进行导电滑环选型
Reasons for rapid wear of conductive slip rings
Compilation warning solution sorting in Quartus II
Relationship between line voltage and phase voltage, line current and phase current
How to copy formatted notepad++ text?
Measurement fitting based on Halcon learning [III] PM_ measure_ board. Hdev routine
STM32 outputs 1PPS with adjustable phase