Commit graph

23 commits

Author SHA1 Message Date
jiangguangming 4f3ddbb299 flash_mmap: restore interrupt and cache before err return 2020-09-24 10:06:18 +08:00
Mahavir Jain 30d2f13358 spi_flash: fix stale read issue for memory mapped partition
On flash program operation (either erase or write), if corresponding address has
cache mapping present then cache is explicitly flushed (for both pro and app cpu)

Closes https://github.com/espressif/esp-idf/issues/2146
2019-07-11 04:23:51 +00:00
Mahavir Jain b3aff63db4 app_update: fix intermittent failure with firmware updates
Routine `spi_flash_cache2phys` sometimes return incorrect value,
resulting in failure in getting currently running ota partition.
This in turn aborts firmware update process.This issue was more
prominent with SPIRAM enabled cases.

Fix ensures proper cache guards during `spi_flash_cache2phys`, and
also for few other similar APIs.

In addition, `esp_ota_get_running_partition` has also been optimized
to save currently running partition for subsequent invocations.

Fixes https://github.com/espressif/esp-idf/issues/2451
2018-10-18 04:38:31 +00:00
Ivan Grokhotkov 79e7f02286 spi_flash: allocate mmap pages array in internal memory
* spi_flash_mmap_pages needs pages array to be in internal memory.
  Document and check this.

* Fix a bug that spi_flash_mmap did not allocate pages array in
  internal memory.

* Minor style fixes: const-ify pages argument of spi_flash_mmap, add
  spaces around operators, mark output arguments with [out].

Closes https://github.com/espressif/esp-idf/issues/2229.
2018-07-31 13:11:04 +03:00
Konstantin Kondrashov 8f80cc733d soc: Change DPORT access
When two CPUs read the area of the DPORT and the area of the APB, the result is corrupted for the CPU that read the APB area.
And another CPU has valid data.

The method of eliminating this error.
Before reading the registers of the DPORT, make a preliminary reading of the APB register.
In this case, the joint access of the two CPUs to the registers of the APB and the DPORT is successful.
2018-05-14 17:54:57 +05:00
Tian Zhong Xing fa68774344 spi_flash:
1. add test code for new api
2. resolve some comments
2018-03-26 10:24:42 +08:00
Tian Zhong Xing 7555031553 add api get valid mmu table pages number 2018-03-16 10:40:55 +08:00
Deng Xin 337f790fd3 bug fix of assert happen in PSRAM 2018-01-09 20:01:06 +08:00
Jeroen Domburg 740f8a79f0 Add logic to make external RAM usable with malloc() 2017-09-28 17:17:50 +08:00
Jeroen Domburg 34372a091c Add initial SPI RAM support. This adds support for an ESP-PSRAM32 chip connected to the default flash pins and GPIO 16 and 17. The RAM is mapped to address 0x3F800000, but otherwise ignored by esp-idf as of yet. 2017-09-04 12:05:49 +08:00
Angus Gratton 17adb40ca8 bootloader: Calculate SHA256 hash of image on every boot
Makes app image booting more reliable (256-bit rather than 8-bit verification.)

Some measurements, time to boot a 655KB app.bin file and run to app_main() execution.

(All for rev 1 silicon, ie no 340ms spurious WDT delay.)

80MHz QIO mode:
before = 300ms
after = 140ms

40MHz DIO mode:
before = 712ms
after = 577ms

40MHz DIO mode, secure boot enabled
before = 1380ms
after = 934ms

(Secure boot involves two ECC signature verifications (partition table, app) that take approx 300ms each with 80MHz CPU.)
2017-07-19 18:31:59 +10:00
Jeroen Domburg 113bb30218 This commit adds spi_flash_mmap_pages(), a function to map a set of unordered 64K pages in flash into a contiguous region in memory space. 2017-06-23 14:28:57 +08:00
Ivan Grokhotkov d790300215 spi_flash: fix stale data being read from mmaped region
The issue that cache entries are not invalidated correctly sometimes
can also be reproduced for non-encrypted flash as well.
This change updates the workaround to do Cache_Flush, enabling it for
non-encrypted flash, and adds a unit test.
2017-03-04 17:48:44 +08:00
Ivan Grokhotkov 8911e666a0 Merge branch 'feature/docs_partition_ota_flash' into 'master'
Partition/SPI/OTA docs & OTA new functionality

* Update partition, SPI flash & OTA docs to reflect functionality changes
* Refactor OTA implementation to perform checks mentioned in API doc
* Add new functions to OTA API: esp_ota_get_running_partition() & esp_ota_get_next_update_partition() functions
* Add spi_flash_cache2phys() & spi_flash_phys2cache() functions to support esp_ota_get_running_partition()


See merge request !513
2017-03-03 11:27:01 +08:00
Ivan Grokhotkov f3687f7177 spi_flash: fix memory leak when spi_flash_mmap arguments are invalid
Check src_addr and size first, then allocate new_entry.
2017-02-28 15:11:54 +08:00
Ivan Grokhotkov 75115e1d83 spi_flash: fix mmap not working for SPI_FLASH_MMAP_INST 2017-02-24 21:50:05 +08:00
Angus Gratton 093dd98101 spi_flash: Add new phys2cache & cache2phys functions to query flash cache mappings 2017-02-22 10:22:50 +11:00
Angus Gratton d8aae55eeb Flash encryption: Temporary fix for issue with stale cache reads
Seems doing certain kinds of short reads while flash encryption is
enabled will return stale data. This fixes it, but is probably a
little heavy-handed performance wise.
2017-01-26 18:29:18 +11:00
Angus Gratton d4462664b7 spi_flash: Move FLASH_PAGE_SIZE constant into esp_spi_flash.h 2017-01-20 19:50:01 +08:00
Angus Gratton 36ccdee6ec spi_flash: Flush flash cache if flash_mmap()ing a written-to page
Without this, it's possible for stale information to be read from
cache via mmap, even if the MMU table entry had been invalidated
prior to writing flash (if  the same MMU table entry was re-used after
writing flash.)
2017-01-20 19:48:46 +08:00
Angus Gratton ab5915ff8b spi_flash: Standardise argument types & names used for flash offsets
Closes github #88: https://github.com/espressif/esp-idf/issues/88
2016-12-22 15:07:02 +11:00
Ivan Grokhotkov e229ec0340 spi_flash: check physical address in mmap against flash chip size 2016-10-27 17:58:42 +08:00
Ivan Grokhotkov 42068c3b36 spi_flash: implement mmap/munmap 2016-10-27 17:57:29 +08:00