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.

Compiler/RM57L843: Running code problem

Part Number: RM57L843
Other Parts Discussed in Thread: HALCOGEN

Tool/software: TI C/C++ Compiler

hello everyone,

I have a weird problem, when i want to run a simple code on the board RM57L843.

CLINT is an object form the math library FLINT.

the project is built and the following snippet code works fine on the board, but when adding one more variable the code breaks
anyone has experienced this kind of behaviour?


this picture show the debugger cursor moves till the third line

but in this picture where i added the fourth variable, the debugger exits after the first line, even though it is the same code

I would appreciate and recommendations.

thank you all
Sincerely
Moud Jadaan

  • My guess is you are running out of stack.  I can tell from debugger screen shots that CLINT is a type which stands for unsigned short[257].  That's 514 bytes for one array.  And you have 6 of them.  That's 3084 bytes.

    The usual way to change the stack size in a CCS project is shown in the screen shot below.

    Another solution to consider ... Change all those CLINT variables to static.

    Thanks and regards,

    -George

  • hi George,

    Thank you very much for your help.
    Changing the stack size didn't work, BUT making CLINT as a static variable worked. Would you please tell my why it is like that?

    Sincerely
    Moud
  • Moud Jadaan said:
    Changing the stack size didn't work

    My guess is that you didn't change it enough.  Just as an experiment, make it huge.  Something like 6 KB sounds right.

    Moud Jadaan said:
    BUT making CLINT as a static variable worked. Would you please tell my why it is like that?

    Local variables are defined inside the function.  They are available for use only while the function is executing.  Otherwise, they do not exist.  You get a fresh new set of uninitialized local variables every time the function starts.  Such variables are allocated on the stack.  (Or sometimes in registers.  But that is never true for array variables like you have here.)  A function which has around 3 KB of local variables is unusual.  That is why you need an unusually large stack to handle it.

    Static variables also have their scope limited to that of the function where they are defined.  But they persist between calls.  That is because they are not allocated on the stack, but in the same section where other global variables are allocated.  In this case, that section is probably .bss.  

    Thanks and regards,

    -George

  • huge thanks George :)
  • Moud Jadaan said:
    Changing the stack size didn't work, BUT making CLINT as a static variable worked. Would you please tell my why it is like that?

    When HALCoGen is used, the stack size is set on the HALCoGen tool (under the RAM tab), rather than on the CCS project properties - see Linker ignoring stack size setting

  • hey Chester,

    you are definitely right, when I changed the stack size using HALCoGen, it works perfectly

    thank you