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

Realview problem with "lr"

Hi,

This is the code I need to make compatible with RV.

void vPortYieldProcessor( void )
{
        __asm{ ADD      lr, lr, #4 };

        /* Perform the context switch. */
        portSAVE_CONTEXT();
        vTaskSwitchContext();
        portRESTORE_CONTEXT();
}


With this code. I received error "lr is undefined"

After reading the manual, and probably understood incorrectly, I put declaration

#define   lr   __return_address()

before the above function, and received this error instead

..\..\Source\portable\Keil\ARM7\portISR.c(98): error:  #1093: Must be a modifiable lvalue

Anyone can help? Thanks

Parents Reply Children
  • Actually, that's an early version of the entry/leave code for the SVC gate of a multithreading nanokernel I'm writing for the ARM7.

    I have stripped-off detailed comments to keep the code focused on the entry/exit sequences.
    The point I want to make is that handling the context saving/restore must be done in a way that preserves the calling context. Although it can be done with the RVCT C compiler (using the embedded assembler), it is much easier, clearer and probably faster to do that directly in assembly.
    But, in any case, you would probably not be able to do that in pure C code.