Keil Logo

L166: INCORRECT ADDRESS USED FOR ARRAY


Information in this article applies to:

  • C166 Version 3.12
  • C166 Version 4.03

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

  • Refer to sdata in the C166 User's Guide.
  • Refer to DPPUSE in the L166 User's Guide.

SEE ALSO

Last Reviewed: Tuesday, April 28, 2015


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.