ARM VERSION 1.2 manual Example,CODE,READONLY An example code section

Models: VERSION 1.2

1 360
Download 360 pages 38.37 Kb
Page 335
Image 335

Directives Reference

Identical ELF sections with the same name are overlaid in the same section of memory by the linker. If any are different, the linker generates a warning and does not overlay the sections. See the Linker chapter in ADS Linker and Utilities Guide.

COMMON Is a common data section. You must not define any code or data in it. It is initialized to zeroes by the linker. All common sections with the same name are overlaid in the same section of memory by the linker. They do not all need to be the same size. The linker allocates as much space as is required by the largest common section of each name.

DATA Contains data, not instructions. READWRITE is the default.

NOINIT Indicates that the data section is uninitialized, or initialized to zero. It contains only space reservation directives SPACE or DCB, DCD, DCDU, DCQ, DCQU, DCW, or DCWU with initialized values of zero. You can decide at link time whether an AREA is uninitialized or zero-initialized (see the Linker chapter in ADS Linker and Utilities Guide).

READONLY Indicates that this section should not be written to. This is the default for Code areas.

READWRITE Indicates that this section can be read from and written to. This is the default for Data areas.

Usage

Use the AREA directive to subdivide your source file into ELF sections. You can use the same name in more than one AREA directive. All areas with the same name are placed in the same ELF section.

You should normally use separate ELF sections for code and data. Large programs can usually be conveniently divided into several code sections. Large independent data sets are also usually best placed in separate sections.

The scope of local labels is defined by AREA directives, optionally subdivided by ROUT directives (see Local labels on page 3-16 and ROUT on page 7-68).

There must be at least one AREA directive for an assembly.

Example

The following example defines a read-only code section named Example.

AREA

Example,CODE,READONLY ; An example code section.

 

; code

ARM DUI 0068B

Copyright © 2000, 2001 ARM Limited. All rights reserved.

7-53

Page 335
Image 335
ARM VERSION 1.2 manual Example,CODE,READONLY An example code section