Hello, I'm looking for example code that allows me:
- to random access bytes within the partition (with caching, as code has)
- to write the partition from the start up to some size (basically store a file in it)
So this partition should act and feel like constants, similar to const in code. It is basically just some code that is constant between OTA's.
Despite this seemingly being a common request, I could not find any direct answers (and only suggestions, no code).
Use case: I need to store up to 300k of fonts (my partition is 300k and is named "fonts"). Thanks!
Access partition example
-
- Posts: 9725
- Joined: Thu Nov 26, 2015 4:08 am
Re: Access partition example
I think the esp_partition_* API can help you out there. Mmap the partition to access the data as memory, erase/program it if you want to rewrite.
Re: Access partition example
More precisely: https://docs.espressif.com/projects/esp ... ables.html Right?ESP_Sprite wrote:I think the esp_partition_* API can help you out there. Mmap the partition to access the data as memory, erase/program it if you want to rewrite.
The best info I got so far is from:
https://github.com/espressif/esp-idf/bl ... est_mmap.c
Maybe I should read up on OTA partitions, it seems I just want one without the OTA part.
Note that I understand all the terms you use. But I know NOTHING about how THE ESP32 implements those things and what ACTUAL ADDRESSES, CONVENTIONS and MECHANICS it uses. The docs (or posts) don't deal with that, it's secret knowledge.
Other peripherals have examples, but apparently this one is so simple.. it doesn't need one. I'm sure all it takes is just a handful of lines.
Suggestion: please give us a partition type "mmap" (in partitions.csv) and have this working out of the box.
Because: there is memory, I just want to use it...
Re: Access partition example
You can map into memory (mmap) any kind of partition, its type in the partition table does not matter.
Basic workflow is:
1. Define the partition in the partition table.
2. Call esp_partition_find to get the pointer to esp_partition_t stucture describing this partition
3. Call esp_partition_mmap with the obtained pointer. This will give you two outputs: void* pointer to memory location where partition was mapped, and a handle which you can later use to unmap the partition.
Have captured you request for the example, will put it on our plan.
Basic workflow is:
1. Define the partition in the partition table.
2. Call esp_partition_find to get the pointer to esp_partition_t stucture describing this partition
3. Call esp_partition_mmap with the obtained pointer. This will give you two outputs: void* pointer to memory location where partition was mapped, and a handle which you can later use to unmap the partition.
Have captured you request for the example, will put it on our plan.
Who is online
Users browsing this forum: Baidu [Spider] and 72 guests