ESP32 NVS flash encryption compilation error


I’m trying to develop a very basic application using the NVS Flash encryption features on a ESP32 WROVER KIT.

I’m using:

  • Platform: espressif32 version 1.11.2
  • framework-espidf: I can’t find a versioning of this module. Is it maintained by Plateformio ? I’m asking this because I saw on the esp-idf Github that a new version 4.0 is out since last month and I was wondering how these updates are imported to Plateformio. How are these sources (esp-idf and Platformio framework-espidf) linked and updated ?

I activated the following options in my sdkconfig.h:



My problem is that the compilation of the bootloader fails:

.pio\build\esp-wrover-kit\bootloader\libbootloader_support.a(flash_encrypt.o):(.literal.encrypt_flash_contents+0x80): undefined reference to `esp_efuse_write_random_key'
.pio\build\esp-wrover-kit\bootloader\libbootloader_support.a(flash_encrypt.o):(.literal.encrypt_flash_contents+0x84): undefined reference to `esp_efuse_burn_new_values'
.pio\build\esp-wrover-kit\bootloader\libbootloader_support.a(flash_encrypt.o): In function `encrypt_flash_contents':
flash_encrypt.c:(.text.encrypt_flash_contents+0xcb): undefined reference to `esp_efuse_write_random_key'
flash_encrypt.c:(.text.encrypt_flash_contents+0xd1): undefined reference to `esp_efuse_burn_new_values'
flash_encrypt.c:(.text.encrypt_flash_contents+0xe2): undefined reference to `esp_efuse_burn_new_values'
flash_encrypt.c:(.text.encrypt_flash_contents+0x11b): undefined reference to `esp_efuse_burn_new_values'
flash_encrypt.c:(.text.encrypt_flash_contents+0x2ca): undefined reference to `esp_efuse_burn_new_values'
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\esp-wrover-kit\bootloader.elf] Error 1

What am I missing ?

Note: New features for the Flash encryption has been added in the esp-idf 4.0 release (CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT). Is this related to my problem ?

Yes the packaging and PlatformIO build scripts are maintained by PIO, the ESPIDF content comes from . See Service End for Bintray, JCenter, GoCenter, and ChartCenter | JFrog for available versions.

From Releases · platformio/platform-espressif32 · GitHub this uses ESP-IDF 3.3 LTS version. So no 4.0.

Already asked in Support for ESP IDF v4 - #3 by ivankravets

Due to the fact that PIO is not using ESP IDF v4 right now probably.

Most interestingly there’s already a v4 package but no announcement has been made yet, so idk how well it works. You may give at a shot to do

platform =
platform_packages =  

in the platformio.ini

Thank you for all this info.

I might try this out but I will most probably wait for Platformio to release the new framework version.
I checked out the V4 because of the new NVS encryption example they published.

Just to close this thread, I checked out the version 4.0 of the official esp-idf repo and managed to execute their exemple after a few manipulations. I will use this until the release of the new Platfromio framework version.

Thanks a lot for the help !

Keep an eye on espidf-40 branch of platform-espressif32 to see what’s happening, as valeros appears to be hard at work at porting the ESPIDF v4.0. This branch was pushed to the main develop branch two days ago, so it shouldn’t be too far away from going live, after it’s had some more tyre kicking testing I presume.