Issue building code on vs code with esp32

I have been working on a project using the ESP32 for a while and never had issues building and compiling. Now I have done something to my code and it won’t compile. I have even reverted it to a previous commit I have done and still can’t find it. I have been on a few different forums trying to fix it through different past posts, but can’t seem to figure it out. I think it has something to do with the config.h file and I found a potential fix in this and other posts, but can’t find the config.h to edit it and try.

The error coming up is:

c:/users/lukem/.platformio/packages/toolchain-xtensa32@2.50200.80/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\esp32dev\firmware.elf section `.dram0.bss' will not fit in region `dram0_0_seg'
c:/users/lukem/.platformio/packages/toolchain-xtensa32@2.50200.80/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: DRAM segment data does not fit.
c:/users/lukem/.platformio/packages/toolchain-xtensa32@2.50200.80/bin/../lib/gcc/xtensa-esp32-elf/5.2.0/../../../../xtensa-esp32-elf/bin/ld.exe: region `dram0_0_seg' overflowed by 161456 bytes
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp32dev\firmware.elf] Error 1

The error message says that the BSS segment, in which global uninitialized variables / buffers go, cannot be put in the ESP32’s (Data)RAM segment anymore because you’ve gone beyond its physical capacity by circa 157.6 kilobytes.

You have either massively increased some buffer sizes used in your application or you have modified the sdkconfig.h so that ESP-IDF (if you are using that framework) pulls in more data. Or you suddenly included libraries which allocate large buffers.

The forum thread is talking about the config.h when compiling the “jerryscript-project” JavaScript engine project. Are you compiling this project?

Hey, thanks for getting back to me. I am not trying to compile the jerryscript project, but thought that error was relevant. But I guess not. I haven’t added any code except like 2 lines in one class, since my last successful build either.

Did you update PlatformIO inbetween or the used frameworks? What’s your exact platformio.ini and the code delta to the last successful build? Does reverting them make the project compile?

The framework was changed temporarily to espidf, then using both frameworks. Then it broke and I tried ot revert it back to straight arduino framework.

; PlatformIO Project Configuration File

;

;   Build options: build flags, source filter

;   Upload options: custom upload port, speed and extra flags

;   Library options: dependencies, extra library storages

;   Advanced options: extra scripting

;

; Please visit documentation for the other options and examples

; https://docs.platformio.org/page/projectconf.html

[env:esp32dev]

platform = espressif32

board = esp32dev

framework = arduino

lib_extra_dirs = ~/Documents/Arduino/libraries

monitor_speed = 115200

So the intended framework is just Arduino? Have you cleaned the project and retried already? Build artifacts from the large ESP-IDF build may still be there.

Already tried cleaning and rebuilding. I have tried also turning off and on vs code. How could I go about checking to see if there are any build artifacts from the large ESP-IDF build and removing them?

The artifacts are contained in thie hidden .pio\build folder of the project. Clearing .pio\libdeps might be a good idea too, however.

Hey, I’ve gone through and deleted all the contents of both those folders while VS Code was not running. I opened the project back up and they reappeared. I tried this twice, also tried cleaning and building between each of these and the same issue keeps coming up.

For anyone interested, I managed to finally debug this with a friend. I had initialised an array that was too large, which caused the overflow issue. I fixed it by creating a new branch off an older working commit and backtracking to find the source of the issue.