[Top][All Lists]

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

Re: [avr-gcc-list] Calling functions (-udivhi3) from asm ?

From: Denis Chertykov
Subject: Re: [avr-gcc-list] Calling functions (-udivhi3) from asm ?
Date: 10 Mar 2001 21:59:11 +0300

address@hidden (Robert Rozman) writes:

> Hello,
> after some work in gcc, I have some small parts of project that I'd like to
> implement in asm (I use avr-gcc assembler). But I ran into problems:
> - I'd need function like itoa but I want function to return pointer to last
> character - so I transferred itos.S into my project, make changes and the
> try to compile - but I get error:
> : undefined reference to '_udivhi3'
> itoa.S calls this function with line :
>  XCALL _U(_udivhi3) ; quotient in rP1:rP0, remainder in r26:r27
> I obviously don't know how to specifiy extern function in asm file.
> But then I tried another solution for test - I've changed original itoa.S,
> recompiled library and then used itoa as part of stdlib. But I get same type
> of error. Is itoa functional as it is in original form or I'm doing
> something wrong ?
> Of cource right solution is if I change some global functions to include
> them as custom parts of my project - but I'd like to know how to solve this
> problem in asm file so main question remains :
> How to properly call function '_udivhi3' from asm procedure ? What
> definitions should I make ?

In latest avr-gcc right name is `__udivmodhi4'

       Division 16 / 16 => (result + remainder)
#define r_remL  r26     /* remainder Low */
#define r_remH  r27     /* remainder High */

/* return: remainder */
#define r_arg1L r24     /* dividend Low */
#define r_arg1H r25     /* dividend High */

/* return: quotient */
#define r_arg2L r22     /* divisor Low */
#define r_arg2H r23     /* divisor High */
#define r_cnt   r21     /* loop count */

reply via email to

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