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.

heap crashed in tms320f28335

Other Parts Discussed in Thread: TMS320F28335

I am using ccs4 and compiler c2000 version TI v5.2.6 for TMS320F28335.

The problem is till now the dynemic memory allocation functions are running well in my code;
but now i am using more flash size and ram size by combining some memory blocks i.e.(L2, L3 for stack; L4, L5 for heap, L1 for ram functions and L5, L6 for ebss section same way for flash memory i used FLASH C to H
now when i try to allocate dynamic memory than compiler allocates memory in already allocated memory spacy. so, my system is crashed at that point (i am using linked list) and illegal isr trap triggedred.

please do some needful for me.

  • Now I have tried TI's Latest compiler as well as tool set ccs v6 and compile is c200 v6.2.9 but my problem still persists................ please do some needful it's very urgent my project is in last stage of design.

    One another problem is cpu restarts within 30 minuts after start of my application and after that it works fine......

    It seems that compiler is generating some wrong code..............!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • Kalpesh,

    I highly recommend you *not* use dynamic memory allocation.  Embedded systems are hard enough to debug without it.  It violates MISRA rules also, for good reason.

    Also, it is unlikely to be a compiler problem.  Buffer overrun is usually the culprit.

    Regards,

    Bill

  • I agree with Bill.  It is likely not a compiler issue but a buffer overflowing into code, or a stack overflow, or some such.  If your code is in an ITRAP here are some suggestions for debugging how the code got there.

    http://processors.wiki.ti.com/index.php/Interrupt_FAQ_for_C2000#The_ITRAP_Interrupt

  • Bill,

    Thank You for the reply,

    It's compulsory for me to use dynamic memory allocation because i am using third party graphics library for lcd display in my application. I am working on this project from 1 and half year. till now all the things were working fine

    but after adding some extra code things become worst.

    My actual heap size requirement in application at any point is almost 4096 bytes but i have allocated it to 8192 bytes and stack size is also amount of 8192 bytes, i have checked for the stack as well as heap overflow but it's not the actual case.

  • In My debug trace i have found one point when it goes to ITRAP.

    The graphics library generating a linked list when i generate a window and some widgets on the screen, before that it freed up the allocated memory first than using malloc function generates new linked list.

    now, when i try to generate a new linked list when old one alread exist in the memory than new one should be generated on non allocated memory space but it just break down previous linked list and start point of new linked list is somewhere in between first ones start and end point. So, when i try to use first one than it goes to ITRAP because it was break.

  • Kalpesh,

    > but after adding some extra code things become worst.

    This says to me, that some part of the 'extra code' contains a buffer overrun.  In other words, the new part of the code is writing over memory that it shouldn't be, due to an indexing error of some kind.

    Comment out the new code, and verify the system runs as expected.  Then add back in the new code a piece at a time until you find out what broke it.

    Also, there is a feature to add a breakpoint to an address in memory, that breaks execution whenever the address is written to.  I find this very helpful in finding what part of code is going haywire.

    Regards,

    Bill