AnsweredAssumed Answered

Crash when using RAMFUNCs

Question asked by on Jun 30, 2020
Latest reply on Jul 7, 2020 by Felipe García


To optimize for performance, we move a set of functions to ITCM memory.
We do this with __RAMFUNC(RAM2)

Now we randomly experience crashes with this. Randomly means, we change anything somewhere in the firmware, not necessarily in a RAM function, recompile and rerun it, and then the problem appears.

Often, we then have to add one more function to RAMFUNC, or remove one, and the problem disappears.

When we debug, we see that the program comes to a "veneer", and there instead jump to the respective function, go on to the next veneer and execute that function call. Then it crashes.


This is the call of the function TCA9555_WriteOutput




Then I do instruction stepping. One step later:



Three steps later


I'd expect it to go to the function in RAM now, but instead it goes to the next veneer:


Then I'm stepping further, and it even goes to the next veneer:


This call is then actually executed (which is not the actual program flow at all):


I can't make any sense of this.

I attached the .map file.


Thanks in advance and regards,