> -----Original Message-----
> From: 
> avr-gcc-list-bounces+eweddington=cso.atmel....@nongnu.org 
> [mailto:avr-gcc-list-bounces+eweddington=cso.atmel....@nongnu.
> org] On Behalf Of Radoslav Kolev
> Sent: Saturday, February 28, 2009 10:51 AM
> To: avr-gcc-list@nongnu.org
> Subject: [avr-gcc-list] just 2 bytes allocated for uint32_t?
> 
> 
> The problem is the compiler inlining functions more than once,

Known issue.

> 
> char getch(void)
> {
>   /* m8 */
>         uint32_t count = 0;
>   while(!(inb(UCSRA) & _BV(RXC))) {
>                 /* HACKME:: here is a good place to count times*/
>                 count++;
>                 if (count > MAX_TIME_COUNT)
>                         app_start();
>   }
>   return (inb(UDR));
> }
> 
> The complete code is available here:
> 
> When I changed the type of the count variable from uint32_t to
> unsigned long things started working correctly.
> 
> But aren't uint32_t and unsigned long supposed to be the same and both
> 4 bytes long in this case?
> 

Are you including <stdint.h> or <inttypes.h>?

And please stop using inb() and outb(). They have been removed from avr-libc 
and are not necessary. Just use a regular assignment.


_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to