[upload] Error 2 with esp8266 ESP-07 board #193

I use VSCODE to create project. I create a project and select ESp-07 board and ESP8266 RTOS SDK framework then create a main.c file in src directory and copy content of main.c file of esp8266-rtos-sdk-blink example to my project main.c file. it compile successfully but when i want to upload it to my board following error occur :

Processing esp07 (platform: espressif8266; framework: esp8266-rtos-sdk; board: esp07)
Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: Redirecting...
PLATFORM: Espressif 8266 2.3.2 > Espressif Generic ESP8266 ESP-07
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES: toolchain-xtensa 1.40802.0 (4.8.2), framework-esp8266-rtos-sdk 1.5.0-beta.5, tool-esptool 1.413.0 (4.13), tool-esptoolpy 1.20800.0 (2.8.0), tool-mkspiffs 1.200.0 (2.0)
LDF: Library Dependency Finder → bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies…
No dependencies
Building in release mode
Retrieving maximum program size .pio\build\esp07\firmware.elf
Checking size .pio\build\esp07\firmware.elf
Advanced Memory Usage is available via “PlatformIO Home > Project Inspect”
DATA: [==== ] 36.3% (used 29754 bytes from 81920 bytes)
PROGRAM: [======= ] 73.9% (used 278664 bytes from 376832 bytes)
Configuring upload protocol…
AVAILABLE: espota, esptool
CURRENT: upload_protocol = esptool
Looking for upload port…
Auto-detected: COM3
Uploading .pio\build\esp07\firmware.bin
esptool.py v2.8
Serial port COM3
Connecting…
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 5c:cf:7f:33:a6:e6
Uploading stub…
Running stub…
Stub running…
Configuring flash size…
Auto-detected Flash size: 1MB
A fatal error occurred: File C:\Users\MrTavakoli.platformio\packages\framework-esp8266-rtos-sdk\bin\esp_init_data_default.bin (length 128) at offset 4177920 will not fit in 1048576 bytes of flash. Use --flash-size argument, or change flashing address.
*** [upload] Error 2

I test my board with Arduino framework successfully.

Thanks you

You’ve configured it as a board with 4MB of FLASH, but the bootloader as auto-detected it as

You could correct that by changing the flash size configuration script used via your project configuration platformio.ini… i.e.

build_flags = -Wl,-Teagle.flash.1m.ld

Thank you
I copy eagle.flash.1m.ld file from Arduino sdk (because there isn’t such file in rtos sdk) to src directory and add flag then build project now following error occur :

*** [.pio\build\esp07\firmware.elf] Implicit dependency C:\Users\MrTavakoli\.platformio\platforms\espressif8266\builder\eagle.flash.1m.ld' not found, needed by target.pio\build\esp07\firmware.elf’.

I try with eagle.app.v6.new.1024.app1.ld file of rtos sdk framework and same error occur.

Oh bugger…you’re using the ESP8266 RTOS SDK and I’m giving you instructions for the ESP8266 Arduino framework! :man_facepalming:

Ok, the RTOS linker scripts are

in .platformio\packages\framework-esp8266-rtos-sdk\ld

so see if it works with:

build_flags = -Wl,-Teagle.app.v6.new.1024.app1.ld

(you shouldn’t need the file in your project dir, it’s framework supplied).

If that doesn’t work, someone more familiar with the ESP8266_RTOS stuff will have to help you out.

Thanks
It don’t work :frowning_face:

I use esp01-1M board instead of esp07 board and compile then upload to esp07 board successfully.
again change board to esp07 and add

board_upload.maximum_size = 1048576

to platformio.ini file and compile and upload to esp07` board successfully.
I found 1048576 value from esp01_1m.json file.

1 Like

Oh, nice! So it looks like the size constraint came from that, not the memory layout file… Good to know! Thanks for sharing! :slight_smile:

I also had the same problem, I was using esp32S3. How can this microcontroller developed with platformio solve this problem?

英语
How did you solve this problem