Extern int Image$$RW

  
 

Limit Meaning


There has always been a plausible understanding of the RO, RW and ZI data described in the ARM system. During this time, I have carefully understood it and found some rules. I have understood some things that were in the previous books but I don’t understand them. I think there should be a lot of people who have the same confusion as me. So I will write some of my understandings about RO, RW and ZI, I hope I can have something for everyone. help. To understand RO, RW and ZI, you need to first understand the following knowledge:


The composition of the ARM program


The "ARM program" referred to here is the ARM system. The program being executed, not the bin image file stored in the ROM, pays attention to the difference. An ARM program consists of three parts: RO, RW, and ZI RO are the instructions 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 as: RO is readonly, RW is read/write, ZI is zero


The composition of ARM image file The so-called ARM image file refers to the bin file that is burned into ROM and also becomes image file. The following uses the Image file to call it. The Image file contains RO and RW data. The reason why the Image file does not contain ZI data is because the ZI data is 0, it is not necessary to include, as long as the program is running, the area where the ZI data is located is always cleared. Including it wastes storage space. Q: Why must Image contain RO and RW? A: Because the commands and constants in the RO and the variables initialized in the RW are not like the ZI, there is nothing in the middle.


The execution process of ARM program


From the above two points, it can be known that the image file burned into ROM is not completely compatible with the ARM program in actual operation. the same. Therefore, it is necessary to understand how the ARM program reaches the actual running state from the image in the ROM. In fact, the instructions in the ROM should at least have such a function: 1. Move the RW from the ROM to the RAM. Since RW is a variable, the variable cannot exist in the ROM. 2. Clear the RAM area where ZI is located. Because the ZI area is not in the Image, the program needs to clear the corresponding RAM area according to the ZI address and size given by the compiler. The ZI is also a variable. Similarly, the variable cannot exist in the ROM. In the initial stage of the program operation, the C program can access the variable normally after the two instructions are completed. Otherwise you can only run code without variables.

rt_system_heap_init ((void *) & Image
RW I RAM1

ZI $$ Limit, (void *) STM32_SRAM_END);


Image
RW I RAM1

ZI$$Limit


This is a symbol exported by the linker, which represents the end of the ZI segment, that is, after the RAM of the program execution area ends (note this & lsquo; & rsquo; ;, a little i++ and ++i) address, in turn, is the starting address of the unused area of ​​RAM in our execution area (in fact, this is a bit far-fetched, because this understanding is often just a standard for quasi-finding, thinking in RAM The use of the ZI area is often the end of the entire program, maybe I understand it wrong here).
&Image Take the address.
RW I RAM1

ZI$$Limit

Copyright © Windows knowledge All Rights Reserved