Re: [avr-gcc-list] Re: C vs. assembly performance

2009-03-01 Thread Vincent Trouilliez
Thanks all for the input on switch statement, I appreciate. On Sun, 01 Mar 2009 14:37:57 +0100 David Brown david.br...@hesbynett.no wrote: Apart from that, I've a couple of other comments on your code. The variable names tmp16, tmp32 and tmpS16 are truly awful. Oh :-) I was just trying to

Re: [avr-gcc-list] Re: C vs. assembly performance

2009-02-28 Thread Vincent Trouilliez
On Sat, 28 Feb 2009 19:09:13 -0700 Weddington, Eric ewedding...@cso.atmel.com wrote: So in application code I tend to avoid switch statements for embedded systems, unless I'm writing throw-away code or the application is trivial. Oh no ! ;-) I have only recently got round to using switch

Re: [avr-gcc-list] Re: C vs. assembly performance

2009-02-28 Thread Vincent Trouilliez
On Sat, 28 Feb 2009 19:24:38 -0700 Weddington, Eric ewedding...@cso.atmel.com wrote: You wouldn't need *nested* ifs, but an if-else-if structure, or better yet, a table of function pointers, also known as a dispatch table. Each method depends on the type of data that you're switching on. I

Re: [avr-gcc-list] Re: sprintf

2009-02-27 Thread Vincent Trouilliez
On Fri, 27 Feb 2009 22:10:16 +0100 David Brown david.br...@hesbynett.no wrote: sprintf((A_String + i), %c, 0xff) has exactly the same effect as: A_String[i] = 0xff; A_String[i + 1] = 0x00; delay_about_1000_processor_cycles();

Re: [avr-gcc-list] Re: sprintf

2009-02-27 Thread Vincent Trouilliez
On Fri, 27 Feb 2009 16:50:57 -0500 David VanHorn d...@mobilefusioninc.com wrote: As was earlier, and more gently pointed out by Dave, Sprintf was pretty wasteful. It worked though, and that's what the programmers here suggested I use. They are big iron guys, so less sensitive to the costs.

Re: [avr-gcc-list] Newbie question

2009-02-25 Thread Vincent Trouilliez
On Wed, 25 Feb 2009 11:05:02 -0500 David VanHorn d...@mobilefusioninc.com wrote: I am kinda a newbee too, but I will throw my comments. The experts will come to the rescue soon I am sure ;-) I have an app on a Mega32L, running at 4 MHz. in ITEMP,TCNT1H ;Once I've captured the timer value,

Re: [avr-gcc-list] How to force GCC to not to remove nop statements ?

2009-02-20 Thread Vincent Trouilliez
On Fri, 20 Feb 2009 08:03:52 +0100 (MET) j...@uriah.heep.sax.de (Joerg Wunsch) wrote: Vincent Trouilliez vincent.trouill...@modulonet.fr wrote: lcd.c:96: error: »asm« undeclared (first use in this function) That's because you are using a -std setting the prevents GCC from using its

[avr-gcc-list] How to force GCC to not to remove nop statements ?

2009-02-19 Thread Vincent Trouilliez
Hi list, Like many people I guess, I am using in-lined nop asm statements to respect the timing of external devices, when toggling their control lines. In the case at hand I am driving a text LCD module, and the Enable line must be pulsed low for 250ns. void lcd_send_nibble(uint8_t data) { ...

Re: [avr-gcc-list] How to force GCC to not to remove nop statements ?

2009-02-19 Thread Vincent Trouilliez
On Thu, 19 Feb 2009 11:14:40 -0700 Weddington, Eric ewedding...@cso.atmel.com wrote: If you are using WinAVR 20081205 then you can use one of the new builtin functions: void __builtin_avr_delay_cycles(unsigned long __n); Hmm, sweet ! Unfortunately I am on Linux so no WinAVR for me ! ;-) --

Re: [avr-gcc-list] How to force GCC to not to remove nop statements ?

2009-02-19 Thread Vincent Trouilliez
On Thu, 19 Feb 2009 10:22:23 -0800 (PST) Parthasaradhi Nayani partha_nay...@yahoo.com wrote: Hi Vincent, If I understand correctly, the word volatile itself is to tell the compiler not to ignore the statement. I am not sure if your statement is correct, but I have used  asm volatile

[avr-gcc-list] memcpy() : problem when passing destination pointer

2009-02-10 Thread Vincent Trouilliez
Morning, I am trying to copy part of a buffer into another buffer with memcpy(): memcpy(KLineFrameM1, Buff[2], 66); ... but get a warning about the destination pointer: ui.c:989: warning: passing argument 1 of ‘memcpy’ discards qualifiers from pointer target type KLineFrameM1 is declared and

Re: [avr-gcc-list] memcpy() : problem when passing destination pointer

2009-02-10 Thread Vincent Trouilliez
On Tue, 10 Feb 2009 04:32:36 -0500 Graham Davies ecros...@ecrostech.com wrote: Vincent Trouilliez wrote: ... get a warning about the destination pointer: ... passing argument 1 of ‘memcpy’ discards qualifiers from pointer target type Well, this is a pretty clear warning. Forgive me

Re: [avr-gcc-list] compiler bug?

2009-02-10 Thread Vincent Trouilliez
On Tue, 10 Feb 2009 11:45:52 + Richard F li...@keynet-technology.com wrote: Hi Call me a newbie, but is there anything wrong with the following statement? rtc.time_element.tm_wday = (rtc.time_element.tm_wday 6) ? a = ( a 6 ) Looks strange. the '' is used to evaluate/test if a

Re: [avr-gcc-list] memcpy() : problem when passing destination pointer

2009-02-10 Thread Vincent Trouilliez
On Tue, 10 Feb 2009 21:54:41 -0700 Weddington, Eric ewedding...@cso.atmel.com wrote: It is still in the FAQ, and still #1 in the FAQ, in the avr-libc user manual. It's been that way for many years. Hmm let mcheck again ! ;-) O... I can see it ! But I missed it because the FAQ entry

[avr-gcc-list] Failing to share a flag between two files/modules :-/

2009-02-08 Thread Vincent Trouilliez
Hello Gents, I am having problem communicating between main.c and another file/module, ui.c to name it. In main.c I set a flag from a timer ISR, every 100ms. In ui.c I am watching for that flag, but unfortunately it always reads zero :-/ However if I watch for the flag in main() then it works

Re: [avr-gcc-list] Failing to share a flag between two files/modules :-/

2009-02-08 Thread Vincent Trouilliez
Just a quick collective thank you to Dave Hylands and Chris Kuethe who sorted me out off-list ! :-) static flag was precisely telling the compiler NOT to share the flag, extern OTOH does just that. Program works as expected now, thanks chaps. -- Vince

Re: [avr-gcc-list] Re: Strings: escape sequence to insert arbitrary hex value ?

2009-02-05 Thread Vincent Trouilliez
On Thu, 05 Feb 2009 07:58:26 +0100 David Brown david.br...@hesbynett.no wrote: Thanks to all the people who replied while I was away ! An alternative idea is to find an ASCII character that you don't need otherwise (say, ~), and use it in your strings. Then do on-the-fly conversion when

Re: [avr-gcc-list] Re: Strings: escape sequence to insert arbitrary hex value ?

2009-02-05 Thread Vincent Trouilliez
ISO C99, section 6.4.4.4, p3: the question-mark ?, [..] is representable according to the following table of escape sequences: question mark? \? Interesting. I wonder why the standard deeemd it necessary to provide an escape sequence for the question mark ? I do happen to have question marks

Re: [avr-gcc-list] Re: Strings: escape sequence to insert arbitrary

2009-02-05 Thread Vincent Trouilliez
On Thu, 5 Feb 2009 20:32:46 +0200 lu...@proxima.alt.za wrote: Because there is a rather arcane way to represent characters in which three question marks appear prominently. I recall now that it's called trigraphs. Don't look it up, no one in his right mind would take that standard

Re: [avr-libc-dev] RE: [avr-gcc-list] no avr/lib/avr25/attiny13a/Makefile.in

2009-01-30 Thread Vincent Trouilliez
The problem is that Ubuntu (by default) links sh to dash, and almost all other Linux distributions link sh to bash. Not that Ubuntu needs anyone to jump in to defend them but ;-) as an Ubuntu user since day one, I do vividly remember when they thoughtfully decided, nearly 3 years ago, to

[avr-gcc-list] __DATE__ constant, any way to format it differently ?

2009-01-28 Thread Vincent Trouilliez
Hello, I am using the __DATE__ constant, to display it on screen at power-up. the screen is a 4x20 LCD, and the string returned by __DATE__ is quite long: MMM DD . Is there a way to select a different (shorter in my case) format, or is it cast in stone ? I downloaded the heavy GCC 4.3.3 PDF

Re: [avr-gcc-list] __DATE__ constant, any way to format it differently ?

2009-01-28 Thread Vincent Trouilliez
On Wed, 28 Jan 2009 13:06:47 -0700 Weddington, Eric ewedding...@cso.atmel.com wrote: The __DATE__ macro is a predefined macro, and you can find it in the C Preprocessor manual (CPP) which is separate from the GCC manual. Look under section 3.7.1, Standard Predefined Macros. Thanks. Seems the

Re: [avr-gcc-list] __DATE__ constant, any way to format it differently ?

2009-01-28 Thread Vincent Trouilliez
On Wed, 28 Jan 2009 12:10:44 -0800 Dave Hylands dhyla...@gmail.com wrote: This is really a make question and not a gcc question. Hmmpf.. yes, then the numerous avr-libc question on this list should not be there too, I guess ! ;-) If we do a different list for GCC, CPP, Make files, avr-libc, I

Re: [avr-gcc-list] __DATE__ constant, any way to format itdifferently ?

2009-01-28 Thread Vincent Trouilliez
On Wed, 28 Jan 2009 13:33:45 -0700 Stu Bell sb...@dataplay.com wrote: Check out the SubVersion manual: http://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.keywords.h tml Geez, thanks Stu, hard to make it simpler than that ! :-) I sure had downloaded a PDf copy of this book, but I

Re: [avr-gcc-list] __DATE__ constant, any way to format itdifferently ?

2009-01-28 Thread Vincent Trouilliez
Check out the SubVersion manual: http://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.keywords.html mmm, think I got carried away. This isn't helpful for what I want. I would have to commit for SVN to embed the string in the code, and then compile. Of course I am not gonna commit

Re: [avr-gcc-list] __DATE__ constant, any way to format itdifferently ?

2009-01-28 Thread Vincent Trouilliez
On Wed, 28 Jan 2009 21:50:04 +0100 Torsten Seeboth torsten.seeb...@t-online.de wrote: http://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.keywords.h HTTP 404 Error Come on Torsten, I am sure you spotted the trailing tml on the following line, just add it manually in the address

Re: [avr-gcc-list] __DATE__ constant, any way to format it differently ?

2009-01-28 Thread Vincent Trouilliez
On Wed, 28 Jan 2009 12:59:17 -0800 Steven Michalske smichal...@gmail.com wrote: one suggestion, this doesn't check if the files were modified from the svn revision. if you only compile code that is checked in this is fine, if you have changes in the working copy this poses problems.

Re: [avr-gcc-list] __DATE__ constant, any way to format it differently ?

2009-01-28 Thread Vincent Trouilliez
Steven Michalske smichal...@gmail.com wrote: you are assigning it to a string here but gcc sees an integer. use this: -DMY_DATE=\`date %y%m%d`\ so that MY_DATE is defined as 090128 (a string) in your code -DMY_DATE=`date %y%m%d` gives you MY_DATE as 090128 (an integer) in your code.

Re: [avr-gcc-list] A couple GCC warnings I would like to understand / get rid of...

2009-01-24 Thread Vincent Trouilliez
On Thu, 22 Jan 2009 10:17:07 -0700 larry barello la...@barello.net wrote: the compiler is complaining because you have an extra or a missing const in your structure definitions. There is a mismatch between your flash declaration and the type of pointer within your struct. Probably adding a

Re: [avr-gcc-list] A couple GCC warnings I would like to understand / get rid of...

2009-01-24 Thread Vincent Trouilliez
menu.c:44: warning: type qualifiers ignored on function return type Ignore that one, was just a little bug while I was cutting down the program... -- Vince ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org

Re: [avr-gcc-list] A couple GCC warnings I would like to understand/ get rid of...

2009-01-24 Thread Vincent Trouilliez
On Sat, 24 Jan 2009 16:33:38 -0700 Weddington, Eric ewedding...@cso.atmel.com wrote: See attached. No warnings, no errors. Thanks Eric ! But you have won only half the trophey I am afraid.. you didn't fix the first warning(s) menu.c:35: warning: initialization from incompatible pointer type

Re: [avr-gcc-list] A couple GCC warnings I would like to understand/ get rid of...

2009-01-24 Thread Vincent Trouilliez
... where I initialize a pointer with dummy_func errata, I meant menu_sub not dummy_func of course... -- Vince, should not listen to music while typing... ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org

Re: [avr-gcc-list] A couple GCC warnings I would like tounderstand/ get rid of...

2009-01-24 Thread Vincent Trouilliez
On Sat, 24 Jan 2009 17:23:13 -0700 Weddington, Eric ewedding...@cso.atmel.com wrote: I am using WinAVR 20081205 with AVR GCC 4.3.2. 4.3.2.. yes I intended to upgrade to it, as soon as it's in an installable state in the Ubuntu 9.04 repo (currently in development). I pulled the GCC source to try

Re: [avr-gcc-list] A couple GCC warnings I would like tounderstand/get rid of...

2009-01-24 Thread Vincent Trouilliez
On Sat, 24 Jan 2009 18:47:40 -0700 Weddington, Eric ewedding...@cso.atmel.com wrote: Ah, ok, I see now. Sorry that I just gave it a quick glance. Again, typecasts are all that you need. See attached; no warnings, no errors. {Item 1 ,(const struct Tmenu*)menu_sub,NULL},

Re: [avr-gcc-list] A couple GCC warnings I would like tounderstand/get rid of...

2009-01-24 Thread Vincent Trouilliez
On Sun, 25 Jan 2009 03:20:02 +0100 Vincent Trouilliez vincent.trouill...@modulonet.fr wrote: Oops, I guess our respective GCC versions don't behave the same again.. adding this type cast gives me a new/different warning: menu.c:35: warning: type-punning to incomplete type might break

Re: [avr-gcc-list] A couple GCC warnings I would like tounderstand/get rid of...

2009-01-24 Thread Vincent Trouilliez
On Sun, 25 Jan 2009 03:37:11 +0100 Vincent Trouilliez vincent.trouill...@modulonet.fr wrote: Hmm, I switched temporarily from GCC 4.2.2 to 4.3.0, and 4.3.0 doesn't give any warnings at all... I shall just ignore the warnings from 4.2.2 then. I don't want to move to 4.3.0 as I suspect it had

[avr-gcc-list] Typdef chick 'n egg situation.. way out ?

2009-01-21 Thread Vincent Trouilliez
Hi list, Problem: I have two typdef's statement, each type contains a pointer to the other type ! Hmmm typedef TMenuItem struct { chartext[20]; TMenu *ptr; void (*fptr)(); }; typedef TMenu struct { uint8_t nb; char

Re: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?

2009-01-21 Thread Vincent Trouilliez
On Wed, 21 Jan 2009 09:14:39 -0700 larry barello la...@barello.net wrote: Use a struct tag, rather than the typdef tag for your storage type, as: Thanks Larry. -- Vince ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org

Re: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?

2009-01-21 Thread Vincent Trouilliez
On Wed, 21 Jan 2009 09:33:43 -0800 Dean Ferreyra dferre...@igc.org wrote: Also, Vince, do you really mean to use a flexible array for the items field; i.e., leaving the size of items unspecified? Yes.. well it's just out of convenience really. When I define/initialise a structure of that type,

Re: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?

2009-01-21 Thread Vincent Trouilliez
On Wed, 21 Jan 2009 10:14:03 -0800 Dean Ferreyra dferre...@igc.org wrote: Vincent Trouilliez wrote: On Wed, 21 Jan 2009 09:33:43 -0800 Dean Ferreyra dferre...@igc.org wrote: Also, Vince, do you really mean to use a flexible array for the items field; i.e., leaving the size of items

Re: [avr-gcc-list] Typdef chick 'n egg situation.. way out ?

2009-01-21 Thread Vincent Trouilliez
On Wed, 21 Jan 2009 16:41:37 -0700 larry barello la...@barello.net wrote: You can't make a flexible typdef. If you did that the compiler would Ops yes, might be, don't know because to solve my problem I have been suggested to not use Typedef. Dunnon why I wanted to make a Type ouf of my

[avr-gcc-list] Syntax: Function pointer hell... newbee lost ! ;-)

2009-01-19 Thread Vincent Trouilliez
Hi list, I need a little help from the pros ;-) I Googled for C tutorials on the net, found a few. They aren't all quite clear about how to use function pointers, and where they are clear, the syntax they suggest doesn't appear to work on avr-gcc :-( I need to call a void/void function through

Re: [avr-gcc-list] Syntax: Function pointer hell... newbee lost ! ;-)

2009-01-19 Thread Vincent Trouilliez
On Mon, 19 Jan 2009 23:35:26 +0100 Georg-Johann Lay a...@gjlay.de wrote: int f_call; f_call = fptr; //load the function via the pointer Just call it: fptr(); //call function indirect Oh thanks, it works now ! :-) So I had only that part wrong, the declaration and

Re: [avr-gcc-list] address@hidden ... what is it for ?!

2009-01-06 Thread Vincent Trouilliez
On Mon, 5 Jan 2009 23:26:13 +0100 Sascha Silbe sascha-ml-uc-avr-...@silbe.org wrote: Sounds like you copied something from an obfuscating mailing list web archive into your Makefile, probably with improperly wrapped lines. Inspect your Makefile closely. I copied my Makefile below, if someone

Re: [avr-gcc-list] address@hidden ... what is it for ?!

2009-01-06 Thread Vincent Trouilliez
thanks Sascha and Preston, you got it right indeed, it was this very list's archive web front end that replaced the actual option with this addr...@hidden stuff ! Grrr. David Kelly wrote: Vincent, as the original author of your Makefile Thanks for hearing my call, David ! ;-) (didn't ge

[avr-gcc-list] address@hidden ... what is it for ?!

2009-01-05 Thread Vincent Trouilliez
Hi list (and happy new year to everyone) The last time I workd on my AVr project it was gcc version 3.x something, a while ago then. I resuming work on that project now, with a more current version of gcc (4.3.0), and I notice something new : Everytime I run make to compile the project, a weird

Re: [avr-gcc-list] How to specifiy binary constants ?

2009-01-03 Thread Vincent Trouilliez
Preston Wilson pwil...@scopuli.com wrote: There is a GCC extension that supports binary constants: http://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html I have not used it, but I ran across the documentation while looking at other extensions. Thanks, I just gave it a try, seems to have

Re: [avr-gcc-list] ATMega32 fuse bit problem

2007-08-16 Thread Vincent Trouilliez
On Thu, 16 Aug 2007 20:34:25 +0100 James Pascoe [EMAIL PROTECTED] wrote: Hi All, Apologies for the following question which is very OT, but there is a good chance you guys can help. Hi James, Yes this is off-topic, but it would be perfectly spot on topic on the sister list of avr-gcc :

[avr-gcc-list] Getting gdb to use simulavr ?

2007-07-05 Thread Vincent Trouilliez
Hi list, I am trying to get started using debugging tools. I am going to fork some cash for a JTAG ICE at some point in the coming months, but in the meantime I would like to fiddle with simulation. I use Insight as a GUI for GDB. From what I understand and saw so far, I have to install simulavr

Re: [avr-gcc-list] Getting gdb to use simulavr ?

2007-07-05 Thread Vincent Trouilliez
Vincent Trouilliez [EMAIL PROTECTED] wrote: So I could really do with some guidance on setting everything up :-) Had a look at simulavr's man page, which shed some light. Seems that simulavr must be started manually, before gdb, and made to listen to a TCP connection from a GDB server: I tried

Re: [avr-gcc-list] Two interrupts one function?

2006-05-13 Thread Vincent Trouilliez
On Sat, 2006-05-13 at 09:28 -0400, Trampas wrote: I have two external interrupts connected to a quadature encoder, I do the same operations when either interrupt pin is changed. I was wondering if it was possible to have one ISR that is called from both interrupts. If so how do I do it?

RE: [avr-gcc-list] Two interrupts one function?

2006-05-13 Thread Vincent Trouilliez
On Sat, 2006-05-13 at 09:31 -0700, Larry Barello wrote: Depending what you are doing, the function, below, will have problems. To avoid false counts with mechanical jitter [...] Yes, admittedly, I did get a few problems with jitter at first (though it was surprisingly usable as is), so I added

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

2006-04-05 Thread Vincent Trouilliez
On Mon, 2006-04-03 at 12:44 -0500, David Kelly wrote: Speaking of having built your sources, 3.4.6 complains on gmake depend: In file included from ui.h:11, from menu.h:7, from main.c:14:

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

2006-04-03 Thread Vincent Trouilliez
On Fri, 2006-03-31 at 22:05 +, Albert Pion wrote: How do I get a program listing with my C source code included as comments? I've tried about everything I can think of (including the --Wa,-alhd option) but have been unable to get it to work. I would love to know the answer to that one

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

2006-04-03 Thread Vincent Trouilliez
On Mon, 2006-04-03 at 12:44 -0500, David Kelly wrote: Vincent, thats originally my Makefile and object.list should already contain exactly what you are looking for. Hi David ! Yes, I still use your Makefile, I quite like it :-) It makes it very easy to add more files to my project, and

Re: [avr-gcc-list] how to measure execution time on avr butterfly?

2006-02-10 Thread Vincent Trouilliez
On Fri, 2006-02-10 at 12:18 -0800, Dave wrote: I'm trying to use a timer in my program. I've looked into avr-libc's timer/counter sections but the examples only show how to read/write TCNT1. Are there any examples showing how to start a timer? How can I set the rate the timer will be

Re: [avr-gcc-list] How to (efficeiently !!!) test a bitwithinamulti-byte intege

2005-11-05 Thread Vincent Trouilliez
The bug is almost certainly a delay loop variable that is not declared volatile. The delay function is probably something like: void shortDelay(void) { uint8_t n = 50; while (n--); } Correct :-) actually I did'nt even make it a function, as I use it only in one place, the

Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within a multi-byte integer ?

2005-11-05 Thread Vincent Trouilliez
Ian is close to how I would have handled it. I use a union32_t type a fair bit in my code for no other purpose than to pluck values out of the middle painlessly. typedef union union32_t { Okay, I think I can see the light about unions now, thanks to David Kelly and Bernard who hammered

Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within amulti-byte integer ?

2005-11-05 Thread Vincent Trouilliez
For a long time I always put address bit 0 on address pin A0 of the memory, bit 1 on A1, etc. But this is not always needed! Especially for a RAM device where you the AVR is the only one having access, the address lines can be swapped as you like. The same holds for the data lines. For

Re: [avr-gcc-list] Compiling gcc-avr : how to enable dwarf-2 option ?

2005-11-05 Thread Vincent Trouilliez
On Fri, 2005-11-04 at 19:53 +0100, Joerg Wunsch wrote: Vincent Trouilliez [EMAIL PROTECTED] wrote: Now that I have enabled dwarf-2 and recompiled gcc, I noticed that I still loose the annotations, if I use the -O3 optimisation flag, but not if I use -O or -Os. Keep in mind that -O3

Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within a multi-byte integer ?

2005-11-05 Thread Vincent Trouilliez
I compiled 3.4.3 ... does 3.4.4 or 4.0 do a better job at it ? With gcc-3.4.4 and -Os, the compiler loads 4 registers with the 32 bits value (address) and then use 'sbrs register,2' to perform the test. Hence it is very fast. It would be faster if it needs only one register to test

Re: [avr-gcc-list] How to (efficeiently !!!) test abitwithinamulti-byte intege

2005-11-05 Thread Vincent Trouilliez
FWIW, I always had good luck with the delay functions in delay.h for short hardcoded (usec) delays. Lucky you ! Other than wanting to avoid all this in-line stuff, the reason I replaced _delay_us(40) in my lcd routine, by an empty for loop, is that I accidentally realised that _delay_us(40)

Re: [avr-gcc-list] How to (efficeiently !!!) test a bitwithinamulti-byte intege

2005-11-05 Thread Vincent Trouilliez
Didn't I tell you to poll the LCD's busy bit in the first place? Wouldn't have had the above problem if you had. :-) -- David Kelly N4HHE, [EMAIL PROTECTED] Yes yes, you did ;-) So I decided to tackle it last night, and I wired the LCD R/W line. I now poll the Busy Flag successfully,

Re: [avr-gcc-list] How to (efficeiently !!!) test abitwithinamulti-byte intege

2005-11-05 Thread Vincent Trouilliez
On Sat, 2005-11-05 at 20:24 +0100, Joerg Wunsch wrote: Vincent Trouilliez [EMAIL PROTECTED] wrote: Lucky you ! Other than wanting to avoid all this in-line stuff, the reason I replaced _delay_us(40) in my lcd routine, by an empty for loop, is that I accidentally realised that _delay_us(40

Re: [avr-gcc-list] How to (efficeiently !!!) test abitwithinamulti-byte intege

2005-11-05 Thread Vincent Trouilliez
Alas, the fix is not yet in any released version of avr-libc, I just checked. So you'd either need to pull the fix straight from CVS (as all this is just in a header file, the fix would be self-contained, you don't need more than that file itself), or you gotta wait a bit. Both, avr-libc

Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within a multi-byte integer ?

2005-11-04 Thread Vincent Trouilliez
On Fri, 2005-11-04 at 15:20 +0800, Ian Caddy wrote: Hi Vince, All your new code is doing is checking that address is non-zero as it is a logical AND with a non-zero number, which would get optimised out. I haven't tried this, but it might be better: unsigned char temp; temp =

Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within a multi-byte integer ?

2005-11-04 Thread Vincent Trouilliez
On Fri, 2005-11-04 at 10:17 +0100, Alex Wenger wrote: Him Vincent Trouilliez schrieb: Thank you very much Ian, your code is highly efficient, and does work perfectly, unlike or . :o) I am in heaven : temp = (address 16) 0xFF; 28bc: ca 01 movwr24

Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within a multi-byte integer ?

2005-11-04 Thread Vincent Trouilliez
Now your problem with 'address 0x0004' is a real one: avr-gcc is not yet very good with 32 bits operators Well, this way we have nice things to be looking forward to, for upcoming releases of gcc :-) (BTW what version of avr-gcc do you use?). I compiled 3.4.3 ... does 3.4.4 or 4.0

[avr-gcc-list] Compiling gcc-avr : how to enable dwarf-2 option ?

2005-11-03 Thread Vincent Trouilliez
Hi all, So far I have used the binaries of gcc-avr 3.4.3, that my distro (Ubuntu) supplies, and it seems it doesn't support the -gdwarf-2 flag. So I defaulted to just -g as suggest by Joerg back then, but now for the first time, I really need to use the disassembler listing with all the C

Re: [avr-gcc-list] Compiling gcc-avr : how to enable dwarf-2 option ?

2005-11-03 Thread Vincent Trouilliez
On Fri, Nov 04, 2005 at 02:08:19AM +0100, Vincent Trouilliez wrote: So far I have used the binaries of gcc-avr 3.4.3, that my distro (Ubuntu) supplies, and it seems it doesn't support the -gdwarf-2 flag. Vincent, Adding --with-dwarf2 to the configure options, when rebuilding avr

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

2005-11-03 Thread Vincent Trouilliez
Hello list, I just ran into a weird problem that I hardly expected. I wrote a trivial routine that takes a 32bit unsigned int, which holds a memory address, and shifts the lower 19 bits, out to a port pin (this feeds cascaded shift registers, that in turn drive the 19 address lines of a memory

Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within a multi-byte integer ?

2005-11-03 Thread Vincent Trouilliez
How should I re-word my bit test statement/expression, to cause the compiler to use these lovely SBRS/C instructions at last ? Sorry for the noise :-/ Why is it always AFTER I hit the 'send' button, that I suddenly get the bright idea that stops me pulling my hair ?? I replaced the ''

Re: [avr-gcc-list] Compiling gcc-avr : how to enable dwarf-2 option ?

2005-11-03 Thread Vincent Trouilliez
I put it there http://www.007.org.uk/~vtrouilliez/temp/ it's the one called object.list. Something else must be wrong. The backannotated disassembly listing is also supposed to work with stabs debugging. What I find (found) strange was that, if you look carefully at the file, SOME

Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within a multi-byte integer ?

2005-11-03 Thread Vincent Trouilliez
I replaced the '' operator with the more appropriate '' one works much better... 5 instructions instead of 115 (3 + 6*18 + 4) for the previous code. So that's indeed about 20 times faster. Although I still don't get why it can't just use one single SBRC/S instruction instead of these 4 cp

Re: [avr-gcc-list] Issue with interrupt handler on Atmel Mega 8

2005-11-01 Thread Vincent Trouilliez
On Wed, 2005-11-02 at 00:03 +0100, Jerome Kerdreux wrote: I'm trying to use the timer 0 on a mega 8. Everything works fine, (I mean, i can see the timer TCNT0 incrementing) but when I want to route the interrupt to an handler, I get a infinite reset. I think that's normal. You forgot

Re: [avr-gcc-list] timing things

2005-10-18 Thread Vincent Trouilliez
hi whats the best method for timing how long thing is running for. i see atmega32's have built in 8bit timers, but i'm yet to see any good examples or explainations of how to use these. thing that would time how long a funtion has been running for would be perfect. Hmmm, I don't

Re: [avr-gcc-list] makefile for ubuntu

2005-10-14 Thread Vincent Trouilliez
On Thu, 2005-10-13 at 21:02 -0500, Patrick Blanchard wrote: It will probably work, but only until Vincent tries it on his own linux box (which is different from my linux box(es)) will he be undoubtedly certain that it works or not. And if it doesn't work, it might get him so frustrated that he

Re: [avr-gcc-list] makefile for ubuntu

2005-10-12 Thread Vincent Trouilliez
On Wed, 2005-10-12 at 12:58 -0700, Cullen Newsom wrote: Does anyone want to tell me all the undocumented* tricks to getting a working dev environment for avr-gcc on ubuntu with the stk200 and either it's programmer, or with avrisp? Anyone have a makefile that might work? Hi Cullen, Nice to

Re: [avr-gcc-list] Reading block from EEPROM ?

2005-10-10 Thread Vincent Trouilliez
On Mon, 2005-10-10 at 08:50 -0500, Andy Warner wrote: Bernard Fouché wrote: [...] Check that avrdude is told not to erase the eeprom before reflashing (the default value for flash/eeprom for unset memory is 0xFF). I guess your problem is coming from that and not single byte/block read.

Re: [avr-gcc-list] light up and led

2005-10-06 Thread Vincent Trouilliez
ok i made it turn on. now i've attempted to make it blink, unsuccessfully. the light just stays off now. unsigned char i; DDRA |= 1PA0; while (1) { for (i=0; i2; i++) wait(); PORTA |= 1PA0; That's normal I think. You turn the LED on when i reaches 20,000,

[avr-gcc-list] CVS or SVN ?!

2005-09-30 Thread Vincent Trouilliez
Hi list, I have been advised to use CVS when developing programs, but it seems awkward to set up the server side. While asking around for help, I have been suggested to give up CVS and use SVN, subversion, instead, and that it was meant to supplant CVS. Now CVS seems difficult enough, so I

Re: [avr-gcc-list] calling function pointers via pointers ?

2005-09-29 Thread Vincent Trouilliez
On Thu, 2005-09-29 at 09:25 +0200, David Brown wrote: It's a little easier to follow than all this void (*fp[])(void) crap, wouldn't you say? Thanks for pointing out that my code is crap ! ;-P I do mean it ! I mean, I am beginner... very motivated and eager to learn the art, but I can only do

Re: [avr-gcc-list] calling function pointers via pointers ?

2005-09-29 Thread Vincent Trouilliez
On Thu, 2005-09-29 at 14:24 +0200, David Brown wrote: You've picked a chalenge with your complex menu structures, but you are definitely going about it the right way. Unconstrained arrays are almost certainly the most elegant way to deal with the structures - when you figure them out fully,

Re: [avr-gcc-list] calling function pointers via pointers ?

2005-09-29 Thread Vincent Trouilliez
On Thu, 2005-09-29 at 16:20 +0200, David Brown wrote: You're getting very close now - don't give up! David Thanks again David for the detailed review, and thanks everyone else :-) The forward declaration did the trick indeed, magic ! :o) So now the definition of my menus look like this. I

Re: [avr-gcc-list] calling function pointers via pointers ?

2005-09-29 Thread Vincent Trouilliez
I tried the '' sign, but I get this error: ui.c:63: warning: initialization discards qualifiers from pointer target type I am really lost as to how to specify the address of menu_sub in ui_menu_main Well, once I manage to initialise the main menu with the address of the sub menu,

Re: [avr-gcc-list] Accessing structures defined in ROM ?

2005-09-28 Thread Vincent Trouilliez
If your target allow it, print pointer values when deferencing fails. Matched with the symbol file, it will help you understand if your problem comes from pointer calculation or not. (if you have dynamic memory allocation, that's another story) Bernard Thanks for the tip Bernard !

[avr-gcc-list] calling function pointers via pointers ?

2005-09-28 Thread Vincent Trouilliez
Hi list, Another pointer problem again, oops... I need pointers to functions in my project. Using the great on-line resource http://www.eskimo.com/~scs/C-faq/q4.12.html which someone on here mentioned recently, I got the basics working. But my actual case at hand is a bit trickier and I am lost

Re: [avr-gcc-list] calling function pointers via pointers ?

2005-09-28 Thread Vincent Trouilliez
Thank you so much chaps, after an hour experimenting, armed with all your suggestion, I have now improved my understanding of pointers again... and it now works... However, something still causes me trouble apparently The actual/complete declaration of my menu data type / structure is :

RE: [avr-gcc-list] calling function pointers via pointers ?

2005-09-28 Thread Vincent Trouilliez
On Wed, 2005-09-28 at 21:18 -0700, stevech wrote: Unspecified array sizes are a basic no-no on a microprocessor platform. The compiler strategies have to be simple and explicit, unlike elegant situations on multi-megabyte big computers. Thanks chaps, it's a no-no then. I will just move the

RE: [avr-gcc-list] calling function pointers via pointers ?

2005-09-28 Thread Vincent Trouilliez
Thanks chaps, it's a no-no then. I will just move the strings out of the structure, or make them fixed size, by setting a limit to the number of items/options I can have in a menu. Replying to my post but, since my struct has two arrays, one of strings and one of pointers, and one of them MUST

[avr-gcc-list] Accessing structures defined in ROM ?

2005-09-26 Thread Vincent Trouilliez
Hi list, I defined a structure in ROM, and am having difficulties accessing it using a pointer. Structure contains an integer and an array of strings. Accessing the array works, but when I try to read the integer number using the pointer, I don't get the correct value what am I doing wrong

Re: [avr-gcc-list] Syntax : how to specifiy a binary constant ?

2005-09-23 Thread Vincent Trouilliez
On Fri, 2005-09-23 at 08:46 +0200, Alex Wenger wrote: I use a small header-file and the notation b. bin.h: #define b 0x00 #define b0001 0x01 . #define b 0xff Simple, but clever :-) Thanks for posting the entire table, that will save me the work, I will just

[avr-gcc-list] Syntax : how to specifiy a binary constant ?

2005-09-22 Thread Vincent Trouilliez
Hi list, I am very new to C, and I can't find how to specify a binary constant. I tried for example foo = 0b; or foo = b; but neither worked... I am using gcc-avr 3.4.3 and avr-libc 1.2.3 Regards, -- Vince ___

Re: [avr-gcc-list] Syntax : how to specifiy a binary constant ?

2005-09-22 Thread Vincent Trouilliez
GCC 3.4.3 must work for foo = 0b; OR foo = 0B; Are you getting compilation errors? Nayani Hi Nayani, Yes, I get a compiler error in both cases. About foo = 0b000; or foo = 0B; it says : main.c:92:9: invalid suffix b on integer constant ...and

Re: [avr-gcc-list] Syntax : how to specifiy a binary constant ?

2005-09-22 Thread Vincent Trouilliez
One can use binary values in AVR GCC 3.4.3. In fact I had used the same in some of my projects and I am not able to make a guess on why you are getting an error. So the patch is already in 3.4.3 ? So I should have it then !! G :-/ MAybe the debian package is faulty in some way

Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?

2005-09-20 Thread Vincent Trouilliez
On Tue, 2005-09-20 at 00:56 -0500, David Kelly wrote: I prefer to read the busy flag in bit 7 of register 0 on the LCD rather than timed loops. Text LCDs are fairly predictable but I'm more comfortable delaying my next write until the particular LCD says its ready. Some LCD commands take

Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?

2005-09-19 Thread Vincent Trouilliez
On Mon, 2005-09-19 at 20:22 -0500, David Kelly wrote: OK, 0.2ms max to write one, but how long to write two? Once the data is latched into the LCD it has to process and IIRC that is often 1 ms. No, as I said it takes only 40us for the LCD to process a character. You send a character to it,

Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?

2005-09-18 Thread Vincent Trouilliez
Thanks Jesper and Yann ! :-) So far I had the clear idea that a header file should not contain any C statement that yields to executable code, and that such code should be in the source file. But I wasn't sure about constants, since they don't produce any code. But, they nonetheless occupy code

Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?

2005-09-18 Thread Vincent Trouilliez
Thanks chaps, printf_P and printf(%S, ) do the trick. If I may ask one more question before, I happen to have a problem define one of the units : °C. This '°' degree sign is not ASCII but extended ASCII, and my LCD module has a japanese (!) page code for extended characters. So I need to

Re: [avr-gcc-list] Initilizing complex const arrays : syntax ?

2005-09-18 Thread Vincent Trouilliez
On Sun, 2005-09-18 at 16:54 -0500, David Kelly wrote: ...I don't use printf() so I haven't used printf_P() But how do you do then ? Well, now I think of it, there is at least one case where I won't be able to use printf, well I think. printf_P() is nice to printf my strings easily from

  1   2   >