Page 1 of 1

基于ESP32C3运行Homekit example报错的问题

Posted: Thu Jun 10, 2021 7:05 am
by mephisto
IDF版本v4.3-rc

直接烧入Homekit Lightbulb例程之后报错:
E (410) esp_image: Image length 1665504 doesn't fit in partition length 1638400


为了解决这个问题,我将partitions_hap.csv的内容修改为:
[Codebox]
# Name, Type, SubType, Offset, Size, Flags
# Note: Firmware partition offset needs to be 64K aligned, initial 36K (9 sectors) are reserved for bootloader and partition table
sec_cert, 0x3F, ,0xd000, 0x3000, , # Never mark this as an encrypted partition
nvs, data, nvs, 0x10000, 0x6000,
otadata, data, ota, , 0x2000
phy_init, data, phy, , 0x1000,
ota_0, app, ota_0, 0x20000, 1792K,
ota_1, app, ota_1, , 1792K,
factory_nvs, data, nvs, 0x3a0000, 0x6000
nvs_keys, data, nvs_keys,0x3a6000, 0x1000
[/Codebox]

再次编译下载后,依然报错无法正常运行
[Codebox]
ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0xc (RTC_SW_CPU_RST),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x40383e58
0x40383e58: esp_restart_noos at /Users/mephisto/esp/esp-idf/components/esp32c3/system_api_esp32c3.c:137 (discriminator 1)

SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x1778
load:0x403ce000,len:0x8d4
load:0x403d0000,len:0x293c
entry 0x403ce000
I (35) boot: ESP-IDF v4.3-rc 2nd stage bootloader
I (35) boot: compile time 15:00:03
I (35) boot: chip revision: 3
I (37) boot.esp32c3: SPI Speed : 80MHz
I (42) boot.esp32c3: SPI Mode : DIO
I (46) boot.esp32c3: SPI Flash Size : 4MB
I (51) boot: Enabling RNG early entropy source...
I (57) boot: Partition Table:
I (60) boot: ## Label Usage Type ST Offset Length
I (67) boot: 0 sec_cert unknown 3f 00 0000d000 00003000
I (75) boot: 1 nvs WiFi data 01 02 00010000 00006000
I (82) boot: 2 otadata OTA data 01 00 00016000 00002000
I (90) boot: 3 phy_init RF data 01 01 00018000 00001000
I (97) boot: 4 ota_0 OTA app 00 10 00020000 001c0000
I (105) boot: 5 ota_1 OTA app 00 11 001e0000 001c0�ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x1778
load:0x403ce000,len:0x8d4
load:0x403d0000,len:0x293c
entry 0x403ce000
I (30) boot: ESP-IDF v4.3-rc 2nd stage bootloader
I (30) boot: compile time 15:00:03
I (30) boot: chip revision: 3
I (32) boot.esp32c3: SPI Speed : 80MHz
I (37) boot.esp32c3: SPI Mode : DIO
I (41) boot.esp32c3: SPI Flash Size : 4MB
I (46) boot: Enabling RNG early entropy source...
I (52) boot: Partition Table:
I (55) boot: ## Label Usage Type ST Offset Length
I (62) boot: 0 sec_cert unknown 3f 00 0000d000 00003000
I (70) boot: 1 nvs WiFi data 01 02 00010000 00006000
I (77) boot: 2 otadata OTA data 01 00 00016000 00002000
I (85) boot: 3 phy_init RF data 01 01 00018000 00001000
I (92) boot: 4 ota_0 OTA app 00 10 00020000 001c0000
I (100) boot: 5 ota_1 OTA app 00 11 001e0000 001c0000
I (107) boot: 6 factory_nvs WiFi data 01 02 003a0000 00006000
I (115) boot: 7 nvs_keys NVS keys 01 04 003a6000 00001000
I (122) boot: End of partition table
I (127) esp_image: segment 0: paddr=00020020 vaddr=3c140020 size=46a04h (289284) map
I (180) esp_image: segment 1: paddr=00066a2c vaddr=3fc8da00 size=045f0h ( 17904) load
I (184) esp_image: segment 2: paddr=0006b024 vaddr=40380000 size=04ff4h ( 20468) load
I (190) esp_image: segment 3: paddr=00070020 vaddr=42000020 size=13e0dch (1302748) map
I (398) esp_image: segment 4: paddr=001ae104 vaddr=40384ff4 size=0889ch ( 34972) load
I (405) esp_image: segment 5: paddr=001b69a8 vaddr=50000000 size=00010h ( 16) load
I (409) boot: Loaded app from partition at offset 0x20000
I (410) boot: Disabling RNG early entropy source...
I (427) cpu_start: Pro cpu up.
I (439) cpu_start: Pro cpu start user code
I (440) cpu_start: cpu freq: 160000000
I (440) cpu_start: Application information:
I (442) cpu_start: Project name: lightbulb
I (447) cpu_start: App version: esp_homekit_release_3.0.r3-38-g
I (454) cpu_start: Compile time: Jun 10 2021 14:59:55
I (461) cpu_start: ELF file SHA256: 1a89a731318cf04a...
I (466) cpu_start: ESP-IDF: v4.3-rc
I (472) heap_init: Initializing. RAM available for dynamic allocation:
I (479) heap_init: At 3FC9AE00 len 00025200 (148 KiB): DRAM
I (485) heap_init: At 3FCC0000 len 0001F060 (124 KiB): STACK/DRAM
I (492) heap_init: At 50000010 len 00001FF0 (7 KiB): RTCRAM
I (498) spi_flash: detected chip: generic
I (503) spi_flash: flash io: dio
I (507) sleep: Configure to isolate all GPIO pins in sleep state
I (513) sleep: Enable automatic switching of GPIO sleep configuration
I (521) cpu_start: Starting scheduler.
Keystore initialised
Accessory is not Paired with any controller
Database initialised. Accessory Device ID: E3:BC:81:CB:BE:91
HAP Initialization succeeded. Version : 4.0-c654909
E (566) ledc: freq_hz=5000 duty_resolution=0
I (566) gpio: GPIO[0]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:3
I (576) app_hap_setup_payload: -----QR Code for HomeKit-----
I (586) app_hap_setup_payload: Scan this QR code from the Home app on iOS

█▀▀▀▀▀█ █▀ █▀▀▀▀▀█
█ ███ █ █▀▄▀▀ █ ███ █
█ ▀▀▀ █ ██▀ █ █ ▀▀▀ █
▀▀▀▀▀▀▀ █ █ ▀ ▀▀▀▀▀▀▀
▀ ▀███▀ ▄▀ ▄█▄██▀██ ▄
█▄█▄▀▄▀▀▀█▀▄█ ▀ ▄█▄
▀▀ ▀▀▄▄▀ ▀▄▀▄ ▄▄█▀
█▀▀▀▀▀█ ▄ ▄█▀▄█ █ ▀▄
█ ███ █ █▀█ ▄▀▀█▀ ▀
█ ▀▀▀ █ ▀█▄ █▄ ▄ █▀ ▄
▀▀▀▀▀▀▀ ▀▀ ▀▀▀ ▀▀


I (656) app_hap_setup_payload: If QR code is not visible, copy paste the below URL in a browser.
https://api.qrserver.com/v1/create-qr-c ... 27813XES32
MFi auth not supported. Falling back to HAP_MFI_AUTH_NONE
I (686) coexist: coexist rom version 9387209
I (686) pp: pp rom version: 9387209
I (686) net80211: net80211 rom version: 9387209
I (706) wifi:wifi driver task: 3fca65c4, prio:23, stack:6656, core=0
I (706) system_api: Base MAC address is not set
I (706) system_api: read default base MAC address from EFUSE
I (716) wifi:wifi firmware version: c7d0450
I (716) wifi:wifi certification version: v7.0
I (716) wifi:config NVS flash: enabled
I (726) wifi:config nano formating: disabled
I (726) wifi:Init data frame dynamic rx buffer num: 32
I (736) wifi:Init management frame dynamic rx buffer num: 32
I (736) wifi:Init management short buffer num: 32
I (746) wifi:Init dynamic tx buffer num: 32
I (746) wifi:Init static tx FG buffer num: 2
I (756) wifi:Init static rx buffer size: 1600
I (756) wifi:Init static rx buffer num: 10
I (756) wifi:Init dynamic rx buffer num: 32
I (766) wifi_init: rx ba win: 6
I (766) wifi_init: tcpip mbox: 32
I (766) wifi_init: udp mbox: 10
I (776) wifi_init: tcp mbox: 6
I (776) wifi_init: tcp tx win: 5744
I (786) wifi_init: tcp rx win: 5744
I (786) wifi_init: tcp mss: 1440
I (786) wifi_init: WiFi IRAM OP enabled
I (796) wifi_init: WiFi RX IRAM OP enabled
Setup ID: ES32
HAP Main Loop Started
mDNS initialised
Registering HomeKit web handlers
Announcing _hap._tcp mDNS service
W (816) BTDM_INIT: esp_bt_mem_release not implemented, return OK
I (826) wifi_prov_scheme_ble: BT memory released
I (826) app_wifi: Starting provisioning
I (836) phy_init: phy_version 500,985899c,Apr 19 2021,16:05:08
I (946) wifi:set rx active PTI: 0, rx ack PTI: 12, and default PTI: 1
I (956) wifi:mode : sta (7c:df:a1:87:b1:fc)
I (956) wifi:enable tsf
I (956) BTDM_INIT: BT controller compile version [501d88d]
I (956) coexist: coexist rom version 9387209
I (966) BTDM_INIT: Bluetooth MAC: 7c:df:a1:87:b1:fe

E (966) simple_ble: Configuration mismatch. Select BLE Only or BTDM mode from menuconfig
E (976) protocomm_ble: simple_ble_start failed w/ error code 0xffffffff
E (986) wifi_prov_scheme_ble: Failed to start protocomm BLE service
E (996) wifi_prov_mgr: Failed to start service
ESP_ERROR_CHECK failed: esp_err_t 0xffffffff (ESP_FAIL) at 0x4038565d
0x4038565d: _esp_error_check_failed at /Users/mephisto/esp/esp-idf/components/esp_common/src/esp_err.c:41

file: "/Users/mephisto/esp/esp-homekit-sdk/examples/common/app_wifi/app_wifi.c" line 421
func: app_wifi_start
expression: wifi_prov_mgr_start_provisioning(security, pop, service_name, service_key)

abort() was called at PC 0x40385661 on core 0
0x40385661: _esp_error_check_failed at /Users/mephisto/esp/esp-idf/components/esp_common/src/esp_err.c:42

Stack dump detected
Core 0 register dump:
MEPC : 0x40386524 RA : 0x40386c84 SP : 0x3fca00b0 GP : 0x3fc8e288
0x40386524: panic_abort at /Users/mephisto/esp/esp-idf/components/esp_system/panic.c:367

0x40386c84: rtos_int_enter at /Users/mephisto/esp/esp-idf/components/freertos/port/riscv/portasm.S:35

TP : 0x3fc598fc T0 : 0x37363534 T1 : 0x7271706f T2 : 0x33323130
S0/FP : 0x00000004 S1 : 0x3fca0114 A0 : 0x3fca00dc A1 : 0x3fca0112
A2 : 0x00000000 A3 : 0x3fca0109 A4 : 0x00000001 A5 : 0x3fc9b000
A6 : 0x7a797877 A7 : 0x76757473 S2 : 0x00000000 S3 : 0x00000000
S4 : 0x00000000 S5 : 0x00000000 S6 : 0x00000000 S7 : 0x00000000
S8 : 0x00000000 S9 : 0x00000000 S10 : 0x00000000 S11 : 0x00000000
T3 : 0x6e6d6c6b T4 : 0x6a696867 T5 : 0x66656463 T6 : 0x62613938
MSTATUS : 0x00001881 MTVEC : 0x40380001 MCAUSE : 0x00000007 MTVAL : 0x00000000
0x40380001: _vector_table at ??:?

MHARTID : 0x00000000


Backtrace:


panic_abort (details=details@entry=0x3fca00dc "abort() was called at PC 0x40385661 on core 0") at /Users/mephisto/esp/esp-idf/components/esp_system/panic.c:367
367 *((int *) 0) = 0; // NOLINT(clang-analyzer-core.NullDereference) should be an invalid operation on targets
#0 panic_abort (details=details@entry=0x3fca00dc "abort() was called at PC 0x40385661 on core 0") at /Users/mephisto/esp/esp-idf/components/esp_system/panic.c:367
#1 0x40386c84 in esp_system_abort (details=details@entry=0x3fca00dc "abort() was called at PC 0x40385661 on core 0") at /Users/mephisto/esp/esp-idf/components/esp_system/system_api.c:112
#2 0x4038c456 in abort () at /Users/mephisto/esp/esp-idf/components/newlib/abort.c:46
#3 0x40385664 in _esp_error_check_failed (rc=<optimized out>, file=file@entry=0x3c144e20 "", line=line@entry=421, function=function@entry=0x3c144764 <__func__.8973> "", expression=expression@entry=0x3c144acc "") at /Users/mephisto/esp/esp-idf/components/esp_common/src/esp_err.c:42
#4 0x42009240 in app_wifi_start (ticks_to_wait=ticks_to_wait@entry=4294967295) at /Users/mephisto/esp/esp-homekit-sdk/examples/common/app_wifi/app_wifi.c:421
#5 0x420079ba in lightbulb_thread_entry (arg=<optimized out>) at ../main/app_main.c:267
#6 0x40389480 in vPortEnterCritical () at /Users/mephisto/esp/esp-idf/components/freertos/port/riscv/port.c:130
#7 0x00000000 in ?? ()
Backtrace stopped: frame did not save the PC
ELF file SHA256: 1a89a731318cf04a
[/Codebox]

请问这个问题如何解决?

我这边同样的例程把环境修改为ESP32就可以正常运行。这个问题只在ESP32C3上出现。

Re: 基于ESP32C3运行Homekit example报错的问题

Posted: Thu Jun 10, 2021 7:36 am
by ESP_Gargamel
Component config → Bluetooth → Bluetooth Host 选 NimBLE - BLE only。