BL51: DATA MEMORY OVERLAP WHEN USING PRECEDE DIRECTIVE
Information in this article applies to:
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.
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.
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.
Last Reviewed: Tuesday, July 19, 2005
of your data.