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.

static variables overwritten

Other Parts Discussed in Thread: TMS320F28377D

I am working with CCS Version 6.0 on Win8.1, trying to program a Delfino TMS320F28377D with an algorithm that i used on a PC-based real time system before. I am not experienced with DSP programming, but i guess the code might be a large for the Delfino.

I was building up the project sucessfully since a few months step by step, but since a few days i am encountering weird problems such as:

- I declare an additional variable after which different code lines that worked before do now not work anymore.

- a static variable in a small function, assigned only at one point in this function, has a different value when re-entering the function

Other posts describing similar problems seemed to be related to stack overflow. So I tried to double the stack size in the project properties (from 0x100 to 0x200), which didn't solve the problem. Moreover i could not find how to set a breakpoint on stack overflow to identify if this is really the problem.

My linker file contains:

RAMM1           : origin = 0x000400, length = 0x000400

and:
   .stack           : > RAMM1,     PAGE = 1

which seems to be related to the stack size. But i am not experience with configuring this linker file.


Im kinda lost. Anyone has an idea how i should approach this problem?

  • Check where your linker file place the BSS segment (typically in LS5). The BSS segment contains static variables and variables initialized to 0, so you might inadvertently be overwriting memory there.
  • Thanks for your response, Michael!

    Yes, .bss is in LS5 - as well as .econst and .esysmem, which is the default configuration from the TI example project i used. Im not familiar with cmd-scripts, but I guess that the linker would manage to prevent that neither data from .econst nor .esysmem would overwrite the variables in .bss - right?
    The previous memory block LS4 belongs to .text which would also not vary in size during operation and exceed its boundaries - right?
    Extending .ebss didn't solve the problem, which seemed reasonable to me.
    Is there a way to track which instructions access a certain address in memory?
  • Yes, the linker will normally make sure everything is put where you specify it, but it can't prevent you from inadvertently accessing memory locations directly in your code (i.e. you can always write directly to a memory address anywhere as long as it is accessible).
    I don't know if CCS6 can break on memory access...
  • Found it, you were right, my mistake: I use many global arrays, one of which i declared one field too small.
    Thanks for your hints, Michael!