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.

Can't use variables as array indexes.

Other Parts Discussed in Thread: MSP430F2274

Hello,

I am using Code Composer Studio v4 with an MSP430F2274 connected via the MSP430FET-UIF.

Towards the end of the program, I can't use any variables as array indexes otherwise the program hangs.

For example,

x = array[0]; //this line will execute properly

int i = 0;
x = array[i]; //this line will not execute properly

I'm quite confused, as I've checked every variable and its declaration and can't find any issue.

If anyone has seen something like this before and has any guidance or suggestions, it would be much appreciated.

Thanks,

Zack 

  • Hello Zack,

    you write "towards the end" - this reminds me of a issue I discussed here a week ago. How much is your RAM filled? Are you calling many functions? With many parameters? I might be, that you are facing a stack overflow. But it's just a guess - you can easily check with a view into the memory view of the debugger. A simple trick is to fill the entire ram with a specific pattern (0xAA for example) let your program run and look at the stack (highest memory adress downwards). If there is no 0xAA before the stack, you are into an overflow.

  • Zack Kagan said:
    I've checked every variable and its declaration

    This is a run-time issue, not a compile-time issue - so you need to connect your debugger to see what's actually happening to the code as it runs...

    Guess: check stack space...

**Attention** This is a public forum