If I do use gettimeofday from isr it crashes if the application is also executing gettimeofday because the lock is acquired already by the application.
Here is the relevant traceback:
Code: Select all
0x40097ba0: invoke_abort at panic.c:?
0x40097f11: abort at ??:?
0x4008685b: lock_acquire_generic at locks.c:?
0x40086955: _lock_acquire at ??:?
0x40086766: _gettimeofday_r$part$0 at time.c:?
0x400867b7: _gettimeofday_r at ??:?
0x4017b34d: gettimeofday at /home/jeroen/esp8266/esp32/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/
syscalls/../../../.././newlib/libc/syscalls/sysgettod.c:12
0x40081855: unlock_spi_from_isr at modqueue.c:?
0x400828c5: gpio_isr_loop at gpio.c:?
0x4008292d: gpio_intr_service at gpio.c:?
0x400863f9: _xt_lowint1 at xtensa_vectors.o:?
0x4011bc1d: set_boot_time at time.c:?
0x4008676c: _gettimeofday_r$part$0 at time.c:?
0x400867b7: _gettimeofday_r at ??:?
0x4017b34d: gettimeofday at /home/jeroen/esp8266/esp32/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/
syscalls/../../../.././newlib/libc/syscalls/sysgettod.c:12
0x400f7c70: time_time at modutime.c:?
I already tried to just use esp_timer_get_time() inside the isr and assembly the time later on myself. but this seems especially nontrivial as all the required functions in https://github.com/espressif/esp-idf/bl ... lib/time.c are not public accessible...
Do I really have to go down that route or do you see an easier solution?