some questions about spi_flash_mmap

tobewinner
Posts: 30
Joined: Thu Dec 10, 2015 5:27 am

some questions about spi_flash_mmap

Postby tobewinner » Mon Sep 18, 2017 3:11 am

1, Will spi_flash_mmap decrypt data unconditional if Flash Encryption is on?I mean no matter the area is in partitions or not.
2, As We know, Not all of the flash is encrypted. Is it possible to save data in area which is not support now using spi_flash_write_encrypted and read them using spi_flash_mmap?

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: some questions about spi_flash_mmap

Postby ESP_igrr » Mon Sep 18, 2017 4:08 am

Memory-mapped reads from flash are always decrypted if flash encryption is on, that is how the flash MMU is designed.
Therefore you can't use memory mapping to read from unencrypted partitions in flash, if flash encryption is on. (Or rather, you can, but such reads will produce garbage)

tobewinner
Posts: 30
Joined: Thu Dec 10, 2015 5:27 am

Re: some questions about spi_flash_mmap

Postby tobewinner » Mon Sep 18, 2017 7:01 am

ESP_igrr wrote:Memory-mapped reads from flash are always decrypted if flash encryption is on, that is how the flash MMU is designed.
Therefore you can't use memory mapping to read from unencrypted partitions in flash, if flash encryption is on. (Or rather, you can, but such reads will produce garbage)
And question 2?
Is it possible to save data in area which is not supportted now (unused area, not in partitions) using spi_flash_write_encrypted and read them using spi_flash_mmap?

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: some questions about spi_flash_mmap

Postby ESP_igrr » Mon Sep 18, 2017 10:35 am

Is it possible to save data in area which is not supportted now (unused area, not in partitions) using spi_flash_write_encrypted and read them using spi_flash_mmap?
All area of the flash chip is supported, in the sense that it can be accessed via spi_flash_* APIs and esp_partition_* APIs (in the latter case, provided that you define a partition for respective area). Yes, you can write to unpartitioned space using spi_flash_write_encrypted and then use spi_flash_mmap to read.
But this is not recommended, in general. Most applications should use esp_partition_* APIs. That is the best way to ensure that your application is future proof and will not conflict with other components.

Who is online

Users browsing this forum: No registered users and 58 guests