Tool News
 
 
 

Tool News

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

NC77WA, NC77 Precaution

Please take note of the following problems in using C compilers NC77WA (with assembler and integrated development environment) and NC77 for the 77XX series of microcomputers.


On the Multiplication of a 2- and a 4-Byte Variable
  1. Versions Concerned
    Product Name Versions
    NC77WA/NC77 V.4.00 Release 1 to V.5.00 Release 1


  2. Problem
    Only when a value spreading over the multiplication library is loaded into the X register, the contents of the register is corrupted after calling the multiplication library.

  3. Conditions
    This problem occurs only if the following four conditions are satisfied:
    (1) Option "-OS" is not chosen.
    (2) Multiplication of a 2- and a 4-byte variable is performed.
    (3) The above 4-byte variable is within a range of 0x00000000 through 0x0000ffff.
    (4) A Value spreading over the multiplication is loaded into the X register.
  4. Phenomenon
    The contents to be held in the X register are corrupted after performing the multiplication.

  5. Example
    [C Source File]
          -----------------------------------------------------------------------
         |
         |    extern int      j;
         |    extern long     l;
         |    extern int      arr[5];
         |
         |    void func(register int i)
         |    {
         |           j = arr[i];
         |           l = i * 0x0ffffL;
         |           j = arr[i];
         |    }
         |
          -----------------------------------------------------------------------

    [Compilation]
          -----------------------------------------------------------------------
         |
         |    nc77 -c -fER -O sample.c
         |
          -----------------------------------------------------------------------
  6. Workaround
    Choose the "-OS" option.

On the Casting of a Constant to a Pointer
  1. Versions Concerned
    Product Name Versions
    NC77WA/NC77 V.3.10 Release 1 to V.5.00 Release 1

  2. Problem
    When a constant is cast to a pointer, the address given by the constant may not correctly be accessed.

  3. Conditions
    This problem occurs only if the following three conditions are satisfied:
    (1) Option "-O", "-OR", or "-OS" is chosen.
    (2) The value stored in the address given by a constant is changed by casting the constant to type pointer.
    (3) Immediately after the above change of the value, the same constant described above is cast to the same type of pointer to read the value stored in the address given by the constant.
  4. Phenomenon
    The value precedent to the one that has been changed by the first access of the pointer is referenced at the second access of the pointer.

  5. Example
    [C Source File]
          --------------------------------------------------------------------
         |
         |     void func(int i)
         |     {
         |            *(int *)0x9000 -= i;
         |            sub( *(int *)0x9000 );  /* the data before subtraction 
         |                                       is performed in the previous 
         |                                       line is used */
         |                                       
         |     }
         |
          --------------------------------------------------------------------

  6. Workaround
    Define the #pragma ADDRESS directive instead of casting a constant to a pointer.
    Note: Make sure that the #pragma ADDRESS directive does not co-reside with the example C source file shown above.
    [C Source File after Modification]
          --------------------------------------------------------------------
         |
         |     #pragma ADDRESS adr 9000H
         |     int *adr;
         |
         |     void func(int i)
         |     {
         |            *(int *)adr -= i;
         |            sub( *(int *)adr );  /* the data before subtraction
         |                                    is performed in the previous 
         |                                    line is used */
         |          
         |     }
         |
          --------------------------------------------------------------------

On Option "-Ostack_frame_align"
  1. Versions Concerned
    Product Name Version
    NC77WA/NC77V.5.00 Release 1


  2. Problem
    When a specific type of function is described, choosing option "-Ostack_frame_align" may produce the result opposite to the one intended.

  3. Conditions
    This problem occurs only if the following two conditions are satisfied:
    (1) Option "-Ostack_frame_align" is chosen.
    (2) A function with no argument and auto variable is described.

  4. Phenomenon
    The "-Ostack_frame_align" option does not act on functions with no argument and auto variable. On the other hand, the jsrl instruction pushes a 3-byte return address onto the stack. Then, the function called by a one with no argument and auto variable comes with such a return address that the beginning address of the stack saving it is always even.

  5. Workaround
    Don't give the "-Ostack_frame_align" option to any file in which the above mentioned type of function exists.




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