Bad build image for ESP32?

I want to move my development to Platform IO on linux from Arduino on Windows for a new complex project. I have built and downloaded an image to “firebeetle32” ESP32 board in Arduino IDE on windows (dead simple “blink the LED” in 1 main.cc file). No issues. I wanted to learn Platform IO using this simple setup. I started by installing VSCode-PlatformIO on my new Pi5. Set everything up, ran the build, no issues. However, I cannot get the program uploaded to the ESP32 test board. There is a problem with the image or upload via Platform IO. When I run esptool directly on the Pi using the Arduino combined image at offset 0, everything works fine. So I have eliminated the Pi and underlying linux causing problems. Yet, just using Platform IO, it doesn’t work.

Below are the key items from the logs of the download and the output of the ESP32 failure. There is nothing special I am trying to do, everything should be default. As I said, when I use esptool directly and upload the Arduino combined binary at offset 0, everything works…

Platform IO ini file:

[env:firebeetle32]
platform = espressif32
board = firebeetle32
framework = arduino
monitor_speed = 115200
upload_speed = 115200


Hash of data verified.
Compressed 269376 bytes to 149404…
Writing at 0x00010000… (10 %)
Writing at 0x0001c484… (20 %)
Writing at 0x00024a7e… (30 %)
Writing at 0x00029d00… (40 %)
Writing at 0x0002f273… (50 %)
Writing at 0x000347e6… (60 %)
Writing at 0x0003d47e… (70 %)
Writing at 0x00046285… (80 %)
Writing at 0x0004b812… (90 %)
Writing at 0x00051093… (100 %)
Wrote 269376 bytes (149404 compressed) at 0x00010000 in 13.2 seconds (effective 163.1 kbit/s)…
Hash of data verified.

Leaving…
Hard resetting via RTS pin…
========================================================= [SUCCESS] Took 23.98 seconds =========================================================
*

CONSOLE OUTPUT

Rebooting…
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_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
E (148) spi_flash: Detected size(4096k) smaller than the size in the binary image header(16384k). Probe failed.

assert failed: do_core_init startup.c:328 (flash_ret == ESP_OK)

Backtrace: 0x4008344d:0x3ffe3ab0 0x400880e1:0x3ffe3ad0 0x4008d021:0x3ffe3af0 0x400da2d2:0x3ffe3c20 0x40082b79:0x3ffe3c50 0x40079306:0x3ffe3c90 |<-CORRUPTED

ELF file SHA256: ccebb76b7ef1222b

E (171) esp_core_dump_flash: Core dump flash config is corrupted! CRC=0x7bd5c66f instead of 0x0
Rebooting…

So why does the ESP32 detect a 4MB flash here when Firebeetle ESP32 board should have 16MB? Is this not your board?

https://www.dfrobot.com/product-1590.html

grafik

This is a real old dev board I bought from some website a long time ago, I’m not sure what is the “matching” one. However, this is the one I always have used in Arduino when I program this board - it just worked - the sketches have been relatively small, never had a problem.

In arduino the upload is
esptool.exe" --before default_reset --after hard_reset write_flash -z --flash_mode keep --flash_freq keep --flash_size keep

In the platform IO instantiation I see this

Configuring flash size…

Is this the difference?

I want to run the build on the Platform IO setup “the same” as Arduino to find the problem. How do I do that?

If I have to find a new board definition that matches exactly this old development board - that could be a problem. I need a “generic” dev board to use, and this firebeetle one always worked for me.

thanks
tony

There might a difference in PlatformIO when it comes to flashing the image: Instead of setting it to autodetected, it actually uses the flash size associated with the board setting.

Change your platformio.ini to use

board = esp32dev

and reupload.

Yep, that is the issue. Thanks for the help!