During the optimization project, it often begins to focus on time performance, such as codec MIPS or mcps. When the time performance can meet the requirements, we often add the size parameter for comparison, then we need to consider a variety of size. This performance parameter may be clearly described in the project requirements book, and there are more prepared data records in the test performance result or release note.
See the following table:
Program Rom |
Data Ram |
Rom table |
Scratch |
Stack |
Static |
Xx |
Xx |
Xx |
Xx |
Xx |
First, we need to understand the meaning of these size and the performance significance of the response.
1. code size, RO data, RW data, Zi data
The above variables are values that may appear in the arm development environment. You can add some parameters in armlink to obtain the corresponding. Map File, from which you can obtain these values accurately.ArticleDescribe these meanings in detail:
arm Program (the program being executed in the arm system, rather than the binfile stored in the ROM)
An arm program consists of three parts: RO segment, RW and Zi segments
Ro is the commands and constants in the Program
RW is the initialized variable in the Program
Zi is the uninitialized variable in the Program
the above three points can be understood:
Ro is readonly,
RW is read/write,
Zi is a component of the zero
arm image file
the so-called arm image file refers to the binary file burned into the ROM and also becomes an image file. The following is called an image file.
the image file contains Ro and RW data.
the reason why the image file does not contain the Zi data is that the Zi data is 0 and does not need to be included. You only need to clear the region where the Zi data is located before running the program. It wastes storage space.
Q: Why must the image contain Ro and RW?
A: the commands and constants in RO and the initialized variables in RW cannot be "born out of nothing" like Zi.
execution process of the arm Program
as you can see from the above two points, the image file burned to the Rom is not exactly the same as the actual running arm program. Therefore, it is necessary to understand how the arm Program reaches the actual running state from the image in the Rom.
In fact, commands in Ro should have at least the following functions:
1. Move RW from Rom to ram. Because RW is a variable, the variable cannot exist in Rom.
2. Clear all the ram regions where Zi is located. Because the Zi region is not in the image, the program needs to reset the corresponding Ram regions based on the Zi address and size given by the compiler. Zi is also a variable. Similarly, the variable cannot exist in Rom.
at the initial stage of the program running, the C program can access the variable normally after the commands in RO Have completed these two tasks. Otherwise, only the Code without variables can be run.
after talking about what Ro, RW, and Zi are, I will give several examples to illustrate Ro, RW, what does Zi mean in C.
Specific link: http://hi.baidu.com/whyspai/blog/item/d1815fa99c3da6fb1e17a283.html