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/TMS320C5535: Struct "<unnamed>" has no field ...

Part Number: TMS320C5535


Tool/software: TI C/C++ Compiler

I'm running into an issue I can't understand regarding the C5000 DSP and its corresponding chip support libaray (C55xx CSL). I'm trying to access a control register for the DMA peripheral but the compiler fails to build with the error:

'Building file: ../i2s_dma.c'
'Invoking: C5500 Compiler'
"C:/ti/ccsv5/tools/compiler/c5500_4.4.1/bin/cl55" -v5515 --memory_model=large -g --include_path="C:/ti/ccsv5/tools/compiler/c5500_4.4.1/include" --include_path="C:/ti/ezdsp5535_BSL_RevC/ezdsp5535_v1/include" --include_path="C:/ti/c55_lp/c55_csl_3.07/inc" --include_path="C:/Users/evan/workspace_v5_5/danalog/Debug" --include_path="C:/ti/bios_5_42_02_10/packages/ti/bios/include" --include_path="C:/ti/bios_5_42_02_10/packages/ti/rtdx/include/c5500" --define=c5535 --display_error_number --diag_warning=225 --gen_func_subsections=on --ptrdiff_size=16 --preproc_with_compile --preproc_dependency="i2s_dma.pp" "../i2s_dma.c"
"../i2s_dma.c", line 115: error #137: struct "<unnamed>" has no field "DMACH0TCR2"


The code that it's failing on is:

However this doesn't make sense to me because if I look through the CSL source, I can find the definition for CSL_DmaRegsOvly:

c55xx_csl/inc/soc.h has the typedef on line 90:

c55xx_csl/inc/cslr_dma.h contains the datastructure:

Hopefully I'm not making a silly mistake. Any help would be much appreciated!

  • I cannot see an error in what you show here.  So that must mean the compiler sees it differently.

    There is a good technique for debugging include file and preprocessor problems like this.  Build the problem source file with the option --gen_acp_raw (which is named --gen_preprocessor_listing in newer TI compilers) and inspect the resulting listing file.  This file has the same name as the source file, with the extension changed to .rl.  You can see how files are included, preprocessed lines are shown before and after expansion, and so on.  The format of the listing file is described in the C55x compiler manual.  More often than not, this takes you straight to the source of the problem.

    Thanks and regards,

    -George

  • What matters here is the type of dmaHandle. I suspect it's an anonymous union. Accessing members of an anonymous union is a gcc extension, which is not enabled by default in the C55x compiler. Try adding the compilation option --gcc. If that doesn't work, you'll probably need to change the definition of the type of dmaHandle to give the union a name, and to use that name when referring to its members.
  • Hi George and Archaeologist,

    Thank you very much for the response. I was able to try both of your suggestions but I wasn't able to resolve my problem.

    George:

    I compiled with the --gen_acp_raw flag and was able to view the preprocessed source. However, the source under question was unchanged by the preprocessor as shown by the "N" in front of the lines:

    N CSL_DmaRegsOvly dma_reg;

    N dma_reg = dmaHandle->dmaRegs;
    E "../i2s_dma.c" 115 15 struct "<unnamed>" has no field "DMACH0TCR2"
    N if (dma_reg->DMACH0TCR2 & 0x0002) { // last xfer: pong
    N isrCounterPing++;
    N } else { // last xfer: ping
    N isrCounterPong++;
    N }

    I'm still confused why the compiler thinks dma_reg doesn't have a member DMACH0TCR2 when that exact field is declared in the structure itself.

    Archaeologist:

    I tried compiling with the -gcc flag but the error persists:

    "C:/ti/ccsv5/tools/compiler/c5500_4.4.1/bin/cl55" --gcc -v5515 --memory_model=large -g --include_path="C:/ti/ccsv5/tools/compiler/c5500_4.4.1/include" --include_path="C:/ti/ezdsp5535_BSL_RevC/ezdsp5535_v1/include" --include_path="C:/ti/c55_lp/c55_csl_3.07/inc" --include_path="C:/Users/evan/workspace_v5_5/danalog/Debug" --include_path="C:/ti/bios_5_42_02_10/packages/ti/bios/include" --include_path="C:/ti/bios_5_42_02_10/packages/ti/rtdx/include/c5500" --define=c5535 --display_error_number --diag_warning=225 --gen_func_subsections=on --ptrdiff_size=16 --preproc_with_compile --preproc_dependency="i2s_dma.pp"  "../i2s_dma.c"

    "../i2s_dma.c", line 115: error #137: struct "<unnamed>" has no field "DMACH0TCR2"

    1 error detected in the compilation of "../i2s_dma.c".

    dmaHandle is a CSL_DMA_Handle, which is defined below:

    I don't see any anonymous unions in this structure so I'm not sure if that's the issue.

    Thanks again for the feedback, hoping to hear back soon!

    Evan

  • Okay, then dmaHandle->dmaRegs is of type CSL_DmaRegsOvly. Is dma_regs of the same type?

    I'm guessing CSL_DmaRegsOvly is a typedef of a struct type with no struct tag. Give it a name (at least for debugging the issue).
  • Correct, dma_reg is of the same type. 

    Archaeologist said:
    I'm guessing CSL_DmaRegsOvly is a typedef of a struct type with no struct tag. Give it a name (at least for debugging the issue).

    Can you clarify what you mean by "give it a name"? 

    Thanks!

  • I mean give the struct a struct tag:

    typedef struct I_need_a_name
    {
    [..]
    } CSL_DmaRegsOvly ;