Can't make platformio to build for 8MB flash

I can’t make platformio to build partition table for 8MB flash.

I have a esp32 wroom 32ue with 8MB flash. I use the board esp32dev, here is my platformio.ini section:

[env:esp32doit-devkit-v1]
platform = espressif32
;board = esp32doit-devkit-v1
board = esp32dev
framework = arduino
board_build.flash_size = 8MB
board_build.partitions = Partition_Table_8mb.csv
board_upload.flash_size = 8MB
board_upload.wait_for_upload_port = yes
board_upload.use_1200bps_touch = yes
monitor_port = Auto
monitor_speed = 115200
monitor_filters = colorize
monitor_echo = yes
lib_deps =
     ESP Async WebServer

This is the partition table:

# Name,	Type,	SubType,	Offset,	Size,	Flags
nvs,	data,	nvs,	0x9000,	0x5000,	
otadata,	data,	ota,	0xe000,	0x2000,	
app0,	app,	ota_0,	0x10000,	0x330000,	
app1,	app,	ota_1,	0x340000,	0x330000,	
spiffs,	data,	spiffs,	0x670000,	0x180000,	
coredump,	data,	coredump,	0x7f0000,	0x10000,

and this is the terminal output when I build the filesystem image:

Processing esp32doit-devkit-v1 (platform: espressif32; board: esp32dev; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (6.9.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, 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.20017.0 (2.0.17) 
 - tool-esptoolpy @ 1.40501.0 (4.5.1) 
 - tool-mkfatfs @ 2.0.1 
 - tool-mklittlefs @ 1.203.210628 (2.3) 
 - tool-mkspiffs @ 2.230.0 (2.30) 
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 45 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ESP Async WebServer @ 1.2.4
|-- ArduinoJson @ 7.1.0+sha.bf99aee
|-- PubSubClient @ 2.8.0+sha.2d228f2
...

I upload successfully but when running I get crashes like

ets Jul 29 2019 12:21:46

rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13232
load:0x40080400,len:3028
entry 0x400805e4

If you see the terminal output above it reports

HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash

which is not right. I have stated board_build.flash_size = 8MB
In any case:

esptool.py --chip esp32 --port /dev/ttyUSB0 flash_id

reports

Chip is ESP32-D0WD-V3 (revision v3.1)
Manufacturer: a1
Device: 4017
Detected flash size: 8MB

Can someone help me with this? Is there any other parameter in the ini file that I should know of? Thank you.

I’m missing board_upload.maximum_size.

Try this:

[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32dev
framework = arduino
board_upload.flash_size = 8MB
board_upload.maximum_size = 8388608
board_build.partitions = Partition_Table_8mb.csv
monitor_speed = 115200
monitor_filters = colorize
monitor_echo = yes
lib_deps =
     ESP Async WebServer

ok, now it builds reporting 8MB:

Processing esp32doit-devkit-v1 (platform: espressif32; board: esp32dev; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (6.9.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 8MB Flash

After I upload the file system and code I boot the esp32.
The code starts but as soon as I try to initialize SPIFFS:

// Initialize SPIFFS
void initSPIFFS() {
  if (!SPIFFS.begin(true)) {
    Serial.println("An error has occurred while mounting SPIFFS");
  }
  Serial.println("SPIFFS mounted successfully");
}

I get the crash error:

ets Jul 29 2019 12:21:46

rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:13232
load:0x40080400,len:3028
entry 0x400805e4

It doesn’t even print the message ```
“An error has occurred while mounting SPIFFS”

Did you call initSPIFFS() in setup() ?

OK, looking into again I realized there were more calls than just initSPIFFS() in setup(). My mistake! There was a call pinMode(6, INPUT);
Pin6 in esp32-wroom-32 is somehow restricted for internal SPI_CLK, while in other mcu’s can be fully programmed (esp32-s3).
I rebuilt the files and now it works! Thank you a lot sivar2311!!

1 Like

There is a great article about the GPIO’s of the ESP32 : ESP32 Pinout Reference: Which GPIO pins should you use? | Random Nerd Tutorials

1 Like