Keil Logo

C51: Mixing Memory Models and Memory Areas


Information in this article applies to:

  • C51 Version 5.50

QUESTION

We have a large memory configuration (external RAM of 64K code and 64K XData). We would like to use the external data for buffers, queues, and so on.

Is there a compiler option to use the internal RAM (256 -32 bytes) for our stack? We do not want to use the simulated stack because of inefficiency.

ANSWER

The compiler is completely flexible in where you locate variables, buffers, reentrant stacks, and so on. You may specify different memory models for each function in your program, different memory models for reentrant functions, and for each variable. For example:

  • void func (void) large -- large memory model function - vars stored in xdata
  • void func (void) small -- small memory model function - vars stored in data
  • void func (void) small reentrant -- reentrant function using the small memory model reentrant stack
  • http://www.keil.com/support/man/docs/c51/c51_le_memmodels.htm
  • char xdata x; -- char in xdata
  • int code y; -- int in code (EPROM)

SEE ALSO


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.