Hi The IAR 8051 C compiler has an overlay mechanism whereby function parameters and non-static local variables are not stored on the stack (due to very small processor stack) but instead are stored in shared RAM (either on-chip RAM or external RAM). The RAM locations used for the local variables of one function might be the same locations as for another function, if the linker determines that those functions are never "active" at the same time i.e. that one doesn't directly or indirectly call the other. For functions that are called by interrupts, the compiler appears to realise that the shared RAM used by these functions must be separate from the shared RAM used by non-interrupt functions. The compiler help file I have doesn't describe this very well though. My question is : if one interrupt service routine can interrupt another (because they have different priorities), does the compiler/linker realise that each interrupt service routine must have separate shared RAM from any other interrupt service routine (regardless of whether the reentrant keyword is used or not). Also, is it safe to assume that the IAR 8051 C compiler won't re-order accesses to non-local variables "across a function call" if the function being called is in another module? TIA
IAR 8051 C compiler overlay mechanism
Started by ●February 1, 2006
Reply by ●February 1, 20062006-02-01
darkknight wrote:> > My question is : if one interrupt service routine can interrupt another > (because they have different priorities), does the compiler/linker > realise that each interrupt service routine must have separate shared > RAM from any other interrupt service routine (regardless of whether the > reentrant keyword is used or not). >Suggestions. 1. Try on a simple piece of code and look at the compiler output. 2. Ask IAR 3. Ask at www.8052.com Ian