On Thu, Aug 4, 2011 at 10:22 AM, Alexandru Stefan
<alexandru.ste...@cloudbit.ro> wrote:
> Hello,
>
>        I am currently working on two inline routines to read and write
> data to
>        addresses >64k.
>
>        This is the 'write' routine:
>
>
>        static inline __attribute__((always_inline)) void
> flash_write(uint32_t addr,
>        uint16_t val){
>
>                __asm__ __volatile__ (
>                        "dint \n"
>                        "nop \n"
>                        "pushx.a r15 \n"
>                        "movx.a %[addr], r15 \n"
>                        "movx %[val], @r15 \n"
>                        "popx.a r15 \n"
>                        "eint \n"
>                        :
>                        :[addr] "r"(addr), [val] "r"(val)
>                        );
>        }
>
>        and this is the asm code it generates:
>
>        static inline __attribute__((always_inline)) void
> flash_write(uint32_t addr,
>        uint16_t val){
>
>                __asm__ __volatile__ (
>            315c:       2e 44           mov     @r4,    r14
>            315e:       1f 44 02 00     mov     2(r4),
> r15     ;0x0002(r4)
>            3162:       1d 44 04 00     mov     4(r4),
> r13     ;0x0004(r4)
>            3166:       32 c2           dint
>            3168:       03 43           nop
>            316a:       00 18           .word   0x1800; ????
>            316c:       4f 12           push.b  r15
>            316e:       00 18           .word   0x1800; ????
>            3170:       4f 4e           mov.b   r14,    r15
>            3172:       40 18           .word   0x1840; ????
>            3174:       8f 4d 00 00     mov     r13,
> 0(r15)  ;0x0000(r15)
>            3178:       00 18           .word   0x1800; ????
>            317a:       7f 41           pop.b   r15
>            317c:       32 d2           eint

   0:   32 c2           dint
   2:   03 43           nop
   4:   00 18 4f 12     pushx.a r15
   8:   00 18 4f 4e     movx.a  r14,    r15
   c:   40 18 8f 4d     movx    r13,    0(r15)  ;0x00000(r15)
  10:   00 00
  12:   00 18 7f 41     popx.a  r15
  16:   32 d2           eint
  18:   30 41           ret

Your disassembler isn't up to date.

Peter
>
>                uint32_t address = 0x11110UL;
>                uint16_t val = 0x33;
>
>                flash_write(address, val);
>        }
>
>        The main question is why is used the simple MOV instruction
> instead of the
>        extended version?
>
>        Regards,
>        Alex
>
>
> ------------------------------------------------------------------------------
> BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
> The must-attend event for mobile developers. Connect with experts.
> Get tools for creating Super Apps. See the latest technologies.
> Sessions, hands-on labs, demos & much more. Register early & save!
> http://p.sf.net/sfu/rim-blackberry-1
> _______________________________________________
> Mspgcc-users mailing list
> Mspgcc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to