AnsweredAssumed Answered

Jumping to RAM instead of inside switch-case?

Question asked by Mathias Edman on Apr 23, 2019
Latest reply on Apr 25, 2019 by Mathias Edman



I am using development board and daughter board for MPC5777C together with S32 and default compiler/linker (powerpc-eabivle-4_9). It all worked great until today when I inserted the flash driver code (example driver code). For some reason the MCU is jumping to start address in RAM when executing a simple switch()-case c statement !?


I have never seen anything like this before and I am totally mesmerized about how this can even happen.


I base everything I did so far on the example that I could find in your example list (interrupts are disabled):

Example MPC5777C Single ELF multi-core Pin Toggling - S32DS Power v1.2


 Please see below picture:


For some reason jumping to ram in a switch()


The lockedBlockSelection is here set to C55_BLOCK_LOW.

When we execute the instruction at 0x00811cba (se_bctr) we jump to RAM address 0x40000000 (r7 will hold this value at that point). If I remove the switch case and replace it with something else everything works.


registers are as below in the position shown in picture:

General Registers General Purpose and FPU Register Group
r0 0x811e38 (Hex)
r1 0x40001f68 (Hex)
r2 0x40008000 (Hex)
r3 0x0 (Hex)
r4 0x0 (Hex)
r5 0x40040000 (Hex)
r6 0x100bf (Hex)
r7 0x0 (Hex)
r8 0x0 (Hex)
r9 0x0 (Hex)
r10 0x0 (Hex)
r11 0x40001fe0 (Hex)
r12 0x0 (Hex)
r13 0x40008018 (Hex)
r14 0x0 (Hex)
r15 0x0 (Hex)
r16 0x0 (Hex)
r17 0x0 (Hex)
r18 0x0 (Hex)
r19 0x0 (Hex)
r20 0x0 (Hex)
r21 0x0 (Hex)
r22 0x0 (Hex)
r23 0x0 (Hex)
r24 0x0 (Hex)
r25 0x0 (Hex)
r26 0x0 (Hex)
r27 0x0 (Hex)
r28 0x0 (Hex)
r29 0x0 (Hex)
r30 0x0 (Hex)
r31 0x40001f68 (Hex)
pc 0x811c80 (Hex)
msr 0x2001000 (Hex)
cr 0x40000004 (Hex)
lr 0x811e38 (Hex)
ctr 0x0 (Hex)
xer 0x0 (Hex)



Anyone know power pc architecture better than me that could explain how this can happen? Any hints?