This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

INTERNAL ERROR! <aLabel> defined differently in each pass

Other Parts Discussed in Thread: LM3S1968

I was adding some features to a legacy product that was ported to F280x a while ago and went to compile the existing project with late model code gen tools and have been stumped by this. The old project compiles fine on 4.1.3 code gen tools. The target is F2806 and this code was originally for the F240, hence the C2xLP compatibility option. Note 6.1 code gen has same issue. 

Hope someone has a clue how to fix.

Thanks, Dave

-------

C:/TI/ccsv4/tools/compiler/C2000 Code Generation Tools 5.2.12/bin/cl2000" --silicon_version=28 -g --define=MODEL=80 --define=_DEBUG=1 --include_path="C:/TI/ccsv4/tools/compiler/C2000 Code Generation Tools 5.2.12/include" --include_path="C:/src/Firmware/da8x-4.3/include" --diag_warning=225 --display_error_number --optimize_with_debug --large_memory_model --unified_memory --c2xlp_src_compatible --preproc_with_compile --preproc_dependency="src/bug.pp" --obj_directory="src" "../src/bug.asm"
"../src/bug.asm", INTERNAL ERROR!: endModeSelect defined differently in each
pass

This may be a serious problem. Please contact customer support with a
description of the problem and a sample of the sourcefile that caused this
message to appear.

-------

The Code that caused this

-------

CF_MODE .set 5
OP_MODE .set 3
.text
.ref FooMode,_OpMode,_ConfigFlags
.def doFoo

doFoo: .asmfunc
 LPADDR
 .lp_amode

; BCND endModeSelect,TC
; BIT _OpMode,15-OP_MODE
; LDP #_ConfigFlags
; LACL _ConfigFlag
CC FooMode,EQ,TC,NC
; LDP #_ConfigFlags
; BIT _ConfigFlags,15-CF_MODE
; BCND xxMode,NTC
xxMode:
endModeSelect:
.endasmfunc
.END

  • This is now SDSCM00044472

  • I hope this regression is fixed in the 6.x code gen tools as well.

    Dave

  • I came across this same problem yesterday in CCS5 working with LM3S1968 assembly.  The code below demonstrates.  Looks like the size of const1 is unknown on the first pass and the assembler is reserving a word for the instruction, but on the second pass uses a 16-bit Thumb2 instruction instead.

    ; code to generate internal error
     .thumb
     .text
     .align 4
    main: .asmfunc
              cmp R0, #const1
              beq here

    here: .endasmfunc

    const1 .equ 0 ; move this line before the usage, or change to a large hex value, and error does not occur

     .end

    ;;;;;;;;;;;;;;

  • I've submitted SDSCM00048732 to track this issue.

  • This is not a bug and it is not the same as CQ44472 which has different size information about a label.

    When you handcoded the assembly code, using .equ to link a constant with a symbol, you need to do this before the symbol's first use.

    See ARM document: SPRU118l.pdf, 

    .set/.equ Define Assembly-Time Constant
    Syntax symbol .set value
    symbol .equ value
    Description The .set and .equ directives equate a constant value to a .set/.equ symbol. The symbol
    can then be used in place of a value in assembly source. This allows you to equate
    meaningful names with constants and other values. The .set and .equ directives are
    identical and can be used interchangeably.

    So put the .equ before its first use, it will work as you have also experimented.