question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uploading to ota_0 instead of factory partition

See original GitHub issue

I’m trying to upload the program to an esp32 devkitv1 and I get the following issue.

When I press the upload button in vscode the firmware is uploaded to the ota_ 0 partition instead of the factory partition. The bootstrap tries to start the factory partition and rises an error, then the app starts from the ota_0 partition. Prior to upload I did a flash erase. What I expect is that the firmware is uploaded to the factory partition.

This is my custom partition table

# Name,   Type, SubType, Offset,  Size, Flags
nvs,      data, nvs,     0x19000,  0x5000,
otadata,  data, ota,     0x1E000,  0x2000,
factory,  app,  factory, 0x20000, 0x100000,
app0,     app,  ota_0,   0x120000, 0x150000,
app1,     app,  ota_1,   0x270000, 0x150000,
spiffs,   data, spiffs,  0x3C0000, 0x40000,

this is my platformio.ini:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino, espidf
monitor_speed = 115200
lib_deps = 
	C:\git\rfid
monitor_filters = esp32_exception_decoder
board_build.partitions = partitions_custom.csv

And this is the command displayed in the console:

platformio.exe run --target upload

and this the point that it says it’s writing to ota0 (0x120000) instead that factory (0x20000)

Wrote 764096 bytes (471615 compressed) at 0x00120000 in 11.0 seconds (effective 554.5 kbit/s)...

This is the boostrapper log:

D (259) boot: Trying partition index -1 offs 0x20000 size 0x100000
D (265) esp_image: reading image header @ 0x20000
D (270) bootloader_flash: mmu set block paddr=0x00020000 (was 0xffffffff)
D (277) esp_image: image header: 0xff 0xff 0xff 0x0f ffffffff
E (283) esp_image: image at 0x20000 has invalid magic byte (nothing flashed here?)
E (291) boot: Factory app partition is not bootable
D (297) boot: Trying partition index 0 offs 0x120000 size 0x100000
D (303) esp_image: reading image header @ 0x120000
D (308) bootloader_flash: mmu set block paddr=0x00120000 (was 0x00020000)
D (315) esp_image: image header: 0xe9 0x06 0x02 0x02 40082094

This issue is a follow-up to this thread: https://community.platformio.org/t/uploading-to-ota-0-instead-of-factory-partition/28951/9

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Jason2866commented, Jul 26, 2022

I was running in this too. See my PR https://github.com/platformio/platform-espressif32/pull/785 We are using a factory firmware too handle a optimized OTA process to save flash space. We used flash extra images to specify where to flash the factory image https://github.com/arendst/Tasmota/blob/development/boards/esp32_4M.json This functions can be used to flash more images!

0reactions
stale[bot]commented, Oct 12, 2022

This issue has been automatically marked as stale because it has not had recent activity. Please provide more details or it will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uploading to ota_0 instead of factory partition - vscode
I'm trying to upload the program to an esp32 devkitv1 and I get the following issue (on the esp32s it works correctly).
Read more >
Partition for large app with OTA support
My app uses both bluetooth and wifi so it's quite large. As it stands, it occupies 80% of the 1.5M i've allocated to...
Read more >
Partition Tables - ESP32 - — ESP-IDF Programming Guide ...
OTA never updates the factory partition. If you want to conserve flash usage in an OTA project, you can remove the factory partition...
Read more >
Frequently asked questions
How did A/B affect the 2016 Pixel partition sizes? ... If you've actually used a device, taken an OTA, and performed a factory...
Read more >
HOW DO OTA UPDATES HAPPEN IN THE ESP32? - YouTube
In this video, we will learn about the use case of OTA Updates in the ESP32. Then we will learn about the Partition...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found