Please fix use of prog_char

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
itain
Posts: 75
Joined: Tue Aug 23, 2011 10:32 pm

Please fix use of prog_char

Post by itain »

The prog_* types are not accepted by new versions of avr-gcc. The problem was reported by NikTheGreek here for Ubuntu 13.04. I see the same errors with Fedora 19.

changing [GPS.cpp, line 240] resolves the compile error.

Code: Select all

void SerialGpsPrint(const char PROGMEM * str) {


****************************************************************************************************
It may be argued that Linux distros should use the same compiler and libraries as arduino (arduino-1.0.5 comes with avr-gcc version 4.3.2, which dates back to 2008). I do not expect to have installed two versions of avr-gcc. The newer avr-gcc 4.7.3 is so much better. Comparing compilation of MultiWii (latest SVN, fixed prog_char as described above):
Using arduino-1.0.5 downloaded from arduino.cc:
Binary sketch size: 33,238 bytes (of a 258,048 byte maximum)
And arduino-1.0.5 installed from Fedora repositories:
Binary sketch size: 30,580 bytes (of a 258,048 byte maximum)

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: Please fix use of prog_char

Post by Alexinparis »

itain wrote:The prog_* types are not accepted by new versions of avr-gcc. The problem was reported by NikTheGreek here for Ubuntu 13.04. I see the same errors with Fedora 19.

changing [GPS.cpp, line 240] resolves the compile error.

Code: Select all

void SerialGpsPrint(const char PROGMEM * str) {


****************************************************************************************************
It may be argued that Linux distros should use the same compiler and libraries as arduino (arduino-1.0.5 comes with avr-gcc version 4.3.2, which dates back to 2008). I do not expect to have installed two versions of avr-gcc. The newer avr-gcc 4.7.3 is so much better. Comparing compilation of MultiWii (latest SVN, fixed prog_char as described above):
Using arduino-1.0.5 downloaded from arduino.cc:
Binary sketch size: 33,238 bytes (of a 258,048 byte maximum)
And arduino-1.0.5 installed from Fedora repositories:
Binary sketch size: 30,580 bytes (of a 258,048 byte maximum)


ok, corrected ;)

About version of gcc.
I'm fully agree with you and I don't understand why Arduino is not upgrading its version of gcc.
The reason why I still use it as a reference is just to stick on a plug&play Arduino way.

BarneyG
Posts: 39
Joined: Tue May 07, 2013 4:42 pm

Re: Please fix use of prog_char

Post by BarneyG »

Alexinparis wrote:
itain wrote:The prog_* types are not accepted by new versions of avr-gcc. The problem was reported by NikTheGreek here for Ubuntu 13.04. I see the same errors with Fedora 19.

changing [GPS.cpp, line 240] resolves the compile error.

Code: Select all

void SerialGpsPrint(const char PROGMEM * str) {


****************************************************************************************************
It may be argued that Linux distros should use the same compiler and libraries as arduino (arduino-1.0.5 comes with avr-gcc version 4.3.2, which dates back to 2008). I do not expect to have installed two versions of avr-gcc. The newer avr-gcc 4.7.3 is so much better. Comparing compilation of MultiWii (latest SVN, fixed prog_char as described above):
Using arduino-1.0.5 downloaded from arduino.cc:
Binary sketch size: 33,238 bytes (of a 258,048 byte maximum)
And arduino-1.0.5 installed from Fedora repositories:
Binary sketch size: 30,580 bytes (of a 258,048 byte maximum)


ok, corrected ;)

About version of gcc.
I'm fully agree with you and I don't understand why Arduino is not upgrading its version of gcc.
The reason why I still use it as a reference is just to stick on a plug&play Arduino way.


I think this is still broken ... using const char PROGMEM * str on line 240 results in a warning - '__progmem__' attribute ignored [-Wattributes]
and there is still a prog_char on line 251

To fix both of these I believe it should be :

Code: Select all

  void SerialGpsPrint(const char *str) {
    char b;
    while(str && (b = pgm_read_byte(str++))) {
      SerialWrite(GPS_SERIAL, b);
      #if defined(UBLOX)
        delay(5);
      #endif     
    }
  }
 #endif
 #if defined(UBLOX)
   const char UBLOX_INIT[] PROGMEM = {

Post Reply