Commit graph

19 commits

Author SHA1 Message Date
Ivan Grokhotkov c928bcc4b8 spi_flash: don't call vTaskDelay in non-os context
Fixes regression in core dump, when a crash happens in interrupt
context.
2020-09-04 21:24:32 +02:00
KonstantinKondrashov 754f59fba7 spi_flash(new driver): Add a Kconfig option - Bypass a block erase and always do sector erase
Closes: IDF-1561
2020-05-22 05:07:20 +00:00
KonstantinKondrashov a128eae7b8 spi_flash(new driver): Add vTaskDelay while a long erasing 2020-05-22 05:07:20 +00:00
Angus Gratton c38c3ff3f0 spi_flash: Remove 16KB free internal heap limit for esp_flash_read() into PSRAM
Allocation of the temporary internal buffer will now repeat until a small enough buffer can be
allocated, and only fail if less than a 256 byte block of internal RAM is free.

Adds unit test for the same, and generic test utility for creating memory pressure.
2020-03-09 09:59:43 +11:00
Angus Gratton af4c6ac0f3 spi_flash: Fix over-allocation and OOM crash when reading from SPI flash to PSRAM buffers
Previously would try allocate buffer of minimum size 16KB not maximum size 16KB, causing
out of memory errors for any large reads, or if less than 16KB contiguous free heap.

Also, if using legacy API and internal allocation failed then implementation would abort()
instead of returning the error to the caller.

Added test for using large buffers in PSRAM.

Closes https://github.com/espressif/esp-idf/issues/4769

Also reported on forum: https://esp32.com/viewtopic.php?f=13&t=14304&p=55972
2020-03-05 17:11:26 +11:00
Michael (XIAO Xufeng) b5d04a21fb esp_flash: fix the quad issue for some GD flash chips
The GD flash with product ID 40H, is already used in Wrover-nosufix modules.
2019-11-21 12:26:15 +08:00
Michael (XIAO Xufeng) 2b7681ec4f esp_flash: fix set qe bit and write command issues
There used to be dummy phase before out phase in common command
transactions. This corrupts the data.

The code before never actually operate (clear) the QE bit, once it finds
the QE bit is set. It's hard to check whether the QE set/disable
functions work well.

This commit:

1. Cancel the dummy phase

2. Set and clear the QE bit according to chip settings, allowing tests
   for QE bits. However for some chips (Winbond for example), it's not
   forced to clear the QE bit if not able to.

3. Also refactor to allow chip_generic and other chips to share the same
   code to read and write qe bit; let common command and read command share
   configure_host_io_mode.

4. Rename read mode to io mode since maybe we will write data with quad
   mode one day.
2019-11-21 12:26:14 +08:00
Ivan Grokhotkov e5ff431b35 Merge branch 'fix/esp_flash_coredump_4.0' into 'release/v4.0'
esp_flash: fix coredump issues (backport v4.0)

See merge request espressif/esp-idf!6136
2019-09-26 21:26:53 +08:00
michael 0bba92b2a0 esp_flash: put adapter to legacy functions into IRAM to be back-compatible 2019-09-18 15:16:00 +08:00
Michael (XIAO Xufeng) d3b54ec84a esp_flash: fix the coredump issue
During coredump, dangerous-area-checking should be disabled, and cache
disabling should be replaced by a safer version.

Dangerous-area-checking used to be in the HAL, but it seems to be more
fit to os functions. So it's moved to os functions. Interfaces are
provided to switch between os functions during coredump.
2019-09-18 14:30:23 +08:00
Michael (XIAO Xufeng) e4b44f3488 esp_flash: fix coredump for legacy spi flash API
When legacy mode is used, the coredump still fails during linking
because "esp_flash_init_default_chip", "esp_flash_app_init" and
"esp_flash_default_chip " are not compiled and linked.

Instead of using ``if`` macros in callers, these functions are protected
by ``if`` macros in the header, and also not compiled in the sources.
"esp_flash_default_chip" variable is compiled with safe default value.
2019-09-18 14:28:12 +08:00
Michael (XIAO Xufeng) b9a2639ab4 esp_flash: add support for encrypted read and write
Using legacy implementation.
2019-09-16 17:10:08 +08:00
Ivan Grokhotkov ad100e497a spi_flash: remove duplicate definition of spi_flash_unlock
The other (static) definition is in flash_ops.c, all references are
also in flash_ops.c.
2019-09-10 17:18:51 +02:00
Michael (XIAO Xufeng) 1cc860216e esp_flash: fix the set/get write protection functions
Add support for get write protection support, fixed the duplicated
set_write_protection link.

All the write_protection check in the top layer are removed. The lower
levels (chip) should ensure to disable write protection before the
operation start.
2019-08-20 14:05:35 +08:00
Ivan Grokhotkov ec427a5b43 spi_flash: support for partitions in external flash 2019-07-02 10:26:06 +02:00
Michael (XIAO Xufeng) d6bd24ca67 esp_flash: add initialization interface for SPI devices 2019-06-27 13:27:27 +08:00
Michael (XIAO Xufeng) 37cb673cd7 esp_flash: update the document to the latest API 2019-06-20 11:50:23 +08:00
Ivan Grokhotkov 026533cd72 esp_flash: fix C++ compilation and some typos 2019-06-20 10:55:13 +08:00
Michael (XIAO Xufeng) 1036a091fe spi_flash: support working on differnt buses and frequency 2019-06-18 06:32:52 +00:00