[ESP32C3] Flash memory overflow

huybui91
Posts: 10
Joined: Thu Dec 14, 2023 6:15 am

[ESP32C3] Flash memory overflow

Postby huybui91 » Wed Feb 21, 2024 5:40 am

Dear my friends,
I 'm using ESP32C3 to develop function including: connect to wifi and bluetooth as well. So far, With Wifi connection function, It worked well and available update OTA via websocket
And now, I'm adding bluetooth function but I faced problem that flash memory of device is overflow. I try customize partitions table as below but look like It was over 4MB of device. If I try add more code mybe, size of bin file will be more and can't upload to device
So Please give me advise for this case. Thanks so much

My partitions table:
# ESP-IDF Partition Table
# Name , Type , SubType , Offset , Size , Flags
nvs , data , nvs , 0x9000 , 16K ,
OTA Data,data , ota , , 8K
phy_init,data , phy , , 4K
factory ,app , factory , , 0x14173A
ota 0 ,app ,ota_0 , ,0x14173A
ota 1 ,app ,ota_1 , ,0x14173A
Error:
Error: All app partitions are too small for binary project-name.bin size 0x184e30:
- Part 'factory' 0/0 @ 0x10000 size 0x14173a (overflow 0x436f6)
- Part 'ota 0' 0/16 @ 0x160000 size 0x14173a (overflow 0x436f6)
- Part 'ota 1' 0/17 @ 0x2b0000 size 0x14173a (overflow 0x436f6)
ninja: build stopped: subcommand failed.

huybui91
Posts: 10
Joined: Thu Dec 14, 2023 6:15 am

Re: [ESP32C3] Flash memory overflow

Postby huybui91 » Thu Feb 22, 2024 12:48 am

Hello
Anyone can help me?

ESP_Sprite
Posts: 9766
Joined: Thu Nov 26, 2015 4:08 am

Re: [ESP32C3] Flash memory overflow

Postby ESP_Sprite » Thu Feb 22, 2024 2:30 pm

Well, there's not really anything to do here... your code is 0x184e30 bytes (or about 1.6 MiB) and if you need two OTA and a factory partition that can all have a version of that code, you'd need 3x1.6=4.8MiB of flash, and you only have 4.

Can you go without a factory partition? If so, you can still put it in the available 4MiB of flash. If not, you'd need to get a chip or module with more flash.

huybui91
Posts: 10
Joined: Thu Dec 14, 2023 6:15 am

Re: [ESP32C3] Flash memory overflow

Postby huybui91 » Fri Feb 23, 2024 12:29 am

Well, look like It worked well. I removed factory app and only using 2 OTA section.
May I know what is different paritions factory app and without factory app?

ESP_Sprite
Posts: 9766
Joined: Thu Nov 26, 2015 4:08 am

Re: [ESP32C3] Flash memory overflow

Postby ESP_Sprite » Fri Feb 23, 2024 2:31 am

A factory app is intended as a fallback option: it's the known-good firmware that is flashed in the factory and never changes during the lifetime of the device. In case your OTA procedure is messed up in such a way that both OTA partitions contain broken code, you can always revert to the factory app (either automatically, because both OTA partitions are corrupted, or manually, by e.g. configuring the bootloader so the user can hold a button on startup to revert to the factory app) to recover the device.

huybui91
Posts: 10
Joined: Thu Dec 14, 2023 6:15 am

Re: [ESP32C3] Flash memory overflow

Postby huybui91 » Fri Feb 23, 2024 6:22 am

Thanks for your explanation.

I think 2 OTA are enought for update OTA, 1 OTA is using for bootloader and other is using for load new firmware. As I read ESP-IDF document, bootloader will consider using 1 of 2 OTA as long as which one is the newest updated. So in case, If OTA 1 or 2 update firmware fail, system will auto using previous OTA as bootloader.
Correct me if I'm wrong

ESP_Sprite
Posts: 9766
Joined: Thu Nov 26, 2015 4:08 am

Re: [ESP32C3] Flash memory overflow

Postby ESP_Sprite » Fri Feb 23, 2024 7:14 am

huybui91 wrote:
Fri Feb 23, 2024 6:22 am
So in case, If OTA 1 or 2 update firmware fail, system will auto using previous OTA as bootloader.
This is correct.

Who is online

Users browsing this forum: No registered users and 97 guests