Take u8 and vu8 as examples:
u8: unsigned char, unsigned 8-bit data
vu8: volatile unsigned char, volatile read and write access to unsigned 8-bit data
In general, the use cases of volatile are as follows:
1. Variables modified in the interrupt service routine for detection by other programs need to be added with volatile;
2. The flag shared by each task in a multitasking environment needs to be added with volatile;
3. The memory-mapped hardware register should be specified with volatile, because each reading and writing of it may have different meanings;
In addition, the integrity of the data should also be considered in the above situations (several interrelated flags are interrupted and rewritten after being read in half), in 1, it can be achieved by turning off interrupts, in 2, task scheduling can be disabled, and 3 can only rely on Good hardware design.
https://baike.baidu.com/item/volatile/10606957?fr=aladdin (volatile Baidu Encyclopedia details)