Virtual Efuses Not Working

sidwarkd
Posts: 9
Joined: Mon Aug 02, 2021 9:34 pm

Virtual Efuses Not Working

Postby sidwarkd » Sat Mar 04, 2023 10:05 pm

I have an existing project that runs as desired. I am looking to enable Secure Boot and so I would like to use virtual efuses to test. Before enabling Secure Boot I decided to just enable virtual efuses to make sure everything still ran the same but it does not. In fact it doesn't run at all now. But what is strange is that the efuses shown in the boot output are not the correct state of my efuses at all.

When I dump my efuses this is the output I get:

Code: Select all

Detecting chip type... ESP32
BLOCK0          (                ) [0 ] read_regs: 00110080 6d31ca18 0024e89f 0000ad00 00000436 f015de26 00000344
BLOCK1          (flash_encryption) [1 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK2          (secure_boot_v1 s) [2 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
BLOCK3          (                ) [3 ] read_regs: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000

EFUSE_REG_DEC_STATUS        0x00000000
And then when I boot my device I see the following:

Code: Select all

W (85) efuse: Loading virtual efuse blocks from flash
EFUSE_BLKx:
0) 0x023c8564 0xa1701079 0x10f4f5f8 0xa1a402fa 0x023c8564 0xa1701079 0x10f4f5f8 
1) 0x65778af8 0xd1407f74 0xfa268f21 0x24b18f14 0x65778af8 0xd1407f74 0xfa268f21 0x24b18f14 
2) 0xedf0e0c3 0xbf46abd3 0xf6955dfa 0x4319559a 0xedf0e0c3 0xbf46abd3 0xf6955dfa 0x4319559a 
3) 0x89d94c1c 0xd589f44d 0x29a97c06 0xcba24d68 0x89d94c1c 0xd589f44d 0x29a97c06 0xcba24d68 
I did erase the virtual efuse region of memory so it shouldn't be reading random garbage. I confirmed this by dumping the region with esptool and saw all 0xFF. I do have flash encryption enabled. Not sure if that has any effect. A few questions.

1. Why don't the efuses read from flash match?
2. Do I need to mark the efuse_em partition as encrypted? (it is currently not)
3. Can the efuse_em partition be anywhere in the partition table? If not, where does it specifically need to go.

I appreciate any help.

sidwarkd
Posts: 9
Joined: Mon Aug 02, 2021 9:34 pm

Re: Virtual Efuses Not Working

Postby sidwarkd » Mon Mar 06, 2023 2:56 pm

Did some more testing with this today on a dev kit with a fresh project. Starting from scratch the virtual efuses loaded correctly based on what the espefuse.py dump command showed. However, the device still wouldn't boot fully. This is with a simple hello world project. I then enabled flash encryption in menuconfig and booted again. Now all of the efuses shown loaded from flash are garbage. Device does still not boot.

sidwarkd
Posts: 9
Joined: Mon Aug 02, 2021 9:34 pm

Re: Virtual Efuses Not Working

Postby sidwarkd » Mon Mar 06, 2023 6:52 pm

Posted reproducible issue to IDF repo. Including here in case somebody finds this post later. https://github.com/espressif/esp-idf/issues/10925

Also posted this issue as well which is related. https://github.com/espressif/esp-idf/issues/10929

Seems that you cannot have flash encryption enabled (real efuses) and use virtual efuses at the same time. Flash encryption must be disabled first which is unfortunate.

Who is online

Users browsing this forum: axellin and 108 guests