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/TMS320C6678: Error occurs when we pass a big data struct into the function

Part Number: TMS320C6678

Tool/software: TI C/C++ Compiler

Hi TI engineer,

        We have a code like this:

        typedef struct _BigStruct{

               int data0;

               int data1;

               int data2;

               ...

                int data63}BigStruct

        void func(int a, int b, BigStruct bigStruct)

        {          ......

my_value = bigStruct.data0 + bigStruct.data1

}

The software is built successfuly.But when we run the program, and set breakboint in the func() ,try to check the "bigStruct" int the "expression view", we find that the type of bigStruct is shown as "BigStruct  *", not "BigStruct ". And if we input "bigStruct .data0",it shows an error.  But at the time,"my_value"  seems to be set correctly.

          And we find that if BigStruct replaced by a little struct like typedef struct {data0,data1,data2}, it doesn't happen."littleStruct" will be showed just as "LittleStruct".

          We want to know that:

          1, Is the struct changed to struct point automatically?

          2, when we use bigStruct,data0, is it "bigStruct->data0" in fact?

          3, Can we use bigStruct as Formal parameter rightfully?

  • Parameters are passed on the stack. You are probably running out of stack space. You can increase the stack space or better, you should use a pointer.
  • To see how structures are passed to functions, please search the C6000 Embedded Application Binary Interface for the sub-chapter titled Structures or Unions Passed and Returned by Reference.  

    YUCHAO WANG said:
        1, Is the struct changed to struct point automatically?

    For the big one, yes.  If the total size of the little one is 64-bits or less, no.

    YUCHAO WANG said:
        2, when we use bigStruct,data0, is it "bigStruct->data0" in fact?

    Yes.

    YUCHAO WANG said:
              3, Can we use bigStruct as Formal parameter rightfully?

    Yes.

    This might be a case of the debugger not handling a structure argument correctly.  Does this seem right to you?

    Thanks and regards,

    -George