dcrespo3d / ZX-ESPectrum-Wiimote

A ZX spectrum 48K/128K emulator running on ESP32 powered Lilygo TTGo VGA32 v1.4 board, using PS2 keyboard and/or Wiimote as input device. Active branches are master and devkit-custom
MIT License
67 stars 17 forks source link

Not building with USE_SD_CARD #22

Closed mirivlad closed 1 year ago

mirivlad commented 2 years ago

Hello. I checked new version and get error from gcc. This error reproduce when i build with option #define USE_SD_CARD 1 and don't reproduce if i use #define USE_INT_FLASH 1 in hardconfig.h Build log:

Executing task in folder ZX-ESPectrum-Wiimote: platformio run 

Processing pico32 (platform: espressif32@3.5; board: pico32; framework: arduino)
----------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/pico32.html
PLATFORM: Espressif 32 (3.5.0) > ESP32 Pico Kit
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.10006.210326 (1.0.6) 
 - tool-esptoolpy @ 1.30100.210531 (3.1.0) 
 - tool-openocd-esp32 @ 2.1000.20210721 (10.0) 
 - toolchain-xtensa32 @ 2.50200.97 (5.2.0)
Converting ZX-ESPectrum.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 30 compatible libraries
Scanning dependencies...
Dependency Graph
|-- FabGL
|-- FS @ 1.0
|-- SD(esp32) @ 1.0.5
|   |-- FS @ 1.0
|   |-- SPI @ 1.0
|-- SPIFFS @ 1.0
|   |-- FS @ 1.0
|-- WiFi @ 1.0
Building in release mode
Compiling .pio/build/pico32/src/AySound.cpp.o
Compiling .pio/build/pico32/src/CPU.cpp.o
Compiling .pio/build/pico32/src/Config.cpp.o
Compiling .pio/build/pico32/src/ESP32Lib/Composite/Composite.cpp.o
Compiling .pio/build/pico32/src/ESP32Lib/I2S/I2S.cpp.o
Compiling .pio/build/pico32/src/ESP32Lib/LED/ParallelLED.cpp.o
Compiling .pio/build/pico32/src/ESP32Lib/LED/ParallelLEDGraphics.cpp.o
Compiling .pio/build/pico32/src/ESP32Lib/LED/SerialLED.cpp.o
Compiling .pio/build/pico32/src/ESP32Lib/VGA/VGA.cpp.o
Compiling .pio/build/pico32/src/ESP32Lib/VGA/VGA14BitI.cpp.o
Compiling .pio/build/pico32/src/ESP32Lib/VGA/VGA3BitI.cpp.o
Compiling .pio/build/pico32/src/ESP32Lib/VGA/VGA6BitI.cpp.o
Compiling .pio/build/pico32/src/ESP32Wiimote/ESP32Wiimote.cpp.o
Compiling .pio/build/pico32/src/ESP32Wiimote/TinyWiimote.cpp.o
Compiling .pio/build/pico32/src/ESPectrum.cpp.o
Compiling .pio/build/pico32/src/FileSNA.cpp.o
Compiling .pio/build/pico32/src/FileUtils.cpp.o
Compiling .pio/build/pico32/src/FileZ80.cpp.o
Compiling .pio/build/pico32/src/Font.cpp.o
Compiling .pio/build/pico32/src/Mem.cpp.o
Compiling .pio/build/pico32/src/OSDMain.cpp.o
Compiling .pio/build/pico32/src/OSDMenu.cpp.o
Compiling .pio/build/pico32/src/PS2Boot/PS2KeyAdvanced.cpp.o
Compiling .pio/build/pico32/src/PS2Kbd.cpp.o
Compiling .pio/build/pico32/src/Ports.cpp.o
Compiling .pio/build/pico32/src/Tape.cpp.o
Compiling .pio/build/pico32/src/Wiimote2Keys.cpp.o
Compiling .pio/build/pico32/src/Z80_JLS.cpp.o
Compiling .pio/build/pico32/src/ZX-ESPectrum.ino.cpp.o
Compiling .pio/build/pico32/src/pwm_audio.c.o
Compiling .pio/build/pico32/src/vga_6bit.cpp.o
Generating partitions .pio/build/pico32/partitions.bin
Compiling .pio/build/pico32/lib4e8/FabGL/devdrivers/soundgen.cpp.o
Compiling .pio/build/pico32/lib393/FS/FS.cpp.o
Compiling .pio/build/pico32/lib393/FS/vfs_api.cpp.o
Archiving .pio/build/pico32/lib4e8/libFabGL.a
Indexing .pio/build/pico32/lib4e8/libFabGL.a
Compiling .pio/build/pico32/lib6bf/SPI/SPI.cpp.o
Compiling .pio/build/pico32/libe73/SD/SD.cpp.o
Archiving .pio/build/pico32/lib6bf/libSPI.a
Indexing .pio/build/pico32/lib6bf/libSPI.a
Compiling .pio/build/pico32/libe73/SD/sd_diskio.cpp.o
Archiving .pio/build/pico32/lib393/libFS.a
Indexing .pio/build/pico32/lib393/libFS.a
Compiling .pio/build/pico32/libe73/SD/sd_diskio_crc.c.o
Compiling .pio/build/pico32/libf81/SPIFFS/SPIFFS.cpp.o
Compiling .pio/build/pico32/libe45/WiFi/ETH.cpp.o
Archiving .pio/build/pico32/libe73/libSD.a
Indexing .pio/build/pico32/libe73/libSD.a
Compiling .pio/build/pico32/libe45/WiFi/WiFi.cpp.o
Compiling .pio/build/pico32/libe45/WiFi/WiFiAP.cpp.o
Compiling .pio/build/pico32/libe45/WiFi/WiFiClient.cpp.o
Archiving .pio/build/pico32/libf81/libSPIFFS.a
Indexing .pio/build/pico32/libf81/libSPIFFS.a
Compiling .pio/build/pico32/libe45/WiFi/WiFiGeneric.cpp.o
Compiling .pio/build/pico32/libe45/WiFi/WiFiMulti.cpp.o
Compiling .pio/build/pico32/libe45/WiFi/WiFiSTA.cpp.o
Compiling .pio/build/pico32/libe45/WiFi/WiFiScan.cpp.o
Compiling .pio/build/pico32/libe45/WiFi/WiFiServer.cpp.o
Compiling .pio/build/pico32/libe45/WiFi/WiFiUdp.cpp.o
Archiving .pio/build/pico32/libFrameworkArduinoVariant.a
Indexing .pio/build/pico32/libFrameworkArduinoVariant.a
Compiling .pio/build/pico32/FrameworkArduino/Esp.cpp.o
Compiling .pio/build/pico32/FrameworkArduino/FunctionalInterrupt.cpp.o
Compiling .pio/build/pico32/FrameworkArduino/HardwareSerial.cpp.o
Archiving .pio/build/pico32/libe45/libWiFi.a
Indexing .pio/build/pico32/libe45/libWiFi.a
Compiling .pio/build/pico32/FrameworkArduino/IPAddress.cpp.o
Compiling .pio/build/pico32/FrameworkArduino/IPv6Address.cpp.o
Compiling .pio/build/pico32/FrameworkArduino/MD5Builder.cpp.o
Compiling .pio/build/pico32/FrameworkArduino/Print.cpp.o
Compiling .pio/build/pico32/FrameworkArduino/Stream.cpp.o
Compiling .pio/build/pico32/FrameworkArduino/StreamString.cpp.o
Compiling .pio/build/pico32/FrameworkArduino/WMath.cpp.o
Compiling .pio/build/pico32/FrameworkArduino/WString.cpp.o
Compiling .pio/build/pico32/FrameworkArduino/base64.cpp.o
Compiling .pio/build/pico32/FrameworkArduino/cbuf.cpp.o
Compiling .pio/build/pico32/FrameworkArduino/esp32-hal-adc.c.o
Compiling .pio/build/pico32/FrameworkArduino/esp32-hal-bt.c.o
Compiling .pio/build/pico32/FrameworkArduino/esp32-hal-cpu.c.o
Compiling .pio/build/pico32/FrameworkArduino/esp32-hal-dac.c.o
Compiling .pio/build/pico32/FrameworkArduino/esp32-hal-gpio.c.o
Compiling .pio/build/pico32/FrameworkArduino/esp32-hal-i2c.c.o
Compiling .pio/build/pico32/FrameworkArduino/esp32-hal-ledc.c.o
Compiling .pio/build/pico32/FrameworkArduino/esp32-hal-log.c.o
Compiling .pio/build/pico32/FrameworkArduino/esp32-hal-matrix.c.o
Compiling .pio/build/pico32/FrameworkArduino/esp32-hal-misc.c.o
Compiling .pio/build/pico32/FrameworkArduino/esp32-hal-psram.c.o
Compiling .pio/build/pico32/FrameworkArduino/esp32-hal-rmt.c.o
Compiling .pio/build/pico32/FrameworkArduino/esp32-hal-sigmadelta.c.o
Compiling .pio/build/pico32/FrameworkArduino/esp32-hal-spi.c.o
Compiling .pio/build/pico32/FrameworkArduino/esp32-hal-time.c.o
Compiling .pio/build/pico32/FrameworkArduino/esp32-hal-timer.c.o
Compiling .pio/build/pico32/FrameworkArduino/esp32-hal-touch.c.o
Compiling .pio/build/pico32/FrameworkArduino/esp32-hal-uart.c.o
Compiling .pio/build/pico32/FrameworkArduino/libb64/cdecode.c.o
Compiling .pio/build/pico32/FrameworkArduino/libb64/cencode.c.o
Compiling .pio/build/pico32/FrameworkArduino/main.cpp.o
Compiling .pio/build/pico32/FrameworkArduino/stdlib_noniso.c.o
Compiling .pio/build/pico32/FrameworkArduino/wiring_pulse.c.o
Compiling .pio/build/pico32/FrameworkArduino/wiring_shift.c.o
Archiving .pio/build/pico32/libFrameworkArduino.a
Indexing .pio/build/pico32/libFrameworkArduino.a
Linking .pio/build/pico32/firmware.elf
/home/mirivlad/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/pico32/firmware.elf section `.iram0.text' will not fit in region `iram0_0_seg'
/home/mirivlad/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: IRAM0 segment data does not fit.
/home/mirivlad/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: region `iram0_0_seg' overflowed by 1004 bytes
collect2: error: ld returned 1 exit status
*** [.pio/build/pico32/firmware.elf] Error 1

Build from VSCode with installing PlatformIO. Reproducing on Linux and Windows.

pamribeirox commented 2 years ago

I'm also having that compile error with this defines. Commenting USE_SD_CARD and uncommenting USE_INT_FLASH compiles and runs without problems. //#define USE_INT_FLASH 1

define USE_SD_CARD 1

Any solution from the masters (thanks!) of this project?

MadedCat commented 2 years ago

изображение I have excluded all whats contains WIFI from project, and its builds normally. изображение

Next that i can fix - video system. its working normally at 400*300 pixels vga, but display games at top-left corner

изображение

Gods69 commented 2 years ago

I'm also having compile errors when using USE_SD_CARD option:

../xtensa-esp32-elf/bin/ld.exe: .pio\build\pico32\firmware.elf section `.iram0.text' will not fit in region `iram0_0_seg'
../xtensa-esp32-elf/bin/ld.exe: IRAM0 segment data does not fit.
../xtensa-esp32-elf/bin/ld.exe: region`iram0_0_seg' overflowed by 1004 bytes
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\pico32\firmware.elf] Error 1
dcrespo3d commented 1 year ago

Hello, seems like the IRAM section is a very limited resource and we were using too much. I have removed the IRAM_ATTR qualifier from many functions which were not time critical (just removing the one from Config class did the trick for me, but I removed a lot more just in case).