Esp32 flash size in menuconfig doesn't work

Above information may be incorrect – you primarily need to give PlatformIO and ESP-IDF (I assume you’re using that instead of Arduino since this topic is about ESP-IDF) the right partition table. Not via “flash size” in the menuconfig. That is a parameter that’s being used for esptool during flashing, not during build.

Read Unable to build and upload SPIFFS filesystem image with framework esp-idf - #3 by maxgerhardt up until the line “And I quit-and-save out of that”, it shows how to set a partition file and also an example partition. You will surely want a different partition file or adapted sizes per Espressif 32 — PlatformIO latest documentation.

Also see Problem compiling idf + arduino.