[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] GCC problem, volatile
From: |
Ned Konz |
Subject: |
Re: [avr-gcc-list] GCC problem, volatile |
Date: |
Fri, 12 Mar 2004 07:36:53 -0800 |
User-agent: |
KMail/1.6.1 |
On Friday 12 March 2004 5:48 am, Andreas Becker wrote:
> static volatile _RX_BUFFER *_rx_decode_buffer;
>
> SIGNAL(SIG_ADC)
> {
> _rx_decode_buffer++;
> }
With your declaration and -O1:
static volatile _RX_BUFFER *_rx_decode_buffer;
26:test2.c **** while(1)
98 .LM5:
99 0036 8091 0000 lds r24,_rx_decode_buffer
100 003a 9091 0000 lds r25,(_rx_decode_buffer)+1
101 .L9:
27:test2.c **** {
28:test2.c **** if (_rx_decode_buffer != NULL)
103 .LM6:
104 003e 0097 sbiw r24,0
105 0040 F1F3 breq .L9
29:test2.c **** {
30:test2.c **** _rx_decode_buffer = NULL;
107 .LM7:
108 0042 80E0 ldi r24,lo8(0)
109 0044 90E0 ldi r25,hi8(0)
110 0046 FBCF rjmp .L9
31:test2.c **** }
32:test2.c **** }
33:test2.c **** }
With the declaration:
static _RX_BUFFER *volatile _rx_decode_buffer;
26:test2b.c **** while(1)
27:test2b.c **** {
28:test2b.c **** if (_rx_decode_buffer != NULL)
99 .LM5:
100 0036 8091 0000 lds r24,_rx_decode_buffer
101 003a 9091 0000 lds r25,(_rx_decode_buffer)+1
102 003e 892B or r24,r25
103 0040 D1F3 breq .L8
29:test2b.c **** {
30:test2b.c **** _rx_decode_buffer = NULL;
105 .LM6:
106 0042 1092 0000 sts (_rx_decode_buffer)+1,__zero_reg__
107 0046 1092 0000 sts _rx_decode_buffer,__zero_reg__
108 004a F5CF rjmp .L8
31:test2b.c **** }
32:test2b.c **** }
33:test2b.c **** }
But I think you probably mean that the pointer *and* what it points to are
both being changed by the interrupt routine, in which case you *really* want:
static volatile _RX_BUFFER *volatile _rx_decode_buffer;
--
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE
_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list