Tool News
 
 
 

Tool News

Products Info
Downloads
Tools FAQs
MAEC TOOL NEWS: MAECT-NC308WA-010916D

NC308WA, NC30WA, AS308, and AS30
Precautions

Please take note of the following problem in using C compilers (with an assembler and integrated development environment) NC308WA and NC30WA; and assemblers AS308 and AS30 for the M16C family MCUs:
  • On the function of optimizing branch instructions


  1. Versions Concerned
    C compiler for the M16C/80 series MCUs : NC308WA V.1.00 Release 1 -- V.3.10 Release 3
    C compiler for the M16C/60 and M16C/20 series MCUs : NC30WA V.1.00 Release 1 -- V.4.00 Release 2

    Assembler for the M16C/80 series MCUs: AS308 V.1.00 Release 1 -- V.2.00 Release 1
    Assembler for the M16C/60 and M16C/20 series MCUs : AS30 V.1.00 Release 1 -- V.3.20 Release 1

  2. Description
    When the assembler concerned performs optimization of branch instructions, an error message "Value is out of range" may appear at the line where an unconditional branch instruction (JMP) resides.

  3. Conditions
    This problem occurs if the following three conditions are satisfied:
    (1) As a result of optimization, a short-jump instruction "JMP.S" is generated for each of the two successive unconditional branch instructions.
    (2) Between the second unconditional branch instruction and its destination is described an ".ALIGN" directive to correct the address to even.
    (3) The alignment places the destination of the second unconditional branch instruction at the address indicated by the program counter (PC)+10.

  4. Example
    In a source file written in assembler language
    ------------------------------------------------------------------------
          .section prg,code,align
          jmp  label1
          .byte 1,2,3,4
      label1:
          .byte 1,2,3
          jmp  label2         ; At this line an error message appears.
          .byte 1,2,3,4
          .byte 1,2,3,4
         .align               ; Condition (2) (Here is made alignment.)
      label2:                 ; Condition (3)
         .end
    ------------------------------------------------------------------------
  5. Workaround
    Disable the generation of a short-jump instruction (JMP.S) for the unconditional branch instruction that causes the error by describing a JMP.S-generation control directive ".SJMP".
    5.1 In a Source File Written in Assembler Language
    -----------------------------------------------------------------------
          .section prg,code,align
          jmp  label1
          .byte 1,2,3,4
      label1:
          .byte 1,2,3      
          .sjmp  off       ; Generation of a JMP.S instruction disabled.
          jmp  label2
          .sjmp  on        ; Generation of a JMP.S instruction enabled.
          .byte 1,2,3,4
          .byte 1,2,3,4
         .align               
      label2:
         .end
    -----------------------------------------------------------------------
    5.2 In a Source File Written in C Language
    Suppose this type of error arises within an if-else construct.
    -------------------------------------------------------------------------
      func( )
      {
        asm(" .sjmp  off "); /* Generation of a JMP.S instruction disabled */
        if(xxxxx)
           ......
        else
           .......
        asm(" .sjmp  on ");  /* Generation of a JMP.S instruction enabled */
      }
    
    -------------------------------------------------------------------------

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




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