Keil arm compile RO RW ZI DATA

Publisher:runaway2000Latest update time:2016-01-12 Source: eefocusKeywords:Keil  arm  compile  DATA Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
The composition of ARM program (referring to the program being executed in the ARM system, not the bin file saved in ROM) 
An ARM program consists of 3 parts: RO segment, RW segment and ZI segment 
RO is the instructions and constants in the program 
RW is the initialized variable in the program 
ZI is the uninitialized variable in the program 
From the above 3 points, it can be understood that: 
RO is readonly, 
RW is read/write, and 
ZI is zero 
The composition of ARM image file 
The so-called ARM image file refers to the bin file burned into ROM, also known as image file. It is called Image file below. 
Image file contains RO and RW data. 
The reason why Image file does not contain ZI data is that ZI data is all 0, so it is not necessary to include it. Just clear the area where ZI data is before running the program. Including it will waste storage space. 
Q: Why must Image contain RO and RW? 
A: Because the instructions and constants in RO and the initialized variables in RW cannot be "created out of nothing" like ZI.  From the above two points, we can know that the image file burned into ROM is not exactly the same as the ARM program in actual operation. Therefore, it is necessary to understand how the ARM program reaches the actual operation state from the image in ROM.
In  fact, the instructions in RO should at least have the following functions:  1. Move RW from ROM to RAM, because RW is a variable and variables cannot exist in ROM.  2. Clear all RAM areas where ZI is located, because the ZI area is not in the image, so the program needs to clear the corresponding RAM area according to the ZI address and size given by the compiler. ZI is also a variable. Similarly: variables cannot exist in ROM In the initial stage of program operation, the C program can access variables normally only after the instructions in RO complete these two tasks. Otherwise, only code without variables can be run.  After saying the above, you may still be a little confused. What are RO, RW and ZI? Below I will give a few examples to explain what RO, RW, and ZI mean in C in the most intuitive way.   1; RO  Look at the following two programs. There is a statement between them. This statement is to declare a character constant. So according to what we said before, they should only differ by one byte in RO data (character constants are 1 byte).  Prog1:  #include   void main(void)  {  ;  }  Prog2:  #include   const char a = 5;  void main(void)  {  ;  }  The compiled information of Prog1 is as follows:  ===========================================================================================  Code RO Data RW Data ZI Data Debug  948 60 0 96 0 Grand Totals  =====================================================================================  Total RO Size(Code + RO Data) 1008 ( 0.98kB)  Total RW Size(RW Data + ZI Data  ) 96 ( 0.09kB)  Total ROM Size(Code + RO Data + RW Data) 1008 ( 0.98kB)  === ...  ===================================================================  09  (  0.99kB  )  Total RW Size (RW Data + ZI Data) 96 ( 0.09kB)  Total ROM Size (Code + RO Data + RW  Data  )  1009  (  0.99kB  )  ===  ... 














































void main(void) 



Prog4: 
#include  
char a = 5; 
void main(void) 



The information after compiling Prog3 is as follows: 
======================================================================================= 
Code RO Data RW Data ZI Data Debug 
948 60 0 96 0 Grand Totals 
=============================================================================================================== 
Total RO Size(Code + RO Data) 1008 ( 0.98kB) 
Total RW Size(RW Data + ZI Data) 96 ( 0.09kB) 
Total ROM Size(Code + RO Data + RW Data) 1008 ( 0.98kB) 
=========================================================================================== 
The information compiled by Prog4 is as follows: 
====================================================================================================== 
Code RO Data RW Data ZI Data Debug 
948 60 1 96 0 Grand Totals 
============================================================================ 
Total RO Size(Code + RO Data) 1008 (0.98kB) 
Total RW Size(RW Data + ZI Data) 97 (0.09kB) 
Total ROM Size(Code + RO Data + RW Data) 1009 (0.99kB) 
=== 
... 
​ 
​ 
Prog3: 
#include  
void main(void) 



Prog4: 
#include  
char a; 
void main(void) 



The information after compiling Prog3 is as follows: 
======================================================================================== 
Code RO Data RW Data ZI Data Debug 
948 60 0 96 0 Grand Totals 
====================================================================================== 
Total RO Size(Code + RO Data) 1008 ( 0.98kB)  Total RW Size(RW Data + ZI Data 
) 96 ( 0.09kB) 
Total ROM Size(Code + RO Data + RW Data) 1008 ( 0.98kB) 
=== ...  ===================================================================  08 ( 0.98kB  ) Total RW Size (RW Data + ZI Data)  97  (  0.09kB)  Total ROM Size (Code + RO Data + RW Data) 1008 (0.98kB) 








=== 
... 
​ 
​ 
​ 
​ 
​ 
​ 
Appendix: 
Program compilation command (assuming the C program is named tst.c): 
armcc -c -o tst.o tst.c 
armlink -noremove -elf -nodebug -info totals -info sizes -map -list aa.map -o tst.elf
The compiled information of tst.o is in the aa.map file. 
ROM mainly refers to: NAND Flash, Nor Flash 
RAM mainly refers to: PSRAM, SDRAM, SRAM, DDRAM 
Keywords:Keil  arm  compile  DATA Reference address:Keil arm compile RO RW ZI DATA

Previous article:STM32 Getting Started Notes (3)——GPIO
Next article:NAND flash boot of S3C2410X

Recommended ReadingLatest update time:2024-11-16 20:26

Embedded Linux Development (XVIII) Memory Management (2) ARM Memory Management
Hardware memory management armv7v8 ARM is uniformly addressed, that is, peripherals and (memory A) are uniformly addressed, together forming a 4G physical address space (32 bits as an example). The memory controller belongs to peripherals, and the memory belongs to (memory A). The internal and external memory of a soc
[Microcontroller]
Introduction to ARM7 Series LPC2103 MCU
1 Introduction LPC2103 is the latest LPC2103 launched by PHILIPS based on ARM7TDMI-S and LQFP48 package, with a maximum operating speed of 70MHz, 32KB on-chip FLASH program memory and 8K on-chip static RAM. ISP/IAP programming is achieved through the on-chip boot loader. The LPC2103's 10-bit A/D converter provides
[Microcontroller]
Introduction to ARM7 Series LPC2103 MCU
Design and implementation of network card interface based on ARM and DM9000
The most basic switched capacitor circuit is composed of electronic switches and capacitors, and its main application is to form various low-pass, high-pass, band-pass, band-stop and other switched-capacitor filters (SCF). The switched capacitor active filter composed of the switched capacitor circuit and the operat
[Microcontroller]
Design and implementation of network card interface based on ARM and DM9000
Research on GPS signal acquisition and processing under ARM-Linux platform
Positioning and navigation are important functions of many portable mobile devices and automotive electronic devices, so GPS is widely used in these devices. The embedded platform based on ARM-Linux is becoming the main development platform for various portable devices and vehicle navigation devices due to its opennes
[Microcontroller]
Research on GPS signal acquisition and processing under ARM-Linux platform
【ARM】The function of BL0 in S5PV210 chip
The functions of BL0 in the S5PV210 chip are as follows: (1) Turn off the watchdog; (2) Clear the instruction register; (3) Initialize the stack area; (4) Initialize the heap area; (5) Initialize the block device copy function; (6) Initialize the PLL and set the system clock; (7) Copy BL1
[Microcontroller]
ARM and Hopu Investments issued a joint statement on the removal of Wu Xiong'ang
On June 10, 2020, ARM and Hopu Investments jointly issued a statement saying that they had reached a decision to remove Wu Xiong'ang, chairman and CEO of ARM China. The original text is as follows: As the majority shareholder of ARM Technology (China) Co., Ltd. (hereinafter referred to as ARM China), ARM and Hopu
[Semiconductor design/manufacturing]
Introduction to ARM serial communication and parallel communication
Computer communication (data exchange) is mainly divided into: serial communication and parallel communication Serial Communication Concept: Data transmission between a computer and an I/O device is done one bit at a time in sequence. Usually data is transmitted on a single data line or a pair of differential lines.
[Microcontroller]
Introduction to ARM serial communication and parallel communication
Redundant Design of ARM Processor in DCS Controller
In many areas of automation, the requirements for effectiveness are getting higher and higher, and thus the requirements for the fault tolerance level of the automation system are also getting higher and higher, especially in situations where the cost of equipment downtime is very high. In order to meet these string
[Microcontroller]
Redundant Design of ARM Processor in DCS Controller
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号