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.

F28069U: Stack overflow?



Hello Community,
This topic might be related to two different forums. I am starting with this.

I encountered a problem while testing a functionality. Following are the details:
1. after some troubleshooting, I found out that when 2 unsigned short global variables are removed from the build, the functionality works
2. So I focussed on stack overflow and memory corruption
3. I tested for stack overflow with traditional method of initializing stack with known value and running the system until
   the functionality of interested is executed. But I saw that stack was well within the limit
4. I tried removing other variables of same size from different files, but no use
5. even stranger was this -
    a. hex file that didn't work was loaded; as expected, that feature wouldn't work
    b. now I removed those two variables from the file; feature started working
    c. now I keep those two variables back; feature works even now!!
    d. I then deleted the workspace (.metadata) and reloaded the hex; feature stopped working!!
6. so I thought it could be workspace corruption and changed the file name, created new file. Nothing worked.

I am now clueless about how to debug this.
Does any one have better idea?

CCS - 4.2.4.00033

CGT - 6.0.2 (changing to 6.0.6 didn't help)


(let me know what other information is needed)

thank you,
Vishwanatha

  • make sure all the global variables your program uses are properly initialized before they are used in code. It could be possible that the program is working because some of the variables are located in a RAM memory which by chance is initlaized to zeroes and it doesn;t work the next time because they got moved to locations that aren;t zero-initlaized anymore.

    Also check your linker command and map files to make sure where .cinit sections are going and it isn;t over riding itself or stack.

    Best Regards

    Santosh

  • Hi Santosh,

    1. All global variables are initialised

    2. .cinit goes to Flash (Page0) and I don't understand how can this override Stack.

    --

    Vishwanatha