[Icc-avr] Using to much RAM for local variables

John Baraclough j_baraclough at zetnet.co.uk
Fri Aug 15 02:11:04 PDT 2008


That is why arrays should always be global! They don't take up any more 
space and the code to access them is the same, but the compiler will 
detect the problem immediately.

John


Bengt Ragnemalm wrote:
>
> Hi.
>
>  
>
> I felled in a new pit and have just found the ladder.
>
>  
>
> I use an Mega88, it has 1 k RAM. I have declared two local arrays, 
> both with 512 bytes. Obviously this will not work if they are used 
> simultaneously. Unfortunately they are, something I totally missed. 
> But the code compiles fine and I have been a little upset struggling 
> with the problem that my hardware just turned off after 90 seconds by 
> it self without ever entering the POWER OFF state. The problem was 
> that as soon as one of the arrays was starting to write data to the 
> later sections, it instead was writing in my registers. Among others, 
> the register that was controlling the power.
>
>  
>
> QUESTION: Is it natural that the compiler does not generate any error 
> in this situation?
>
>  
>
> The actual problem should not be to difficult to solve.
>
>  
>
> /Bengt
>
>  
>
>  
>



More information about the Icc-avr mailing list