Hello all,
I am debugging a bare metal Raspberry Pi 2 (BCM2836) project using a JLink EDU and am facing a very weird problem. I have noticed a problem with the execution of the push {lr} instruction. I have a chain of about 11 functions being called in a for loop. The first iteration of the for loop goes through without a problem. During the second iteration, once the 11th function is called, the push {lr} instruction has no effect on the stack which results in a random return address causing an exception.
The effect is extremely reproducible. I tried the same code on a Pi B+ (BCM2835) and it works there without a problem on ES4.16. I am guessing it has something to do with a Pi 2 but I don't know if it is an ARM7 issue (not really an expert there) or if I am missing some ES settings. Is there something like a stack depth setting? Even then, the stack depth is the same for the first iteration. I have stepped through the program at assembly level and tried manipulating the stack by hand but that too did not help.
Does someone have any experience with a similar problem? I don't think it is hardware related either. Any advice would be greatly appreciated.
Regards,
Szoshi
I am debugging a bare metal Raspberry Pi 2 (BCM2836) project using a JLink EDU and am facing a very weird problem. I have noticed a problem with the execution of the push {lr} instruction. I have a chain of about 11 functions being called in a for loop. The first iteration of the for loop goes through without a problem. During the second iteration, once the 11th function is called, the push {lr} instruction has no effect on the stack which results in a random return address causing an exception.
The effect is extremely reproducible. I tried the same code on a Pi B+ (BCM2835) and it works there without a problem on ES4.16. I am guessing it has something to do with a Pi 2 but I don't know if it is an ARM7 issue (not really an expert there) or if I am missing some ES settings. Is there something like a stack depth setting? Even then, the stack depth is the same for the first iteration. I have stepped through the program at assembly level and tried manipulating the stack by hand but that too did not help.
Does someone have any experience with a similar problem? I don't think it is hardware related either. Any advice would be greatly appreciated.
Regards,
Szoshi
The post was edited 1 time, last by szoshi ().