[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Efficient copy from flash to ram

From: Gavin Jackson
Subject: [avr-gcc-list] Efficient copy from flash to ram
Date: Thu, 19 Jun 2003 15:14:27 +1200

Hi there

I'm trying to build my own OS and need to copy structures from flash into
The structures were 4 bytes long and I used the following code for the copy:

#define __LPM_TASK__(addr) ({       \
    unsigned short __addr16 = (unsigned short)(addr); \
    tTaskDescriptor __result;     \
    __asm__ (                   \
        "lpm %A0, Z+ \n\t"      \
        "lpm %B0, Z+ \n\t"      \
        "lpm %C0, Z+ \n\t"      \
        "lpm %D0, Z"            \
        : "=r" (__result)       \
        : "z" (__addr16)        \
    );                          \
    __result;                   \

The problem is that now the structures are double the size and no longer
placed in the registers but use the Y register pair as a pointer. How can
I copy my data structures to their ram locations, I tried using lpm
_tmp_reg_, Z+
and std Y+1, _tmp_reg_ but couldn't get it to work.

Thanks in advance


reply via email to

[Prev in Thread] Current Thread [Next in Thread]