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

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

RE: [avr-gcc-list] just 2 bytes allocated for uint32_t?


From: Weddington, Eric
Subject: RE: [avr-gcc-list] just 2 bytes allocated for uint32_t?
Date: Sat, 28 Feb 2009 11:09:42 -0700

 

> -----Original Message-----
> From: 
> address@hidden 
> [mailto:address@hidden
> org] On Behalf Of Radoslav Kolev
> Sent: Saturday, February 28, 2009 10:51 AM
> To: address@hidden
> 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.




reply via email to

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