partation table questions

wziy520
Posts: 42
Joined: Thu Nov 10, 2016 7:58 am

partation table questions

Postby wziy520 » Tue Dec 06, 2016 3:42 pm

1. example
# 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
factory, 0, 0, 0x10000, 1M
ota_0, 0, ota_0, , 1M
ota_1, 0, ota_1, , 1M

1. why not list 0x0000 ~0x8FFF,this part of space reserve for what type of using ?
2. make flash , does all binary flash to SPI flash, where the binary stored, from which addr?
3. does NVS write by page, and erase by block, what kind of variables recommend to save to NVS,?

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: partation table questions

Postby kolban » Tue Dec 06, 2016 4:00 pm

The address space of the SPI flash is architected by Espressif. I'm imagining that all addresses south of 0x1 0000 are architected for exclusive use by ESP32 internals ... and you must not use them. I believe address 0x1 0000 onwards is available for your application and data usage.

When we run make flash, the esptool.py is run which copies three files into flash address space:

bootloader.bin -> 0x1000
partitions.bin -> 0x8000
app.bin -> 0x1 0000

The API for Non Volatile Storage appears to be well documented here ...

http://esp-idf.readthedocs.io/en/latest ... flash.html

The different types of variables you can store are rich including signed and unsigned numerics, strings and blobs. The purpose of NVS storage is to persist data between boots. A classic example might be to store configuration data such as your WiFi connection configuration, passwords for remote web services that your app may call etc etc.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

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

Re: partation table questions

Postby ESP_Sprite » Wed Dec 07, 2016 4:08 am

If I recall correctly, space from 0x0 to 0x1000 is reserved for secureboot stuff; it's unused if you do not use that. Address 0x1000-0x8000 is reserved for the 2nd stage bootloader. Address 0x8000 is where the partition table starts; the 2nd stage bootloader uses that to load whatever else you have in memory.

zizoalbert
Posts: 7
Joined: Tue Jan 03, 2017 10:11 am

Re: partation table questions

Postby zizoalbert » Tue Jan 03, 2017 10:14 am

Hello
i have a question about partition table and bootloader:
If we use OTA1 and OTA2, how can i choose in what OTA i want to boot my device ? TKX

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

Re: partation table questions

Postby ESP_Sprite » Tue Jan 03, 2017 1:22 pm

In general, you do not. The bootloader will always pick the last successfully flashed OTA partition and boot that.

zizoalbert
Posts: 7
Joined: Tue Jan 03, 2017 10:11 am

Re: partation table questions

Postby zizoalbert » Tue Jan 03, 2017 2:24 pm

Thank you for your help
but i have two others questions (plz)
1- So to flash the OTA1 app for example, i must run flash just the app in address (0x10000 + 1M), then the boot-loader will boot in it ?
2- If -one day- we will want to boot in our factory app, how can we do ?

Thank you for your help

zizoalbert
Posts: 7
Joined: Tue Jan 03, 2017 10:11 am

Re: partation table questions

Postby zizoalbert » Tue Jan 03, 2017 2:31 pm

Hello,
why they said that the boot-loader will read some parameters in OTADATA (partition after NVS) and boot in the partition that corresponds to the parameters read in OTADATA ?

Thank you

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

Re: partation table questions

Postby ESP_Sprite » Tue Jan 03, 2017 3:06 pm

You should use the OTA API, it takes care of flashing to the correct OTA partition and setting the OTADATA information correctly. At the moment we do not have a way to boot to the factory firmware yet; we have some plans to have user-configurable hooks for that but nothing concrete yet. For now, you can copy the bootloader code to your own project and put in a condition to boot the factory f/w yourself.

zizoalbert
Posts: 7
Joined: Tue Jan 03, 2017 10:11 am

Re: partation table questions

Postby zizoalbert » Wed Jan 04, 2017 8:01 am

thank you for your help, but where can i find the bootloader code (is it the code that we find in component/bootloader ? or there is a github for bootloader source ?

TKX

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: partation table questions

Postby WiFive » Wed Jan 04, 2017 10:29 am

zizoalbert wrote:is it the code that we find in component/bootloader ?
Yes

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 83 guests