Tool News
 
 
 

Tool News

Products Info
Downloads
Tools FAQs
MESC TOOL NEWS: MESCT-NC77WA-010316D

NC77WA
Precaution

Please take note of the following problem in using C compiler NC77WA for the 77xx series of microcomputers.
  • The x flag may not indicate correct status.


  1. Versions Concerned
    NC77WA V.5.00 Release 1 -- V.5.20 Release 4


  2. Problem
    In the processing that comes with backward jumps, the "for" statement for example, the x flag may not indicate correct status.
    2.1 Conditions
    This problem occurs if the following four conditions are satisfied:
    (1) Data of type char and of other types co-exist within the range of backward jumps made with "goto" backward jumps only), "for", "while", or "do-while" statements (hereafter called a backward jump block).
    (2) In the first statement of the backward jump block in (1), a code that compares a constant with the contents of the X or Y register is generated by the compiler. (In Example below, the contents of register X is used as the offset value of s.ch1.)
    (3) In the last statement of the backward jump block in (1), a code that compares a constant of 0 with the contents of register X or Y is generated. (In Example below, the contents of register X is used as the offset value of uc[i].)
    (4) The program jumps to the beginning of the backward jump block with the X flag being set or cleared depending on the evaluation of the conditional expression in (3).
    2.2 Example
    -------------------------------------------------------------
      /* In this example, the problem occurs 
                      when compile option -OS used. */
      struct S{
          unsigned char   ch1;
          unsigned char   ch2;
      } s;
    
      unsigned char   uc[5];
    
      void func(void)
      {
          int i, j;
    
          for( i=0; i<2; i++ ){                   /* Condition (1) */
              if( s.ch1 == 1 ){                   /* Condition (2) */
                  uc[i] = 1;
              }
    
              if( (uc[i] == 5) || (uc[i] == 0) ){ /* Condition (3) */
                  uc[i] = 0;
              }
              /* Condition (4)
               * If evaluation TRUE, program jumps with X flag set to 1; 
               * otherwise, with X flag cleared to 0.
              */
          }
      }
    -------------------------------------------------------------


  3. Workaround
    If this problem arises, force the value of the X flag to change by adding an asm function immediately after the last backward jump block.
       [Example]
       -------------------------------------------------------------
             struct S{
                 unsigned char   ch1;
                 unsigned char   ch2;
             } s;
    
             unsigned char   uc[5];
    
             void func(void)
             {
                 int i, j;
    
                 for( i=0; i<2; i++ ){
                     if( s.ch1 == 1 ){
                         uc[i] = 1;
                     }
    
                     if( (uc[i] == 5) || (uc[i] == 0) ){
                         uc[i] = 0;
                     }
                     asm(2,0);  /* Added to clear the X flag only to 0 */
                 }
             }
       -------------------------------------------------------------


  4. Schedule of Fixing Problem
    We plan to fix this problem in our next release.





© 2008. Renesas Technology Corp., All rights reserved. Privacy | Legal