Keil Logo

BL51: DATA MEMORY OVERLAP WHEN USING PRECEDE DIRECTIVE


Information in this article applies to:

  • C51 Version 5.50

SYMPTOMS

When I add printf() to my project, I get a Memory Overlap Error from the linker for the Data space. Part of my map file looks like the following:

            TYPE    BASE      LENGTH    RELOCATION   SEGMENT NAME
            -----------------------------------------------------

            * * * * * * *   D A T A   M E M O R Y   * * * * * * *
            ...
            DATA    0018H     0024H     UNIT         _DATA_GROUP_
* OVERLAP * DATA    0028H     0002H     UNIT         ?DT?EVL_INIT
            DATA    003CH     0010H     UNIT         ?DT?DEMO1
                    004CH     0024H                  *** GAP ***
            ...

The segment ?DT?EVL_INIT is located at 0028H with the linker DATA directive. The linker PRECEDE directive is used with the _DATA_GROUP_ segment.

CAUSE

When you added the printf() call, the size of the _DATA_GROUP_ segment increased in size to the point where it could not fit into Data memory before the ?DT?EVL_INIT segment. When the linker tried to place the ?DT?EVL_INIT segment into memory, it failed because part of that space was already taken by the Data Group. The reason the _DATA_GROUP_ segment was located before the ?DT_EVL_INIT segment was because the PRECEDE directive is used.

RESOLUTION

Remove _DATA_GROUP_ from the PRECEDE directive so the linker can fit the Data Group into Data memory after locating the ?DT?EVL_INIT segment. This gives the linker the greatest flexibility in locating the segments.

If it is not possible to remove _DATA_GROUP_ from the PRECEDE directive, then the DATA directive must be used to juggle the segments around so they can all fit into Data memory.

MORE INFORMATION

  • Refer to DATA in the BL51 User's Guide.
  • Refer to PRECEDE in the BL51 User's Guide.

Last Reviewed: Tuesday, July 19, 2005


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.