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.

TM4C1294NCPDT: Have the correct definition but can't compile normally?

Part Number: TM4C1294NCPDT
Other Parts Discussed in Thread: TM4C123GH6PM, PCA9539,

Hi:

Please refer to the attach zip file.

If the following two lines are commented out in the program, it can be successfully compiled, but if not, it cannot be compiled successfully.

extern void VCU_Model_Chart_Init(B_Chart_VCU_Model_T *localB,DW_Chart_VCU_Model_T *localDW);
extern void VCU_Model_Chart(B_Chart_VCU_Model_T *localB, DW_Chart_VCU_Model_T *localDW);

The "B_Chart_VCU_Model_T" and "DW_Chart_VCU_Model_T" type are already defined in the program. Why does an error still occur?

thanks

CompilerTestCaseFiles.zip

  • Hi,

      Can provide more information as to which toolchain, compiler and version you are using so I can forward your question to our compiler experts?

  • There are toolchain, compiler version infrmation in the CompilerTestCaseFiles.zip file.

    CCS 11.2

    ti-cgt-arm_20.2.7.LTS

    Do you need to provide other information besides these?

    thanks

    7651.VCU_Model.pp.txt

    4810.VCU_Model_data.pp.txt

  • The "B_Chart_VCU_Model_T" and "DW_Chart_VCU_Model_T" type are already defined in the program. Why does an error still occur?

    Because the definition of those type names occurs after the function declarations which refer to them.  Here is one way to see it ...

    % findstr B_Chart_VCU_Model_T main.pp.txt
    extern void VCU_Model_Chart_Init(B_Chart_VCU_Model_T *localB,
    extern void VCU_Model_Chart(B_Chart_VCU_Model_T *localB, DW_Chart_VCU_Model_T
    } B_Chart_VCU_Model_T;
      B_Chart_VCU_Model_T sf_Chart_e;      /* '<S50>/Chart' */
      B_Chart_VCU_Model_T sf_Chart_l;      /* '<S49>/Chart' */

    Line 1 shows the command being run.  findstr is a Windows command line utility which shows all the lines that have the given string in it.  In this case, the type name B_Chart_VCU_Model_T is searched in the preprocessed file main.pp.txt.  Lines 2-3 show two function declarations which refer to B_Chart_VCU_Model_T.  These are the lines for which the compiler issues the error diagnostics.  That is because B_Chart_VCU_Model_T is not defined.  Line 4 shows the line which defines B_Chart_VCU_Model_T.  Lines 5-6 show later uses of B_Chart_VCU_Model_T that compile correctly.  It is a similar situation for the type name DW_Chart_VCU_Model_T.

    Thanks and regards,

    -George

  • If I only use VCU_Model_ert_rtw.zip files to create a CCS project, it can be successfully compiled.

    According to the source code, it seems that the definition order is correct(The definition of those type names occurs before the function declarations).

    B_Chart_VCU_Model_T is defined in the VCU_Model.h file.

    VCU_Model_Chart_Init(B_Chart_VCU_Model_T *localB,DW_Chart_VCU_Model_T *localDW) is defined in the VCU_Model_private.h file.

    In the VCU_Model_private.h file, first include VCU_Model.h before defining VCU_Model_Chart_Init().

    But if I compile the original full project will cause the undefined problem.Is there any way to solve it?

    thanks!

    VCU_Model_ert_rtw.zip

  • Hi,

      It looks like you are not using any TivaWare library code. It seems all the files are your own code. Is that correct?

      In any case I try to build only the VCU_Model.c file and there is no error except some warning messages. See my log. 

    I use the blinky example project as a starting point and simply copy all of your files into the project. 

    I right click on VCU_Model.c file and select 'Build selected File(s)'

    Below is the log I have. I use /ti_cgt-arm_18.12.0.LTS to compile VCU_Model.c file. There are warnings but no errors like yours. Note that I had to comment out line 38 and 39 in VCU_Model.h because you did not provide these header files. 

    **** Build of configuration Debug for project customer_code ****

    "C:\\ti\\ccs1011\\ccs\\utils\\bin\\gmake" -k -j 8 VCU_Model.obj -O

    Building file: "../VCU_Model.c"
    Invoking: ARM Compiler
    "C:/ti/ccs1011/ccs/tools/compiler/ti_cgt-arm_18.12.0.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me -O2 --include_path="C:/Users/a0321879/Documents/CCS/TM4C/My CCS EKTM4C123GXL 2.2.0/customer_code" --include_path="C:/ti/TivaWare_C_Series-2.2.0.295" --include_path="C:/ti/ccs1011/ccs/tools/compiler/ti_cgt-arm_18.12.0.LTS/include" --define=ccs="ccs" --define=PART_TM4C123GH6PM --define=TARGET_IS_TM4C123_RB1 -g --gcc --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi --ual --preproc_with_compile --preproc_dependency="VCU_Model.d_raw" "../VCU_Model.c"
    "../VCU_Model.c", line 276: warning #225-D: function "P18Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 287: warning #225-D: function "P18Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 303: warning #225-D: function "P18Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 314: warning #225-D: function "P18Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 330: warning #225-D: function "P18Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 341: warning #225-D: function "P18Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 357: warning #225-D: function "P18Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 368: warning #225-D: function "P18Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 384: warning #225-D: function "P18Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 395: warning #225-D: function "P18Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 411: warning #225-D: function "P18Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 422: warning #225-D: function "P18Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 438: warning #225-D: function "P18Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 449: warning #225-D: function "P18Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 465: warning #225-D: function "P18Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 476: warning #225-D: function "P18Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 507: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 518: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 534: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 545: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 561: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 572: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 588: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 599: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 615: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 626: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 642: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 653: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 669: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 680: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 696: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 707: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 738: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 749: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 765: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 776: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 792: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 803: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 819: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 830: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 846: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 857: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 873: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 884: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 900: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 911: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 927: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 938: warning #225-D: function "P19Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 1070: warning #225-D: function "UART7InterruptSend" declared implicitly
    "../VCU_Model.c", line 1139: warning #225-D: function "IR_Sens_DO1_ON" declared implicitly
    "../VCU_Model.c", line 1150: warning #225-D: function "IR_Sens_DO1_OFF" declared implicitly
    "../VCU_Model.c", line 1166: warning #225-D: function "P18Con_DO_I2C1_PCA9539" declared implicitly
    "../VCU_Model.c", line 1177: warning #225-D: function "P18Con_DO_I2C1_PCA9539" declared implicitly
    Finished building: "../VCU_Model.c"

    **** Build Finished ****

      

  • Sorry for the late reply. Because we were on Lunar New Years holiday last week.

    I have streamlined the software project as attached file.

    This should make it easier to clarify the problem.

    Thanks!

    8132.TivaWorkspace.zip

  • Hi,

      I can see the error when I build your project. I do see #include "VCU_Model.h" is included in VCU_Model_private.h but I don't know why the error. This is not a MCU level issue and I need to consult with our CCS and toolchains expert. 

    Building file: "../Source/DiDoModule/DiDoFunctions.c"
    Invoking: Arm Compiler
    "C:/ti/ccs1011/ccs/tools/compiler/ti-cgt-arm_20.2.4.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me -O2 --opt_for_speed=5 --include_path="C:/Users/a0321879/Documents/My CCS TM4C Forum Customers/GT_VCU" --include_path="C:/Users/a0321879/Documents/My CCS TM4C Forum Customers/GT_VCU" --include_path="C:/ti/TivaWare_C_Series-2.2.0.295" --include_path="C:/ti/TivaWare_C_Series-2.2.0.295/third_party/lwip-1.4.1/src/include" --include_path="C:/ti/TivaWare_C_Series-2.2.0.295/third_party/lwip-1.4.1/src/include/ipv4" --include_path="C:/ti/TivaWare_C_Series-2.2.0.295/third_party/lwip-1.4.1/ports/tiva-tm4c129/include" --include_path="C:/ti/TivaWare_C_Series-2.2.0.295/third_party/lwip-1.4.1/apps" --include_path="C:/ti/ccs1011/ccs/tools/compiler/ti-cgt-arm_20.2.4.LTS/include" --include_path="C:/Users/a0321879/Documents/My CCS TM4C Forum Customers/GT_VCU_Model/VCU_Model_ert_rtw" --include_path="C:/Users/a0321879/Documents/My CCS TM4C Forum Customers/GT_VCU/Source" --include_path="C:/Users/a0321879/Documents/My CCS TM4C Forum Customers/GT_VCU/Source/CanModule" --include_path="C:/Users/a0321879/Documents/My CCS TM4C Forum Customers/GT_VCU/Source/AdcModule" --include_path="C:/Users/a0321879/Documents/My CCS TM4C Forum Customers/GT_VCU/Source/Bootloader" --include_path="C:/Users/a0321879/Documents/My CCS TM4C Forum Customers/GT_VCU/Source/EepromModule" --include_path="C:/Users/a0321879/Documents/My CCS TM4C Forum Customers/GT_VCU/Source/WatchdogModule" --include_path="C:/Users/a0321879/Documents/My CCS TM4C Forum Customers/GT_VCU/Source/TimerModule" --include_path="C:/Users/a0321879/Documents/My CCS TM4C Forum Customers/GT_VCU/Source/UartModule" --include_path="C:/Users/a0321879/Documents/My CCS TM4C Forum Customers/GT_VCU/Source/PwmModule" --include_path="C:/Users/a0321879/Documents/My CCS TM4C Forum Customers/GT_VCU/Source/PortIsrModule" --include_path="C:/Users/a0321879/Documents/My CCS TM4C Forum Customers/GT_VCU/Source/EthernetModule" --include_path="C:/Users/a0321879/Documents/My CCS TM4C Forum Customers/GT_VCU/Source/InfraStruct" --define=ccs="ccs" --define=PART_TM4C1294NCPDT --define=TARGET_IS_TM4C129_RA2 --define=DEBUG_OUTPUT --define=UIP_OFFLOAD_ICMP_CHKSUM -g --gcc --diag_warning=225 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi --ual --preproc_with_compile --preproc_dependency="Source/DiDoModule/DiDoFunctions.d_raw" --obj_directory="Source/DiDoModule" "../Source/DiDoModule/DiDoFunctions.c"

    >> Compilation failure
    Source/DiDoModule/subdir_rules.mk:9: recipe for target 'Source/DiDoModule/DiDoFunctions.obj' failed
    "..\Source\DiDoModule\..\..\..\GT_VCU_Model\VCU_Model_ert_rtw\..\..\GT_VCU\Source\UartModule\..\..\..\GT_VCU_Model\VCU_Model_ert_rtw\VCU_Model_private.h", line 21: error #20: identifier "B_Chart_VCU_Model_T" is undefined
    "..\Source\DiDoModule\..\..\..\GT_VCU_Model\VCU_Model_ert_rtw\..\..\GT_VCU\Source\UartModule\..\..\..\GT_VCU_Model\VCU_Model_ert_rtw\VCU_Model_private.h", line 21: error #20: identifier "DW_Chart_VCU_Model_T" is undefined
    "..\Source\DiDoModule\..\..\..\GT_VCU_Model\VCU_Model_ert_rtw\..\..\GT_VCU\Source\UartModule\..\..\..\GT_VCU_Model\VCU_Model_ert_rtw\VCU_Model_private.h", line 22: error #20: identifier "B_Chart_VCU_Model_T" is undefined
    "..\Source\DiDoModule\..\..\..\GT_VCU_Model\VCU_Model_ert_rtw\..\..\GT_VCU\Source\UartModule\..\..\..\GT_VCU_Model\VCU_Model_ert_rtw\VCU_Model_private.h", line 22: error #20: identifier "DW_Chart_VCU_Model_T" is undefined
    4 errors detected in the compilation of "../Source/DiDoModule/DiDoFunctions.c".
    gmake: *** [Source/DiDoModule/DiDoFunctions.obj] Error 1

  • The file main.c eventually includes VCU_Model.h.  That file has these lines ...

    #include "..\..\GT_VCU\Source\DiDoModule\DiDoFunctions.h"
    #include "..\..\GT_VCU\Source\UartModule\UartFunctions.h"
    
    /* Block signals for system '<S49>/Chart' */
    typedef struct {
      uint8_T DOs;                         /* '<S49>/Chart' */
    } B_Chart_VCU_Model_T;
    
    /* Block states (default storage) for system '<S49>/Chart' */
    typedef struct {
      uint8_T is_active_c1_VCU_Model;      /* '<S49>/Chart' */
      uint8_T is_c1_VCU_Model;             /* '<S49>/Chart' */
    } DW_Chart_VCU_Model_T;
    

    Notice that B_Chart_VCU_Model_T and DW_Chart_VCU_Model_T are defined after DiDoFunctions.h is included.  DiDoFunctions.h has these lines ...

    #include "..\..\..\GT_VCU_Model\VCU_Model_ert_rtw\VCU_Model.h"
    #include "..\..\..\GT_VCU_Model\VCU_Model_ert_rtw\VCU_Model_private.h"

    Because of inclusion guards, this #include of VCU_Model.h has no effect.  This is the first time VCU_Model_private.h is seen.  It has these lines ...

    #include "VCU_Model.h"
    
    extern void VCU_Model_Chart_Init(B_Chart_VCU_Model_T *localB, DW_Chart_VCU_Model_T *localDW);
    extern void VCU_Model_Chart(B_Chart_VCU_Model_T *localB, DW_Chart_VCU_Model_T *localDW);

    Again, this #include of VCU_Model.h has no effect.  Notice the last two lines use B_Chart_VCU_Model_T and DW_Chart_VCU_Model_T.  But those types have not been seen yet, and that is why the compiler issues the error diagnostic.

    I don't know the best solution.  A quick solution is, in VCU_Model.h, to move these lines ...

    /* Block signals for system '<S49>/Chart' */
    typedef struct {
      uint8_T DOs;                         /* '<S49>/Chart' */
    } B_Chart_VCU_Model_T;
    
    /* Block states (default storage) for system '<S49>/Chart' */
    typedef struct {
      uint8_T is_active_c1_VCU_Model;      /* '<S49>/Chart' */
      uint8_T is_c1_VCU_Model;             /* '<S49>/Chart' */
    } DW_Chart_VCU_Model_T;

    ... before DiDoFunctions.h is included.  

    Thanks and regards,

    -George

  • This problem is really complicated, but this method is really useful. Thank you!