Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/06/02 22:08
Read: times


 
#28768 - RE: Overlaying
Peter wrote:
"On C you must hold variables local whenever possible.
E.g. on some Projects I use 1000 Bytes or more as local variables and the compiler can overlay all these to fit it into the 256 bytes internal RAM."
(my emphasis)

Spencer replied:
"I'm currently using 'C' with a cygnal 005"

Whose 'C'?
What version?

"If 1000 bytes of data need to be stored and there is 256 memory locations it doesn't seem possible to somehow store this info."

Peter referred specifically to local data. So, although he has a total of 1000 bytes, he doesn't use all 1000 at the same time. Therefore the Linker can re-use the memory space (or "Overlay" the variables) so that he only needs to use <256 bytes at any particular time

On bigger processors (eg, x86), function parameters & local variables are held on the stack, so this "overlaying" effectively takes place at run-time. The 8051 doesn't have enough stack space to do this, so the overlaying has to be done "statically" - worked out at Link-time.
This is why you have to specifically mark C51 functions as reentrant, and implement your own software stack, if you need to use 'C' reentrancy on the 8051.


List of 8 messages in thread
TopicAuthorDate
Need more data RAM?            01/01/70 00:00      
RE: Need more data RAM?            01/01/70 00:00      
RE: Need more data RAM?            01/01/70 00:00      
RE: Need more data RAM?            01/01/70 00:00      
RE: Need more data RAM?            01/01/70 00:00      
RE: Need more data RAM?            01/01/70 00:00      
RE: Need more data RAM?            01/01/70 00:00      
RE: Overlaying            01/01/70 00:00      

Back to Subject List