schinken / Flash

An Arduino library for smoother, easier access to Flash data.
11 stars 6 forks source link

Example BASIC gives compilation errors #14

Open grumpy-gnome opened 5 years ago

grumpy-gnome commented 5 years ago

Trying to verify the basic example sketch and I get the following errors:

`Arduino: 1.8.7 (Windows Store 1.8.15.0) (Windows 10), Board: "Arduino/Genuino Uno"

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware -hardware C:\Users\jemim\Documents\ArduinoData\packages -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\tools\avr -tools C:\Users\jemim\Documents\ArduinoData\packages -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\libraries -libraries C:\Users\jemim\Documents\Dev\arduino\libraries -fqbn=arduino:avr:uno -ide-version=10807 -build-path C:\Users\jemim\AppData\Local\Temp\arduino_build_170568 -warnings=default -build-cache C:\Users\jemim\AppData\Local\Temp\arduino_cache_367985 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avr-gcc-5.4.0-atmel3.6.1-arduino2.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.2.1.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino14.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\tools\avr -verbose C:\Users\jemim\Documents\Dev\arduino\libraries\Flash\examples\Basic\Basic.ino C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\arduino-builder -compile -logger=machine -hardware C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware -hardware C:\Users\jemim\Documents\ArduinoData\packages -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\tools-builder -tools C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\tools\avr -tools C:\Users\jemim\Documents\ArduinoData\packages -built-in-libraries C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\libraries -libraries C:\Users\jemim\Documents\Dev\arduino\libraries -fqbn=arduino:avr:uno -ide-version=10807 -build-path C:\Users\jemim\AppData\Local\Temp\arduino_build_170568 -warnings=default -build-cache C:\Users\jemim\AppData\Local\Temp\arduino_cache_367985 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avr-gcc-5.4.0-atmel3.6.1-arduino2.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.2.1.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino14.path=C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\tools\avr -verbose C:\Users\jemim\Documents\Dev\arduino\libraries\Flash\examples\Basic\Basic.ino Using board 'uno' from platform in folder: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\arduino\avr Using core 'arduino' from platform in folder: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\arduino\avr Detecting libraries used... "C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10807 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino" "-IC:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\arduino\avr\variants\standard" "C:\Users\jemim\AppData\Local\Temp\arduino_build_170568\sketch\Basic.ino.cpp" -o nul "C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10807 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino" "-IC:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\arduino\avr\variants\standard" "-IC:\Users\jemim\Documents\Dev\arduino\libraries\Flash\src" "C:\Users\jemim\AppData\Local\Temp\arduino_build_170568\sketch\Basic.ino.cpp" -o nul "C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10807 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino" "-IC:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\arduino\avr\variants\standard" "-IC:\Users\jemim\Documents\Dev\arduino\libraries\Flash\src" "C:\Users\jemim\Documents\Dev\arduino\libraries\Flash\src\Flash.cpp" -o nul Generating function prototypes... "C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10807 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino" "-IC:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\arduino\avr\variants\standard" "-IC:\Users\jemim\Documents\Dev\arduino\libraries\Flash\src" "C:\Users\jemim\AppData\Local\Temp\arduino_build_170568\sketch\Basic.ino.cpp" -o "C:\Users\jemim\AppData\Local\Temp\arduino_build_170568\preproc\ctags_target_for_gcc_minus_e.cpp" "C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\jemim\AppData\Local\Temp\arduino_build_170568\preproc\ctags_target_for_gcc_minus_e.cpp" Compiling sketch... "C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86__mdqgnx93n4wtt\hardware\tools\avr/bin/avr-g++" -c -g -Os -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10807 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\arduino\avr\cores\arduino" "-IC:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.15.0_x86mdqgnx93n4wtt\hardware\arduino\avr\variants\standard" "-IC:\Users\jemim\Documents\Dev\arduino\libraries\Flash\src" "C:\Users\jemim\AppData\Local\Temp\arduino_build_170568\sketch\Basic.ino.cpp" -o "C:\Users\jemim\AppData\Local\Temp\arduino_build_170568\sketch\Basic.ino.cpp.o" In file included from C:\Users\jemim\Documents\Dev\arduino\libraries\Flash\examples\Basic\Basic.ino:21:0:

C:\Users\jemim\Documents\Dev\arduino\libraries\Flash\src/Flash.h: In instantiation of 'class _FLASH_TABLE':

C:\Users\jemim\Documents\Dev\arduino\libraries\Flash\examples\Basic\Basic.ino:70:1: required from here

C:\Users\jemim\Documents\Dev\arduino\libraries\Flash\src/Flash.h:159:21: internal compiler error: in type_hash_canon, at tree.c:6953

typedef T PROGMEM _DataType;

                 ^

Please submit a full bug report,

with preprocessed source if appropriate.

See http://gcc.gnu.org/bugs.html for instructions.

Using library Flash at version 1.0.1 in folder: C:\Users\jemim\Documents\Dev\arduino\libraries\Flash exit status 1 Error compiling for board Arduino/Genuino Uno.`

Any pointers would be appreciated

Lurgainn commented 5 years ago

Same error here. A temporary workaround is to compile with 1.6.21 version of avr boards manager.

grumpy-gnome commented 5 years ago

Thanks for the pointer.

Unfortunately on my set up it still gives compile errors, although not a catastrophic compiler error as before. I'll just have to stop being lazy and create my own code to manage PROGMEM stuff. It'll help me understand what's going on anyway.

Thanks again

Lurgainn commented 5 years ago

I guess that the problem arise from the fact that from 1.6.22 version it's enforced the condition that every PROGMEM statement must be 'const'. I hope that the author of this library will adapt the code because flash library is SO MUCH MORE easy to use vs. original PROGMEM.

schinken commented 5 years ago

Can anyone try that out? https://github.com/schinken/Flash/commit/4d2ce7eb5a29326c0c2f1c1506906673a79c05a4

Lurgainn commented 5 years ago

With the modified Flash.h I have the same error (even if with the 'const' keyword) :(

per1234 commented 5 years ago

Here's a workaround:

  1. Tools > Board > Boards Manager
  2. Wait for downloads to finish.
  3. When you move the mouse pointer over "Arduino AVR Boards", you will see a "Select version" dropdown menu appear. Select "1.6.21".
  4. Click "Install".
  5. Wait for installation to finish.
  6. Click "Close".

Due to a bug, this workaround doesn't work with Arduino IDE 1.8.6, but it will work with any other version of the Arduino IDE.

If you have File > Preferences > Check for updates on startup checked, the Arduino IDE may occasionally notify you that a new version of Arduino AVR Boards is available, you'll need to refrain from updating back to the new Arduino AVR Boards version, otherwise you'll be back to seeing the segmentation fault error again.

The error also doesn't occur with the beta version of Arduino's AVR toolchain, so I think the issue will no longer occur in the next release of Arduino AVR Boards.