Re: [avr-gcc-list] Program Space String optimization

2005-12-15 Thread David Brown
On Dec 14, 2005, at 8:57 AM, Joerg Wunsch wrote: volatile PGM_P txt= P_Txt; Your volatile qualifier is at the wrong place. You're marking the object txt points to as volatile, not the pointer itself. Change that into PGM_P volatile txt = P_Txt; and it will work. Believe

Re: [avr-gcc-list] Program Space String optimization

2005-12-15 Thread bolet (sent by Nabble.com)
Your volatile qualifier is at the wrong place. You're marking the object txt points to as volatile, not the pointer itself. Change that into PGM_P volatile txt = P_Txt; and it will work. Thank you for your fast answer. I've compiled whith those changes and it works as expected. I supose

Re: [avr-gcc-list] Program Space String optimization

2005-12-15 Thread bolet (sent by Nabble.com)
A solution I would propose is to change the offending line like this (I haven't checked this, though): do{} while( (a=(volatile char)(pgm_read_byte(txt))) ); Thanks for answering. I've tryed your suggestion with the same result, but the answer given by Joerg Wunsch (first answer in thread)

[avr-gcc-list] Program Space String optimization

2005-12-14 Thread bolet (sent by Nabble.com)
Hi, I'm new in AVR-gcc programming. Sorry if this question is too obious (and sorry for my english too...) I'm just making some test to know how to access Flash strings. The program uses one interrupt to sends chars until end of string. The 'end of string' is checked in 'main' (just for test

Re: [avr-gcc-list] Program Space String optimization

2005-12-14 Thread Joerg Wunsch
bolet (sent by Nabble.com) [EMAIL PROTECTED] wrote: The 'end of string' is checked in 'main' (just for test purposes). A very strange way, indeed... volatile PGM_P txt= P_Txt; Your volatile qualifier is at the wrong place. You're marking the object txt points to as volatile, not the

Re: [avr-gcc-list] Program Space String optimization

2005-12-14 Thread Dimitar Dimitrov
On 14.12.2005 11:42, bolet (sent by Nabble.com) wrote: The program works OK without optimization. It doesn't work with optimization (-o1). The code is: ...includes... const char P_Txt[] PROGMEM = Just a test..; volatile PGM_P txt= P_Txt; int main (void) { ...Init code ... (reg setup

RE: [avr-gcc-list] Program Space String optimization

2005-12-14 Thread Dave Hansen
From: bolet (sent by Nabble.com) [EMAIL PROTECTED] [...] The program works OK without optimization. It doesn't work with optimization (-o1). The code is: ...includes... const char P_Txt[] PROGMEM = Just a test..; volatile PGM_P txt= P_Txt; int main (void) { ...Init code ... (reg setup

Re: [avr-gcc-list] Program Space String optimization

2005-12-14 Thread David Kelly
On Dec 14, 2005, at 8:57 AM, Joerg Wunsch wrote: volatile PGM_P txt= P_Txt; Your volatile qualifier is at the wrong place. You're marking the object txt points to as volatile, not the pointer itself. Change that into PGM_P volatile txt = P_Txt; and it will work. Believe that is

Re: [avr-gcc-list] Program Space String optimization

2005-12-14 Thread Joerg Wunsch
David Kelly [EMAIL PROTECTED] wrote: Believe that is correct. But the other thing that was tripping him is in general all function calls are effectively volatile as well. That's not entirely true. For standard library functions, if the compiler knows exactly the result (and knows it has no