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.

C6713 memory allocation problem

Hey, guys. I am in trouble with the C6713 memory allocation problems.

I developed my project in CCS 3.3 with  C. I had defined some structures in header file as follows:

typedef struct _tagA
{
 float * a1;   

float a2;
}A;

typedef struct _tagB
{

A  *val1; 
A *val2;

}B;

In my main program, i had defined two structure B variables as follows: B b1,b2. Varibles b1 and b2 are allocated in the RAM with DATA_SECTION precompiler command and the RAM address is defined as  RAM: o=  00000200h l = 0003FD00h in the command file.  I used the malloc function in C to dynamic allocate the memory space for  variables b1 and b2. It is normal for  variable b1, the memory address for b1.val1 = 0x0001ABD8, b1.val2 = 0x0001ADB8(length is 1E0). But there are some wrong with the variable b2 memory allocation, b2.val1 = 0x00000000, b2.val2 = 0x000001E0, that is illegal address for data read and write.

I am confusing with this strange problem? Any help or suggestion would be sincerely appreciated!

 

 

  • Please show the DATA_SECTION code and the malloc code and the size of your heap. Be sure that you are testing the result of malloc to ensure it is returning a valid value, for example it should not be 0 unless there is an error in the result of the malloc function.