Closed indexdb closed 1 year ago
Can you provide the full decode of the backtrace? Also what version of ESP-IDF did you use?
20:11:48.267 -> �[0;32mI (27) boot: ESP-IDF -128-NOTFOUND 2nd stage bootloader�[0m
...
20:11:48.829 -> �[0;32mI (567) main: Esp32FeederController 1 Initializing�[0m
20:11:48.829 -> �[0;32mI (568) main: Compiled on Mar 28 2023 16:56:01 using IDF -128-NOTFOUND�[0m
These lines normally should have the ESP-IDF version but they are showing up as an invalid version. So I'm not sure how you built this thus the questions.
I (27) boot: ESP-IDF v5.0.1-dirty 2nd stage bootloader I (27) boot: compile time 09:39:36 I (27) boot: chip revision: v1.0 I (31) boot.esp32: SPI Speed : 40MHz I (35) boot.esp32: SPI Mode : DIO I (40) boot.esp32: SPI Flash Size : 4MB I (44) boot: Enabling RNG early entropy source... I (50) boot: Partition Table: I (53) boot: ## Label Usage Type ST Offset Length I (61) boot: 0 nvs WiFi data 01 02 00009000 00006000 I (68) boot: 1 phy_init RF data 01 01 0000f000 00001000 I (76) boot: 2 factory factory app 00 00 00010000 00177000 I (83) boot: End of partition table I (87) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=4145ch (267356) map I (192) esp_image: segment 1: paddr=00051484 vaddr=3ffb0000 size=03638h ( 13880) load I (198) esp_image: segment 2: paddr=00054ac4 vaddr=40080000 size=0b554h ( 46420) load I (217) esp_image: segment 3: paddr=00060020 vaddr=400d0020 size=c498ch (805260) map I (508) esp_image: segment 4: paddr=001249b4 vaddr=4008b554 size=0b32ch ( 45868) load I (539) boot: Loaded app from partition at offset 0x10000 I (539) boot: Disabling RNG early entropy source... I (566) main: Esp32FeederController 1 Initializing I (567) main: Compiled on Mar 30 2023 09:35:52 using IDF v5.0.1-dirty I (568) main: Running from: factory I (572) soc_info: Reset reason:software reset (CPU) (12), model:ESP32, chip revision:100, number of cores:2, embedded flash:No, embedded PSRAM: No, WiFi:Yes, IEEE 802.15.4:No, BLE:Yes, BT:Yes I (590) main: Initializing NVS I (623) wifi_mgr: Setting hostname to "esp32feeder". I (630) wifi_mgr: Configuring Station (SSID:QiQi Wifi-2.4G) I (630) wifi_mgr: Starting WiFi stack I (721) wifi_mgr: WiFi station started. I (1759) wifi_mgr: Connected to SSID:XXXXX I (1760) wifi_mgr: [1/36] Waiting for IP address assignment. I (1773) wifi_mgr: IP address:192.168.1.164 I (1773) wifi_mgr: [2/36] Waiting for IP address assignment. I (1781) gcode_client_mgr: 0 clients connected I (1782) gcode_server: Waiting for connections on 192.168.1.164:8989... I (1790) feeder_mgr: Initializing I2C Bus W (1792) feeder_mgr: PCA9685(40) was not detected. W (1796) feeder_mgr: PCA9685(41) was not detected. W (1802) feeder_mgr: PCA9685(42) was not detected. I (1809) feeder_mgr: PCA9685(43/0x3ffca198) configured for use. W (1814) feeder_mgr: PCA9685(44) was not detected. W (1819) feeder_mgr: PCA9685(45) was not detected. W (1825) feeder_mgr: PCA9685(46) was not detected. W (1830) feeder_mgr: PCA9685(47) was not detected. I (1838) feeder_mgr: Detected PCA9685 devices:1 W (1841) feeder_mgr: MCP23017(20) was not detected! W (1847) feeder_mgr: MCP23017(21) was not detected! W (1853) feeder_mgr: MCP23017(22) was not detected! I (1861) feeder_mgr: MCP23017(23/0x3ffca1d8) configured for use. W (1864) feeder_mgr: MCP23017(24) was not detected! W (1870) feeder_mgr: MCP23017(25) was not detected! W (1875) feeder_mgr: MCP23017(26) was not detected! W (1881) feeder_mgr: MCP23017(27) was not detected!
abort() was called at PC 0x4014eab3 on core 0 0x4014eab3: cxxabiv1::terminate(void (*)()) at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:48
Backtrace: 0x40081f1a:0x3ffba180 0x40089f19:0x3ffba1a0 0x40090f3a:0x3ffba1c0 0x4014eab3:0x3ffba240 0x4014eae8:0x3ffba260 0x4014ebc3:0x3ffba280 0x400e34bf:0x3ffba2a0 0x400e0b9a:0x3ffba320 0x400daa75:0x3ffba5d0 0x40192c19:0x3ffba760 0x4008d35d:0x3ffba780 0x40081f1a: panic_abort at C:/Espressif/frameworks/esp-idf-v5.0.1/components/esp_system/panic.c:423
0x40089f19: esp_system_abort at C:/Espressif/frameworks/esp-idf-v5.0.1/components/esp_system/esp_system.c:153
0x40090f3a: abort at C:/Espressif/frameworks/esp-idf-v5.0.1/components/newlib/abort.c:38
0x4014eab3: cxxabiv1::terminate(void (*)()) at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:48
0x4014eae8: std::terminate() at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:58
0x4014ebc3: __cxa_throw at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:95
0x400e34bf: std::throw_bad_weak_ptr() at c:\espressif\tools\xtensa-esp32-elf\esp-2022r1-11.2.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\11.2.0\bits/shared_ptr_base.h:93
(inlined by) std::__shared_count<(gnu_cxx::_Lock_policy)2>::shared_count(std::__weak_count<(gnu_cxx::_Lock_policy)2> const&) at c:\espressif\tools\xtensa-esp32-elf\esp-2022r1-11.2.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\11.2.0\bits/shared_ptr_base.h:873
(inlined by) std::shared_ptr<Feeder, (__gnu_cxx::_Lock_policy)2>::shared_ptr<Feeder, void>(std::__weak_ptr<Feeder, (__gnu_cxx::_Lock_policy)2> const&) at c:\espressif\tools\xtensa-esp32-elf\esp-2022r1-11.2.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\11.2.0\bits/shared_ptr_base.h:1178
(inlined by) std::shared_ptr
0x400e0b9a: decltype (::new ((void)(0)) Feeder((declval
0x400daa75: app_main at C:/Users/yan/Desktop/feeder-bin/firmware/main/main.cpp:91
Thanks @indexdb, this new log and backtrace decode is very helpful. I haven't tested this with ESP-IDF v5.x yet so there may be a change from IDF v4.4 to v5.x that is causing this.
Let me see if I can reproduce this locally and figure out what I can come up with as a fix.
I use IDF v5.0 not 5.01 to build the project and get same errors. I can't build with v4.4 because asio Dependence ESP-IDF >=5.0 https://components.espressif.com/components/espressif/asio
asio is bundled within IDF v4.4 and not an external component, so it shouldn't be an issue due to that.
Yes, I build it with v4.4 with internal componet. I got same errors as follow
============================================ I (30) boot: ESP-IDF v4.4.4-dirty 2nd stage bootloader I (30) boot: compile time 12:18:03 I (31) boot: chip revision: v1.0 I (34) boot_comm: chip revision: 1, min. bootloader chip revision: 0 I (41) boot.esp32: SPI Speed : 40MHz I (46) boot.esp32: SPI Mode : DIO I (51) boot.esp32: SPI Flash Size : 4MB I (55) boot: Enabling RNG early entropy source... I (60) boot: Partition Table: I (64) boot: ## Label Usage Type ST Offset Length I (71) boot: 0 nvs WiFi data 01 02 00009000 00006000 I (79) boot: 1 phy_init RF data 01 01 0000f000 00001000 I (86) boot: 2 factory factory app 00 00 00010000 00177000 I (94) boot: End of partition table I (98) boot_comm: chip revision: 1, min. application chip revision: 0 I (105) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=35bech (220140) map I (193) esp_image: segment 1: paddr=00045c14 vaddr=3ffb0000 size=03be8h ( 15336) load I (200) esp_image: segment 2: paddr=00049804 vaddr=40080000 size=06814h ( 26644) load I (211) esp_image: segment 3: paddr=00050020 vaddr=400d0020 size=b8424h (754724) map I (484) esp_image: segment 4: paddr=0010844c vaddr=40086814 size=10224h ( 66084) load I (523) boot: Loaded app from partition at offset 0x10000 I (523) boot: Disabling RNG early entropy source... I (549) main: Esp32FeederController 1 Initializing I (550) main: Compiled on Mar 30 2023 12:16:56 using IDF v4.4.4-dirty I (551) main: Running from: factory I (556) soc_info: Reset reason:software reset (CPU) (12), model:ESP32, chip revision:1, number of cores:2, embedded flash:No, embedded PSRAM: No, WiFi:Yes, IEEE 802.15.4:No, BLE:Yes, BT:Yes I (573) main: Initializing NVS I (607) wifi_mgr: Setting hostname to "esp32feeder". I (612) wifi_mgr: Configuring Station (SSID:xxxx Wifi-2.4G) I (613) wifi_mgr: Starting WiFi stack I (702) wifi_mgr: WiFi station started. E (1351) wifi:Association refused temporarily, comeback time 1004 mSec E (2361) wifi:Association refused temporarily, comeback time 1004 mSec I (3371) wifi_mgr: Connection to SSID:xxxxx Wifi-2.4G (reason:203) failed I (3417) wifi_mgr: Connected to SSID:xxx Wifi-2.4G I (3418) wifi_mgr: [1/36] Waiting for IP address assignment. I (4420) wifi_mgr: IP address:192.168.1.164 I (4421) wifi_mgr: [2/36] Waiting for IP address assignment. I (4428) gcode_client_mgr: 0 clients connected I (4429) gcode_server: Waiting for connections on 192.168.1.164:8989... I (4437) feeder_mgr: Initializing I2C Bus W (4439) feeder_mgr: PCA9685(40) was not detected. W (4443) feeder_mgr: PCA9685(41) was not detected. W (4449) feeder_mgr: PCA9685(42) was not detected. I (4456) feeder_mgr: PCA9685(43/0x3ffcac60) configured for use. W (4461) feeder_mgr: PCA9685(44) was not detected. W (4466) feeder_mgr: PCA9685(45) was not detected. W (4472) feeder_mgr: PCA9685(46) was not detected. W (4477) feeder_mgr: PCA9685(47) was not detected. I (4482) feeder_mgr: Detected PCA9685 devices:1 W (4488) feeder_mgr: MCP23017(20) was not detected! W (4494) feeder_mgr: MCP23017(21) was not detected! W (4499) feeder_mgr: MCP23017(22) was not detected! I (4508) feeder_mgr: MCP23017(23/0x3ffcac88) configured for use. W (4511) feeder_mgr: MCP23017(24) was not detected! W (4517) feeder_mgr: MCP23017(25) was not detected! W (4522) feeder_mgr: MCP23017(26) was not detected! W (4528) feeder_mgr: MCP23017(27) was not detected!
abort() was called at PC 0x4014c8e3 on core 0 0x4014c8e3: cxxabiv1::terminate(void (*)()) at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:47
Backtrace: 0x40081d46:0x3ffbaaa0 0x40089b49:0x3ffbaac0 0x40091205:0x3ffbaae0 0x4014c8e3:0x3ffbab60 0x4014c92a:0x3ffbab80 0x4014c88b:0x3ffbaba0 0x400dbbfa:0x3ffbabc0 0x400e25bb:0x3ffbabe0 0x400df6ee:0x3ffbac50 0x400d9af9:0x3ffbaf20 0x40186c15:0x3ffbb0c0 0x4008d10d:0x3ffbb0e0 0x40081d46: panic_abort at C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_system/panic.c:408
0x40089b49: esp_system_abort at C:/Espressif/frameworks/esp-idf-v4.4.4/components/esp_system/esp_system.c:137
0x40091205: abort at C:/Espressif/frameworks/esp-idf-v4.4.4/components/newlib/abort.c:46
0x4014c8e3: cxxabiv1::terminate(void (*)()) at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:47
0x4014c92a: std::terminate() at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:57
0x4014c88b: __cxa_throw at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:95
0x400dbbfa: std::__throw_bad_weak_ptr() at c:\espressif\tools\xtensa-esp32-elf\esp-2021r2-patch5-8.4.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\8.4.0\bits/shared_ptr_base.h:84
0x400e25bb: std::enable_shared_from_this
0x400df6ee: void std::allocator_traits<std::allocator
0x400d9af9: app_main at C:/Users/yan/Desktop/Esp32FeederController-main/firmware/main/main.cpp:90
0x40186c15: main_task at C:/Espressif/frameworks/esp-idf-v4.4.4/components/freertos/port/port_common.c:141
0x4008d10d: vPortTaskWrapper at C:/Espressif/frameworks/esp-idf-v4.4.4/components/freertos/port/xtensa/port.c:142
Thanks for reproducing it on IDF v4.4. This was working previously and was tested, something must have changed in the gcc versions or IDF since I last tested this.
I'm working on adding some additional logging and support fixes for IDF v5+. Did you see this sort of failure in your testing?
xtensa-esp32-elf/bin/ld: esp-idf/espressif__asio/libespressif__asio.a(asio.cpp.obj):(.literal._ZN4asio6detail10socket_ops9inet_ntopEiPKvPcjmRSt10error_code+0x8): undefined reference to `if_indextoname'
xtensa-esp32-elf/bin/ld: esp-idf/espressif__asio/libespressif__asio.a(asio.cpp.obj): in function `_ZN4asio6detail10socket_ops9inet_ntopEiPKvPcjmRSt10error_code':
Esp32FeederController/firmware/managed_components/espressif__asio/asio/asio/include/asio/detail/impl/socket_ops.ipp:2128: undefined reference to `if_indextoname'
collect2: error: ld returned 1 exit status
to file socket_ops.ipp
You can check the link for this issue https://github.com/espressif/esp-idf/issues/3557
That was fixed and should have been included in the latest IDF but something is broken on asio it seems still. I saw a PR adding a missing header reference for the same thing. I'll be adding the weak function definition as referenced from that issue in my update.
@indexdb Can you test the code on "idfv5" branch? It should compile cleanly without needing to alter anything with IDF v5.0.x
Yes, it works, Thank you!
I use one PCA9685 and one MCP23017, ESP32 detected them, but reboot endless, please check log attached.
ESP32 abort on this line in FeederManager.cpp, then reboot .... feeders_.push_back( std::makeshared(idx + 1, uuid, pca9685 [expanderindex],
mcp23017[expander_index],
expander_channel, context));
========================== LOG ================================= 20:11:48.220 -> ELF file SHA256: 8720b8c32e64e776 20:11:48.220 -> 20:11:48.220 -> Rebooting... 20:11:48.220 -> ets Jun 8 2016 00:22:57 20:11:48.267 -> 20:11:48.267 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) 20:11:48.267 -> configsip: 0, SPIWP:0xee 20:11:48.267 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 20:11:48.267 -> mode:DIO, clock div:2 20:11:48.267 -> load:0x3fff0030,len:6948 20:11:48.267 -> load:0x40078000,len:15500 20:11:48.267 -> load:0x40080400,len:3844 20:11:48.267 -> entry 0x4008064c 20:11:48.267 -> [0;32mI (27) boot: ESP-IDF -128-NOTFOUND 2nd stage bootloader[0m 20:11:48.267 -> [0;32mI (27) boot: compile time 16:58:17[0m 20:11:48.267 -> [0;32mI (27) boot: chip revision: v1.0[0m 20:11:48.267 -> [0;32mI (31) boot.esp32: SPI Speed : 40MHz[0m 20:11:48.267 -> [0;32mI (35) boot.esp32: SPI Mode : DIO[0m 20:11:48.313 -> [0;32mI (40) boot.esp32: SPI Flash Size : 4MB[0m 20:11:48.313 -> [0;32mI (44) boot: Enabling RNG early entropy source...[0m 20:11:48.313 -> [0;32mI (50) boot: Partition Table:[0m 20:11:48.313 -> [0;32mI (53) boot: ## Label Usage Type ST Offset Length[0m 20:11:48.313 -> [0;32mI (61) boot: 0 nvs WiFi data 01 02 00009000 00006000[0m 20:11:48.313 -> [0;32mI (68) boot: 1 phy_init RF data 01 01 0000f000 00001000[0m 20:11:48.313 -> [0;32mI (76) boot: 2 factory factory app 00 00 00010000 00177000[0m 20:11:48.313 -> [0;32mI (83) boot: End of partition table[0m 20:11:48.361 -> [0;32mI (87) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=41804h (268292) map[0m 20:11:48.454 -> [0;32mI (193) esp_image: segment 1: paddr=0005182c vaddr=3ffb0000 size=03638h ( 13880) load[0m 20:11:48.454 -> [0;32mI (198) esp_image: segment 2: paddr=00054e6c vaddr=40080000 size=0b1ach ( 45484) load[0m 20:11:48.454 -> [0;32mI (217) esp_image: segment 3: paddr=00060020 vaddr=400d0020 size=c53dch (807900) map[0m 20:11:48.735 -> [0;32mI (509) esp_image: segment 4: paddr=00125404 vaddr=4008b1ac size=0b744h ( 46916) load[0m 20:11:48.782 -> [0;32mI (540) boot: Loaded app from partition at offset 0x10000[0m 20:11:48.782 -> [0;32mI (540) boot: Disabling RNG early entropy source...[0m 20:11:48.829 -> [0;32mI (567) main: Esp32FeederController 1 Initializing[0m 20:11:48.829 -> [0;32mI (568) main: Compiled on Mar 28 2023 16:56:01 using IDF -128-NOTFOUND[0m 20:11:48.829 -> [0;32mI (569) main: Running from: factory[0m 20:11:48.829 -> [0;32mI (574) soc_info: Reset reason:software reset (CPU) (12), model:ESP32, chip revision:100, number of cores:2, embedded flash:No, embedded PSRAM: No, WiFi:Yes, IEEE 802.15.4:No, BLE:Yes, BT:Yes[0m 20:11:48.829 -> [0;32mI (591) main: Initializing NVS[0m 20:11:48.875 -> [0;32mI (626) wifi_mgr: Setting hostname to "esp32feeder".[0m 20:11:48.875 -> [0;32mI (632) wifi_mgr: Configuring Station (SSID:QiQi Wifi-2.4G)[0m 20:11:48.875 -> [0;32mI (633) wifi_mgr: Starting WiFi stack[0m 20:11:48.969 -> [0;32mI (723) wifi_mgr: WiFi station started.[0m 20:11:49.579 -> E (1328) wifi:Association refused temporarily, comeback time 1004 mSec 20:11:50.562 -> E (2339) wifi:Association refused temporarily, comeback time 1004 mSec 20:11:51.590 -> [0;32mI (3349) wifi_mgr: Connection to SSID:QiQi Wifi-2.4G (reason:203) failed[0m 20:11:51.636 -> [0;32mI (3386) wifi_mgr: Connected to SSID:QiQi Wifi-2.4G[0m 20:11:51.636 -> [0;32mI (3387) wifi_mgr: [1/36] Waiting for IP address assignment.[0m 20:11:52.622 -> [0;32mI (4388) wifi_mgr: IP address:192.168.1.164[0m 20:11:52.622 -> [0;32mI (4389) wifi_mgr: [2/36] Waiting for IP address assignment.[0m 20:11:52.622 -> [0;32mI (4397) gcode_client_mgr: 0 clients connected[0m 20:11:52.669 -> [0;32mI (4399) gcode_server: Waiting for connections on 192.168.1.164:8989...[0m 20:11:52.669 -> [0;32mI (4406) feeder_mgr: Initializing I2C Bus[0m 20:11:52.669 -> [0;33mW (4408) feeder_mgr: PCA9685(40) was not detected.[0m 20:11:52.669 -> [0;33mW (4412) feeder_mgr: PCA9685(41) was not detected.[0m 20:11:52.669 -> [0;33mW (4418) feeder_mgr: PCA9685(42) was not detected.[0m 20:11:52.669 -> [0;32mI (4425) feeder_mgr: PCA9685(43/0x3ffca244) configured for use.[0m 20:11:52.669 -> [0;33mW (4430) feeder_mgr: PCA9685(44) was not detected.[0m 20:11:52.669 -> [0;33mW (4435) feeder_mgr: PCA9685(45) was not detected.[0m 20:11:52.717 -> [0;33mW (4441) feeder_mgr: PCA9685(46) was not detected.[0m 20:11:52.717 -> [0;33mW (4446) feeder_mgr: PCA9685(47) was not detected.[0m 20:11:52.717 -> [0;32mI (4451) feeder_mgr: Detected PCA9685 devices:1[0m 20:11:52.717 -> [0;33mW (4457) feeder_mgr: MCP23017(20) was not detected![0m 20:11:52.717 -> [0;33mW (4462) feeder_mgr: MCP23017(21) was not detected![0m 20:11:52.717 -> [0;33mW (4468) feeder_mgr: MCP23017(22) was not detected![0m 20:11:52.717 -> [0;32mI (4477) feeder_mgr: MCP23017(23/0x3ffca284) configured for use.[0m 20:11:52.717 -> [0;33mW (4480) feeder_mgr: MCP23017(24) was not detected![0m 20:11:52.717 -> [0;33mW (4486) feeder_mgr: MCP23017(25) was not detected![0m 20:11:52.765 -> [0;33mW (4491) feeder_mgr: MCP23017(26) was not detected![0m 20:11:52.765 -> [0;33mW (4497) feeder_mgr: MCP23017(27) was not detected![0m 20:11:52.765 -> 20:11:52.765 -> abort() was called at PC 0x4014f40f on core 0 20:11:52.765 -> 20:11:52.765 -> 20:11:52.765 -> Backtrace: 0x40081f0e:0x3ffba1c0 0x40089eed:0x3ffba1e0 0x40090f22:0x3ffba200 0x4014f40f:0x3ffba280 0x4014f444:0x3ffba2a0 0x4014f51f:0x3ffba2c0 0x400e35cb:0x3ffba2e0 0x400e0c9e:0x3ffba360 0x400dab79:0x3ffba610 0x40193669:0x3ffba7a0 0x4008d331:0x3ffba7c0 20:11:52.813 -> 20:11:52.813 -> 20:11:52.813 -> 20:11:52.813 ->