WestfW / OptiLoader

Arduino sketch for burning new bootloaders
198 stars 105 forks source link

avr-gcc 4.6.2 compilation problem #4

Open kermitas opened 12 years ago

kermitas commented 12 years ago

Arduino 1.0

avr-gcc (Fedora 4.6.2-1.fc16) 4.6.2

Compiling causes a lot of problems about missing "const" words.

Those are my changes that fix this.

OPTILOADER.H 1)

// Forward decl extern const image_t PROGMEM image_328, image_328p, image_168, image_8;

OPTILOADER.PDE 1) void read_image(const image_t *ip);

2)

/*

3) image_t const _targetflashptr; / pointer to target info in flash */

4)

/*

5)

/*

boolean target_findimage () { // tutaj skasowalem linie image_t *ip;

fp("Searching for image...\n"); for (uint8_t i=0; i < sizeof(images)/sizeof(images[0]); i++) { //target_flashptr = images[i];

const image_t *ip = images[i];
target_flashptr = images[i];

if (ip && (pgm_read_word(&ip->image_chipsig) == target_type)) {
  fp("  Found \"");
  flashprint(&ip->image_name[0]);
  fp("\" for ");
  flashprint(&ip->image_chipname[0]);
  fp("\n");
  read_image(ip);
  return true;
}

} fp(" Not Found\n");

return(false); }

Thanks, Arthur.

kermitas commented 12 years ago

Here are those compilation problems (before code modification):

avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=100 -I/home/as/Pobrane/toDelete2/arduino-1.0/hardware/arduino/cores/arduino -I/home/as/Pobrane/toDelete2/arduino-1.0/hardware/arduino/variants/standard /tmp/build5303070477758921458.tmp/optiLoader.cpp -o/tmp/build5303070477758921458.tmp/optiLoader.cpp.o optiLoader.cpp:144:1: error: invalid conversion from 'const imaget* {aka const image}' to 'imaget {aka image_}' [-fpermissive] optiLoader.cpp:144:1: error: invalid conversion from 'const imaget {aka const image_}' to 'imaget {aka image_}' [-fpermissive] optiLoader.cpp:144:1: error: invalid conversion from 'const imaget {aka const image_}' to 'imaget {aka image_}' [-fpermissive] optiLoader.cpp:144:1: error: invalid conversion from 'const imaget {aka const image_}' to 'imaget {aka image*}' [-fpermissive] optiLoader.cpp: In function 'long unsigned int spi_transaction(uint8_t, uint8_t, uint8_t, uint8_t)': optiLoader.cpp:308:26: warning: left shift count >= width of type [enabled by default] optiLoader.cpp: At global scope: optiLoader.cpp:688:17: error: variable 'image_328' must be const in order to be put into read-only section by means of 'attribute((progmem))' optiLoader.cpp:688:17: error: conflicting declaration 'image_t image_328' optiLoader.h:25:30: error: 'image_328' has a previous declaration as 'const image_t image_328' optiLoader.cpp:742:17: error: variable 'image_328p' must be const in order to be put into read-only section by means of 'attribute((progmem))' optiLoader.cpp:742:17: error: conflicting declaration 'image_t image_328p' optiLoader.h:25:41: error: 'image_328p' has a previous declaration as 'const image_t image_328p' optiLoader.cpp:796:17: error: variable 'image_168' must be const in order to be put into read-only section by means of 'attribute((progmem))' optiLoader.cpp:796:17: error: conflicting declaration 'image_t image_168' optiLoader.h:25:53: error: 'image_168' has a previous declaration as 'const image_t image_168' optiLoader.cpp:850:17: error: variable 'image_8' must be const in order to be put into read-only section by means of 'attribute((progmem))' optiLoader.cpp:850:17: error: conflicting declaration 'image_t image_8' optiLoader.h:25:64: error: 'image_8' has a previous declaration as 'const image_t image_8' optiLoader.cpp: In function 'uint8_t hexton(uint8_t)': optiLoader.cpp:220:1: warning: control reaches end of non-void function [-Wreturn-type]

WestfW commented 12 years ago

4.6.2 rather changes ("clarifies") the handling of PROGMEM as well, and may require some additional attention in that area.

kd7ura commented 9 years ago

hello im having a problem compiling or loading optiloader: errors as follows:

Arduino: 1.5.8 (Linux), Board: "Arduino Uno"

/home/#########/arduino-1.5.8/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=158 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -I/home/#########/arduino-1.5.8/hardware/arduino/avr/cores/arduino -I/home/#########/arduino-1.5.8/hardware/arduino/avr/variants/standard /tmp/build7387986693628357267.tmp/optiLoader.cpp -o /tmp/build7387986693628357267.tmp/optiLoader.cpp.o In file included from optiLoader.ino:85:0: /tmp/build7387986693628357267.tmp/optiLoader.h:25:24: error: variable 'image_328' must be const in order to be put into read-only section by means of 'attribute((progmem))' extern image_t PROGMEM image_328, image_328p, image_168, image_8; ^ /tmp/build7387986693628357267.tmp/optiLoader.h:25:35: error: variable 'image_328p' must be const in order to be put into read-only section by means of 'attribute((progmem))' extern image_t PROGMEM image_328, image_328p, image_168, image_8; ^ /tmp/build7387986693628357267.tmp/optiLoader.h:25:47: error: variable 'image_168' must be const in order to be put into read-only section by means of 'attribute((progmem))' extern image_t PROGMEM image_328, image_328p, image_168, image_8; ^ /tmp/build7387986693628357267.tmp/optiLoader.h:25:58: error: variable 'image_8' must be const in order to be put into read-only section by means of 'attribute((progmem))' extern image_t PROGMEM image_328, image_328p, image_168, image_8; ^ optiLoader.ino:663:17: error: variable 'image_328' must be const in order to be put into read-only section by means of 'attribute((progmem))' optiLoader.ino:717:17: error: variable 'image_328p' must be const in order to be put into read-only section by means of 'attribute((progmem))' optiLoader.ino:771:17: error: variable 'image_168' must be const in order to be put into read-only section by means of 'attribute((progmem))' optiLoader.ino:825:17: error: variable 'image_8' must be const in order to be put into read-only section by means of 'attribute((progmem))' Error compiling.