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.

TMS320F28374D: Inappropriate memory writing after code modification

Part Number: TMS320F28374D


Hello,

I added few code rows in a function which is called by an interrupt routine, after bulding the project without errors, and uploading it on the target, when the system runs I notice that a variable changes without a write instruction on the code.

The code rows that I add, and also the whole function that I modified, don't use the variable which changes inappropriately. I tried to insert a watchpoint in the memory area where the mentioned variable is stored to understand the reason of changing and It seems that there is no evidence of writing.

Any suggestion for resolving this anomalous behaviour?

  • Hi,

    Did you look at the map file? Can you initialize the variable at entry point of main() and then set the watch point?

    You may want to open the memory window and watch the memory we you step through the code.

  • Hi Santosh,

    Thanks for your reply.

    I declare the variable as global, allocate it in a ram section, and initialize at the entry point of main. I followed step by step the code execution and it is ok. Also after the introduction of the new code rows all the operations on the mentioned variable are correct, but after a while the variable change its value without an obvious action. I would like to remark that the part of code that I modified doesn't work on the mentioned variable.

  • Hi Riccardo,

    Do you see this inappropriate behavior only with this variable or there are other variables affected too? Usually this is symptom of either stack overflow or memory overflow. You can review the mapfile, what is located on either side of memory assigned to this variable. As a debug step, try to allocate this variable to completely different RAM section, do you still see this behavior?

    You can use this link as guide to debug stack corruption and watch-point issue.

    https://www.ti.com/lit/an/spra820/spra820.pdf

  • Hi Santosh,

    I tried to debug the stack corruption and it didn't occur. Reviewing the map file, the variable is allocated in a memory section with some free space.

    Thanks for your support.

  • Hi Riccardo,

    Can you share the mapfile and the portion of code where the variables are being declared? If you want to send privately, then I can send friend-request and then we can exchange files offline.

    Regards, Santosh