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

Accessing local variables in asm

How can you access local variables in the arm asm block?

One example the software came with looks like this and doesn't work:

int AddUp (
  int n,
  int near *pTab)
{
  __asm  {            ; open inline-assembly block
    mov   r2,pTab     ; R2:=start of table
    mov   r3,n
    ...
As far as I know, near isn't even a valid keyword anymore, but thats a different topic.

I also found references to the LDAV, STAV, and LDAA Keil specific instructions, but I can't seem to get those to work either.

Does anyone have any suggestions?

Thanks,
Peter Burdine
General Atomics -- Lynx Systems

  • The LDAV and STAV Keil instructions load and store local variable values. They may be used as follows:

    void test (int value)
    {
    int local_value;
    
    __asm
      {
      LDAV R1, R2, value
      STAV R1, R2, local_value
      }
    }
    

    This function works just fine using the latest ARM tools update.

    The example in the manual will be updated in the next few days. It was actually created before inline assembler was completed.

    Jon