...'region RAM overflowed with stack'... error on Platformio not allowing compilation

RAM overflow means your program is trying to use more RAM than is available on the microcontroller.

You also have an undefined reference to ainParameters, i.e. no .cpp / .c file defines this variable or implements that function.

What you can do is hack in the linkerscript to force compilation by giving it more RAM. The location of this .ld script can be seen in the verbose linker command (-L <path> -T <linkerscript filename>), visible with project tasks → Advanced → Verbose Build. That forced build won’t be runnable, but you can throw it into https://github.com/ARMmbed/mbed-os-linker-report or add build flags to generate the .map file and throw that into e.g. amap. That will allow you to see the memory usage of every symbol in your firmware, and unusually large or larger than you’ve expected parameters might stand out.

Well if it compiled before the reboot with all the same file contents and now it doesn’t, something is fundamentally wrong or something was changed after all.

Even minute changes like calling a function can cause a huge increase in RAM and FLASH if that function and all the buffers / objects it was working on were previously uncalled + optimized out.