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.

TMS320F280039C: #137 struct "<unnamed>" has no field "xxx"

Part Number: TMS320F280039C
Other Parts Discussed in Thread: C2000WARE, TIDM-1000, SFRA

Hi Champ,

I am asking for my customer.

They used the DCL library for controller.

They would like to add a new member (float32_t xxx) in DCL_PI controller structure in DCLF32.h file.

typedef struct dcl_pi {
    float32_t Kp;       //!< Proportional gain
    ......
    float32_t integral;      //!< Member added by user
} DCL_PI;

However, it compiles with error #137 struct "<unnamed>" has no field "xxx" if initiates value in the .h file.

In .h file., it defines and declares as below.

#define VIENNA_GV DCL_PI

extern VIENNA_GV VIENNA_gv;

In .c file, it's fine.

How to make it work in .h file ? Would the compiler expert kindly explain why it won't work in such way in .h file and please provide workaround?

Thanks for the support.

Regards,

Johnny

  • Hi Champ,

    Would you please help on it?

    Regards,

    Johnny

  • Hi Champ,

    Any chance to have any update?

  • Hi Champ,

    Could anyone help me out here?

    Thank you.

  • Johnny,

    I didn't run into any issue here. I took the 28E12x_PI example in C2000Ware 26.00.00, navigated to DCLF32.h, updated it by adding a float32_t test_var, and also updated the PI_DEFAULTS that initialize it, and built the project without issue.

    //! \brief          Defines the DCL_PI controller structure
    //!
    typedef struct dcl_pi {
        float32_t Kp;       //!< Proportional gain
        float32_t Ki;       //!< Integral gain
        float32_t i10;      //!< I storage
        float32_t Umax;     //!< Upper control saturation limit
        float32_t Umin;     //!< Lower control saturation limit
        float32_t i6;       //!< Saturation storage
        float32_t i11;      //!< I storage
        float32_t Imax;     //!< Upper integrator saturation limit
        float32_t Imin;     //!< Lower integrator saturation limit
        float32_t test_var; //!< Test variable
        DCL_PI_SPS *sps;    //!< Pointer to the shadow parameter set
        DCL_CSS *css;       //!< Pointer to the common support structure
    } DCL_PI;

    //! \brief  Defines default values to initialize the PI structure
    //!
    #define PI_DEFAULTS { 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, 0.0f, 1.0f, -1.0f, \
                          0.0f, NULL_ADDR, NULL_ADDR }
  • Hi Sira,

    Thanks for your reply.

    We knew that initializing the new variable in DCLF32.h worked without issue. But, that's not what customer is asking.

    As the post mentioned, they are initializing the variable in the vienna.h (TIDM-1000), you may have a try.

    Initializing in DCLF32.h  and vienna.c works without issue, the error only occurs when initializing it in vienna.h.

    Would you please duplicate it in TIDM-1000? and suggest how to fix the error?

    Regards,

    Johnny

  • Johnny,

    Understood - assigning to the TIDM-1000 SMEs for a solution.

    Regards,

    Sira

  • Hi Johnny,

    Please note the error is occurring during build of vienna_clatask.cla as below

    C2000 Compiler - building file: "../vienna_clatask.cla"
    "C:/ti/c2000/ti-cgt-c2000_22.6.2.LTS/bin/cl2000" -v28 -ml -mt --cla_support=cla2 --float_support=fpu32 --tmu_support=tmu0 --vcu_support=vcu2 -O2 --opt_for_speed=5 --fp_mode=relaxed --fp_reassoc=on --include_path="C:/Users/a0132451/workspace_ccstheia/pfc3phvienna_nonpowerSUITE_F28004x" --include_path="C:/Users/a0132451/workspace_ccstheia/pfc3phvienna_nonpowerSUITE_F28004x/device" --include_path="C:/ti/c2000/C2000Ware_DigitalPower_SDK_5_06_00_00/c2000ware/driverlib/f28004x/driverlib" --include_path="C:/Users/a0132451/workspace_ccstheia/pfc3phvienna_nonpowerSUITE_F28004x/libraries/power_measurement" --include_path="C:/Users/a0132451/workspace_ccstheia/pfc3phvienna_nonpowerSUITE_F28004x/libraries/utilities" --include_path="C:/Users/a0132451/workspace_ccstheia/pfc3phvienna_nonpowerSUITE_F28004x/libraries/sfra" --include_path="C:/Users/a0132451/workspace_ccstheia/pfc3phvienna_nonpowerSUITE_F28004x/libraries/DCL" --include_path="C:/ti/c2000/C2000Ware_DigitalPower_SDK_5_06_00_00/solutions/tidm_1000/f28004x/drivers/include" --include_path="C:/ti/c2000/ti-cgt-c2000_22.6.2.LTS/include" --define=CLA_DEBUG=1 --define=_DEBUG --define=_FLASH --define=F28x_DEVICE --define=CPU1 --define=LARGE_MODEL -g --float_operations_allowed=32 --diag_suppress=10063 --diag_suppress=173 --diag_warning=225 --diag_wrap=off --display_error_number --quiet --abi=eabi --cla_background_task=on --cla_signed_compare_workaround=on -k --asm_listing --preproc_with_compile --preproc_dependency="vienna_clatask.d_raw" --include_path="C:/Users/a0132451/workspace_ccstheia/pfc3phvienna_nonpowerSUITE_F28004x/FLASH/syscfg" "../vienna_clatask.cla"
    [0]"..\vienna.h", line 333: error #137: struct "<unnamed>" has no field "integral"
    1 error detected in the compilation of "../vienna_clatask.cla".

    VIENNA_GV is conditionally defined in vienna.h:

    • C28x (#ifndef __TMS320C28XX_CLA__): VIENNA_GV = DCL_PI from DCLF32.h
    • CLA (#else): VIENNA_GV = DCL_PI_CLA from DCLCLA.h

    You added integral to DCL_PI in DCLF32.h (line 472), but the CLA task compiles with __TMS320C28XX_CLA__ defined, so it uses DCL_PI_CLA from DCLCLA.h — and that struct does not have the integral field.

    Fix

    Add integral to the DCL_PI_CLA struct in DCLCLA.h:

    typedef struct {
        float32_t Kp;
        float32_t Ki;
        float32_t i10;
        float32_t Umax;
        float32_t Umin;
        float32_t i6;
        float32_t i11;
        float32_t Imax;
        float32_t Imin;
        float32_t integral;      //!< Member added by user   // <-- ADD THIS
    } DCL_PI_CLA;
    

    Important: The field must be added at the same position in DCL_PI_CLA as it is in DCL_PI. Since VIENNA_gv is a shared variable between C28x and CLA (declared extern), both structs must have identical memory layouts to avoid data corruption. Check where you placed integral in DCL_PI (relative to the other fields) and mirror that exact position in DCL_PI_CLA.