F2MC-16LX How to make the ROM efficient C source

Version: **





  1. Using the _direct declaration (C Analyzer enables to detect candidate for efficient _direct.)
      To improve the ROM code efficiency of C source, it is possible to improve by defining static variables as _direct declaration ones.
      The _direct declaration variables are in 256Byte (min.). It is efficient way to define frequent used variables as _direct declaration in order.
      direct declaration sample:
      _direct unsigned char port_new,port_old,port1_data;
      _direct unsigned int time;
      void main(void)
  2. Using the in-line. (C Analyzer enables to detect candidate for in-line expansion.)
      When defining the function of the small code size with argument as static function and implementing in-line expansion, which allow to reduce the code size.
      To implement in-line expansion of static declaration function, the -xauto option need specifying before compiling the source program.
      Example of in-line expansion:
      static Proc7 (IntParI1, IntParI2, IntParOut)
      OneToFifty IntParI1;
      OneToFifty IntParI2;
      OneToFifty *IntParOut;
      REG OneToFifty IntLoc;
      IntLoc = IntParI1 + 2;
      *IntParOut = IntParI2 + IntLoc;
  3. Using the built-in function
      When performing a multiplication and a division by C language, the code size is too big bye using the libraries of div/mul/mod.
      Therefore F2 MC-16LX family allow to use these built-in functions of _mul( )/_div( )/_mod( ). These functions enables to reduce the code size.
      Example of built-in function:
      unsigned int a,b;
      unsigned long c;
      void sample(void)
      //  c=a*b;              /* normal description of C language */
          c=_mul(a,b);     /* description of using built-in function */