Skip to content

issue loading ntp time settings from esp32 . #257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nielsnl68 opened this issue Jan 5, 2022 · 10 comments
Closed

issue loading ntp time settings from esp32 . #257

nielsnl68 opened this issue Jan 5, 2022 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@nielsnl68
Copy link

nielsnl68 commented Jan 5, 2022

Describe the bug
I try to get the current date/time using the time lib. But the esp crashes as soon it set it up.

To Reproduce
See the following code:
https://wokwi.com/arduino/projects/319957381134942802

Expected behavior
that the esp32 runs without a auto Abort.

Environment (please complete the following information):

  • OS: windows10pro
  • chrome
  • Version [e.g. 22] (!!! where to find the version? !!!)
@nielsnl68 nielsnl68 added the bug Something isn't working label Jan 5, 2022
@urish urish self-assigned this Jan 5, 2022
@urish
Copy link
Contributor

urish commented Jan 5, 2022

Reproduces for me:

Connect to WiFi

WiFi connected
IP address: 10.5.75.167
Ready

Stack smashing protect failure!


abort() was called at PC 0x400dcd44 on core 1


Backtrace:0x4008374e:0x3ffb26800x4008d369:0x3ffb26a0 0x400925b1:0x3ffb26c0 0x400dcd44:0x3ffb2740 0x400d4072:0x3ffb2760 0x400d2535:0x3ffb27d0 0x400d4852:0x3ffb2820 




ELF file SHA256: 0000000000000000

Rebooting...

@nielsnl68
Copy link
Author

nielsnl68 commented Jan 5, 2022

Ohhh, yes i forgot that part in my issue.

BTW. this snapshot works fine on a local esp32

@nielsnl68
Copy link
Author

I switched the "time.h" lib to the "TimeLib.h" and that seems to work properly.

Although some looks very slow. Not sure of that is the simulator or my code:
https://wokwi.com/arduino/projects/319957381134942802

when you want to close this issue, @urish , then that is fine by me.

@urish
Copy link
Contributor

urish commented Jan 5, 2022

Although some looks very slow. Not sure of that is the simulator or my code:
https://wokwi.com/arduino/projects/319957381134942802

Thanks for the update! This one doesn't currently compile to me, perhaps you haven't saved the most recent version?

Also, let's keep the issue open, as I want to investigate why this crashed the simulated ESP32. Do you still have the original code that caused the crash?

@yepher
Copy link

yepher commented Jan 6, 2022

Based on the original description above I made this code to reproduce the crash. It crashes on both Chrome and Safari.

https://wokwi.com/arduino/projects/320004099075474004

It waits for user input so press enter in serial field to progress to crash.

It crashes on this line: configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);

This is the console output:

Connecting to Wokwi-GUEST ............ CONNECTED

Stack smashing protect failure!
abort() was called at PC 0x400daeac on core 1

Backtrace:0x40083176:0x3ffb26a00x4008cd41:0x3ffb26c0 0x40091e65:0x3ffb26e0 0x400daeac:0x3ffb2760 0x400d33ae:0x3ffb2780 0x400d220e:0x3ffb27f0 0x400d3bee:0x3ffb2820 

ELF file SHA256: 0000000000000000
Rebooting...

@yepher
Copy link

yepher commented Jan 6, 2022

tried to load in gdb but could not sort out how to make it work:

Reading symbols from /mnt/sketch.elf...
Remote debugging using /dev/ttyS1
warning: multi-threaded target stopped without sending a thread-id, using first non-exited thread
Remote 'g' packet reply is too long (expected 312 bytes, got 420 bytes): 0c28084000000000803cfe3f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000002007060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
(gdb) tbreak setup
Temporary breakpoint 1 at 0x400d2338: file /tmp/build-ofcPFQ/sketch/sketch.ino, line 21.
(gdb) c
The program is not being run.
(gdb) run
Starting program: /mnt/sketch.elf 
/bin/sh: exec: line 1: /mnt/sketch.elf: Permission denied
During startup program exited with code 126.
(gdb) c
The program is not being run.
(gdb) connect
Undefined command: "connect".  Try "help".
(gdb) run
Starting program: /mnt/sketch.elf 
/bin/sh: exec: line 1: /mnt/sketch.elf: Permission denied
During startup program exited with code 126.
(gdb) 

@urish
Copy link
Contributor

urish commented Jan 6, 2022

First of all - thank you!

The Web version of GDB does not support the ESP32.

The only way to use GDB with the ESP32 simulator is to install the ESP32 GDB locally and use the wokwi-gdbserver bridge. But then you have to get the ELF file yourself, and it's a pretty complex to set up.

If you have some experience with building things on Linux and are up to the challenge, I can send you some pointers on how to try to compile the ESP32 GDB to run in the browser. It might be as simple as applying the ESP32 patches over the existing setup, or as complex as fighting strange dependency issues and whatnot.

@yepher
Copy link

yepher commented Jan 6, 2022

I may take you up on getting your notes on how to do that but I think it may be a little bit beyond what I have time to sort out at the moment. Just trying to help out with low-hanging fruit where I can.

@urish
Copy link
Contributor

urish commented Jan 6, 2022

Totally understandable. If you do want to give it a go at some point, #258 has some pointers

@urish
Copy link
Contributor

urish commented Jan 18, 2022

Fixed!

Thanks again @yepher for coming up with a quick reproduction example. Here's the output after fixing the bug:

image

@urish urish closed this as completed Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants