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.

Compiler/TMS570LC4357: compiler switch HET_V2 set different in autogenerated files from HALCOGEN and hetp.exe

Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN

Tool/software: TI C/C++ Compiler

Hi

 

HalcoGen 04.07.00 creates:

HL_het.c, which includes std_nhet.h without prior setting HET_V2

Result: default setting HET_V2 = 0 from std_nhet.h

 

 

HETASM / hetp.exe creates

xxx.c, which includes std_nhet.h without prior setting HET_V2 and without including xxx.h

and

xxx.h which includes std_nhet.h with prior setting HET_V2

Result: intended setting HET_V2 = 1 if xxx.h is included before std_nhet.h

 

 

Files including xxx.h and std_nhet.h will compile with HET_V2 = 1 (correct),

but files including std_nhet.h without including xxx.h before std_nhet.h will compile with HET_V2 = 0 (wrong).

 

Lint detects:

Warning 547: Redefinition of symbol 'HET_v2' conflicts with ....

Error 18: Symbol 'br_format::branch_condition' redeclared (precision)

Error 114: Inconsistent structure declaration for tag 'br_format'

Error 38: Offset of symbol 'br_format::10006' inconsistent

 

The TI compiler ti-cgt-arm_16.9.3.LTS detects the problem only, if all built in MISRA C2 2004 checks are disabled!?!?!?

We can’t easily change the compiler because it was verified by an external company. (restriction don’t use built in MISRA checker)

#48 incompatible redefinition of macro "HET_v2" (declared at line 57 of "D:/yyy/TICore/include/std_nhet.h")   xxx.h                /yyy/TICore/include       line 4     C/C++ Problem

 

My current dirty workaround is:

Manually explicit include xxx.h in xxx.c (both auto generated from hetp.exe)

Manually explicit change order of include files in HL_het.c (auto generated from HalcoGen)

 

Can you confirm the behavior, or did I miss relevant settings in HalcoGen?

Thanks in advance

  • Hello,

    The std_nhet.h defines the nhet instructions. This header files is not included in any other files generated through the HALCoGen. Maybe I missed some settings.


  • Hello QJ Wang
    I agree that no one includes std_nhet.h, while HET advanced config mode is disabled in HalcoGen. (checked in another project)
    If both HET are in use with advanced config mode we have 5 auto generated files including std_nhet.h.   

    Search "\#include.*\"std_nhet.h\"" (5 hits in 5 files)
      D:\myProject\TICore\include\autogenHET0.h (1 hit)    // HET_V2 = 1 - auto generated but manually copied from c:\ti\Hercules\bin\hetp.exe -v2 -hc32 -x -n0 autogenHET0.het
        Line 7: #include "std_nhet.h"
      D:\myProject\TICore\include\autogenHET1.h (1 hit)    // HET_V2 = 1 - auto generated but manually copied from c:\ti\Hercules\bin\hetp.exe -v2 -hc32 -x -n1 autogenHET1.het
        Line 7: #include "std_nhet.h"
      D:\myProject\TICore\source\HL_het.c (1 hit)          // HET_V2 = 0 - auto generated from HALCOGEN 04.07.00 with both HET advanced config mode enabled and files selected
        Line 48: #include "std_nhet.h"
      D:\myProject\TICore\source\autogenHET0.c (1 hit)     // HET_V2 = 0 - auto generated but manually copied from c:\ti\Hercules\bin\hetp.exe -v2 -hc32 -x -n0 autogenHET0.het
        Line 4: #include "std_nhet.h"  
      D:\myProject\TICore\source\autogenHET1.c (1 hit)     // HET_V2 = 0 - auto generated but manually copied from c:\ti\Hercules\bin\hetp.exe -v2 -hc32 -x -n1 autogenHET1.het
        Line 4: #include "std_nhet.h"  
        

    There are 3 independet issues:
    a.) hetp.exe creates autogenHET0.h autogenHET1.h autogenHET0.c autogenHET1.c but does not include the *.h in the corresponding *.c files    
    b.) HalcoGen creates HL_het.c but includes the hetp header after std_nhet.h instead of before.
    c.) The compiler/linker toolchain does not detect the conflicting compiler switches if built in MISRA checking is enabled

    An alternative solution for b.) could be to set default HET_V2 1 in std_nhet.h if device TMS570LC4357ZWT is selected (instead of changing the order of include files).

    Best Regards
    Olaf

  • PS:

    HET_v2 seems to be known problem since 2013:
    e2e.ti.com/support/microcontrollers/hercules/f/312/t/284661
    work around: define HET_v2=1 in  Properties - CCS Build - ARM Compiler - predefined symbols

    Problem is partly solved by this work around.
    But the compiler should complain otherwise


  • Hello Olaf,

    Appreciate your very helpful information.

    I just did a test. I used HET IDE to generate a Test.c and Test.h. The Test.h includes "std_nhet.h" and also defines "HET_v2=1" before that: