Does anybody know how to insert a pointer into an inline assembler sequence?
The following works but loads registers R13..R15 with data not with pointers.

void _reset_vector__(void) {

   ...
   // zero uninitialized RAM
   asm( "                                                \n\
   mov     %0,r15        ; load r15 with end of .text segment \n\
   mov     %1,r14        ; load ram start                \n\
   mov     %2,r13        ; end of data segment            \n\
   cmp     r14,r13                                        \n\
   jeq     Lend_of_data_loop                             \n\
Lcopy_data_loop:                                          \n\
   ; copy data from @r15 to @r14                        \n\
   mov.b   @r15+,@r14    ; move one byte                    \n\
   inc     r14                                            \n\
   cmp     r13,r14        ; check if end of data reached    \n\
   jlo     Lcopy_data_loop                                \n\
Lend_of_data_loop:                                        \n\
   "
   :
   : "m" (_etext), "m" (__data_start), "m" (_edata)
   : "r13", "r14", "r15");

   ...
   }

I tried the sequence   "i" (&_etext)  , but that is an error.
Thanks in advance!


Reply via email to