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.

DSP Code Syntax

I am suspicious that using the same variable names and types in two functions might cause unexpected outputs in the C6000 compiler.
The code below is a representation of the code that I implemented.

int foo_2(float a, Struct *b) {
    b->c = a * b->d;
    return b->c;
}

int foo_1(float a, Struct *b) {
    int c = 0;
    c = foo_2(a, b);
    return c;
}

The problem is when I did this the output is random garbage.
I know this is legitimate in C and should work with something like Visual Studio,
but I don't know why this produce garbage on dsp with the C6000 compiler.

Please advise me how to debug the problem.

  • Hi,

    The problem is when I did this the output is random garbage.
    I know this is legitimate in C and should work with something like Visual Studio,
    but I don't know why this produce garbage on dsp with the C6000 compiler.

    Did you get any "warning" while compiling your CCS project?

    Ex: "#551-D variable "b" is used before its value is set"

    Do you have debugger ?

    ex : XDS510USB TI emulator

    It is very low cost debugger too.

    If you have it , then it is very easy to debug for any variable?

    We have option in CCS to monitor the values of variables while running DSP app.

    Also, You can use "step over" or "step into" options to debug.

    If you interested to know then I will guide you further.

  • I just changed the variable names from

    int foo_1(float a, Struct *b) {
        int c = 0;
        c = foo_2(a, b);
        return c;
    }

    to

    int foo_1(float a_1, Struct *b_1) {
        int c = 0;
        c = foo_2(a_1, b_1);
        return c;
    }

    and it works. However, still I'm confused why this change fixed the problem.

  • Hi,

    Did you get any "warnings" while compiling your CCS project?

    Could you lease attach your complete log including building & warnings logs

    Which compiler version are you using ?

    Say ex: "C6000CGT7.4.6"

    Please attach your DSP code to reproduce & analyze.

    If you hesitate to share in public, You can the attachment through email to "x0213399@ti.com"