Commit Graph

35 Commits

Author SHA1 Message Date
Armando
5948c4b8ff spi_flash: rename spi_flash_os_func_app: spi_start, spi_end
spi_start -> s_acquire_spi_bus_lock
spi_end -> s_release_spi_bus_lock
2023-06-28 11:08:05 +08:00
Armando
0e6d3aa9cd spi_flash: fix concurrency issue when calling esp_flash apis under xip_psram or auto_suspen 2023-06-28 11:08:05 +08:00
Armando
f1f446d495 spiflash: fix not calling on_spi_acquired when CONFIG_SPI_FLASH_SHARE_SPI1_BUS issue 2023-06-28 11:08:05 +08:00
Adam Múdry
cfc8332833 spi: Mask esp_flash_erase chip with esp_flash_erase_sector
add: Fix to prevent WDT trigger
add: comments to better explain SPI API

Closes https://github.com/espressif/esp-idf/issues/9945
Closes https://github.com/espressif/esp-idf/issues/9212
Closes https://github.com/espressif/esp-idf/issues/8135
2023-01-08 13:58:37 +00:00
Matus Fabo
1b747867bd spi: implement yield for spi2 and spi3
add: yield functions for spi2 and spi3
add: spi23 start and end functions
change: function names with spi1 that were not specific to spi1
change: chip data for spi2 and spi3 increased for timestamps
change: merge spi_app_func_arg_t into app_func_arg_t
change: moved os_func_data allocation before host check
2023-01-08 13:58:37 +00:00
wanlei
3c37bccb04 spi_flash: fix flash function arg_check with spi host_id 2022-12-21 20:03:46 +08:00
gaoxu
0909f5b230 system: don't disable cache if Flash .text and .rodata are moved to PSRAM 2022-09-19 12:23:23 +08:00
Cao Sen Miao
a690a87829 spi_flash: Remove legacy spi_flash drivers 2022-07-01 11:01:34 +08:00
Armando
f31d88e3fe spi: move spi_common_internal to esp_private 2022-06-24 19:12:13 +08:00
Cao Sen Miao
6a2d3509dc spi_flash: Making XMC flash works more stable when brownout detected 2022-06-02 10:38:55 +08:00
Michael (XIAO Xufeng)
46b5363e39 spi_flash: forbid writing to main flash when using invalid init arguments
Also refactored the init code to make the logic of device (CS) acquiring
more centralized.

Resolves: https://github.com/espressif/esp-idf/issues/8556
2022-04-13 18:02:34 +08:00
Anton Maklakov
68e5d9d585 Remove IRAM_ATTR from any function declarations
IRAM_ATTR expands to a unique section attribute. Applying it to both
declaration and definition results in a section conflict.
2022-03-22 09:58:50 +00:00
KonstantinKondrashov
884a6b17cc spi_flash: No CPU release time for an erase operation when OS is not running
During the early start, the virtual eFuse mode can call erase operations when OS is not yet running.

Possible workaround: CONFIG_SPI_FLASH_YIELD_DURING_ERASE=n

Fixed for the legacy flash driver as well.
2021-11-01 21:49:24 +08:00
Omar Chebib
b967dc0dbf espsystem: add support for RISC-V panic backtrace
Add .eh_frame and .eh_frame_hdr sections to the binary (can be
enabled/disabled within menuconfig). These sections are parsed
when a panic occurs. Their DWARF instructions are decoded and
executed at runtime, to retrieve the whole backtrace. This
parser has been tested on both RISC-V and x86 architectures.

This feature needs esptool's merge adjacent ELF sections feature.
2021-07-13 15:42:40 +08:00
Armando
9b9ea71ff9 spi: remove HSPI macro on esp32c3 and esp32s3 2021-04-06 13:42:49 +08:00
KonstantinKondrashov
60e58eaddb spi_flash: Add auto-suspend mode for ESP32-S2
Uses HW auto_wait_idle, HW auto_suspend and SW resume
2021-01-25 11:13:38 +08:00
Michael (XIAO Xufeng)
8ae09194ac esp_flash: refactor to support various type of yield
There is a periodically yield in the esp_flash driver, to ensure the
cache will not be disabled for too long on ESP32.

On ESP32-S2 and later, we need to support more different kind of yield:

1. polling conditions, including timeout, SW read request, etc.
2. wait for events, including HW done/error/auto-suspend, timeout
semaphore, etc.

The check_yield() and yield() is separated into two parts, because we
may need to insert suspend, etc. between them.
2020-11-10 19:05:22 +08:00
Michael (XIAO Xufeng)
2d440e408a esp_flash: fix the data type of delay_us
unsigned can be 16-bit on some architecture, which doesn't meet the
requirements of delaying for several hundreds of us.
2020-08-31 18:10:32 +00:00
morris
2917651478 esp_rom: extract common ets apis into esp_rom_sys.h 2020-07-27 15:27:01 +08:00
Michael (XIAO Xufeng)
a9c8895bb2 esp_flash: refactor to be compatible with the latest ROM
Including:
1. Change the write bytes/read bytes parameter in the host driver into slicers to meet the requirements of complicated cases.
2. Refactor the esp_flash_api code a bit so that we can use the code in the ROM laster
3. Provide get_temp_buffer and release_temp_buffer in the os_functions when the buffer passed by application cannot be used directly.
4. Make timeout of operations configurable in the chip_driver.
5. Make dummy number configurable.
2020-07-12 02:09:45 +08:00
Ivan Grokhotkov
03bb2774d9 spi_flash: don't call vTaskDelay in non-os context
Fixes regression in core dump, when a crash happens in interrupt
context.
2020-06-02 15:42:24 +02:00
Michael (XIAO Xufeng)
651eb1a694 esp_flash: fix the write performance regression
Also changed internal delay unit into microsecond.
2020-05-17 22:06:02 +08:00
Michael (XIAO Xufeng)
dae3196157 esp_flash: fix issue that cannot add flash on SPI1 CS1 when SPI_FLASH_SHARE_SPI1_BUS is disabled 2020-05-17 22:06:00 +08:00
michael
fdf983e0c4 spi: fix config break and reduce overhead of the bus lock on SPI1
The SPI bus lock on SPI1 introduces two side effects:

1. The device lock for the main flash requires the
`CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION` to be selected, however this
option is disabled by default in earlier IDF versions. Some developers
may find their project cannot be built by their old sdkconfig files.

2. Usually we don't need the lock on the SPI1 bus, due to it's
restrictions. However the overhead still exists in this case, the IRAM
cost for static version of semaphore functions, and the time cost when
getting and releasing the lock.

This commit:

1. Add a CONFIG_SPI_FLASH_BYPASS_MAIN_LOCK option, which will forbid the
space cost, as well as the initialization of the main bus lock.

2. When the option is not selected, the bus lock is used, the
`CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION` will be selected explicitly.

3. Revert default value of `CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION`
to `n`.

introduced in 49a48644e4.

Closes https://github.com/espressif/esp-idf/issues/5046
2020-04-22 16:06:13 +08:00
Michael (XIAO Xufeng)
49a48644e4 spi: allow using esp_flash and spi_master driver on the same bus 2020-03-26 22:08:26 +08:00
morris
e30cd361a8 global: rename esp32s2beta to esp32s2 2020-01-22 12:14:38 +08:00
morris
1c2cc5430e global: bring up esp32s2(not beta) 2020-01-16 17:41:31 +08:00
Renz Christian Bagaporo
e6ad330018 ble_mesh_wifi_coexist example: Disable Wi-Fi RX IRAM optimisation
Otherwise IRAM usage is too high in this example.
2019-11-28 09:20:00 +08:00
Angus Gratton
adfc06a530 Merge branch 'master' into feature/esp32s2beta_merge 2019-09-20 10:28:37 +10:00
Michael (XIAO Xufeng)
511820820e 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-14 17:01:36 +08:00
Angus Gratton
8f74271d5d esp_rom: Fail immediately if the wrong SoC's header file is included 2019-08-12 16:57:40 +10:00
Angus Gratton
2f56116db2 Cleanup of previous merge commit 2019-08-12 16:57:40 +10:00
Michael (XIAO Xufeng)
d6bd24ca67 esp_flash: add initialization interface for SPI devices 2019-06-27 13:27:27 +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