ARM7A - Question about push {lr}

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • ARM7A - Question about push {lr}

      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

      The post was edited 1 time, last by szoshi ().

    • Hello,

      the function is not at any special address. Like I have mentioned above, the function is called inn a for loop where the first iteration runs without a problen but the second iteration has this error. I managed to change it by hand and let the code run, only to figure out that it happens for another function call. Again here, the stack is not written to after the push {lr} instruction, meaning that the written address is wrong.

      The above problem does not occur with the Pi B+ (BCM2835) but can be reproduced with the Pi 2 (BCM2836). I was wondering if there are any project level settings that influence the written stack or something else like that?

      Szoshi