Keil Logo

BL51: How Much Code and Data Are Used?


Information in this article applies to:

  • C51 Version 6.x

QUESTION

Is there a way I can determine the total size of my CODE and XDATA space?

ANSWER

Yes.

This feature has always been available in the LX51 Linker and was added in Version 4.22 of the BL51 Linker. The program size information is provided at the bottom of the MAP file. For example:

Program Size: data=106.1 xdata=21493 const=0 code=21889
LX51 RUN COMPLETE.  0 WARNING(S),  0 ERROR(S)

These values are in bytes. The decimal in the data size (106.1) is due to the bit variables. In this case, there is a bit variable the size .1 bytes, or 1 bit. If you look in the map file, you may see something like this:

* * * * * * *   D A T A   M E M O R Y   * * * * * * *
REG     0000H     0008H     ABSOLUTE     "REG BANK 0"
BIT     0022H.0   0001H.1   UNIT         _BIT_GROUP_

In Version 4.21 and earlier of the BL51 Linker, you may manually determine the CODE and XDATA space required using the information in the Link Map. For example:

* * * * * * *  X D A T A   M E M O R Y  * * * * * * *
XDATA   0000H     4000H     UNIT         ?XD?ALLOC
XDATA   4000H     0FA0H     UNIT         ?XD?MEMORY
XDATA   4FA0H     03E8H     UNIT         _XDATA_GROUP_
XDATA   5388H     0065H     UNIT         ?XD?OUTPUT
XDATA   53EDH     0008H     UNIT         ?XD?INIT_MEM

The total XDATA space required is 53EDh + 8h = 53F5h or 21493 decimal.

MORE INFORMATION


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.