esp-idf/components
Michael (XIAO Xufeng) d2f9113d14 bootloader: fix the WRSR format for ISSI flash chips
1. The 2nd bootloader always call `rom_spiflash_unlock()`, but never help to clear the WEL bit when exit. This may cause system unstability.

   This commit helps to clear WEL when flash configuration is done.

   **RISK:** When the app starts, it didn't have to clear the WEL before it actually write/erase. But now the very first write/erase operation should be done after a WEL clear. Though the risk is little (all the following write/erase also need to clear the WEL), we still have to test this carefully, especially for those functions used by the OTA.

2. The `rom_spiflash_unlock()` function in the patch of ESP32 may (1) trigger the QPI, (2) clear the QE or (3) fail to unlock the ISSI chips.

   Status register bitmap of ISSI chip and GD chip:

| SR | ISSI | GD25LQ32C |
| -- | ---- | --------- |
| 0  | WIP  | WIP       |
| 1  | WEL  | WEL       |
| 2  | BP0  | BP0       |
| 3  | BP1  | BP1       |
| 4  | BP2  | BP2       |
| 5  | BP3  | BP3       |
| 6  | QE   | BP4       |
| 7  | SRWD | SRP0      |
| 8  |      | SRP1      |
| 9  |      | QE        |
| 10 |      | SUS2      |
| 11 |      | LB1       |
| 12 |      | LB2       |
| 13 |      | LB3       |
| 14 |      | CMP       |
| 15 |      | SUS1      |

   QE bit of other chips are at the bit 9 of the status register (i.e. bit 1 of SR2), which should be read by RDSR2 command.

   However, the RDSR2 (35H, Read Status 2) command for chip of other vendors happens to be the QIOEN (Enter QPI mode) command of ISSI chips. When the `rom_spiflash_unlock()` function trys to read SR2, it may trigger the QPI of ISSI chips.

   Moreover, when `rom_spiflash_unlock()` try to clear the BP4 bit in the status register, QE (bit 6) of ISSI chip may be cleared by accident. Or if the ISSI chip doesn't accept WRSR command with argument of two bytes (since it only have status register of one byte), it may fail to clear the other protect bits (BP0~BP3) as expected.

   This commit makes the `rom_spiflash_unlock()` check whether the vendor is issi. if so, `rom_spiflash_unlock()` only send RDSR to read the status register, send WRSR with only 1 byte argument, and also avoid clearing the QE bit (bit 6).

3. `rom_spiflash_unlock()` always send WRSR command to clear protection bits even when there is no protection bit active. And the execution of clearing status registers, which takes about 700us, will also happen even when there's no bits cleared.

   This commit skips the clearing of status register if there is no protection bits active.

Also move the execute_flash_command to be a bootloader API; move
implementation of spi_flash_wrap_set to the bootloader
2022-10-17 19:15:25 +08:00
..
app_trace gcov: ipc component name changei 2021-11-12 19:28:07 +03:00
app_update otatool: Fix a crash when imported as external python lib 2021-08-05 15:30:58 +08:00
asio asio: updated ASIO port to use latest asio and esp-idf features 2020-01-09 21:53:50 +01:00
bootloader Merge branch 'bugfix/setjmp_longjmp_4.1' into 'release/v4.1' 2021-08-10 03:35:12 +00:00
bootloader_support bootloader: fix the WRSR format for ISSI flash chips 2022-10-17 19:15:25 +08:00
bt Merge branch 'bugfix/a2dp_can_not_connect_after_ble_connected_v4.1' into 'release/v4.1' 2022-10-10 17:25:46 +08:00
cbor cbor: add tinycbor library and example 2019-08-22 17:44:29 +08:00
coap coap: move mbedTLS config options from component to examples 2020-05-26 20:05:33 +05:30
console
cxx [C++]: wrapper functions around unwind code 2021-06-01 14:51:15 +08:00
driver Update the note of the gpio_intr_enable function 2022-07-13 03:07:11 +00:00
efuse Merge branch 'bugfix/fix_esp32h2_efuse_get_ext_mac_v4.1' into 'release/v4.1' 2021-12-15 15:33:12 +00:00
esp32 pm_impl: fix neither enter light sleep nor enter waiti state in idle task 2022-07-13 03:06:37 +00:00
esp32s2beta pm_impl: fix neither enter light sleep nor enter waiti state in idle task 2022-07-13 03:06:37 +00:00
esp_adc_cal [cxx]: fixed extern "C" declarations 2021-04-23 07:35:47 +00:00
esp_common versions: Update version to 4.1.3 2022-04-13 11:43:45 +02:00
esp_eth ci/esp_eth: Make the ICMP destination localhost 2022-07-14 04:46:45 +00:00
esp_event esp_wifi: Add beacon timeout event 2021-12-06 15:16:37 +08:00
esp_gdbstub gdbstub: fix thread list generation 2021-06-18 16:04:02 +02:00
esp_http_client esp_http_client: Fix HEAD request will affect the all next HTTP requests unless we close the HTTP request 2021-10-29 10:21:07 +08:00
esp_http_server esp_http_server: Add lru_socket flag in sock_db to indicate httpd_sess_close is called from httpd_sess_close_lru 2021-01-22 11:16:50 +05:30
esp_https_ota esp_http_client: Fixed handling of EAGAIN return 2021-09-20 18:22:21 +05:30
esp_https_server
esp_local_ctrl esp_local_ctrl: Fix some memory leak issues by coverity static analyzer. 2021-01-18 11:38:00 +05:30
esp_netif lwip: Fixed that ipv6 dns cannot work 2022-07-15 16:21:17 +08:00
esp_ringbuf ringbuf: Fix bug where comparision between a signed and unsigned operand resulted in incorrect free size for no-split/allow-split buffers 2021-12-27 15:13:52 +08:00
esp_rom bootloader: fix the WRSR format for ISSI flash chips 2022-10-17 19:15:25 +08:00
esp_serial_slave_link essl: new component to communicate with esp serial slave devices 2019-12-03 22:58:41 +08:00
esp_websocket_client Add options for esp_http_client and esp_websocket_client to support keepalive 2021-03-31 05:44:48 +00:00
esp_wifi esp_wifi: fix espnow recv unencrypted packets issue 2022-08-04 15:10:22 +08:00
esp-tls Fix esp_mbedtls_write API 2021-09-16 09:07:48 +05:30
espcoredump coredump: Fixes ESP-specific panic reasons handling 2021-11-25 09:43:32 +01:00
esptool_py esptool: Update to fix espsecure.py sign_data default version argument 2021-05-03 04:44:50 +00:00
expat expat: Update library from 2.2.9 to 2.4.1 2021-09-03 16:32:39 +08:00
fatfs fatfs: Fix some memory leak issues by coverity static analyzer. 2021-01-18 11:36:53 +05:30
freemodbus modbus: add additional timer group options for master 2022-06-13 11:44:46 +00:00
freertos freertos: Fix flakey event group unit test 2022-09-19 15:14:24 +08:00
heap components: fix ldgen check errors 2021-06-21 09:52:03 +10:00
idf_test spi_flash_test: remove threshold from unit test 2022-01-18 16:34:19 +08:00
jsmn jsmn: define macros in build system 2019-11-29 18:05:24 +08:00
json cJSON: Update submodule to latest release. 2021-09-06 07:44:42 +05:30
libsodium ut: Move tests back from "esp32" subfolder 2020-01-06 17:13:53 +08:00
log log: correct timestamp formatting to unsigned integer type 2021-03-04 11:54:47 +05:30
lwip lwip: Add macro to disable vendor class option 2021-12-16 11:42:58 +08:00
mbedtls mbedtls: upgrade to release v2.16.12 2021-12-21 14:08:11 +05:30
mdns mdns: Fix of crash when wifi interface get deleted and mdns receives the packets 2021-06-15 16:54:44 +08:00
mqtt MQTT: Update submodule reference to support new config modes 2021-05-25 09:56:29 +02:00
newlib newlib: Fix a case in FD_ISSET macro when n==-1 2021-07-15 11:18:31 +08:00
nghttp nghttp2: upgrade to v1.41.0 release 2021-10-01 04:10:51 +08:00
nvs_flash [doc]: NVS documentation updates 2021-12-17 16:13:23 +08:00
openssl openssl: made verification mode conversion to mbetls modes more strict 2020-09-21 13:21:41 +00:00
partition_table partition_table: Fix case when a few similar to otadata partitions in the table 2021-10-26 16:49:26 +08:00
perfmon xtensa: update header file 2019-12-09 09:44:56 +08:00
protobuf-c
protocomm protocomm: Fixed NULL check of allocated memory 2021-03-05 10:10:55 +05:30
pthread pthread: Fix possible deadlock when using pthread_join() and Debug log level 2021-06-07 02:15:36 +00:00
sdmmc sdmmc: fix the probe issue that forbid sdspi working in highspeed mode 2020-07-28 17:38:37 +08:00
soc bootloader: fix the WRSR format for ISSI flash chips 2022-10-17 19:15:25 +08:00
spi_flash bootloader: fix the WRSR format for ISSI flash chips 2022-10-17 19:15:25 +08:00
spiffs test_spiffs: increase test case stack size 2022-10-17 19:15:24 +08:00
tcp_transport Modify esp-tls and tcp_transport to support keep alive for tcp and ssl connection 2021-03-31 05:44:48 +00:00
tcpip_adapter Set default AP handlers in wifi_create_and_start_ap() 2020-09-15 14:53:11 +08:00
ulp Tools: add Python 2 deprecation warning 2020-12-09 14:41:33 +01:00
unity ut: add DISABLED_FOR_TARGETS macros to control ut building 2020-01-06 17:13:47 +08:00
vfs VFS: select function's timeout is now POSIX compliant 2021-11-30 12:29:35 +08:00
wear_levelling ut: Move tests back from "esp32" subfolder 2020-01-06 17:13:53 +08:00
wifi_provisioning provisioning: fix wifi warning in wifi_prov_mgr application 2021-08-18 18:35:14 +08:00
wpa_supplicant wpa_supplicant: Unicast key renew in TKIP mic failure 2022-08-03 14:52:43 +05:30
xtensa [system]: Made longjmp save for context switch 2021-06-01 07:38:50 +00:00