ARM7 local varaibles (stzack?problem

Hi, in my project I created a state machine where states are functions. When signal arrives I call the actuall state by its function pointer. This wor

ARM7 local varaibles (stzack?problem

Ooops I didn’t want to hit the button!!??? …works fine so far. The state machine runs in its own task, I use heap1, a global array. Using a local variable in these (state functions) didn’t work. My debugger says that when assigning a value to one of this variables the value is assigned not to the intended one but to one after that. So the pointer is one variable (4 bytes?) to far. Is this an alignement problem of heap1? Or is there a trick calling a function by pointer I don’t know yet? Hope I decribed the problem understandable. Regards, Joerg

ARM7 local varaibles (stzack?problem

Which compiler are you using?  If it is using stack pointer relative addressing then maybe there is an error with the stack pointer? Are you sure your state functions are reentrant?

ARM7 local varaibles (stzack?problem

Hi, my use of a local variable made no sense, as the state function gets called on every signal and so the variable is undefined the next call. Did you mean this with reentrant? I was confused by the debugger, changing the value of the next variable, but maybe he was just confused by me ;-) There is a problem but I have to track it down some more before posting here again. Thanks,