avr-gcc 4.6.2 compilation problem

#4 · open · 3 comments

View on GitHub ↗

kermitas

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) /* - Table of defined images */ const image_t *images[] = { &image_328, &image_328p, &image_168, &image_8, 0 }; 3) image_t const _target_flashptr; /_ pointer to target info in flash */ 4) /* - read_image * - Read an intel hex image from a string in pgm memory. - We assume that the image does not exceed the 512 bytes that we have - allowed for it to have. that would be bad. - Also read other data from the image, such as fuse and protecttion byte - values during programming, and for after we're done. */ void read_image (const image_t *ip) { uint16_t len, totlen=0, addr; const char *hextext = &ip->image_hexcode[0]; target_startaddr = 0; 5) /* - target_findimage * - given target_type loaded with the relevant part of the device signature, - search the hex images that we have programmed in flash, looking for one - that matches. */ 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.

Comments

kermitas

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 image_t\* {aka const image_}' to 'image_t_ {aka image_}' [-fpermissive] optiLoader.cpp:144:1: error: invalid conversion from 'const image_t_ {aka const image_}' to 'image_t_ {aka image_}' [-fpermissive] optiLoader.cpp:144:1: error: invalid conversion from 'const image_t_ {aka const image_}' to 'image_t_ {aka image_}' [-fpermissive] optiLoader.cpp:144:1: error: invalid conversion from 'const image_t_ {aka const image_}' to 'image_t_ {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

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

kd7ura

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.