Keil Logo

BL51: Warning L4 (Data Space Memory Overlap)


Information in this article applies to:

  • C51 version 5.50 and later

QUESTION

When I link my code I get this warning message. How do I fix it?

*** WARNING L4: DATA SPACE MEMORY OVERLAP
FROM:    0004H
TO:      0007H

ANSWER

This is caused by the linker attempting to locate more than one data segment at the range of addresses specified in the warning. In the particular case given above, those addresses are usually occupied by Register Bank 0.

Check the map file generated by the linker (extension .m51) and towards the start of the file you will see a table called 'LINK MAP OF MODULE'. This is the memory map of your project.

Look in the Data Memory section at the segments located around 0000H to 0007H. You can figure out from the segment names what is being located there. For example:

?DT?FOO

is a segment that contains the data variables from the file foo.c.

One of the segments must be relocated to avoid the overlap. If you have any variables that you are absolutely locating with the _at_ keyword (in C) or the DSEG directive (in assembler) at locations 0004H to 0007H, then they must be moved to different locations.

If you are absolutely locating a segment at those addresses using the linker DATA directive, then another address must be used.

Finally, if you must use those particular locations to store your variables, then you can change the default Register Bank used. This can be achieved by using the REGISTERBANK directive for both the compiler and assembler:

REGISTERBANK(1)

However, selecting Register Bank 0 with the 'using' keyword or using the REGISTERBANK directive somewhere in your code will cause locations 0000H to 0007H to be reserved for the Register Bank again.

MORE INFORMATION

  • Refer to REGISTERBANK in the Cx51 User's Guide.
  • Refer to DSEG in the Ax51 User's Guide.
  • Refer to DATA in the BL51 User's Guide.
  • Refer to Warning L4 in the BL51 User's Guide.

Last Reviewed: Thursday, February 25, 2021


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.