Directives Reference

7.3.6DCD and DCDU

The DCD directive allocates one or more words of memory, aligned on 4-byte boundaries, and defines the initial runtime contents of the memory.

&is a synonym for DCD.

DCDU is the same, except that the memory alignment is arbitrary.

Syntax

{label} DCD{U} expr{,expr}

where:

 

 

expr

is either:

 

a numeric expression (see Numeric expressions on page 3-20).

 

a program-relative expression.

Usage

DCD inserts up to 3 bytes of padding before the first defined word, if necessary, to achieve 4-byte alignment.

Use DCDU if you do not require alignment.

See also:

DCB on page 7-18

DCW and DCWU on page 7-25

DCQ and DCQU on page 7-24

SPACE on page 7-17.

Examples

data1

DCD

1,5,20

;

Defines 3 words containing

 

 

 

;

decimal values 1, 5, and 20

data2

DCD

mem06 + 4

;

Defines 1 word containing 4 +

 

 

 

;

the address of the label mem06

 

AREA

MyData, DATA,

READWRITE

 

DCB

255

;

Now misaligned ...

data3

DCDU

1,5,20

;

Defines 3 words containing

 

 

 

;

1, 5 and 20, not word aligned

ARM DUI 0068B

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

7-19

Page 301
Image 301
ARM VERSION 1.2 manual DCD and Dcdu, Numeric expression see Numeric expressions on, Program-relative expression