spi_flash s2: Fix encrypted writes when legacy implementation disabled

ROM function didn't use correct Addr bitlen if legacy was disabled on ESP32-S2
This commit is contained in:
Angus Gratton
2020-04-16 21:32:13 +10:00
committed by Felipe Neves
parent dbdce93d23
commit bb0a95b17c
2 changed files with 17 additions and 8 deletions

View File

@@ -24,9 +24,11 @@ static void example_read_write_flash(void);
static const char* TAG = "example";
#if CONFIG_IDF_TARGET_ESP32
#define TARGET_CRYPT_CNT_EFUSE ESP_EFUSE_FLASH_CRYPT_CNT
#define TARGET_CRYPT_CNT_EFUSE ESP_EFUSE_FLASH_CRYPT_CNT
#define TARGET_CRYPT_CNT_WIDTH 7
#elif CONFIG_IDF_TARGET_ESP32S2
#define TARGET_CRYPT_CNT_EFUSE ESP_EFUSE_SPI_BOOT_CRYPT_CNT
#define TARGET_CRYPT_CNT_WIDTH 3
#endif
void app_main(void)
@@ -59,7 +61,7 @@ static void example_print_chip_info(void)
static void example_print_flash_encryption_status(void)
{
uint32_t flash_crypt_cnt = 0;
esp_efuse_read_field_blob(TARGET_CRYPT_CNT_EFUSE, &flash_crypt_cnt, 7);
esp_efuse_read_field_blob(TARGET_CRYPT_CNT_EFUSE, &flash_crypt_cnt, TARGET_CRYPT_CNT_WIDTH);
printf("FLASH_CRYPT_CNT eFuse value is %d\n", flash_crypt_cnt);
esp_flash_enc_mode_t mode = esp_get_flash_encryption_mode();