This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

r0 corruption while making subroutine call on Cortex A-9

Hi,

I am running a bareboard code on i.MX6Quad board (It has Cortex A9 processor). The code is written in C and invokes function A in a while loop. Function A invokes Function B with 3 arguments.

After some cycles (around 100-200 cycles) of while loop, an exception occurs. When I investigate further I find this: the first argument received by subroutine B is 0. The second and third arguments are correct.

I checked the processor state when exception came. The stack region from where function A loads r0 has correct value when exception came. But r0 value at function B entry was not correct.

Also, this exception is observed only if MMU is ON. If MMU is OFF, the code works fine.

Parents
  • It is the usual Vsprintk call from printk () function.

    while (1)

    {

          printk ("\nDummy String");

    }

    void printk (const char *fmt, ...)

    {

        va_list args;

       static char * buffer [1024];

       memset (buffer, 0, sizeof (buffer));

        va_start(args, fmt);
       Vsprintk (fmt, args, buffer);
       va_end(args);

    }

Reply
  • It is the usual Vsprintk call from printk () function.

    while (1)

    {

          printk ("\nDummy String");

    }

    void printk (const char *fmt, ...)

    {

        va_list args;

       static char * buffer [1024];

       memset (buffer, 0, sizeof (buffer));

        va_start(args, fmt);
       Vsprintk (fmt, args, buffer);
       va_end(args);

    }

Children