Basic concepts of scatterfile)

Source: Internet
Author: User

I. Basic Concepts

What is an arm image file? The arm image file is actually an executable file, including the bin or hex format, which can be directly burned into the rom for execution. Generally, an image file consists of three output segments (RO, RW, and ZI. In scatterfile, you can specify different storage region addresses for each code or data zone during loading and execution. The so-called domain refers to the region where the entire bin image file is located, the storage block of Scatlerloading can be divided into two types: loading domain: The Storage Area of the application when the system starts or loads. Execution domain: the memory region where the application executes and data is accessed after the system starts. The system can have one or more execution blocks during real-time running. All the code and data in the image have a loading address and an operational address (the two may be the same or different, depending on the situation ). When the system starts, the _ main initialization code in the C function library performs the necessary copying and resetting operations to transfer the corresponding code and Data Segment of the application from the loading status to the execution status.

The entered Code generally includes the code part and data part. This is the so-called input segment. After compilation, it becomes the ro and rw segments in the binfile, and the so-called zi segments, this is the output segment. For the output segment in the loading field, generally the ro segment is followed by the rw segment, and the rw segment is followed by the zi segment. These output segments are not consecutive in the running domain, but rw and zi must be connected. Data in the zi and rw segments can be rw attributes.

Ii. Basic syntax

1. scatter File Syntax

The scatter file is a simple text file that contains some simple syntax.

ROM 0x0800_0000 0x00e0_0000; Define the loading domain

{

ROM 0x0800_0000 0x0040_0000; defines the execution domain, the execution domain first address = the loading domain first address

{

Bootarm. OBJ (C $ code, + first)

*. OBJ (leading_part, + first)

* Plutommi. Lib (+ RO-CODE)

* Lcmmi. Lib (+ RO-CODE)

* L4_classb.lib (+ RO-CODE)

* Mtkapp. Lib (+ RO-CODE)

* Lw.classb.lib (+ RO-CODE)

* Email. Lib (+ RO-CODE)

* L4misc. Lib (+ RO-CODE)

...........

...........

}

................

...............

ROM3 + 0x0 0x00400000

{

. ANY (+ RO-CODE)

}

ROM4 + 0 x0 0x00400000

{

ANY (+ RO-CODE)

}

ROM5 + 0x0

{

ANY (+ RO-DATA)

}

................

................

}

Each block is defined by a header title. The header contains at least the block name and start address, and the maximum length and other attribute options. The content of the block definition is included in a pair of curly braces that depend on specific system conditions. A loading block must contain at least one execution block. In practice, multiple execution blocks are usually used. An execution block must contain at least one code or data segment. These are usually from target files such as source files or library functions; the wildcard Number * matches the remaining part of the specified attribute item that is not defined in the file. The comment part starts with a semicolon and ends with the end of the current row.

Iii. System Analysis

Generally, a program includes read-only segments and data segments that can be read and written. In the integrated development environment of ARM, read-only code segments and constants are called RO segments (ReadOnly). read-write global variables and static variables are called RW segments (ReadWrite ); the variable to be initialized to zero in the RW segment is called the ZI segment (ZeroInit ). For embedded systems, program images are stored in some non-volatile devices such as Flash memory. during runtime, the RW segment of the program must be reloaded into the read/write RAM. This involves loading and running time domains of programs. Simply put, the loading time domain of a program refers to the state in which the program is burned into Flash, and the running time domain refers to the state in which the program is executed. In simple cases, you can specify ro base and rw base in the arm linker option of the analyticdb integrated development environment to inform the connector of the connection BASE Address of RO and RW. In complex cases, if the RO segment is divided into several parts and mapped to multiple locations in the bucket, you need to create a Scatterfile text file, notifies the connector to connect a part of the program to an address space in the memory. It should be noted that the definition in Scatterfile should be based on the memory distribution after system redirection. After the boot program completes the initialization task, the main program should be transferred to RAM for running to speed up the system.

Next we will parse the attached Scatterfile.

First, the project on the 6223 platform uses NORFlashROM (16 M) + SDRAM (4 M) + InternalRAM (48 K), and all the loaded domains are in FlashROM, that is, the bin size cannot exceed 12 Mb. The execution domain is scattered in FlashROM, SDRAM, and InternalRAM. the first execution domain in Flash ROM starts from the address 0x08000000, and the maximum value is 0x00400000, that is, 4 M, this includes bootarm. obj (C $ code, + First) and other target files. The second execution domain starts from the end of the First execution domain. The maximum value is 0x00400000, which is also 4 M, the third and fourth execution domains are all the remaining NORFlash spaces. The code segments of the execution domains are not specified in FlashROM, SDRAM, and InternalRAM. The external RAM, that is, the execution domain in the SDRAM, is from the address 0x00008000 to 0x00400000, a total of 4 M, including some read and write data segments, including the third-party software we added, the stack and the variable to be initialized to zero (that is, the ZI segment ). Internal RAM, that is, InternalRAM, starts from the address 0x40000000. The maximum value is 0xC000, that is, 48 K. It runs some data segments that need to be maintained by our 3GP module and some data segments such as bootloader.

 

The software running of the current project may feel slower than the previous project software. It is not ruled out that we have used GIF animation to replace the time for parsing images in BMP format, however, if we put some data segments of the 3GP function into the internal RAM to run, it will definitely reduce the system's idle memory usage and make the system need to use more external RAM, this reduces the speed at which the system runs.

Therefore, we can change Scatterfile appropriately and put some infrequently used data into external RAM for execution, which can greatly improve the software speed and give users a better user experience.

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.