Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » AVR-GCC
  • » [avr-gcc-list] How to (efficeiently !!!) test a bit withinamulti-byte integer ? [RSS Feed]

#1 Nov. 4, 2005 12:24:06

n.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] How to (efficeiently !!!) test a bit withinamulti-byte integer ?


Does your lcd-routines rely on busy-waiting? That might be the reason why
opt doesn't work. I don't know but "badly" written wait-loops might e opt'ed
away.

/niklo

-----Original Message-----
From:
On Behalf Of
Vincent Trouilliez
Sent: den 4 november 2005 13:11
To: avr-gcc
Subject: Re: How to (efficeiently !!!) test a bit
withinamulti-byte integer ?

On Fri, 2005-11-04 at 10:04 +0100, Jurek Szczesiul wrote:
> Hi Vince !
> You could also try to retrieve directly the 2. ( from 0) byte of ulong and
check
> the bit , something like this ( -Os) :
>
> if( *((uchar*)&long1+2) & 0x4) PORTB = 0x1;
> 8c: 80 91 65 00 lds r24, 0x0065
> 90: 82 ff sbrs r24, 2
> 92: 02 c0 rjmp .+4 ; 0x98
> 94: 81 e0 ldi r24, 0x01 ; 1
> 96: 88 bb out 0x18, r24 ; 24

Using pointers to access directly the required byte, I did think of it,
but didn't dare ! ;-) It's technically elegant I find, but sadly the
code is not very easy to read I find.

About the -Os flag, I noticed this morning that it managed MASSIVE code
size reduction ! SO far I had been using just -O (I guess that means no
particular optimisation ?), and the program is about 13KB in size. With
-Os, it's only 10KB !!! Sadly, for some reason, when compiled with this
flag, my program misbehaves badly (I get massive corruption of the LCD
display) !! Too bad... :o(



--
Vince



_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-l***@*ongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.orghttp://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Offline

#2 Nov. 4, 2005 12:47:07

Vincent T.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] How to (efficeiently !!!) test a bit withinamulti-byte integer ?


On Fri, 2005-11-04 at 13:23 +0100, niklo wrote:
> Does your lcd-routines rely on busy-waiting? That might be the reason why
> opt doesn't work. I don't know but "badly" written wait-loops might e opt'ed
> away.

Yeah I think we got the same idea... I did replace the _delay_us(40)
delay loop by a custom made empty for loop, as it's so much more
efficient, at least in this particular routine. But looks like -Os
doesn't like empty for loops ! I just checked the disassembler output,
and the loop has indeed been simply ignored/deleted !
I know, I know, I should wire the LCD R/W line and poll the 'busy' flag
instead.... I will get round to doing it... later... too many other,
more important pieces of code to write at the moment, plus, I don't
think the program will grow much bigger than 20KB max, and I have 32KB
to play with...
But that's no excuse for using empty loops instead of proper polling, as
polling it the only reliable way of doing it anyway...


--
Vince, hiding in the corner...






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

Offline

#3 Nov. 9, 2005 08:49:18

Niklas L.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[avr-gcc-list] How to (efficeiently !!!) test a bit withinamulti-byte integer ?


So you're personally responsible for making the release? Couldn't someone
help you out to make it happen faster? If it would be of any help I have
some time... :)

/niklo

-----Original Message-----
From: Eric Weddington
Sent: den 8 november 2005 23:59
To: Niklas Lövgren
Cc: 'Vincent Trouilliez'; 'avr-gcc'
Subject: Re: How to (efficeiently !!!) test a bit
withinamulti-byte integer ?

Niklas Lövgren wrote:
> That's interesting it makes that much differnce between the minors. So how
> much "better" is gcc 4.x.x?
> And also why isn't the newer gcc versions included in a winavr release?

1. Previously, there have been bugs in that tree affecting the AVR port
which has made it a "no-go".

2. Because I haven't done a new WinAVR release yet. I'm planning to
include 4.0.2 as soon as I can come up for air.

Eric



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

Offline

  • Root
  • » AVR-GCC
  • » [avr-gcc-list] How to (efficeiently !!!) test a bit withinamulti-byte integer ? [RSS Feed]

Board footer

Moderator control

Enjoy the 18th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support