SpenceKonde/DxCore

linking error: section .bss' is not within region data'

innermatrix opened this issue · 1 comments

Minimal repro

int16_t samples[260] = { 0 };
volatile uint16_t sampleReadStartIdx = 0;

void setup() {
}


void loop() {
  samples[sampleReadStartIdx] = samples[sampleReadStartIdx];
}

Build output:

/Applications/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/iris/Library/Arduino15/packages -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/iris/Library/Arduino15/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/iris/Documents/Arduino/libraries -fqbn=megaTinyCore:megaavr:atxy4:chip=804,clock=20internal,bodvoltage=1v8,bodmode=disabled,eesave=enable,millis=enabled,startuptime=8,wiremode=mors,printf=default,PWMmux=default,attach=allenabled,WDTtimeout=disabled,WDTwindow=disabled -ide-version=10819 -build-path /var/folders/dw/sj94gjmd0gg46mgmv55zdt400000gv/T/arduino_build_655605 -warnings=none -build-cache /var/folders/dw/sj94gjmd0gg46mgmv55zdt400000gv/T/arduino_cache_703085 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.python3.path=/Users/iris/Library/Arduino15/packages/megaTinyCore/tools/python3/3.7.2-post1 -prefs=runtime.tools.python3-3.7.2-post1.path=/Users/iris/Library/Arduino15/packages/megaTinyCore/tools/python3/3.7.2-post1 -prefs=runtime.tools.arduinoOTA.path=/Users/iris/Library/Arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=/Users/iris/Library/Arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.avrdude.path=/Users/iris/Library/Arduino15/packages/DxCore/tools/avrdude/6.3.0-arduino17or18 -prefs=runtime.tools.avrdude-6.3.0-arduino17or18.path=/Users/iris/Library/Arduino15/packages/DxCore/tools/avrdude/6.3.0-arduino17or18 -prefs=runtime.tools.avr-gcc.path=/Users/iris/Library/Arduino15/packages/DxCore/tools/avr-gcc/7.3.0-atmel3.6.1-azduino7b1 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-azduino7b1.path=/Users/iris/Library/Arduino15/packages/DxCore/tools/avr-gcc/7.3.0-atmel3.6.1-azduino7b1 -verbose /private/tmp/sketch_mar28a/sketch_mar28a.ino
/Applications/Arduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/iris/Library/Arduino15/packages -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/iris/Library/Arduino15/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/iris/Documents/Arduino/libraries -fqbn=megaTinyCore:megaavr:atxy4:chip=804,clock=20internal,bodvoltage=1v8,bodmode=disabled,eesave=enable,millis=enabled,startuptime=8,wiremode=mors,printf=default,PWMmux=default,attach=allenabled,WDTtimeout=disabled,WDTwindow=disabled -ide-version=10819 -build-path /var/folders/dw/sj94gjmd0gg46mgmv55zdt400000gv/T/arduino_build_655605 -warnings=none -build-cache /var/folders/dw/sj94gjmd0gg46mgmv55zdt400000gv/T/arduino_cache_703085 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.python3.path=/Users/iris/Library/Arduino15/packages/megaTinyCore/tools/python3/3.7.2-post1 -prefs=runtime.tools.python3-3.7.2-post1.path=/Users/iris/Library/Arduino15/packages/megaTinyCore/tools/python3/3.7.2-post1 -prefs=runtime.tools.arduinoOTA.path=/Users/iris/Library/Arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=/Users/iris/Library/Arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.avrdude.path=/Users/iris/Library/Arduino15/packages/DxCore/tools/avrdude/6.3.0-arduino17or18 -prefs=runtime.tools.avrdude-6.3.0-arduino17or18.path=/Users/iris/Library/Arduino15/packages/DxCore/tools/avrdude/6.3.0-arduino17or18 -prefs=runtime.tools.avr-gcc.path=/Users/iris/Library/Arduino15/packages/DxCore/tools/avr-gcc/7.3.0-atmel3.6.1-azduino7b1 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-azduino7b1.path=/Users/iris/Library/Arduino15/packages/DxCore/tools/avr-gcc/7.3.0-atmel3.6.1-azduino7b1 -verbose /private/tmp/sketch_mar28a/sketch_mar28a.ino
Using board 'atxy4' from platform in folder: /Users/iris/Library/Arduino15/packages/megaTinyCore/hardware/megaavr/2.6.10
Using core 'megatinycore' from platform in folder: /Users/iris/Library/Arduino15/packages/megaTinyCore/hardware/megaavr/2.6.10
Detecting libraries used...
/Users/iris/Library/Arduino15/packages/DxCore/tools/avr-gcc/7.3.0-atmel3.6.1-azduino7b1/bin/avr-g++ -c -g -Os -Wall -std=gnu++17 -fpermissive -Wno-sized-deallocation -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=attiny804 -DF_CPU=20000000L -DCLOCK_SOURCE=0 -DTWI_MORS -DMILLIS_USE_TIMERA0 -DCORE_ATTACH_ALL -DARDUINO=10819 -DARDUINO_AVR_ATtiny804 -DARDUINO_ARCH_MEGAAVR "-DMEGATINYCORE=\"2.6.10\"" -DMEGATINYCORE_MAJOR=2UL -DMEGATINYCORE_MINOR=6UL -DMEGATINYCORE_PATCH=10UL -DMEGATINYCORE_RELEASED=1 -DARDUINO_attinyxy4 -I/Users/iris/Library/Arduino15/packages/megaTinyCore/hardware/megaavr/2.6.10/cores/megatinycore/api/deprecated -I/Users/iris/Library/Arduino15/packages/megaTinyCore/hardware/megaavr/2.6.10/cores/megatinycore -I/Users/iris/Library/Arduino15/packages/megaTinyCore/hardware/megaavr/2.6.10/variants/txy4 /var/folders/dw/sj94gjmd0gg46mgmv55zdt400000gv/T/arduino_build_655605/sketch/sketch_mar28a.ino.cpp -o /dev/null
Generating function prototypes...
/Users/iris/Library/Arduino15/packages/DxCore/tools/avr-gcc/7.3.0-atmel3.6.1-azduino7b1/bin/avr-g++ -c -g -Os -Wall -std=gnu++17 -fpermissive -Wno-sized-deallocation -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=attiny804 -DF_CPU=20000000L -DCLOCK_SOURCE=0 -DTWI_MORS -DMILLIS_USE_TIMERA0 -DCORE_ATTACH_ALL -DARDUINO=10819 -DARDUINO_AVR_ATtiny804 -DARDUINO_ARCH_MEGAAVR "-DMEGATINYCORE=\"2.6.10\"" -DMEGATINYCORE_MAJOR=2UL -DMEGATINYCORE_MINOR=6UL -DMEGATINYCORE_PATCH=10UL -DMEGATINYCORE_RELEASED=1 -DARDUINO_attinyxy4 -I/Users/iris/Library/Arduino15/packages/megaTinyCore/hardware/megaavr/2.6.10/cores/megatinycore/api/deprecated -I/Users/iris/Library/Arduino15/packages/megaTinyCore/hardware/megaavr/2.6.10/cores/megatinycore -I/Users/iris/Library/Arduino15/packages/megaTinyCore/hardware/megaavr/2.6.10/variants/txy4 /var/folders/dw/sj94gjmd0gg46mgmv55zdt400000gv/T/arduino_build_655605/sketch/sketch_mar28a.ino.cpp -o /var/folders/dw/sj94gjmd0gg46mgmv55zdt400000gv/T/arduino_build_655605/preproc/ctags_target_for_gcc_minus_e.cpp
/Applications/Arduino.app/Contents/Java/tools-builder/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /var/folders/dw/sj94gjmd0gg46mgmv55zdt400000gv/T/arduino_build_655605/preproc/ctags_target_for_gcc_minus_e.cpp
Compiling sketch...
/Users/iris/Library/Arduino15/packages/DxCore/tools/avr-gcc/7.3.0-atmel3.6.1-azduino7b1/bin/avr-g++ -c -g -Os -Wall -std=gnu++17 -fpermissive -Wno-sized-deallocation -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=attiny804 -DF_CPU=20000000L -DCLOCK_SOURCE=0 -DTWI_MORS -DMILLIS_USE_TIMERA0 -DCORE_ATTACH_ALL -DARDUINO=10819 -DARDUINO_AVR_ATtiny804 -DARDUINO_ARCH_MEGAAVR "-DMEGATINYCORE=\"2.6.10\"" -DMEGATINYCORE_MAJOR=2UL -DMEGATINYCORE_MINOR=6UL -DMEGATINYCORE_PATCH=10UL -DMEGATINYCORE_RELEASED=1 -DARDUINO_attinyxy4 -I/Users/iris/Library/Arduino15/packages/megaTinyCore/hardware/megaavr/2.6.10/cores/megatinycore/api/deprecated -I/Users/iris/Library/Arduino15/packages/megaTinyCore/hardware/megaavr/2.6.10/cores/megatinycore -I/Users/iris/Library/Arduino15/packages/megaTinyCore/hardware/megaavr/2.6.10/variants/txy4 /var/folders/dw/sj94gjmd0gg46mgmv55zdt400000gv/T/arduino_build_655605/sketch/sketch_mar28a.ino.cpp -o /var/folders/dw/sj94gjmd0gg46mgmv55zdt400000gv/T/arduino_build_655605/sketch/sketch_mar28a.ino.cpp.o
Compiling libraries...
Compiling core...
Using precompiled core: /var/folders/dw/sj94gjmd0gg46mgmv55zdt400000gv/T/arduino_cache_703085/core/core_bbeec7d21c9dcd8825323d67b3ccf38b.a
Linking everything together...
/Users/iris/Library/Arduino15/packages/DxCore/tools/avr-gcc/7.3.0-atmel3.6.1-azduino7b1/bin/avr-gcc -Wall -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -Wl,--section-start=.text=0x0 -mmcu=attiny804 -o /var/folders/dw/sj94gjmd0gg46mgmv55zdt400000gv/T/arduino_build_655605/sketch_mar28a.ino.elf /var/folders/dw/sj94gjmd0gg46mgmv55zdt400000gv/T/arduino_build_655605/sketch/sketch_mar28a.ino.cpp.o /var/folders/dw/sj94gjmd0gg46mgmv55zdt400000gv/T/arduino_build_655605/../arduino_cache_703085/core/core_bbeec7d21c9dcd8825323d67b3ccf38b.a -L/var/folders/dw/sj94gjmd0gg46mgmv55zdt400000gv/T/arduino_build_655605 -lm
/Users/iris/Library/Arduino15/packages/DxCore/tools/avr-gcc/7.3.0-atmel3.6.1-azduino7b1/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld: address 0x804014 of /var/folders/dw/sj94gjmd0gg46mgmv55zdt400000gv/T/arduino_build_655605/sketch_mar28a.ino.elf section `.bss' is not within region `data'
/Users/iris/Library/Arduino15/packages/DxCore/tools/avr-gcc/7.3.0-atmel3.6.1-azduino7b1/bin/../lib/gcc/avr/7.3.0/../../../../avr/bin/ld: address 0x804014 of /var/folders/dw/sj94gjmd0gg46mgmv55zdt400000gv/T/arduino_build_655605/sketch_mar28a.ino.elf section `.bss' is not within region `data'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board ATtiny3224/1624/1614/1604/824/814/804/424/414/404/214/204.

Compiling for ATtiny804 with IDE 1.8.19, megaTinyCore 2.6.10

Of note

  • making sampleReadStartIdx non-volatile makes the error go away.
  • removing either the read or the write of samples in loop() makes the error go away

Of course, the second I said that, I realized I am using >512 of storage for that array… nevermind