avr-gcc-list
[Top][All Lists]
Advanced

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

[avr-gcc-list] calls of run-time library during interrupts


From: Roland Zitzke
Subject: [avr-gcc-list] calls of run-time library during interrupts
Date: Fri, 9 Aug 2002 13:46:50 +0200

Hi,
I have the following code compiled for avr atmega128 which - instead of
multyplying and dividing - crashes with unpredictable results at the line in
question.
<--- snip
// global variables
unsigned char volume_pwm_0;
SIGNAL(SIG_OVERFLOW0)
{
SIGNAL(SIG_OVERFLOW0)
{
  int y;
...
  int y;
...
    y = (y * volume_pwm_0) / 100;
...
}

<----snip
The compiler generates:
  95:audio.c       ****     y = (y * volume_pwm_0) / 100;
 135                  .stabn 68,0,95,.LM5-_vector_16
 136                .LM5:
 137 004e 2091 0000     lds r18,volume_pwm_0
 138 0052 3327          clr r19
 139 0054 829F          mul r24,r18
 140 0056 A001          movw r20,r0
 141 0058 839F          mul r24,r19
 142 005a 500D          add r21,r0
 143 005c 929F          mul r25,r18
 144 005e 500D          add r21,r0
 145 0060 1124          clr r1
 146 0062 CA01          movw r24,r20
 147 0064 64E6          ldi r22,lo8(100)
 148 0066 70E0          ldi r23,hi8(100)
 149 0068 0E94 0000     call __divmodhi4
 150 006c CB01          movw r24,r22

I wonder if the call to __divmodhi4
causes the problem?
Any solution?

Thanks in advance
Roland

avr-gcc-list at http://avr1.org



reply via email to

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