upload binary image more than 1MB

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

upload binary image more than 1MB

Postby snahmad75 » Mon May 07, 2018 5:04 pm

Hi,

I have custom partition.

# Name, Type, SubType, Offset, Size
nvs, data, nvs, 0x9000, 0x4000
otadata, data, ota, 0xd000, 0x2000
phy_init, data, phy, 0xf000, 0x1000
factory, app, factory, 0x10000, 0x140000
ota_0, app, ota_0, , 0x140000
ota_1, app, ota_1, , 0x140000

My application .bin is about 1100kb

The bootloader also more than 1MB. It is working. but I need some flash for my file system as well.

I guess currently i am using 3MB in total. still 1MB for File system. but if app increase more than 1280 kB. I will be in trouble.

I need to set aside 0.5 MB for for file systems to store files.

Can i reduce bootloader, nvs otadata Sizes?

What is difference between nvs and otadata. Is nvs is one time write area?

chegewara
Posts: 2230
Joined: Wed Jun 14, 2017 9:00 pm

Re: upload binary image more than 1MB

Postby chegewara » Mon May 07, 2018 5:23 pm

Hi,
just a suggestion. If you dont use special case where factory partition is used to keep application that is only used to perform ota updates and your main app do not have ota update code, but is switching partition to factory to perform update, why dont remove factory partition and stay with two OTA partitions?

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: upload binary image more than 1MB

Postby snahmad75 » Mon May 07, 2018 7:20 pm

Hi,

i used this example to update OTA while application is running.

https://github.com/espressif/esp-idf/tr ... system/ota

I also need to perform first time upload flash via serial as well.

I guess i need factory. I cannot avoid it.

chegewara
Posts: 2230
Joined: Wed Jun 14, 2017 9:00 pm

Re: upload binary image more than 1MB

Postby chegewara » Mon May 07, 2018 8:04 pm

Thats the point, you dont need factory partition. You can serial flash to ota partition too. I dont need file system partition, but this is how my partition table looks like in ota update app im playing with now:

Code: Select all

# Espressif ESP32 Partition Table
# Name,   Type, SubType, Offset,  Size
nvs,      data, nvs,     0x9000,  0x4000
otadata,  data, ota,     0xd000,  0x2000
phy_init, data, phy,     0xf000,  0x1000
ota0,  app,  ota_0,	 0x10000, 0x1f0000
ota1,	  app,  ota_1,   ,        0x1f0000
Very first flash after erase_flash is with serial and then i can update from ota. No factory partition, no wasted space.
Im not saying you have to follow this, just having factory partition in ota application in most cases is waste of flash space (just my opinion).

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: upload binary image more than 1MB

Postby snahmad75 » Mon May 07, 2018 8:28 pm

ok, good thanks. i will try this.

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: upload binary image more than 1MB

Postby snahmad75 » Tue May 08, 2018 8:26 am

Yes. all working. Thanks.

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: upload binary image more than 1MB

Postby snahmad75 » Tue May 08, 2018 9:15 am

Sorry bother again.
Does remove of factory partition effects flash encryption?

Can I still use encrypted .bin.

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: upload binary image more than 1MB

Postby snahmad75 » Tue May 08, 2018 12:36 pm

Now I am using fat storage partition as . It is stop working.

# Name, Type, SubType, Offset, Size
nvs, data, nvs, 0x9000, 0x4000,
otadata, data, ota, 0xd000, 0x2000,
phy_init, data, phy, 0xf000, 0x1000,
storage, data, fat, 0x10000 ,0x80000,
ota_0, app, ota_0, , 0x1f0000
ota_1, app, ota_1, , 0x1f0000

I am using
/**
* @brief Provide access to the FAT file system on %SPI flash.
* The FATFS_VFS file system needs a partition definition. This is a map of flash memory that
* specified an array into which the files should be saved and loaded. A partition is a named
* entity and the name we choose in the partition definition should be named in the constructor.
*
* A partition configuration file can be described in the `make menuconfig` settings. For example:
* ~~~~
* nvs, data, nvs, 0x9000, 0x6000,
* phy_init, data, phy, 0xf000, 0x1000,
* factory, app, factory, 0x10000, 1M,
* storage, data, fat, , 1M,
* ~~~~
*
* The recommended file name for the partition description is `partitions.csv`
*
* A typical example would be:
*
* @code{.cpp}
* FATFS_VFS *fs = new FATFS_VFS("/spiflash", "storage");
* fs->mount();
* // Perform file I/O
* fs->unmount();
* delete fs;
* @endcode

any idea why?

snahmad75
Posts: 445
Joined: Wed Jan 24, 2018 6:32 pm

Re: upload binary image more than 1MB

Postby snahmad75 » Tue May 08, 2018 1:09 pm

This custom partition works till I hit mount
esp_vfs_fat_spiflash_mount crash.


# Name, Type, SubType, Offset, Size
nvs, data, nvs, 0x9000, 0x4000
otadata, data, ota, 0xd000, 0x2000
phy_init, data, phy, 0xf000, 0x1000
factory, app, factory, 0x10000, 0x1f0000
storage, data, fat, ,0x80000

V (11270) wl_flash: config start_addr=0x00000000, full_mem_size=0x00080000, pa
ge_size=0x00001000, sector_size=0x00001000, updaterate=0x00000010, wr_size=0x0
0000010, version=0x00000001, temp_buff_size=0x00000020
V (11289) wl_flash: config - this->addr_state1=0x0007d000
V (11294) wl_flash: config - this->addr_state2=0x0007e000
D (11300) wl_flash: init - config ID=1, stored ID=-1, access_count=-1, block_s
ize=-1, max_count=-1, pos=-1, move_count=-1
D (11311) wl_flash: init starts: crc1=-9655541, crc2 = -9655541, this->state.c
rc=-1, state_copy->crc=-1
V (11334) wl_partition: erase_range - start_address=0x0007d000, size=0x0000100
0, result=0x00000000
V (11348) wl_partition: erase_range - start_address=0x0007e000, size=0x0000100
0, result=0x00000000
V (11363) wl_partition: erase_range - start_address=0x0007f000, size=0x0000100
0, result=0x00000000
D (11363) wl_flash: initSections - this->state->max_count=00000010, this->stat
e->max_pos=0000007d
D (11370) wl_flash: initSections - result=00000000
D (11374) wl_flash: recoverPos - this->state.pos=0x00000000, result=00000000
D (11382) vfs_fat_spiflash: using pdrv=0
V (11386) ff_diskio_spiflash: ff_wl_ioctl: cmd=2

V (11390) ff_diskio_spiflash: ff_wl_read - pdrv=0, sector=0, count=1

V (11397) wl_flash: read - src_addr=0x00000000, size=0x00001000
V (11403) wl_flash: calcAddr - addr=0x00000000 -> result=0x00001000
W (11410) vfs_fat_spiflash: f_mount failed (13)
I (11414) vfs_fat_spiflash: Formatting FATFS partition, allocation unit size=4
096
V (11423) ff_diskio_spiflash: ff_wl_ioctl: cmd=3

V (11428) ff_diskio_spiflash: ff_wl_ioctl: cmd=2

V (11432) ff_diskio_spiflash: ff_wl_ioctl: cmd=1

E (11437) vfs_fat_spiflash: f_mkfs failed (14)
ESP_ERROR_CHECK failed: esp_err_t 0xffffffff at 0x40113e9e
file: "C:/Work/LibDev/esp32/esp-idf/components/cpp_utils/FATFS_VFS.cpp" line 4
9
func: void FATFS_VFS::mount()
expression: esp_vfs_fat_spiflash_mount(m_mountPath.c_str(), m_partitionName.c_
str(), &mountConfig, &m_wl_handle)

Backtrace: 0x4008bd9c:0x3ffbc280 0x4008c1e5:0x3ffbc2a0 0x40113e9e:0x3ffbc2c0 0
x400d431e:0x3ffbc2f0 0x400d4579:0x3ffbc340 0x400d2776:0x3ffbc3b0

Entering gdb stub now.
$T0b#e6

chegewara
Posts: 2230
Joined: Wed Jun 14, 2017 9:00 pm

Re: upload binary image more than 1MB

Postby chegewara » Tue May 08, 2018 1:18 pm

Maybe someone smarter than me can confirm that, but if i recall minimum storage data partition is 1MB.

Who is online

Users browsing this forum: Baidu [Spider], MicroController and 133 guests