乐鑫技术交流
直播中

百合子

8年用户 915经验值
擅长:控制/MCU
私信 关注
[问答]

调用ets_efuse_program有概率导致卡死,复位后无法验证sha256怎么解决?

调用ets_efuse_program有概率导致卡死,复位后无法验证sha256

开发板为esp-c3-13-kit 内置4m

由于真写efuse比较费芯片,我找到了一个能复现问题的方法,不用费芯片

注释掉ets_efuse_program就不会触发


程序:
Code: [Select all] [Expand/Collapse]
  • void app_main(void)
  • {
  •     uint8_t data[={0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11};
  •     esp_efuse_set_key_dis_write(EFUSE_BLK_KEY0);
  •     esp_efuse_set_key_dis_read(EFUSE_BLK_KEY0);
  •     esp_err_t ret = esp_efuse_write_field_blob(ESP_EFUSE_KEY0,data,32*8);
  •     printf("Hello world!n");
  •     vTaskDelay(100 / porttiCK_PERIOD_MS);
  •     esp_restart();
  •     while(1);
  • }



GeSHi © Codebox Plus Extension





执行一会之后就能看到日志:

ESP-ROM:esp32c3-api1-20210207

Build:Feb  7 2021

rst:0xc (RTC_SW_CPU_RST),boot:0xc (SPI_FAST_FLASH_BOOT)

Saved PC:0x40380648

0x40380648: esp_restart_noos at D:/Program_Files/esp-idf/components/esp_system/port/soc/esp32c3/system_internal.c:146 (discriminator 1)



SPIWP:0xee

mode:DIO, clock div:2

load:0x3fcd6100,len:0x1dbc

load:0x403ce000,len:0x9f0

load:0x403d0000,len:0x31f8

entry 0x403ce000

I (36) boot: ESP-IDF v4.4-dev-3042-g220590d599-dirty 2nd stage bootloader

I (37) boot: compile time 12:33:04

D (37) bootloader_flash: XMC chip detected by RDID (00204016), skip.

D (43) bootloader_flash: mmu set block paddr=0x00000000 (was 0xffffffff)

I (50) boot: chip revision: 3

D (54) boot.esp32c3: magic e9

D (57) boot.esp32c3: segments 03

D (60) boot.esp32c3: spi_mode 02

D (63) boot.esp32c3: spi_speed 00

D (67) boot.esp32c3: spi_size 02

I (70) boot.esp32c3: SPI Speed      : 40MHz

I (75) boot.esp32c3: SPI Mode       : DIO

I (79) boot.esp32c3: SPI Flash Size : 4MB

D (84) boot: Enabling RTCWDT(9000 ms)

I (88) boot: Enabling RNG early entropy source...

D (93) bootloader_flash: mmu set paddr=00010000 count=1 size=c00 src_addr=10000 src_addr_aligned=10000

D (103) boot: mapped partition table 0x10000 at 0x3c000000

D (108) flash_parts: partition table verified, 4 entries

I (114) boot: Partition Table:

I (117) boot: ## Label            Usage          Type ST Offset   Length

D (125) boot: load partition table entry 0x3c000000

D (130) boot: type=1 subtype=2

I (133) boot:  0 nvs              WiFi data        01 02 00011000 00006000

D (140) boot: load partition table entry 0x3c000020

D (145) boot: type=1 subtype=1

I (148) boot:  1 phy_init         RF data          01 01 00017000 00001000

D (156) boot: load partition table entry 0x3c000040

D (161) boot: type=0 subtype=0

I (164) boot:  2 factory          factory app      00 00 00020000 00100000

I (172) boot: End of partition table

D (176) boot: Trying partition index -1 offs 0x20000 size 0x100000

D (182) esp_image: reading image header @ 0x20000

D (187) bootloader_flash: mmu set block paddr=0x00020000 (was 0xffffffff)

D (194) esp_image: image header: 0xe9 0x06 0x02 0x02 403802d2

I (199) esp_image: segment 0: paddr=00020020 vaddr=3c020020 size=06b20h ( 27424) map

D (208) esp_image: free data page_count 0x0000003f

D (213) bootloader_flash: mmu set paddr=00020000 count=1 size=6b20 src_addr=20020 src_addr_aligned=20000

D (228) bootloader_flash: mmu set block paddr=0x00020000 (was 0xffffffff)

I (229) esp_image: segment 1: paddr=00026b48 vaddr=3fc89e00 size=01524h (  5412) load

D (238) esp_image: free data page_count 0x0000003f

D (243) bootloader_flash: mmu set paddr=00020000 count=1 size=1524 src_addr=26b48 src_addr_aligned=20000

D (253) bootloader_flash: mmu set block paddr=0x00020000 (was 0xffffffff)

I (259) esp_image: segment 2: paddr=00028074 vaddr=40380000 size=07fa4h ( 32676) load

D (267) esp_image: free data page_count 0x0000003f

D (272) bootloader_flash: mmu set paddr=00020000 count=2 size=7fa4 src_addr=28074 src_addr_aligned=20000

D (290) bootloader_flash: mmu set block paddr=0x00030000 (was 0xffffffff)

I (290) esp_image: segment 3: paddr=00030020 vaddr=42000020 size=165e8h ( 91624) map

D (297) esp_image: free data page_count 0x0000003f

D (302) bootloader_flash: mmu set paddr=00030000 count=2 size=165e8 src_addr=30020 src_addr_aligned=30000

D (332) bootloader_flash: mmu set block paddr=0x00040000 (was 0xffffffff)

I (332) esp_image: segment 4: paddr=00046610 vaddr=40387fa4 size=01ce0h (  7392) load

D (336) esp_image: free data page_count 0x0000003f

D (341) bootloader_flash: mmu set paddr=00040000 count=1 size=1ce0 src_addr=46610 src_addr_aligned=40000

D (352) bootloader_flash: mmu set block paddr=0x00040000 (was 0xffffffff)

I (357) esp_image: segment 5: paddr=000482f8 vaddr=50000000 size=00010h (    16) load

D (366) esp_image: free data page_count 0x0000003f

D (370) bootloader_flash: mmu set paddr=00040000 count=1 size=10 src_addr=482f8 src_addr_aligned=40000

D (380) bootloader_flash: mmu set block paddr=0x00040000 (was 0xffffffff)

D (387) boot: Calculated hash: c173afc7246778dcdd1fd5df44e7f5d8988b390d2a77578524a924cd78ff58c0

I (398) boot: Loaded app from partition at offset 0x20000

I (401) boot: Disabling RNG early entropy source...

D (407) boot: Mapping segment 0 as DROM

D (411) boot: Mapping segment 3 as IROM

D (415) boot: calling set_cache_and_start_app

D (419) boot: configure drom and irom and start

D (424) boot: start: 0x403802d2

0x403802d2: call_start_cpu0 at D:/Program_Files/esp-idf/components/esp_system/port/cpu_start.c:270



I (438) cpu_start: Pro cpu up.

I (447) cpu_start: Pro cpu start user code

I (447) cpu_start: cpu freq: 160000000

I (447) cpu_start: Application information:

I (449) cpu_start: Project name:     hello-world

I (455) cpu_start: App version:      1

I (459) cpu_start: Compile time:     Dec 12 2021 12:32:56

I (465) cpu_start: ELF file SHA256:  4b7334e6cff00b34...

I (471) cpu_start: ESP-IDF:          v4.4-dev-3042-g220590d599-dirty

I (478) heap_init: Initializing. RAM available for dynamic allocation:

I (486) heap_init: At 3FC8C2F0 len 00033D10 (207 KiB): DRAM

I (492) heap_init: At 3FCC0000 len 0001F060 (124 KiB): STACK/DRAM

I (499) heap_init: At 50000010 len 00001FF0 (7 KiB): RTCRAM

I (505) spi_flash: detected chip: generic

I (510) spi_flash: flash io: dio

I (514) sleep: Configure to isolate all GPIO pins in sleep state

I (520) sleep: Enable automatic switching of GPIO sleep configuration

I (528) cpu_start: Starting scheduler.

ESP-ROM:esp32c3-api1-20210207

Build:Feb  7 2021

rst:0x8 (TG1WDT_SYS_RST),boot:0xc (SPI_FAST_FLASH_BOOT)

Saved PC:0x4004c4c6

SPIWP:0xee

mode:DIO, clock div:2

load:0x3fcd6100,len:0x1dbc

load:0x403ce000,len:0x9f0

load:0x403d0000,len:0x31f8

entry 0x403ce000

I (36) boot: ESP-IDF v4.4-dev-3042-g220590d599-dirty 2nd stage bootloader

I (37) boot: compile time 12:33:04

D (37) bootloader_flash: XMC chip detected by RDID (00204016), skip.

D (43) bootloader_flash: mmu set block paddr=0x00000000 (was 0xffffffff)

I (50) boot: chip revision: 3

D (54) boot.esp32c3: magic e9

D (57) boot.esp32c3: segments 03

D (60) boot.esp32c3: spi_mode 02

D (63) boot.esp32c3: spi_speed 00

D (67) boot.esp32c3: spi_size 02

I (70) boot.esp32c3: SPI Speed      : 40MHz

I (75) boot.esp32c3: SPI Mode       : DIO

I (79) boot.esp32c3: SPI Flash Size : 4MB

W (84) boot.esp32c3: PRO CPU has been reset by WDT.

D (90) boot: Enabling RTCWDT(9000 ms)

I (93) boot: Enabling RNG early entropy source...

D (99) bootloader_flash: mmu set paddr=00010000 count=1 size=c00 src_addr=10000 src_addr_aligned=10000

D (108) boot: mapped partition table 0x10000 at 0x3c000000

D (114) flash_parts: partition table verified, 4 entries

I (119) boot: Partition Table:

I (123) boot: ## Label            Usage          Type ST Offset   Length

D (130) boot: load partition table entry 0x3c000000

D (135) boot: type=1 subtype=2

I (138) boot:  0 nvs              WiFi data        01 02 00011000 00006000

D (146) boot: load partition table entry 0x3c000020

D (151) boot: type=1 subtype=1

I (154) boot:  1 phy_init         RF data          01 01 00017000 00001000

D (161) boot: load partition table entry 0x3c000040

D (166) boot: type=0 subtype=0

I (170) boot:  2 factory          factory app      00 00 00020000 00100000

I (177) boot: End of partition table

D (181) boot: Trying partition index -1 offs 0x20000 size 0x100000

D (188) esp_image: reading image header @ 0x20000

D (192) bootloader_flash: mmu set block paddr=0x00020000 (was 0xffffffff)

D (199) esp_image: image header: 0xe9 0x06 0x02 0x02 403802d2

I (205) esp_image: segment 0: paddr=00020020 vaddr=3c020020 size=06b20h ( 27424) map

D (213) esp_image: free data page_count 0x0000003f

D (218) bootloader_flash: mmu set paddr=00020000 count=1 size=6b20 src_addr=20020 src_addr_aligned=20000

D (234) bootloader_flash: mmu set block paddr=0x00020000 (was 0xffffffff)

I (235) esp_image: segment 1: paddr=00026b48 vaddr=3fc89e00 size=01524h (  5412) load

D (243) esp_image: free data page_count 0x0000003f

D (248) bootloader_flash: mmu set paddr=00020000 count=1 size=1524 src_addr=26b48 src_addr_aligned=20000

D (259) bootloader_flash: mmu set block paddr=0x00020000 (was 0xffffffff)

I (264) esp_image: segment 2: paddr=00028074 vaddr=40380000 size=07fa4h ( 32676) load

D (273) esp_image: free data page_count 0x0000003f

D (278) bootloader_flash: mmu set paddr=00020000 count=2 size=7fa4 src_addr=28074 src_addr_aligned=20000

D (296) bootloader_flash: mmu set block paddr=0x00030000 (was 0xffffffff)

I (296) esp_image: segment 3: paddr=00030020 vaddr=42000020 size=165e8h ( 91624) map

D (303) esp_image: free data page_count 0x0000003f

D (308) bootloader_flash: mmu set paddr=00030000 count=2 size=165e8 src_addr=30020 src_addr_aligned=30000

D (338) bootloader_flash: mmu set block paddr=0x00040000 (was 0xffffffff)

I (338) esp_image: segment 4: paddr=00046610 vaddr=40387fa4 size=01ce0h (  7392) load

D (342) esp_image: free data page_count 0x0000003f

D (347) bootloader_flash: mmu set paddr=00040000 count=1 size=1ce0 src_addr=46610 src_addr_aligned=40000

D (358) bootloader_flash: mmu set block paddr=0x00040000 (was 0xffffffff)

I (363) esp_image: segment 5: paddr=000482f8 vaddr=50000000 size=00010h (    16) load

D (372) esp_image: free data page_count 0x0000003f

D (377) bootloader_flash: mmu set paddr=00040000 count=1 size=10 src_addr=482f8 src_addr_aligned=40000

D (386) bootloader_flash: mmu set block paddr=0x00040000 (was 0xffffffff)

D (393) boot: Calculated hash: 0000000000000000000000000000000000000000000000000000000000000000

E (402) esp_image: Image hash failed - image is corrupt

D (407) boot: Expected hash: c173afc7246778dcdd1fd5df44e7f5d8988b390d2a77578524a924cd78ff58c0

E (416) boot: Factory app partition is not bootable

D (422) boot: Can't boot from zero-length partition

E (427) boot: No bootable app partitions in the partition table



必须重新上电才行,要不就会一直复位,一直验证hash失败

更多回帖

发帖
×
20
完善资料,
赚取积分