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.

CCS: 1234

Other Parts Discussed in Thread: TMS320C6748

Tool/software: Code Composer Studio

When i am writing  c code with  by initializing array and matrix with less memory allocations,i am able to debug and run the code in CCS  and  I'm able to look at results displayed in console....

but when i initialised arrays and matrices with more memory allocations,I'm unable to get the results  displayed on console.

USING TMS320C6748 

THANKS in ADVANCE

  • Unfortunately, I'm not sure what you mean.  Please show a some small code examples which illustrate what you are doing.  First, what works.  Then, what fails.  

    Lenin Yemineni said:
    I'm able to look at results displayed in console....

    How do you do that?  Do you call printf?  If so, then please see if any of the suggestions in the article Tips for using printf is helpful.

    Thanks and regards,

    -George

  • GEORGE MOCK sir,thanks for giving reply:

    Now,I've explained my problem more clearly.


    CASE#1:
    #include<stdio.h>
    #include<stdlib.h>
    int main(void)
    {
    int i,j,m,n;
    m=5;
    n=5;
    float x[5][5],y[5][5],z[5][5];

    printf("HELLO_WORLD\n");
    for(i=0;i<m;i++)
    { for(j=0;j<n;j++)
    { x[i][j]=rand();
    printf("%f\n",x[i][j]);
    y[i][j]=rand();
    printf("%f\n",y[i][j]);
    z[i][j]=rand();
    printf("%f\n",z[i][j]);
    }
    }
    return 0;
    }

    CONSOLE_OUTPUT:<here we are getting the entire output we desired>




    CASE#2:


    #include<stdio.h>
    #include<stdlib.h>
    int main(void)
    {
    int i,j,m,n;
    m=5;
    n=5;
    float x[m][n],y[m][n],z[m][n];

    printf("HELLO_WORLD\n");
    for(i=0;i<m;i++)
    { for(j=0;j<n;j++)
    x[i][j]=rand();
    printf("%fn",x[i][j]);
    y[i][j]=rand();
    printf("%fn",y[i][j]);
    z[i][j]=rand();
    printf("%fn",z[i][j]);
    }
    return 0;
    }


    CONSOLE_OUTPUT:<blank>
    it is not even printing HELLOWORLD here.




    CASE#3:

    #include<stdio.h>
    #include<stdlib.h>
    int main(void)
    {
    int i,j,m,n;
    m=5;
    n=5;
    float x[100][100],y[100][100],z[100][100];

    printf("HELLO_WORLD\n");
    for(i=0;i<m;i++)
    { for(j=0;j<n;j++)
    x[i][j]=rand();
    printf("%fn",x[i][j]);
    y[i][j]=rand();
    printf("%fn",y[i][j]);
    z[i][j]=rand();
    printf("%fn",z[i][j]);
    }
    return 0;
    }

    CONSOLE-OUTPUT:same as the 3rd case case




    Here my problem is that,in above cases,we can manage by taking the less memory allocations,but sometimes,I require more memory to be initialized,in that case,after debug is completed,it is stopping there without displaying any output in console.


    I want solution to this problem ,mainly regarding 3rd case.
  • This line from case #2 ...

    Lenin Yemineni said:
    float x[m][n],y[m][n],z[m][n];

    ... means those are variable length arrays.  In the TI compiler, these are allocated by calling the internal RTS function __vla_alloc.  This function attempts to allocate 3000 bytes from the malloc heap on the first call.  Subsequent calls allocate from that initial block of memory.  It is a good guess you don't have that much space allocated for the heap.  The size of the heap is typically set with the --heap option to the linker.  

    Thanks and regards,

    -George