ARM Technical Support Knowledge Articles

INCORRECT ADDRESS USED FOR ARRAY

Applies to: L166 Linker/Locator

Answer


Information in this article applies to:


SYMPTOMS

I am trying to copy an array from ROM to on-chip RAM. When I look at the addresses used for the memcpy in the debugger, the wrong address is used for the on-chip RAM and the code attempts to copy the array back to a location in ROM. Here are my linker directives:

DPPUSE (1=NDATA (0x200000-0x207FFF),
        0=NCONST(0x003000-0x003FFF))

CLASSES (NCODE (0X0000-0X2FFF, 0x4000-0xBFFF),
SDATA (0XE000-0XE7FF, 0XFC00-0XFD7F),
SDATA0 (0XE000-0XE7FF, 0XFC00-0XFD7F),
FIXRAM (0xFD80-0xFDFF)

I am copying from an array called src to an array called dest, both three bytes in size:

const unsigned char src[3] = { 0xaa, 0x55, 0xa5};

#pragma RENAMECLASS (NDATA0=FIXRAM)
unsigned char dest[3];

After linking, src was located at 3000H and dest was located at FD80H. However, in the debugger, the address used for dest was 3D80H which is inside the NCONST class.

Why isn't DPP3 being used to access the FIXRAM class? It is located in the address range accessed by DPP3.

CAUSE

The Data Page Pointers may only be used to access the NCONST and NDATA classes. In your DPPUSE directive, you have specified that DPP0, 1 and 2 may be used to access NCONST and NDATA, however DPP3 is not specified. Therefore, it cannot be used to access NCONST or NDATA.

RESOLUTION

Instead of using the FIXRAM class, declare your dest array as sdata. sdata is always accessed using DPP3. The correct address will then be used.

unsigned char sdata dest[3];

Note that it is not possible to add the FIXRAM address range to the NDATA range specified in the DPPUSE directive, as the range of addresses used by NDATA must be contiguous.

MORE INFORMATION

SEE ALSO

Article last edited on: 2005-07-15 13:22:24

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential