当前位置:网站首页>Stored state and running state of program
Stored state and running state of program
2022-07-28 11:57:00 【Mindtechnist】

Welcome to join 【Linux C/C++/Python Community 】 Discuss and share together Linux C/C++/Python/Shell Programming 、 robotics 、 machine learning 、 Machine vision 、 The embedded AI Knowledge and technology in related fields .
The stored state and running state of the program
* Know the operation and storage of programs : Combined with the hardware memory to analyze the storage state of the program when it is running and at rest .Links to related articles
The application has a quiescent state ( Stored state ) And running state ( Running state ). Static state is the state that the program is stored in nonvolatile memory before running , such as stm32 Internal Flash in , therefore , The program can also be saved normally after the system is powered off . When we download the program ( burning ) To STM32F429 Of Flash in , If you do not run the program , Then the program is at rest , The program still exists after shutdown and restart , Will not be lost . When the program starts to run , That is, when the program is running , Programs often modify some temporary data , In order to speed up , These data are usually loaded into memory (RAM) in , The data in memory will be lost after power failure . therefore , The program is in both static and running states , Their positions in the memory are different .
When the program is in the stored state ,RO section (RO section) and RW section (RW section) Is stored in a ROM District , such as STM32 Of Flash in . When the program starts to run , The kernel directly from ROM Read code from , And execute a loading code before executing the body code , hold RW section Data from ROM copy to RAM In the memory , And in RAM Add ZI section,ZI The data of the section is initialized to 0, Finished loading RAM After the district , Officially start the implementation of the main procedure .
stay 《MDK Compilation process and ARM Compile toolchain 》 In the article , The compiled information is divided into several fields ( Please refer to my article ). In compilation information RW-data and ZI-data Corresponding to RW section and ZI section, The difference between the two is whether it needs to be saved after power failure . Because in RAM When creating data in , The default initial values are 0, such as ZI section , But some data require that the initial value is not 0, That is, it is initialized as non 0 The value of the data , This data needs to be processed through ROM To record the initial value ( Because the initial value is determined before the program runs , That is to say, this is not 0 The initial value should have the property of saving after power failure , Therefore, it is necessary to put non 0 The initial value data is saved in ROM/Flash in , And the initial value is 0 After the power failure, the data will be restored in RAM Loading in memory does not affect the initial value , So there is no need to save it after power failure , There is no need to save to ROM/Flash Record the initial value , But directly in the running state RAM You can create it in , namely ZI section), And stored in ROM The data in will be copied to RAM.STM32 Of RO The area will not be loaded into RAM in , The kernel directly from Flash Read instruction . What needs to be distinguished here is , The computer will put RO Area loaded into memory , Because computers have MMU unit , Support virtual memory , You can run programs larger than physical memory .
When the program is downloaded to STM32 Of Flash(RAM) In the time , It takes up space code + RO-data + RW-data , If this sum is greater than STM32 Of Flash Storage space , There will be mistakes . Occupied during program execution SRAM Space for RW-data + ZI-data.
| Program status | Compiled data field |
|---|---|
| Running state RO District | code + RO-data |
| Running state RW District | RW-data + ZI-data |
| Stored state ROM District | code + RO-data + RW-data |


边栏推荐
- WPF layout controls are scaled up and down with the window, which is suitable for multi-resolution full screen filling applications
- Unity中使用UnityWebRequest进行网络和本地图片加载
- 【补题日记】[2022杭电暑期多校2]K-DOS Card
- Redis installation
- Unity 一键替换场景中的物体
- Minikube initial experience environment construction
- Upgrading of computing power under the coordination of software and hardware, redefining productivity
- 从0开发一个自己的npm包
- LabVIEW AI visual Toolkit (non Ni vision) download and installation tutorial
- [diary of supplementary questions] [2022 Hangdian summer school 2] k-dos card
猜你喜欢

Upgrading of computing power under the coordination of software and hardware, redefining productivity

Know the optical fiber interface and supporting optical fiber cable of can optical fiber converter in fire alarm networking

Reasons and solutions for moving the first column to the last column in El table

Update dev (development version) of the latest win11

简单选择排序与堆排序

Techniques for visualizing large time series.

STL concept and its application

瑞吉外卖——Day01

强缓存、协商缓存具体过程

Software testing and quality learning notes 1 --- black box testing
随机推荐
Three methods of using unity mouse to drive objects
Deployment and use of Minio distributed object storage
强缓存、协商缓存具体过程
Software testing and quality learning notes 1 --- black box testing
【补题日记】[2022牛客暑期多校2]L-Link with Level Editor I
Interfaces and abstract classes
【补题日记】[2022杭电暑期多校2]K-DOS Card
可视化大型时间序列的技巧。
In order to ensure the normal operation of fire-fighting equipment in large buildings, the power supply monitoring system of fire-fighting equipment plays a key role
Guys, ask me, this can't be checkpoint, because there is a JDBC task whose task status is finished,
Introduction to the usage of SAP ui5 image display control avatar trial version
What is WordPress
Specific functions of some multi parameter functions
Training mode and practice of digital applied talents in Colleges and Universities under the integration of industry and education
AlexNet—论文分析及复现
一文看懂设备指纹如何防篡改、防劫持
Reasons and solutions for moving the first column to the last column in El table
R language ggplot2 visualization: use the ggdotplot function of ggpubr package to visualize the grouped dot plot, set the palette parameter, and set the color of data points in different grouped dot p
Cvpr2020 best paper: unsupervised learning of symmetric deformable 3D objects
How is the JS code compiled and executed by the browser engine?