esp_secure_boot_v2_permanently_enable() function
Enables secure boot V2 if it is not already enabled. @important If this function succeeds, secure boot V2 is permanently enabled on the chip via efuse. @important This function is intended to be called from bootloader code only. @important In case of Secure Boot V2, this will enable write protection of secure boot key on EFUSE in BLK2. .If secure boot is not yet enabled for bootloader, this will 1) enable W protection of secure boot key on EFUSE 2) enable secure boot by blowing the EFUSE_RD_ABS_DONE_1 efuse. This function does not verify secure boot of the bootloader (the ROM bootloader does this.) Will fail if efuses have been part-burned in a way that indicates secure boot should not or could not be correctly enabled.
Arguments
image_data
Image metadata of the application to be loaded.
Return value
ESP_ERR_INVALID_STATE if efuse state doesn't allow secure boot to be enabled cleanly. ESP_OK if secure boot is enabled on this chip from now on.