Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling flash encryption with ESP-AT result in a missing partition error. #818

Open
3 tasks done
charmed12 opened this issue Mar 27, 2024 · 1 comment
Open
3 tasks done

Comments

@charmed12
Copy link

charmed12 commented Mar 27, 2024

Answers checklist.

  • I have read the documentation ESP-AT Programming Guide and the issue is not addressed there.
  • I have used the latest released firmware or have updated my ESP-AT branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

Hi,

I would like to activate flash encryption on the ESP32 WROOM module. I have successfully enabled it using the Menuconfig in development mode. Additionally, I have configured the log bootloader to none and enabled the bootloader to optimize size. Here is the partition table:

Name, Type, SubType, Offset, Size, Flags

phy_init, data, phy, 0x10000, 0x1000, encrypted
otadata, data, ota, 0x11000, 0x2000, encrypted
nvs, data, nvs, 0x13000, 50K
at_customize, 0x40, 0, 0x20000, 0xE0000
ota_0, app, ota_0, 0x100000, 0x180000, encrypted
ota_1, app, ota_1, 0x280000, 0x180000, encrypted

Name, Type, SubType, Offset, Size, Flags

mfg_nvs, data, nvs, 0x21000, 112K,encrypted
fatfs, data, fat, 0x70000, 576K, encrypted

I deleted all OTA partitions.
I encountered an issue where the factory_param partition was missing. I conducted tests on some AT commands which were successful, however, I encountered errors when trying to use AT+sysflash, AT+BLEGATTSSRVCRE, and AT+BLEGATTSSRVSTART. I must resolve this issue promptly as I need to flash the ble_data partition via the AT command.

After debugging the esp-at code i notice that const esp_partition_t *partition = esp_at_custom_partition_find(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_NVS, g_at_mfg_nvs_name); can't find the g_at_mfg_nvs_name and factory_param partition, even if at_customize is not encrypted and others partitions are encrypted i got the same resualt. esp_at_custom_partition_find. i'm asking if there is any solutions to encrypt nvs partition, and use gatt server (ble_data partition) on esp-at FW ? Or how to resolve this issue? Thank you (I tested on v4.0.0 ,v3.2.0.0 and 2.1.0.0) esp32 Wroom

@ustccw
Copy link
Collaborator

ustccw commented May 21, 2024

esp_at_custom_partition_find(type, subtype, label); will call esp_partition_find_first(0x40, 0, "at_customize"); to get the information of secondary partition table (at_customize.bin), and find the label == "mfg_nvs", could you please add more debug info in esp_partition_find_first().

The factory_param namespace belongs to mfg_nvs partition, and mfg_nvs partition is initialized as nvs by nvs_flash_init_partition_ptr(). Since this partition is encrypted, you
have to initialize this partition as nvs by nvs_flash_secure_init_partition() related APIs, so that the following nvs_open_from_partition() related APIs can fetch the right data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants