I’m encountering a really stupid problem at the moment i really cannot wrap my head around.
The Project is a PlatformIO project, here is the platformio.ini:
[env:esp32cam] platform = espressif32 board = esp32cam framework = arduino monitor_speed = 115200 lib_deps = IRremoteESP8266 Adafruit NeoPixel ArduinoJson PubSubClient EEPROM build_flags = -D MQTT_MAX_PACKET_SIZE=512 -D MQTT_KEEPALIVE=5 -D ARDUINOJSON_USE_LONG_LONG=1
I am working on a project to use ESP32s as smarthome devices. Beeing a newbie in C++ at the time i simply threw all of the code into the .h files.
Learning more about C++, i decided to properly structure the project, moving method implementations to .cpp files. After a few Files i ran into the following error:
/Users/jklink/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: .pio/build/esp32cam/firmware.elf section `.dram0.bss' will not fit in region `dram0_0_seg' /Users/jklink/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: DRAM segment data does not fit. /Users/jklink/.platformio/packages/toolchain-xtensa32/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld: region `dram0_0_seg' overflowed by 4896 bytes
The error disappears when i revert the changes (remove one .cpp and move the code back into the .h).
It reappears when splitting up ANY other file.
What kinda wonders me is that after building the project it displays the following message:
RAM: [==== ] 37.0% (used 121328 bytes from 327680 bytes)
Flash: [=== ] 27.1% (used 852254 bytes from 3145728 bytes)
The RAM usage looks all good there.
The PlatformIO Home Inspection Tool tells me there are 100% (347.9kb) RAM used, but only 22% Flash.
There is not a single additional line Code written, so the compiled code should not be longer than the original one only stored in .h Files.
The complete src directory has a size of 246kb.
Has anyone a suggestion how to handle that?
Thanks in advance,