[Top][All Lists]

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

Re: [avr-gcc-list] Program Listing With C Comments

From: Vincent Trouilliez
Subject: Re: [avr-gcc-list] Program Listing With C Comments
Date: Tue, 04 Apr 2006 20:30:43 +0200

On Mon, 2006-04-03 at 22:19 +0200, Vincent Trouilliez wrote:
> On Mon, 2006-04-03 at 12:44 -0500, David Kelly wrote:
> >OK, I spoke too soon. For example ui_message_show source is totally  
> >separate from its disassembly listing. Get lots of warnings like this:
> >ui.c:762: warning: passing arg 1 of `eeprom_read_byte' makes pointer
> >from integer without a cast
> Ah yes, I remember trying to get rid of these specific warnings, but I
> didn't see the problem, as I was using the exact syntax found in
> avr-libc's documentation. I think I fixed it with some type casts, but
> that made the eeprom_read_byte() very difficult to read :-(
> The documentation says that the address can be passed as a simple
> integer, but gcc is less arranging and wants a pointer not an integer...
> Well, I will fix it again and see if that improves the output of
> objdump...

Oh, I must have been on drugs, the avr-libc doc was correct (of course
it is...), the compiler was right to complain.

All the eeprom related warnings were caused by calls like this:

sampling_period = eeprom_read_byte(EE_SAMPLING_PERIOD));

I added the type cast:

sampling_period = eeprom_read_byte((uint8_t *) ((uint16_t)EE_SAMPLING_PERIOD));

and all these warnings are gone... it's just more difficult to read and longer 
to type :-(

And it still doesn't fix the original problem.. but I have a couple more
types of warning to fix, so there is scope for hope:

menu.c:53: warning: initialization from incompatible pointer type
menu.c:67: warning: initialization discards qualifiers from pointer target type

However you didn't mention them, do you mean that GCC 3.4.6 didn't
report them at all ? I have 16 of them with GCC 3.4.3... I might try
updating GCC then !


reply via email to

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