FR How to reduce the RAM sizes

Answer:

Examination of lessening RAM size from the program of view.

By no useless space in RAM with align, effectively RAM is possible to use.

clear space of external area → use of "varorder sort"

-varorder sort is specified location method of static variable by option of compiler.The examples are shown below.

[Example] Below are some cases of variable definition:

static int i;
static char k;
static int j;
static short m;

 
  

-varorder normal

   

Variable location

   

32bit (4Byte)

   
                                                                                                                                                    
i
    k        *        *        *    
j
m**
  
   

Total 16Byte (clear space 5Byte)

   

(*: clear space)

 
 
 
  

-varorder sort

   

Variable location

   

32bit (4Byte)

   
                                                                                                                            
i
    k        *           m       
j
 
  
   

Total 12Byte (clear space1Byte)

   

(*: clear space)

 

Therefore we recommend actively to use -varorder sort because static variable is stored without uselessness. 

Confirmation of external area

The check whether useless external variable and static variable is used or not and whether useless external area is maintained or not is effective. (however there is no check tool.)
If external area is not needed, RAM size of total program is reduced by changing to local variable but use size of stack is increased.