Comments (8)
Oh noes... I'm using a cover myself, but on an ESP8266 - I'll try to reproduce the issue on my ESP32
So decoding the backtrace for the ESP32 is relatively simple (in fact, I even wanted to create a helper for esphomeyaml at one point, but now fortunately there are much less panics in esphomelib 😅).
Note that this is for *nix systems, I have no idea how this would be done on windows.
First, identify the platformio packages folder for the xtensa toolchain. In my case, this is ~/.platformio/packages/toolchain-xtensa32/bin
. In that folder, there are a bunch of binaries used for compiling and debugging, for example xtensa-esp32-elf-g++
and xtensa-esp32-elf-gdb
.
Now put this path in your global PATH
variable:
export PATH=$PATH:/Users/ottowinter/.platformio/packages/toolchain-xtensa32/bin
Next, navigate to the platformio project folder. In this folder there should be a file called platformio.ini
. In this folder, execture xtensa-esp32-elf-gdb .pioenvs/<NODE_NAME>/firmware.elf
. Now the GDB interactive terminal should open.
Once in there, you basically have access to all gdb commands (and if you're using JTAG, even the step support). But for looking up what's at an address, simply type:
(gdb) list *0x4014c0d6
...
(gdb) list *0x400d2e7b
...
(gdb) list *0x4014c0da
...
(gdb) list *0x400d2e8b
...
You will see the lines surrounding the statement at the given address. Hope it helps :)
from esphome-core.
Not sure if I'm doing this wrong, or maybe I need to recompile with some additional options to not strip the binary?
user@host:~/repos/hass-esphome$ /home/user/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gdb nodes/garage/.pioenvs/garage/firmware.elf
GNU gdb (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=xtensa-esp32-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from nodes/garage/.pioenvs/garage/firmware.elf...done.
(gdb) list *0x4014c0d6
(gdb) list *0x400d2e7b
(gdb) list *0x4014c0da
(gdb) list *0x400d2e8b
(gdb) list *0x400d5041
(gdb) list *0x400d5131
(gdb) list *0x400d2fb5
(gdb) list *0x400d2482
(gdb) list *0x400fc3a6
from esphome-core.
Hmm, I could have sworn that that worked before... but I'm seeing the same issue (should have checked before 😅)
A "workaround" is to dump the entire instruction table:
xtensa-esp32-elf-objdump -x livingroom/.pioenvs/livingroom/firmware.elf -d >symbols.txt
In the file symbols.txt
you will then be able to examine all the code, and at the top of each label there is a comment where that symbol can be found in the source. In the meantime I'll try to get gdb
working...
from esphome-core.
I found this: http://esp-idf.readthedocs.io/en/latest/get-started/idf-monitor.html
Looks like idf_monitor just parses the serial output and calls xtensa-esp32-elf-addr2line
with the firmware and address. That's easy enough to do:
0x4014c0d6: esphomelib::Action<bool>::play_next(bool) at ??:?
0x400d2e7b: esphomelib::switch_::TurnOffAction<bool>::play(bool) at ??:?
0x4014c0da: esphomelib::Action<bool>::play_next(bool) at ??:?
0x400d2e8b: std::_Function_handler<void (), esphomelib::DelayAction<bool>::play(bool)::{lambda()#1}>::_M_invoke(std::_Any_data const&) at ??:?
0x400d5041: esphomelib::Component::loop_internal() at ??:?
0x400d5131: esphomelib::Component::loop_() at ??:?
0x400d2fb5: esphomelib::Application::loop() at ??:?
0x400d2482: loop() at ??:?
0x400fc3a6: loopTask(void*) at ??:?
from esphome-core.
Even better, I found idf_monitor.py and let it catch a few tests:
/home/user/repos/esp-idf/tools/idf_monitor.py --port /dev/ttyUSB0 --toolchain-prefix /home/user/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf- nodes/garage/.pioenvs/garage/firmware.elf
They all seem to blow up at the same place:
[D][cover.mqtt:045]: 'Garage Door Opener': Closing cover...
[D][binary_sensor.mqtt:066]: 'Garage Door Switch': Sending state ON
[D][cover.mqtt:037]: 'Garage Door Opener': Sending state closed
[D][binary_sensor.mqtt:066]: 'Garage Door Switch': Sending state OFF
[D][binary_sensor.mqtt:066]: 'Garage Door Switch': Sending state ON
[D][binary_sensor.mqtt:066]: 'Garage Door Switch': Sending state OFF
Guru Meditation Error: Core 1 panic'ed (LoadProhibited)
. Exception was unhandled.
Core 1 register dump:
PC : 0x4014c0d6 PS : 0x00060f30 A0 : 0x800d2e7e A1 : 0x3ffd2450
0x4014c0d6: esphomelib::Action<bool>::play_next(bool) at ??:?
A2 : 0x3ffcdee8 A3 : 0x00000000 A4 : 0x00000050 A5 : 0x3ffd2430
A6 : 0x00000000 A7 : 0x00000000 A8 : 0x8014c772 A9 : 0x3ffd2430
A10 : 0xa5a5a5a5 A11 : 0x00000000 A12 : 0x00000005 A13 : 0x00000020
A14 : 0x00000020 A15 : 0x3ffcdf04 SAR : 0x0000001b EXCCAUSE: 0x0000001c
EXCVADDR: 0xa5a5a5a5 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff
Backtrace: 0x4014c0d6:0x3ffd2450 0x400d2e7b:0x3ffd2470 0x4014c0da:0x3ffd2490 0x400d2e8b:0x3ffd24b0 0x400d5041:0x3ffd24d0 0x400d5131:0x3ffd24f0 0x400d2fb5:0x3ffd2510 0x400d2482:0x3ffd2530 0x400fc3a6:0x3ffd2550
0x4014c0d6: esphomelib::Action<bool>::play_next(bool) at ??:?
0x400d2e7b: esphomelib::switch_::TurnOffAction<bool>::play(bool) at ??:?
0x4014c0da: esphomelib::Action<bool>::play_next(bool) at ??:?
0x400d2e8b: std::_Function_handler<void (), esphomelib::DelayAction<bool>::play(bool)::{lambda()#1}>::_M_invoke(std::_Any_data const&) at ??:?
0x400d5041: esphomelib::Component::loop_internal() at ??:?
0x400d5131: esphomelib::Component::loop_() at ??:?
0x400d2fb5: esphomelib::Application::loop() at ??:?
0x400d2482: loop() at ??:?
0x400fc3a6: loopTask(void*) at ??:?
It seems to be running off the end of the action list. Here's what the code looks like for that cover:
auto template_cover = App.make_template_cover("Garage Door Opener");
auto gpio_switch = App.make_gpio_switch("Garage Door Switch", GPIOOutputPin(17, OUTPUT));
auto *garage_door_switch = gpio_switch.switch_;
auto *action_4 = garage_door_switch->make_turn_on_action<NoArg>();
auto *action_5 = App.register_component(new DelayAction<NoArg>());
action_5->set_delay(1000);
auto *action_6 = garage_door_switch->make_turn_off_action<NoArg>();
template_cover.template_->add_open_actions({
action_4,
action_5,
action_6,
});
auto *action_7 = garage_door_switch->make_turn_on_action<NoArg>();
auto *action_8 = App.register_component(new DelayAction<NoArg>());
action_8->set_delay(1000);
auto *action_9 = garage_door_switch->make_turn_off_action<NoArg>();
auto *action_10 = App.register_component(new DelayAction<NoArg>());
action_10->set_delay(1000);
auto *action_11 = garage_door_switch->make_turn_on_action<NoArg>();
auto *action_12 = App.register_component(new DelayAction<NoArg>());
action_12->set_delay(1000);
auto *action_13 = garage_door_switch->make_turn_off_action<NoArg>();
template_cover.template_->add_close_actions({
action_7,
action_8,
action_9,
action_10,
action_11,
action_12,
action_13,
});
auto *action = garage_door_switch->make_turn_on_action<NoArg>();
auto *action_2 = App.register_component(new DelayAction<NoArg>());
action_2->set_delay(1000);
auto *action_3 = garage_door_switch->make_turn_off_action<NoArg>();
template_cover.template_->add_stop_actions({
action,
action_2,
action_3,
});
template_cover.template_->set_optimistic(true);
from esphome-core.
Simple fix. I wonder if maybe ESP8266 zeroes all memory, and ESP32 does not?
from esphome-core.
Oh thanks very much!
I don't think the ESP8266 zeros all memory or that there would be a difference, but who knows.
Maybe one reason might be that your close action is quite long... Mine is quite short:
cover:
- platform: template
name: "Wohnzimmer Jalousie"
id: jalousie
optimistic: True
open_action:
- switch.turn_off:
id: jalousie_runter
- switch.turn_on:
id: jalousie_hoch
close_action:
- switch.turn_off:
id: jalousie_hoch
- switch.turn_on:
id: jalousie_runter
stop_action:
- switch.turn_off:
id: jalousie_hoch
- switch.turn_off:
id: jalousie_runter
binary_sensor:
- platform: gpio
pin: D5
name: "Jalousie Überstrom"
inverted: True
id: uberstrom
on_press:
then:
- delay: 100ms
- lambda:
if (id(uberstrom).value) {
id(jalousie).stop();
}
from esphome-core.
That esp-idf monitor is just genius! I will try to add it into the native esphomeyaml logs monitor when I get time - the only real issue will be getting the path for the xtensa-esp32-elf-addr2line
executable from platformio.
from esphome-core.
Related Issues (20)
- Auto-load esphome component upon discovery by Home Assistant HOT 10
- esp32_ble_tracker scan_interval not used correctly HOT 1
- Firmware seems to have watchdog issues for esp32_ble_tracker HOT 1
- PMSx003 does not work
- MQ-2 Sensor. HOT 5
- [RGB Light Platform] Remember brightness and color after restart HOT 5
- Error in HA since 0.86 HOT 1
- DO NOT POST ISSUES HERE
- ESP32 goes to boot loops with option exrire_after HOT 1
- Error OTA update ESP8266 12e HOT 2
- MIC sensor, status fast change HOT 1
- esphomeyaml showing terminated process HOT 1
- esp32 access point not enabled HOT 1
- Update Failed: ERROR[8]: Flash config wrong real: 4194304 IDE: 16777216 HOT 1
- Returning NAN when using id.value HOT 1
- esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header HOT 1
- Ok, now I understand, so you want to have all three units show up as sensor at the same time. HOT 2
- witty cloud with LDR and RGB HOT 2
- Cannot connect to hidden SSID HOT 1
- ERROR Error binary size: Error: ESP has been flashed with wrong flash size. Please choose the correct 'board' option (esp01_1m always works) and then flash over USB. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esphome-core.