Do not pass _etext, _edata, etc. to asm() operands.
Put them in asm code.

The result assembly should look like
mov #_etext,r15

If you really want to put a pointer to _etext somewhere, just do the 
following:

extern int _etext;
int x;
  x = &_etext;

cheers,
~d

On Tuesday 26 October 2004 19:09, Dieter Teuchert wrote:
> 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!
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
> Use IT products in your business? Tell us what you think of them. Give us
> Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
> http://productguide.itmanagersjournal.com/guidepromo.tmpl
> _______________________________________________
> Mspgcc-users mailing list
> Mspgcc-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to