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.

CCsv6.0.1 GCC optimization issue

Hi,

I am using CCSv6.0.1 with TI's official MSP GCC as toolchain on Ubuntu machine. I used optimization setting -Os (size optimized) for the firmware. 

When I use rand() function at this optimization setting, the system crashes. The firmware works fine for optimzation setting less than of equal to -O1.

Also the functions mktime() and strtol() are not behaving as expected even at -O0 optimzation setting. Is there any switch that I need to enable for gcc?

I spent many days trying to figure out the issue but with no success.

I will be glad if anyone can help fix the issue.

Regards,

Ravi Teja

  • Ravi Teja80 said:
    the functions mktime() and strtol() are not behaving as expected even at -O0 optimzation setting

    Perhaps you are overflowing the stack or running out of heap.  Does it work if you use no optimization at all?

    Thanks and regards,

    -George

  • Hi George,

    Thanks for the reply.

    I got this problem sorted out after I updated the toolchain.

    I noticed stack and heap collision in the case of rand() at -Os setting before the update.

    If while testing the firmware, the heap stack collision does not occur, is it safe to assume that this issue will never occur in future again?
    The reason why I am asking is because we will be deploying the device on field.

    Apart from this, I also faced issues with initialization of global variables(globals weren't getting initialized after the firmware is loaded) in old toolchain. After the toolchain update, mktime is working fine. So I guess the issue was with the global variable initialization.

    Thanks and Regards,
    Ravi Teja
  • Ravi Teja80 said:
    If while testing the firmware, the heap stack collision does not occur, is it safe to assume that this issue will never occur in future again?

    I don't know enough details to say with complete certainty.  But I think your chances of no further problems are very good.

    Thanks and regards,

    -George