Keil Logo


Information in this article applies to:

  • C51 Version 5.50


In my design 0000H - 7FFFH is for both code and data (von Neuman architecture) and 8000H - FFFFH is used only for data. How can I configure the linker to use this arrangement?


As far as the linker is concerned data and memory space are seperate and there is no way to tell the linker that you are using a von Neumann architecture. What you will have to do is divide your code and data space into two sections, one for CODE and one for XDATA. For example you would maybe start CODE memory at 0000H and XDATA at perhaps 6000H. You can do this using the following linker directives:

CODE(0000H) XDATA(6000H)

Note that you cannot define the upper limit of CODE or XDATA memory. Using the directives above will define CODE memory from 0000H - FFFFH and XDATA memory from 6000H - FFFFH.

The linker locates segments starting at the lowest available memory location, so as you develop your project the amount of code and xdata space will gradually increase. You will have to keep checking the .m51 file generated by the linker to make sure that your CODE memory usage does not start to overlap with your XDATA memory usage.

For example if you had the arrangement described above and you were using CODE address 6100H the linker will not know that this is also XDATA address 6100H and will not generate an error. You will have to make sure that your XDATA and CODE usage do not overlap.

However, if you wish to treat data as code or vice versa you may wish to overlap segments so they are located in both CODE and XDATA spaces.

If your memory arrangements are more complex and you wish to leave gaps in your CODE memory to avoid overlap then you can declare arrays to generate the gaps:

const code char gap[0x1000] _at_ 0x6000;

Will generate a gap from 6000H to 6FFFH. This block would then be used exclusively for XDATA.


  • Refer to XDATA in the BL51 User's Guide.
  • Refer to CODE in the BL51 User's Guide.


The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Tuesday, July 19, 2005

Did this article provide the answer you needed?
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.