Instructions for RO, RW, Zi

Source: Internet
Author: User

Reference article:

Instructions for RO, rw, and Zi data in arm

Http://mcuos.com/thread-2843-1-1.html

STM32 after generating the compilation file size Explore http://www.cnblogs.com/51mcu/p/3940376.html

Hex, Bin, elf, axf file differences

http://wenku.baidu.com/link?url=jnO4kGRmKoGA8SGl6wN9nZboEAPUqnZGs0_ Xyk743e47wctf5a7crjbprajaeg92voe92dqwoxyksrrrp3pc4wymza65udxgu25ebcr3vmw


ARM program The composition ,refers to the armsysteminstead of the bin image saved in ROM (image)file, this point clear attention to the difference.

ro is the instruction and constant "ReadOnly" in the program.
RW is the initialized variable "read/write" in the program

Zi is an uninitialized variable "zero" in the program


The composition of the arm image file ,refers to the bin file that is burned into ROM and becomes an image file. Use the image file to call it.
the image file contains RO and RW data. The image file does not contain Zi data because the Zi data is 0 and is not necessarily included, as long as the program Run before the Zi data is located in the area of the 0 can be cleared. Instead, it wastes storage space.

Bin File size = RO + RW + CODE

Note: The bin file contains only pure binary data

Hex file contains address information in addition to the data itself, so the hex file is slightly larger

The AXF file contains debugging information.



The instructions in RO include the following functions:

1. Move RW from ROM to ram because RW is a variable and cannot exist in ROM

2, the Zi is located in the Ram area all zeroed, because the Zi region and no longer image, so the program needs to be given by the compiler Zi address and the size of the corresponding RAM area is zeroed, Zi is also a variable, can not exist in the ROM


< Span style= "Color:rgb (34,34,34); Font-family:helvetica,arial,sans-serif; font-size:14px; line-height:22.390625px ">

<span style= "White-space:pre" ></span> Prog1: #include <stdio.h> void main (void)            {            ;            } PROG2: #include <stdio.h> const char a = 5; void main (void)            {            ;            The information after compiling the PROG1 is as follows: ================================================================================ Code RO Data RW data ZI data Debug 948 0 0 Grand Totals =========================== ===================================================== Total RO Size (Code + ro Data) 1008 (0.98kB) T            Otal RW size (rw data + ZI data) (0.09kB) Total ROM Size (Code + RO data + RW data) 1008 (0.98kB) The following information is compiled by ================================================================================ Prog2: =  ===============================================================================          Code RO Data RW data ZI data Debug 948 0 0 Grand Totals ============================ ==================================================== Total RO Size (Code + ro Data) 1009 (0.99kB) to            Tal RW size (rw data + ZI data) (0.09kB) Total ROM Size (Code + RO data + RW data) 1009 (0.99kB) ================================================================================

Prog1 and Prog2 ro a byte difference.

<span style= "White-space:pre" ></span> Prog3: #include <stdio.h> void main (void)            {            ;            } PROG4: #include <stdio.h> char a = 5; void main (void) {            ;            The information after compiling the PROG3 is as follows: ================================================================================ Code RO Data RW data ZI data Debug 948 0 0 Grand Totals =========================== ===================================================== Total RO Size (Code + ro Data) 1008 (0.98kB) T            Otal RW size (rw data + ZI data) (0.09kB) Total ROM Size (Code + RO data + RW data) 1008 (0.98kB) The following information is compiled by ================================================================================ Prog4: =        ===============================================================================    Code RO Data RW data ZI data Debug 948 1 0 Grand Totals ==================================  ============================================== Total RO Size (Code + ro Data) 1008 (0.98kB) Total RW Size (RW data + ZI data) 0.09kB () Total ROM Size (Code + RO data + RW data) 1009 (0.99kB) ====== ==========================================================================

Prog3 and Prog4 rw differ by one byte

<span style= "White-space:pre" ></span> Prog3: #include <stdio.h> void main (void)            {            ;            } PROG4: #include <stdio.h> char A; void main (void) {            ;            The information after compiling the PROG3 is as follows: ================================================================================ Code RO Data RW data ZI data Debug 948 0 0 Grand Totals =========================== ===================================================== Total RO Size (Code + ro Data) 1008 (0.98kB) T            Otal RW size (rw data + ZI data) (0.09kB) Total ROM Size (Code + RO data + RW data) 1008 (0.98kB) The following information is compiled by ================================================================================ Prog4: =            ===============================================================================Code RO Data RW data ZI data Debug 948 0 0 Grand Totals ====================================== ========================================== Total RO Size (Code + ro Data) 1008 (0.98kB) Total RW Siz E (RW data + ZI data) 0.09kB () Total ROM Size (Code + RO data + RW data) 1008 (0.98kB) ========== ======================================================================

Prog3 and Prog4 's Zi differ by one byte.


Summarize:

1, instructions and constants are compiled after the RO type data

2. Variables not initialized to 0 are Zi type data after compilation

3. A variable that has been initialized to a value other than 0 is compiled with the RW type data









Instructions for RO, RW, Zi

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.