Tool News
 
 
 

Tool News

Products Info
Downloads
Tools FAQs
MESC TOOL NEWS: MESCT-NC79WA_1-991116D

NC79WA Precaution

Please take note of the following problem in using C compiler NC79WA (with assembler and integrated development environment) for the 7900 series of microcomputers.


  1. Versions Concerned
    V.3.00 Release 1 -- V.3.10 Release 2

  2. Problem
    In inline functions that produce stack frames, codes for recovering the previous DPR register saved on the stack cannot be created.

  3. Conditions
    This problem occurs if any of the following three conditions is satisfied in a stack frame:
    (1)Arguments are passed to the stack
    (2)Auto variables are used
    (3)A temporary area for operations is needed

  4. Examples
    (1)In the case where arguments are passed to the stack
     ---------------------------------------------------------------
     /*C Program*/
     void  f(int,int);
    
     inline  void  func(int i,int j)
     {
         f( i,j );
     }
    
     /*Codes Created*/
     _func   .MACRO
         phd     0    <------ The previous DPR register saved on the stack
         pha
         tsd
         sta     A,DP0:1 ;  i
     ;## # C_SRC :       f( i,j );
         pei     DP0:5   ;  j
         lda     A,DP0:1 ;  i
         jsrl    $f
         plx
     ;## # C_SRC :   }
         plx
         .ENDM        <---- The previous DPR register 
                                      remains not recovered from the stack
     ---------------------------------------------------------------
    
    (2)In the case where an auto variable is used
     --------------------------------------------------------------- 
     /*C Program*/
     void  f(int);
    
     inline  void  func(void)
     {
         int i = 1;
         f( i );
     }
    
     /*Codes Created*/
     _func   .MACRO
         phd     0    <----- The previous DPR register saved on the stack
         pha
         tsd
     ;## # C_SRC :       int i = 1;
         movm.W  DP0:1,#0001H    ;  i
     ;## # C_SRC :       f( i );
         lda     A,DP0:1 ;  i
         jsrl    $f
     ;## # C_SRC :   }
         plx
         .ENDM        <---- The previous DPR register 
                                     remains not recovered from the stack
     ---------------------------------------------------------------
    
    (3)In the Case where a temporary area for operations is needed
     --------------------------------------------------------------- 
     /*C Program*/
     int  i,j,k,l;
    
     inline  void  func(void)
     {
        i = (i + j) * (k - l);
     }
    
     /*Codes Created*/
     _func   .MACRO
         phd     0    <----- The previous DPR register saved on the stack
         pha
         tsd
     ;## # C_SRC :       i = (i + j) * (k - l);
         lda     A,DT+:_k
         sub     A,DT+:_l
         sta     A,DP0:1 ;  __TMP1
         lda     A,DT+:_j
         add     A,DT+:_i
         mpys    DP0:1   ;  __TMP1
         sta     A,DT+:_i
     ;## # C_SRC :   }
         plx
         .ENDM        <---- The previous DPR register 
                                     remains not recovered from the stack
     ---------------------------------------------------------------
    

  5. Workaround
    Do not declare any function that satisfies any one of the above conditions to be an inline function.





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